Skip to content

class SealdSsksPasswordPlugin

objc
@interface SealdSsksPasswordPlugin : NSObject

This is the main class for the Seald SSKS password plugin. It represents an instance of the Plugin.

MembersDescriptions
initWithSsksURL:appId:instanceName:logLevel:logNoColor:Initialize an instance of Seald SSKS Password plugin.
initWithSsksURL:appId:
saveIdentityWithUserId:password:identity:error:Save the given identity for the given userId, encrypted with the given password.
saveIdentityAsyncWithUserId:password:identity:completionHandler:Save the given identity for the given userId, encrypted with the given password.
saveIdentityWithUserId:rawStorageKey:rawEncryptionKey:identity:error:Save the given identity for the given userId, encrypted with the given raw keys.
saveIdentityAsyncWithUserId:rawStorageKey:rawEncryptionKey:identity:completionHandler:Save the given identity for the given userId, encrypted with the given raw keys.
retrieveIdentityWithUserId:password:error:Retrieve the identity stored on the SSKS server for the given userId, and decrypt it with the given password.
retrieveIdentityAsyncWithUserId:password:completionHandler:Retrieve the identity stored on the SSKS server for the given userId, and decrypt it with the given password.
retrieveIdentityWithUserId:rawStorageKey:rawEncryptionKey:error:Retrieve the identity stored on the SSKS server for the given userId, and decrypt it with the given raw keys.
retrieveIdentityAsyncWithUserId:rawStorageKey:rawEncryptionKey:completionHandler:Retrieve the identity stored on the SSKS server for the given userId, and decrypt it with the given raw keys.
changeIdentityPasswordWithUserId:currentPassword:newPassword:error:Change the password used to encrypt the identity for the userId.
changeIdentityPasswordAsyncWithUserId:currentPassword:newPassword:completionHandler:Change the password used to encrypt the identity for the userId.

initWithSsksURL:appId:instanceName:logLevel:logNoColor:

objc
- (instancetype) initWithSsksURL:(const NSString *)ssksURL
                           appId:(const NSString *)appId
                    instanceName:(const NSString *)instanceName
                        logLevel:(const NSInteger)logLevel
                      logNoColor:(const BOOL)logNoColor;

Initialize an instance of Seald SSKS Password plugin.

Parameters

  • ssksURL The URL of the SSKS Identity Key Storage to which it should connect.

  • appId The application ID to use.

  • instanceName An arbitrary name to give to this SSKS Plugin instance. Can be useful for debugging when multiple instances are running in parallel, as it is added to logs.

  • logLevel The minimum level of logs you want. All logs of this level or above will be displayed. -1: Trace; 0: Debug; 1: Info; 2: Warn; 3: Error; 4: Fatal; 5: Panic; 6: NoLevel; 7: Disabled.

  • logNoColor Should be set to NO if you want to enable colors in the log output, YES if you don't.

initWithSsksURL:appId:

objc
- (instancetype) initWithSsksURL:(const NSString *)ssksURL
                           appId:(const NSString *)appId;

saveIdentityWithUserId:password:identity:error:

objc
- (NSString *) saveIdentityWithUserId:(const NSString *)userId
                             password:(const NSString *)password
                             identity:(const NSData *)identity
                                error:(NSError *_Nullable *)error;

Save the given identity for the given userId, encrypted with the given password.

Parameters

  • userId The ID of the userId.

  • password The password to encrypt the key.

  • identity The identity to save.

  • error Error pointer.

Returns

A NSString containing the SSKS ID of the stored identity, which can be used by your backend to manage it.

saveIdentityAsyncWithUserId:password:identity:completionHandler:

objc
- (void) saveIdentityAsyncWithUserId:(const NSString *)userId
                            password:(const NSString *)password
                            identity:(const NSData *)identity
                   completionHandler:(void(^)(NSString *ssksId, NSError *_Nullable error))completionHandler;

Save the given identity for the given userId, encrypted with the given password.

