SudoProfilesClient
public protocol SudoProfilesClient : AnyObject
Protocol encapsulating a library functions for managing Sudos in the Sudo service.
-
createSudo(sudo:
Asynchronous) Creates a new Sudo.
Throws
SudoProfilesClientError
Parameters
sudo
Sudo to create.
Return Value
the created Sudo.
-
updateSudo(sudo:
Asynchronous) Update a Sudo.
Throws
SudoProfilesClientError
Parameters
sudo
Sudo to update.
Return Value
the updated Sudo.
-
deleteSudo(sudo:
Asynchronous) Deletes a Sudo.
Throws
SudoProfilesClientError
Declaration
Swift
func deleteSudo(sudo: Sudo) async throws
-
listSudos(option:
Asynchronous) Retrieves all Sudos owned by signed in user.
Throws
SudoProfilesClientError
Declaration
Swift
func listSudos(option: ListOption) async throws -> [Sudo]
Parameters
option
option for controlling the behaviour of this API. Refer to
ListOption
enum.Return Value
an array of all the Sudos owned by signed in user.
-
Returns the count of outstanding create or update requests.
Declaration
Swift
func getOutstandingRequestsCount() -> Int
Return Value
Outstanding requests count.
-
Resets any cached data.
Throws
SudoProfilesClientError
Declaration
Swift
func reset() throws
-
subscribe(id:
AsynchronouschangeType: subscriber: ) Subscribes to be notified of new, updated or deleted Sudos. Blob data is not downloaded automatically so the caller is expected to use
listSudos
API if they need to access any associated blobs.Declaration
Swift
func subscribe(id: String, changeType: SudoChangeType, subscriber: SudoSubscriber) async throws
Parameters
id
Unique ID to be associated with the subscriber.
changeType
Change type to subscribe to.
subscriber
Subscriber to notify.
-
subscribe(id:
Asynchronoussubscriber: ) Subscribes to be notified of new, updated and deleted Sudos. Blob data is not downloaded automatically so the caller is expected to use
listSudos
API if they need to access any associated blobs.Declaration
Swift
func subscribe(id: String, subscriber: SudoSubscriber) async throws
Parameters
id
Unique ID to be associated with the subscriber.
subscriber
Subscriber to notify.
-
Unsubscribes the specified subscriber so that it no longer receives notifications about new, updated or deleted Sudos.
Declaration
Swift
func unsubscribe(id: String, changeType: SudoChangeType)
Parameters
id
Unique ID associated with the subscriber to unsubscribe.
changeType
Change type to unsubscribe from.
-
Unsubscribes the specified subscriber so that it no longer receives change notifications.
Declaration
Swift
func unsubscribe(id: String)
Parameters
id
Unique ID associated with the subscriber to unsubscribe.
-
Unsubscribe all subscribers from receiving notifications about new, updated or deleted Sudos.
Declaration
Swift
func unsubscribeAll()
-
getOwnershipProof(sudo:
Asynchronousaudience: ) Retrieves a signed owernship proof for the specified Sudo.
Declaration
Swift
func getOwnershipProof(sudo: Sudo, audience: String) async throws -> String
Parameters
sudo
Sudo to generate an ownership proof for.
audience
Target audience for this proof.
Return Value
JSON Web Token representing Sudo ownership proof.
-
Generate an encryption key to use for encrypting Sudo claims. Any existing keys are not removed to be able to decrypt existing claims but new claims will be encrypted using the newly generated key.
Declaration
Swift
@discardableResult func generateEncryptionKey() throws -> String
Return Value
Unique ID of the generated key.
-
Get the current (most recently generated) symmetric key ID..
Declaration
Swift
func getSymmetricKeyId() throws -> String?
Return Value
Symmetric Key ID.
-
Import encyrption keys to use for encrypting and decrypting Sudo claims. All existing keys will be removed before the new keys are imported.
Declaration
Swift
func importEncryptionKeys(keys: [EncryptionKey], currentKeyId: String) throws
Parameters
keys
Keys to import.
currentKeyId
ID of the key to use for encrypting new claims..
-
Export encryption keys used for encrypting and decrypting Sudo claims.
Declaration
Swift
func exportEncryptionKeys() throws -> [EncryptionKey]
Return Value
Encryption keys.