class SealdEncryptionSession
@interface SealdEncryptionSession : NSObjectAn encryption session, with which you can then encrypt / decrypt multiple messages. This should not be created directly, and should be retrieved with SealdSdk.retrieveEncryptionSessionWithSessionId:useCache:error: or SealdSdk.retrieveEncryptionSessionFromMessage:useCache:error:.
| Members | Descriptions |
|---|---|
sessionId | The ID of this encryptionSession. Read-only. |
retrievalDetails | Details about how this session was retrieved: through a group, a proxy, or directly. Read-only. |
addRecipients:error: | Add new recipients to this session. These recipients will be able to read all encrypted messages of this session. |
addRecipientsAsync:completionHandler: | Add new recipients to this session. These recipients will be able to read all encrypted messages of this session. |
addProxySession:rights:error: | Add a proxy session as a recipient of this session. Any recipient of the proxy session will also be able to retrieve this session. The current user has to be a direct recipient of the proxy session. |
addProxySession:error: | Add a proxy session as a recipient of this session. Any recipient of the proxy session will also be able to retrieve this session. The current user has to be a direct recipient of the proxy session. |
addProxySessionAsync:rights:completionHandler: | Add a proxy session as a recipient of this session. Any recipient of the proxy session will also be able to retrieve this session. The current user has to be a direct recipient of the proxy session. |
addProxySessionAsync:completionHandler: | Add a proxy session as a recipient of this session. Any recipient of the proxy session will also be able to retrieve this session. The current user has to be a direct recipient of the proxy session. |
revokeRecipientsWithSealdIds:proxySessionsIds:symEncKeysIds:tmrAccessIds:tmrAccessAuthFactors:error: | Revoke some recipients or proxy sessions from this session. If you want to revoke all recipients, see revokeAll: instead. If you want to revoke all recipients besides yourself, see revokeOthers:. |
revokeRecipientsAsyncWithSealdIds:proxySessionsIds:symEncKeysIds:tmrAccessIds:tmrAccessAuthFactors:completionHandler: | Revoke some recipients or proxy sessions from this session. If you want to revoke all recipients, see revokeAll: instead. If you want to revoke all recipients besides yourself, see revokeOthers:. |
revokeAll: | Revoke this session entirely. |
revokeAllAsyncWithCompletionHandler: | Revoke this session entirely. |
revokeOthers: | Revoke all recipients besides yourself from this session. |
revokeOthersAsyncWithCompletionHandler: | Revoke all recipients besides yourself from this session. |
listRecipients: | List all recipients from this session. |
listRecipientsAsyncWithCompletionHandler: | List all recipients from this session. |
encryptMessage:error: | Encrypt a clear-text string into an encrypted message, for the recipients of this session. |
encryptMessageAsync:completionHandler: | Encrypt a clear-text string into an encrypted message, for the recipients of this session. |
decryptMessage:error: | Decrypt an encrypted message string into the corresponding clear-text string. |
decryptMessageAsync:completionHandler: | Decrypt an encrypted message string into the corresponding clear-text string. |
encryptFile:filename:error: | Encrypt a clear-text file into an encrypted file, for the recipients of this session. |
encryptFileAsync:filename:completionHandler: | Encrypt a clear-text file into an encrypted file, for the recipients of this session. |
decryptFile:error: | Decrypts an encrypted file into the corresponding clear-text file. |
decryptFileAsync:completionHandler: | Decrypts an encrypted file into the corresponding clear-text file. |
encryptFileFromURI:error: | Encrypt a clear-text file into an encrypted file, for the recipients of this session. |
encryptFileAsyncFromURI:completionHandler: | Encrypt a clear-text file into an encrypted file, for the recipients of this session. |
decryptFileFromURI:error: | Decrypts an encrypted file into the corresponding clear-text file. |
decryptFileAsyncFromURI:completionHandler: | Decrypts an encrypted file into the corresponding clear-text file. |
addTmrAccess:error: | Add a TMR access to this session for the given authentication factor. |
addTmrAccessAsync:completionHandler: | Add a TMR access to this session for the given authentication factor. |
addMultipleTmrAccesses:error: | Add multiple TMR accesses to this session for the given authentication factors. |
addMultipleTmrAccessesAsync:completionHandler: | Add multiple TMR accesses to this session for the given authentication factors. |
serializeWithError: | Serialize the EncryptionSession to a string. This is for advanced use. May be used to keep sessions in a cache. WARNING: a user could use this cache to work around being revoked. Use with caution. WARNING: if the cache is accessible to another user, they could use it to decrypt messages they are not supposed to have access to. Make sure only the current user in question can access this cache, for example by encrypting it. |
sessionId
@property (assign, readonly) NSString * sessionId;The ID of this encryptionSession. Read-only.
retrievalDetails
@property (assign, readonly) SealdEncryptionSessionRetrievalDetails * retrievalDetails;Details about how this session was retrieved: through a group, a proxy, or directly. Read-only.
addRecipients:error:
- (NSDictionary< NSString *, SealdActionStatus * > *) addRecipients:(const NSArray< SealdRecipientWithRights * > *)recipients
error:(NSError *_Nullable *)error;Add new recipients to this session. These recipients will be able to read all encrypted messages of this session.
Parameters
recipientsThe Seald IDs with the associated rights of users to add to this session.errorThe error that occurred while adding the recipients, if any.
Returns
A NSMutableDictionary<NSString*, SealdActionStatus*>* instance.
addRecipientsAsync:completionHandler:
- (void) addRecipientsAsync:(const NSArray< SealdRecipientWithRights * > *)recipients
completionHandler:(void(^)(NSDictionary< NSString *, SealdActionStatus * > *result, NSError *_Nullable error))completionHandler;Add new recipients to this session. These recipients will be able to read all encrypted messages of this session.
Parameters
recipientsThe Seald IDs with the associated rights of users to add to this session.completionHandlerA callback called after function execution. This callback takes two arguments, aNSMutableDictionary<NSString*, SealdActionStatus*>*instance. and aNSError*that indicates if any error occurred.
addProxySession:rights:error:
- (void) addProxySession:(const NSString *)proxySessionId
rights:(const SealdRecipientRights *)rights
error:(NSError *_Nullable *)error;Add a proxy session as a recipient of this session. Any recipient of the proxy session will also be able to retrieve this session. The current user has to be a direct recipient of the proxy session.
Parameters
proxySessionIdThe ID of the session to add as proxy.rightsThe rights to assign to this proxy.errorThe error that occurred while adding the proxy, if any.
addProxySession:error:
- (void) addProxySession:(const NSString *)proxySessionId
error:(NSError *_Nullable *)error;Add a proxy session as a recipient of this session. Any recipient of the proxy session will also be able to retrieve this session. The current user has to be a direct recipient of the proxy session.
Parameters
proxySessionIdThe ID of the session to add as proxy. It will be given default SealdRecipientRights.errorThe error that occurred while adding the proxy, if any.
addProxySessionAsync:rights:completionHandler:
- (void) addProxySessionAsync:(const NSString *)proxySessionId
rights:(const SealdRecipientRights *)rights
completionHandler:(void(^)(NSError *_Nullable error))completionHandler;Add a proxy session as a recipient of this session. Any recipient of the proxy session will also be able to retrieve this session. The current user has to be a direct recipient of the proxy session.
Parameters
proxySessionIdThe ID of the session to add as proxy.rightsThe rights to assign to this proxy.completionHandlerA callback called after function execution. This callback takes aNSError*that indicates if any error occurred.
addProxySessionAsync:completionHandler:
- (void) addProxySessionAsync:(const NSString *)proxySessionId
completionHandler:(void(^)(NSError *_Nullable error))completionHandler;Add a proxy session as a recipient of this session. Any recipient of the proxy session will also be able to retrieve this session. The current user has to be a direct recipient of the proxy session.
Parameters
proxySessionIdThe ID of the session to add as proxy. It will be given default SealdRecipientRights.completionHandlerA callback called after function execution. This callback takes aNSError*that indicates if any error occurred.
revokeRecipientsWithSealdIds:proxySessionsIds:symEncKeysIds:tmrAccessIds:tmrAccessAuthFactors:error:
- (SealdRevokeResult *) revokeRecipientsWithSealdIds:(const NSArray< NSString * > *_Nullable)sealdIds
proxySessionsIds:(const NSArray< NSString * > *_Nullable)proxySessionsIds
symEncKeysIds:(const NSArray< NSString * > *_Nullable)symEncKeysIds
tmrAccessIds:(const NSArray< NSString * > *_Nullable)tmrAccessIds
tmrAccessAuthFactors:(const NSArray< SealdTmrAuthFactor * > *_Nullable)tmrAccessAuthFactors
error:(NSError *_Nullable *)error;Revoke some recipients or proxy sessions from this session. If you want to revoke all recipients, see revokeAll: instead. If you want to revoke all recipients besides yourself, see revokeOthers:.
Parameters
sealdIdsThe Seald IDs of users to revoke from this session.proxySessionsIdsThe IDs of proxy sessions to revoke from this session.symEncKeysIdsThe IDs of symEncKeys to revoke from this session.tmrAccessIdsThe IDs of tmrAccess to revoke from this session.tmrAccessAuthFactorsThe AuthFactor of tmrAccess to revoke from this session.errorThe error that occurred while revoking, if any.
Returns
A SealdRevokeResult instance.
revokeRecipientsAsyncWithSealdIds:proxySessionsIds:symEncKeysIds:tmrAccessIds:tmrAccessAuthFactors:completionHandler:
- (void) revokeRecipientsAsyncWithSealdIds:(const NSArray< NSString * > *_Nullable)sealdIds
proxySessionsIds:(const NSArray< NSString * > *_Nullable)proxySessionsIds
symEncKeysIds:(const NSArray< NSString * > *_Nullable)symEncKeysIds
tmrAccessIds:(const NSArray< NSString * > *_Nullable)tmrAccessIds
tmrAccessAuthFactors:(const NSArray< SealdTmrAuthFactor * > *_Nullable)tmrAccessAuthFactors
completionHandler:(void(^)(SealdRevokeResult *result, NSError *_Nullable error))completionHandler;Revoke some recipients or proxy sessions from this session. If you want to revoke all recipients, see revokeAll: instead. If you want to revoke all recipients besides yourself, see revokeOthers:.
Parameters
sealdIdsThe Seald IDs of users to revoke from this session.proxySessionsIdsThe IDs of proxy sessions to revoke from this session.symEncKeysIdsThe IDs of symEncKeys to revoke from this session.tmrAccessIdsThe IDs of tmrAccess to revoke from this session.tmrAccessAuthFactorsThe AuthFactor of tmrAccess to revoke from this session.completionHandlerA callback called after function execution. This callback takes two arguments, a SealdRevokeResult instance. and aNSError*that indicates if any error occurred.
revokeAll:
- (SealdRevokeResult *) revokeAll:(NSError *_Nullable *)error;Revoke this session entirely.
Parameters
errorThe error that occurred while revoking, if any.
Returns
A SealdRevokeResult instance.
revokeAllAsyncWithCompletionHandler:
- (void) revokeAllAsyncWithCompletionHandler:(void(^)(SealdRevokeResult *result, NSError *_Nullable error))completionHandler;Revoke this session entirely.
Parameters
completionHandlerA callback called after function execution. This callback takes two arguments, a SealdRevokeResult instance. and aNSError*that indicates if any error occurred.
revokeOthers:
- (SealdRevokeResult *) revokeOthers:(NSError *_Nullable *)error;Revoke all recipients besides yourself from this session.
Parameters
errorThe error that occurred while revoking, if any.
Returns
A SealdRevokeResult instance.
revokeOthersAsyncWithCompletionHandler:
- (void) revokeOthersAsyncWithCompletionHandler:(void(^)(SealdRevokeResult *result, NSError *_Nullable error))completionHandler;Revoke all recipients besides yourself from this session.
Parameters
completionHandlerA callback called after function execution. This callback takes two arguments, a SealdRevokeResult instance. and aNSError*that indicates if any error occurred.
listRecipients:
- (SealdRecipientsList *) listRecipients:(NSError *_Nullable *)error;List all recipients from this session.
Returns
A RecipientsList instance.
listRecipientsAsyncWithCompletionHandler:
- (void) listRecipientsAsyncWithCompletionHandler:(void(^)(SealdRecipientsList *result, NSError *_Nullable error))completionHandler;List all recipients from this session.
Parameters
completionHandlerA callback called after function execution. This callback takes two arguments, a SealdRecipientsList instance. and aNSError*that indicates if any error occurred.
encryptMessage:error:
- (NSString *) encryptMessage:(const NSString *)clearMessage
error:(NSError *_Nullable *)error;Encrypt a clear-text string into an encrypted message, for the recipients of this session.
Parameters
clearMessageThe message to encrypt.errorThe error that occurred while encrypting the message, if any.
Returns
The encrypted message
encryptMessageAsync:completionHandler:
- (void) encryptMessageAsync:(const NSString *)clearMessage
completionHandler:(void(^)(NSString *encryptedString, NSError *_Nullable error))completionHandler;Encrypt a clear-text string into an encrypted message, for the recipients of this session.
Parameters
completionHandlerA callback called after function execution. This callback takes two arguments, a NSString* containing the encrypted string, and aNSError*that indicates if any error occurred.
decryptMessage:error:
- (NSString *) decryptMessage:(const NSString *)encryptedMessage
error:(NSError *_Nullable *)error;Decrypt an encrypted message string into the corresponding clear-text string.
Parameters
encryptedMessageThe encrypted message to decrypt.errorThe error that occurred while decrypting the message, if any.
Returns
The decrypted clear-text message.
decryptMessageAsync:completionHandler:
- (void) decryptMessageAsync:(const NSString *)encryptedMessage
completionHandler:(void(^)(NSString *decryptedString, NSError *_Nullable error))completionHandler;Decrypt an encrypted message string into the corresponding clear-text string.
Parameters
encryptedMessageThe encrypted message to decrypt.completionHandlerA callback called after function execution. This callback takes two arguments, a NSString* containing the decrypted string, and aNSError*that indicates if any error occurred.
encryptFile:filename:error:
- (NSData *) encryptFile:(const NSData *)clearFile
filename:(const NSString *)filename
error:(NSError *_Nullable *)error;Encrypt a clear-text file into an encrypted file, for the recipients of this session.
Parameters
clearFileANSData*of the clear-text content of the file to encrypt.filenameThe name of the file to encrypt.errorThe error that occurred while encrypting the file, if any.
Returns
A NSData* of the content of the encrypted file.
encryptFileAsync:filename:completionHandler:
- (void) encryptFileAsync:(const NSData *)clearFile
filename:(const NSString *)filename
completionHandler:(void(^)(NSData *encryptedFile, NSError *_Nullable error))completionHandler;Encrypt a clear-text file into an encrypted file, for the recipients of this session.
Parameters
clearFileANSData*of the clear-text content of the file to encrypt.filenameThe name of the file to encrypt.completionHandlerA callback called after function execution. This callback takes two arguments, a NSData containing the encrypted file, and aNSError*that indicates if any error occurred.
decryptFile:error:
- (SealdClearFile *) decryptFile:(const NSData *)encryptedFile
error:(NSError *_Nullable *)error;Decrypts an encrypted file into the corresponding clear-text file.
Parameters
encryptedFileANSData*of the content of the encrypted file to decrypt.errorThe error that occurred while decrypting the file, if any.
Returns
A SealdClearFile instance, containing the filename and the fileContent of the decrypted file.
decryptFileAsync:completionHandler:
- (void) decryptFileAsync:(const NSData *)encryptedFile
completionHandler:(void(^)(SealdClearFile *clearFile, NSError *_Nullable error))completionHandler;Decrypts an encrypted file into the corresponding clear-text file.
Parameters
encryptedFileANSData*of the content of the encrypted file to decrypt.completionHandlerA callback called after function execution. This callback takes two arguments, a SealdClearFile containing the decrypted file, and aNSError*that indicates if any error occurred.
encryptFileFromURI:error:
- (NSString *) encryptFileFromURI:(const NSString *)clearFileURI
error:(NSError *_Nullable *)error;Encrypt a clear-text file into an encrypted file, for the recipients of this session.
Parameters
clearFileURIANSString*of an URI of the file to encrypt.errorThe error that occurred while encrypting the file, if any.
Returns
A NSString* of the URI of the encrypted file.
encryptFileAsyncFromURI:completionHandler:
- (void) encryptFileAsyncFromURI:(const NSString *)clearFileURI
completionHandler:(void(^)(NSString *encryptedFileURI, NSError *_Nullable error))completionHandler;Encrypt a clear-text file into an encrypted file, for the recipients of this session.
Parameters
clearFileURIANSString*of an URI of the file to encrypt.completionHandlerA callback called after function execution. This callback takes two arguments, a NSString containing the URI of the encrypted file, and aNSError*that indicates if any error occurred.
decryptFileFromURI:error:
- (NSString *) decryptFileFromURI:(const NSString *)encryptedFileURI
error:(NSError *_Nullable *)error;Decrypts an encrypted file into the corresponding clear-text file.
Parameters
encryptedFileURIANSString*of an URI of the encrypted file to decrypt.errorThe error that occurred while decrypting the file, if any.
Returns
A NSString* of the URI of the decrypted file.
decryptFileAsyncFromURI:completionHandler:
- (void) decryptFileAsyncFromURI:(const NSString *)encryptedFileURI
completionHandler:(void(^)(NSString *clearFileURI, NSError *_Nullable error))completionHandler;Decrypts an encrypted file into the corresponding clear-text file.
Parameters
encryptedFileURIANSString*of an URI of the encrypted file to decrypt.completionHandlerA callback called after function execution. This callback takes two arguments, a NSString containing the URI of the decrypted file, and aNSError*that indicates if any error occurred.
addTmrAccess:error:
- (NSString *) addTmrAccess:(const SealdTmrRecipientWithRights *)recipient
error:(NSError *_Nullable *)error;Add a TMR access to this session for the given authentication factor.
Parameters
recipientA TMR recipient with its associated rights.errorA pointer to a SealdError* where details will be stored in case of error.
Returns
A NSString* containing the Id of the created TMR access.
addTmrAccessAsync:completionHandler:
- (void) addTmrAccessAsync:(const SealdTmrRecipientWithRights *)recipient
completionHandler:(void(^)(NSString *result, NSError *_Nullable error))completionHandler;Add a TMR access to this session for the given authentication factor.
Parameters
recipientA TMR recipient with its associated rights.completionHandlerA callback called after function execution. This callback takes two arguments, aNSString*instance, and aNSError*that indicates if any error occurred.
addMultipleTmrAccesses:error:
- (NSDictionary< NSString *, SealdActionStatus * > *) addMultipleTmrAccesses:(const NSArray< SealdTmrRecipientWithRights * > *)recipients
error:(NSError *_Nullable *)error;Add multiple TMR accesses to this session for the given authentication factors.
Parameters
recipientsThe TMR recipients with their associated rights.errorA pointer to a SealdError* where details will be stored in case of error.
Returns
A NSMutableDictionary<NSString*, SealdActionStatus*>* instance.
addMultipleTmrAccessesAsync:completionHandler:
- (void) addMultipleTmrAccessesAsync:(const NSArray< SealdTmrRecipientWithRights * > *)recipients
completionHandler:(void(^)(NSDictionary< NSString *, SealdActionStatus * > *result, NSError *_Nullable error))completionHandler;Add multiple TMR accesses to this session for the given authentication factors.
Parameters
recipientsThe TMR recipients with their associated rights.completionHandlerA callback called after function execution. This callback takes two arguments, aNSMutableDictionary<NSString*, SealdActionStatus*>*instance, and aNSError*that indicates if any error occurred.
serializeWithError:
- (NSString *) serializeWithError:(NSError *_Nullable *)error;Serialize the EncryptionSession to a string. This is for advanced use. May be used to keep sessions in a cache. WARNING: a user could use this cache to work around being revoked. Use with caution. WARNING: if the cache is accessible to another user, they could use it to decrypt messages they are not supposed to have access to. Make sure only the current user in question can access this cache, for example by encrypting it.
Parameters
errorA pointer to a SealdError* where details will be stored in case of error.
Returns
Returns the serialized encryption session as a NSString*.