Parameters

  • userId The ID of the userId.

  • password The password to encrypt the key.

  • identity The identity to save.

  • completionHandler A callback called after function execution. This callback take two arguments, a NSString* containing the SSKS ID of the stored identity, which can be used by your backend to manage it, and a NSError* that indicates if any error occurred.

saveIdentityWithUserId:rawStorageKey:rawEncryptionKey:identity:error:

objc
- (NSString *) saveIdentityWithUserId:(const NSString *)userId
                        rawStorageKey:(const NSString *)rawStorageKey
                     rawEncryptionKey:(const NSData *)rawEncryptionKey
                             identity:(const NSData *)identity
                                error:(NSError *_Nullable *)error;

Save the given identity for the given userId, encrypted with the given raw keys.

Parameters

  • userId The ID of the userId.

  • rawStorageKey The key under which identity keys are stored. This MUST be a secret known only to this user of your app, and never to other users, as learning it will allow deleting the stored identities. Useful to change if you want to store multiple identities for the same userId. Allowed characters : A-Za-z0-9+/=-_@.. Max length is 256 characters.

  • rawEncryptionKey The raw encryption key used to encrypt / decrypt the stored identity keys. This MUST be a cryptographically random NSData of 64 bytes.

  • identity The identity to save.

  • error Error pointer.

Returns

A NSString containing the SSKS ID of the stored identity, which can be used by your backend to manage it.

saveIdentityAsyncWithUserId:rawStorageKey:rawEncryptionKey:identity:completionHandler:

objc
- (void) saveIdentityAsyncWithUserId:(const NSString *)userId
                       rawStorageKey:(const NSString *)rawStorageKey
                    rawEncryptionKey:(const NSData *)rawEncryptionKey
                            identity:(const NSData *)identity
                   completionHandler:(void(^)(NSString *ssksId, NSError *_Nullable error))completionHandler;

Save the given identity for the given userId, encrypted with the given raw keys.

Parameters

  • userId The ID of the userId.

  • rawStorageKey The key under which identity keys are stored. This MUST be a secret known only to this user of your app, and never to other users, as learning it will allow deleting the stored identities. Useful to change if you want to store multiple identities for the same userId. Allowed characters : A-Za-z0-9+/=-_@.. Max length is 256 characters.

  • rawEncryptionKey The raw encryption key used to encrypt / decrypt the stored identity keys. This MUST be a cryptographically random NSData of 64 bytes.

  • identity The identity to save.

  • completionHandler A callback called after function execution. This callback take two arguments, a NSString* containing the SSKS ID of the stored identity, which can be used by your backend to manage it, and a NSError* that indicates if any error occurred.

retrieveIdentityWithUserId:password:error:

objc
- (NSData *) retrieveIdentityWithUserId:(const NSString *)userId
                               password:(const NSString *)password
                                  error:(NSError *_Nullable *)error;

Retrieve the identity stored on the SSKS server for the given userId, and decrypt it with the given password.

If you use an incorrect password multiple times, the server may throttle your requests. In this case, you will receive an error Request throttled, retry after {N}s, with {N} the number of seconds during which you cannot try again.

Parameters

  • userId The ID of the userId.

  • password The password to encrypt the key.

  • error Error pointer.

Returns

A NSData containing the retrieved identity

retrieveIdentityAsyncWithUserId:password:completionHandler:

objc
- (void) retrieveIdentityAsyncWithUserId:(const NSString *)userId
                                password:(const NSString *)password
                       completionHandler:(void(^)(NSData *identity, NSError *_Nullable error))completionHandler;

Retrieve the identity stored on the SSKS server for the given userId, and decrypt it with the given password.

If you use an incorrect password multiple times, the server may throttle your requests. In this case, you will receive an error Request throttled, retry after {N}s, with {N} the number of seconds during which you cannot try again.

