Skip to content

class SealdSsksTMRPlugin

objc
@interface SealdSsksTMRPlugin : NSObject
@interface SealdSsksTMRPlugin : NSObject

The SealdSSKSTmrPlugin class allows to use the SSKS key storage service to store Seald identities easily and securely, encrypted by a key stored on your back-end server.

MembersDescriptions
initWithSsksURL:appId:instanceName:logLevel:logNoColor:Initialize an instance of Seald SSKS TMR plugin.
initWithSsksURL:appId:
saveIdentity:authFactor:challenge:rawTMRSymKey:identity:error:Save the Seald account to SSKS.
saveIdentityAsync:authFactor:challenge:rawTMRSymKey:identity:completionHandler:Save the Seald account to SSKS.
retrieveIdentity:authFactor:challenge:rawTMRSymKey:error:Retrieve the Seald account previously saved with [ssksTMRPluginInstance saveIdentity].
retrieveIdentityAsync:authFactor:challenge:rawTMRSymKey:completionHandler:Retrieve the Seald account previously saved with [ssksTMRPluginInstance saveIdentity].
getFactorToken:authFactor:challenge:error:Retrieve the TMR JWT associated with an authentication factor.
getFactorTokenAsync:authFactor:challenge:completionHandler:Retrieve the TMR JWT associated with an authentication factor.

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;
- (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 TMR 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. 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;
- (instancetype) initWithSsksURL:(const NSString *)ssksURL
                           appId:(const NSString *)appId;

saveIdentity:authFactor:challenge:rawTMRSymKey:identity:error:

objc
- (void) saveIdentity:(const NSString *)sessionId
           authFactor:(const SealdTmrAuthFactor *)authFactor
            challenge:(const NSString *)challenge
         rawTMRSymKey:(const NSData *)rawTMRSymKey
             identity:(const NSData *)identity
                error:(NSError *_Nullable *)error;
- (void) saveIdentity:(const NSString *)sessionId
           authFactor:(const SealdTmrAuthFactor *)authFactor
            challenge:(const NSString *)challenge
         rawTMRSymKey:(const NSData *)rawTMRSymKey
             identity:(const NSData *)identity
                error:(NSError *_Nullable *)error;

Save the Seald account to SSKS.

Parameters

  • sessionId The user's session ID.

  • authFactor The authentication factor to use.

  • challenge The challenge sent by SSKS to the user's authentication method. Set to empty string if the SSKS server replies to challenge_send API call with must_authenticate set to false.

  • rawTMRSymKey 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.

saveIdentityAsync:authFactor:challenge:rawTMRSymKey:identity:completionHandler:

objc
- (void) saveIdentityAsync:(const NSString *)sessionId
                authFactor:(const SealdTmrAuthFactor *)authFactor
                 challenge:(const NSString *)challenge
              rawTMRSymKey:(const NSData *)rawTMRSymKey
                  identity:(const NSData *)identity
         completionHandler:(void(^)(NSError *_Nullable error))completionHandler;
- (void) saveIdentityAsync:(const NSString *)sessionId
                authFactor:(const SealdTmrAuthFactor *)authFactor
                 challenge:(const NSString *)challenge
              rawTMRSymKey:(const NSData *)rawTMRSymKey
                  identity:(const NSData *)identity
         completionHandler:(void(^)(NSError *_Nullable error))completionHandler;

Save the Seald account to SSKS.

Parameters

  • sessionId The user's session ID.

  • authFactor The authentication factor to use.

  • challenge The challenge sent by SSKS to the user's authentication method. Set to empty string if the SSKS server replies to challenge_send API call with must_authenticate set to false.

  • rawTMRSymKey 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 a pointer to a NSError that indicates if any error occurred.

retrieveIdentity:authFactor:challenge:rawTMRSymKey:error:

objc
- (SealdSsksRetrieveIdentityResponse *) retrieveIdentity:(const NSString *)sessionId
                                              authFactor:(const SealdTmrAuthFactor *)authFactor
                                               challenge:(const NSString *)challenge
                                            rawTMRSymKey:(const NSData *)rawTMRSymKey
                                                   error:(NSError *_Nullable *)error;
- (SealdSsksRetrieveIdentityResponse *) retrieveIdentity:(const NSString *)sessionId
                                              authFactor:(const SealdTmrAuthFactor *)authFactor
                                               challenge:(const NSString *)challenge
                                            rawTMRSymKey:(const NSData *)rawTMRSymKey
                                                   error:(NSError *_Nullable *)error;

Retrieve the Seald account previously saved with [ssksTMRPluginInstance saveIdentity].

Parameters

  • sessionId The user's session ID.

  • authFactor The authentication factor to use.

  • challenge The challenge sent by SSKS to the user's authentication method.

  • rawTMRSymKey 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 SealdSsksRetrieveIdentityResponse instance, containing identity, the retrieved identity, shouldRenewKey, a boolean set to true is the user private key should be renewed (using [sealdSDKInstance renewKeys]), and authenticatedSessionId, a new authenticated sessionId, that you can use to perform further SSKS TMR operations without challenge.

retrieveIdentityAsync:authFactor:challenge:rawTMRSymKey:completionHandler:

objc
- (void) retrieveIdentityAsync:(const NSString *)sessionId
                    authFactor:(const SealdTmrAuthFactor *)authFactor
                     challenge:(const NSString *)challenge
                  rawTMRSymKey:(const NSData *)rawTMRSymKey
             completionHandler:(void(^)(SealdSsksRetrieveIdentityResponse *response, NSError *_Nullable error))completionHandler;
- (void) retrieveIdentityAsync:(const NSString *)sessionId
                    authFactor:(const SealdTmrAuthFactor *)authFactor
                     challenge:(const NSString *)challenge
                  rawTMRSymKey:(const NSData *)rawTMRSymKey
             completionHandler:(void(^)(SealdSsksRetrieveIdentityResponse *response, NSError *_Nullable error))completionHandler;

Retrieve the Seald account previously saved with [ssksTMRPluginInstance saveIdentity].

Parameters

  • sessionId The user's session ID.

  • authFactor The authentication factor to use.

  • challenge The challenge sent by SSKS to the user's authentication method.

  • rawTMRSymKey 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.

getFactorToken:authFactor:challenge:error:

objc
- (SealdSsksGetFactorTokenResponse *) getFactorToken:(const NSString *)sessionId
                                          authFactor:(const SealdTmrAuthFactor *)authFactor
                                           challenge:(const NSString *)challenge
                                               error:(NSError *_Nullable *)error;
- (SealdSsksGetFactorTokenResponse *) getFactorToken:(const NSString *)sessionId
                                          authFactor:(const SealdTmrAuthFactor *)authFactor
                                           challenge:(const NSString *)challenge
                                               error:(NSError *_Nullable *)error;

Retrieve the TMR JWT associated with an authentication factor.

Parameters

  • sessionId Session ID given by SSKS to your app's server.

  • authFactor Authentication method of this user, to which SSKS has sent a challenge at the request of your app's server.

  • challenge The challenge sent by SSKS to the user's authentication method if any. Set to empty string if you already have an authenticated session.

  • error Error pointer.

Returns

An [GetFactorTokenResponse] instance, containing the retrieved authentication factor token.

getFactorTokenAsync:authFactor:challenge:completionHandler:

objc
- (void) getFactorTokenAsync:(const NSString *)sessionId
                  authFactor:(const SealdTmrAuthFactor *)authFactor
                   challenge:(const NSString *)challenge
           completionHandler:(void(^)(SealdSsksGetFactorTokenResponse *response, NSError *_Nullable error))completionHandler;
- (void) getFactorTokenAsync:(const NSString *)sessionId
                  authFactor:(const SealdTmrAuthFactor *)authFactor
                   challenge:(const NSString *)challenge
           completionHandler:(void(^)(SealdSsksGetFactorTokenResponse *response, NSError *_Nullable error))completionHandler;

Retrieve the TMR JWT associated with an authentication factor.

Parameters

  • sessionId Session ID given by SSKS to your app's server.

  • authFactor Authentication method of this user, to which SSKS has sent a challenge at the request of your app's server.

  • challenge The challenge sent by SSKS to the user's authentication method if any. Set to empty string if you already have an authenticated session.

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