Parameters

  • userId The ID of the userId.

  • password The password to encrypt the key.

  • completionHandler A callback called after function execution. This callback take two arguments, a NSData* containing the retrieved identity, and a NSError* that indicates if any error occurred.

retrieveIdentityWithUserId:rawStorageKey:rawEncryptionKey:error:

objc
- (NSData *) retrieveIdentityWithUserId:(const NSString *)userId
                          rawStorageKey:(const NSString *)rawStorageKey
                       rawEncryptionKey:(const NSData *)rawEncryptionKey
                                  error:(NSError *_Nullable *)error;

Retrieve the identity stored on the SSKS server for the given userId, and decrypt it with the given raw keys.

If you use an incorrect password multiple times, the server may throttle your requests. In this case, you will receive an error Request throttled, retry after {N}s, with {N} the number of seconds during which you cannot try again.

Parameters

  • userId The ID of the userId.

  • rawStorageKey The key under which identity keys are stored. This MUST be a secret known only to this user of your app, and never to other users, as learning it will allow deleting the stored identities. Useful to change if you want to store multiple identities for the same userId. Allowed characters : A-Za-z0-9+/=-_@.. Max length is 256 characters.

  • rawEncryptionKey The raw encryption key used to encrypt / decrypt the stored identity keys. This MUST be a cryptographically random NSData of 64 bytes.

  • error Error pointer.

Returns

A NSData containing the retrieved identity

retrieveIdentityAsyncWithUserId:rawStorageKey:rawEncryptionKey:completionHandler:

objc
- (void) retrieveIdentityAsyncWithUserId:(const NSString *)userId
                           rawStorageKey:(const NSString *)rawStorageKey
                        rawEncryptionKey:(const NSData *)rawEncryptionKey
                       completionHandler:(void(^)(NSData *identity, NSError *_Nullable error))completionHandler;

Retrieve the identity stored on the SSKS server for the given userId, and decrypt it with the given raw keys.

If you use an incorrect password multiple times, the server may throttle your requests. In this case, you will receive an error Request throttled, retry after {N}s, with {N} the number of seconds during which you cannot try again.

Parameters

  • userId The ID of the userId.

  • rawStorageKey The key under which identity keys are stored. This MUST be a secret known only to this user of your app, and never to other users, as learning it will allow deleting the stored identities. Useful to change if you want to store multiple identities for the same userId. Allowed characters : A-Za-z0-9+/=-_@.. Max length is 256 characters.

  • rawEncryptionKey The raw encryption key used to encrypt / decrypt the stored identity keys. This MUST be a cryptographically random NSData of 64 bytes.

  • completionHandler A callback called after function execution. This callback take two arguments, a NSData* containing the retrieved identity, and a NSError* that indicates if any error occurred.

changeIdentityPasswordWithUserId:currentPassword:newPassword:error:

objc
- (NSString *) changeIdentityPasswordWithUserId:(const NSString *)userId
                                currentPassword:(const NSString *)currentPassword
                                    newPassword:(const NSString *)newPassword
                                          error:(NSError *_Nullable *)error;

Change the password used to encrypt the identity for the userId.

Parameters

  • userId The ID of the userId.

  • currentPassword The user's current password.

  • newPassword The new password.

  • error Error pointer.

Returns

A NSString containing the new SSKS ID of the stored identity.

changeIdentityPasswordAsyncWithUserId:currentPassword:newPassword:completionHandler:

objc
- (void) changeIdentityPasswordAsyncWithUserId:(const NSString *)userId
                               currentPassword:(const NSString *)currentPassword
                                   newPassword:(const NSString *)newPassword
                             completionHandler:(void(^)(NSString *ssksId, NSError *_Nullable error))completionHandler;

Change the password used to encrypt the identity for the userId.

Parameters

  • userId The ID of the userId.

  • currentPassword The user's current password.

  • newPassword The new password.

  • completionHandler A callback called after function execution. This callback take two arguments, a NSString* containing the new SSKS ID of the stored identity, and a NSError* that indicates if any error occurred.