Skip to content

class SealdEncryptionSession

objc
@interface SealdEncryptionSession : NSObject
@interface SealdEncryptionSession : NSObject

An 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:.

MembersDescriptions
sessionIdThe ID of this encryptionSession. Read-only.
retrievalDetailsDetails 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.
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.
revokeRecipientsIds:proxySessionsIds: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:.
revokeRecipientsIdsAsync:proxySessionsIds: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.
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.

sessionId

objc
@property (assign, readonly) NSString * sessionId;
@property (assign, readonly) NSString * sessionId;

The ID of this encryptionSession. Read-only.

retrievalDetails

objc
@property (assign, readonly) SealdEncryptionSessionRetrievalDetails * retrievalDetails;
@property (assign, readonly) SealdEncryptionSessionRetrievalDetails * retrievalDetails;

Details about how this session was retrieved: through a group, a proxy, or directly. Read-only.

addRecipients:error:

objc
- (NSDictionary< NSString *, SealdActionStatus * > *) addRecipients:(const NSArray< SealdRecipientWithRights * > *)recipients
                                                              error:(NSError *_Nullable *)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

  • recipients The Seald IDs with the associated rights of users to add to this session.

  • error The error that occurred while adding the recipients, if any.

Returns

A [NSMutableDictionary<NSString*, SealdActionStatus*>*] instance.

addRecipientsAsync:completionHandler:

objc
- (void) addRecipientsAsync:(const NSArray< SealdRecipientWithRights * > *)recipients
          completionHandler:(void(^)(NSDictionary< NSString *, SealdActionStatus * > *result, NSError *_Nullable error))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

  • recipients The Seald IDs with the associated rights of users to add to this session.

  • completionHandler A callback called after function execution. This callback take two arguments, a [NSMutableDictionary<NSString*, SealdActionStatus*>*] instance. and a NSError* that indicates if any error occurred.

addProxySession:rights:error:

objc
- (void) addProxySession:(const NSString *)proxySessionId
                  rights:(const SealdRecipientRights *)rights
                   error:(NSError *_Nullable *)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

  • proxySessionId The ID of the session to add as proxy.

  • rights The rights to assign to this proxy.

  • error The error that occurred while adding the proxy, if any.

addProxySessionAsync:rights:completionHandler:

objc
- (void) addProxySessionAsync:(const NSString *)proxySessionId
                       rights:(const SealdRecipientRights *)rights
            completionHandler:(void(^)(NSError *_Nullable error))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

  • proxySessionId The ID of the session to add as proxy.

  • rights The rights to assign to this proxy.

  • completionHandler A callback called after function execution. This callback take a NSError* that indicates if any error occurred.

revokeRecipientsIds:proxySessionsIds:error:

objc
- (SealdRevokeResult *) revokeRecipientsIds:(const NSArray< NSString * > *)recipientsIds
                           proxySessionsIds:(const NSArray< NSString * > *)proxySessionsIds
                                      error:(NSError *_Nullable *)error;
- (SealdRevokeResult *) revokeRecipientsIds:(const NSArray< NSString * > *)recipientsIds
                           proxySessionsIds:(const NSArray< NSString * > *)proxySessionsIds
                                      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

  • recipientsIds The Seald IDs of users to revoke from this session.

  • proxySessionsIds The IDs of proxy sessions to revoke from this session.

  • error The error that occurred while revoking, if any.

Returns

A [SealdRevokeResult] instance.

revokeRecipientsIdsAsync:proxySessionsIds:completionHandler:

objc
- (void) revokeRecipientsIdsAsync:(const NSArray< NSString * > *)recipientsIds
                 proxySessionsIds:(const NSArray< NSString * > *)proxySessionsIds
                completionHandler:(void(^)(SealdRevokeResult *result, NSError *_Nullable error))completionHandler;
- (void) revokeRecipientsIdsAsync:(const NSArray< NSString * > *)recipientsIds
                 proxySessionsIds:(const NSArray< NSString * > *)proxySessionsIds
                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

  • recipientsIds The Seald IDs of users to revoke from this session.

  • proxySessionsIds The IDs of proxy sessions to revoke from this session.

  • completionHandler A callback called after function execution. This callback take two arguments, a [SealdRevokeResult] instance. and a NSError* that indicates if any error occurred.

revokeAll:

objc
- (SealdRevokeResult *) revokeAll:(NSError *_Nullable *)error;
- (SealdRevokeResult *) revokeAll:(NSError *_Nullable *)error;

Revoke this session entirely.

Parameters

  • error The error that occurred while revoking, if any.

Returns

A [SealdRevokeResult] instance.

revokeAllAsyncWithCompletionHandler:

objc
- (void) revokeAllAsyncWithCompletionHandler:(void(^)(SealdRevokeResult *result, NSError *_Nullable error))completionHandler;
- (void) revokeAllAsyncWithCompletionHandler:(void(^)(SealdRevokeResult *result, NSError *_Nullable error))completionHandler;

Revoke this session entirely.

Parameters

  • completionHandler A callback called after function execution. This callback take two arguments, a [SealdRevokeResult] instance. and a NSError* that indicates if any error occurred.

revokeOthers:

objc
- (SealdRevokeResult *) revokeOthers:(NSError *_Nullable *)error;
- (SealdRevokeResult *) revokeOthers:(NSError *_Nullable *)error;

Revoke all recipients besides yourself from this session.

Parameters

  • error The error that occurred while revoking, if any.

Returns

A [SealdRevokeResult] instance.

revokeOthersAsyncWithCompletionHandler:

objc
- (void) revokeOthersAsyncWithCompletionHandler:(void(^)(SealdRevokeResult *result, NSError *_Nullable error))completionHandler;
- (void) revokeOthersAsyncWithCompletionHandler:(void(^)(SealdRevokeResult *result, NSError *_Nullable error))completionHandler;

Revoke all recipients besides yourself from this session.

Parameters

  • completionHandler A callback called after function execution. This callback take two arguments, a [SealdRevokeResult] instance. and a NSError* that indicates if any error occurred.

encryptMessage:error:

objc
- (NSString *) encryptMessage:(const NSString *)clearMessage
                        error:(NSError *_Nullable *)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

  • clearMessage The message to encrypt.

  • error The error that occurred while encrypting the message, if any.

Returns

The encrypted message

encryptMessageAsync:completionHandler:

objc
- (void) encryptMessageAsync:(const NSString *)clearMessage
           completionHandler:(void(^)(NSString *encryptedString, NSError *_Nullable error))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

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

decryptMessage:error:

objc
- (NSString *) decryptMessage:(const NSString *)encryptedMessage
                        error:(NSError *_Nullable *)error;
- (NSString *) decryptMessage:(const NSString *)encryptedMessage
                        error:(NSError *_Nullable *)error;

Decrypt an encrypted message string into the corresponding clear-text string.

Parameters

  • encryptedMessage The encrypted message to decrypt.

  • error The error that occurred while decrypting the message, if any.

Returns

The decrypted clear-text message.

decryptMessageAsync:completionHandler:

objc
- (void) decryptMessageAsync:(const NSString *)encryptedMessage
           completionHandler:(void(^)(NSString *decryptedString, NSError *_Nullable error))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

  • encryptedMessage The encrypted message to decrypt.

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

encryptFile:filename:error:

objc
- (NSData *) encryptFile:(const NSData *)clearFile
                filename:(const NSString *)filename
                   error:(NSError *_Nullable *)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

  • clearFile A NSData* of the clear-text content of the file to encrypt.

  • filename The name of the file to encrypt.

  • error The error that occurred while encrypting the file, if any.

Returns

A NSData* of the content of the encrypted file.

encryptFileAsync:filename:completionHandler:

objc
- (void) encryptFileAsync:(const NSData *)clearFile
                 filename:(const NSString *)filename
        completionHandler:(void(^)(NSData *encryptedFile, NSError *_Nullable error))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

  • clearFile A NSData* of the clear-text content of the file to encrypt.

  • filename The name of the file to encrypt.

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

decryptFile:error:

objc
- (SealdClearFile *) decryptFile:(const NSData *)encryptedFile
                           error:(NSError *_Nullable *)error;
- (SealdClearFile *) decryptFile:(const NSData *)encryptedFile
                           error:(NSError *_Nullable *)error;

Decrypts an encrypted file into the corresponding clear-text file.

Parameters

  • encryptedFile A NSData* of the content of the encrypted file to decrypt.

  • error The 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:

objc
- (void) decryptFileAsync:(const NSData *)encryptedFile
        completionHandler:(void(^)(SealdClearFile *clearFile, NSError *_Nullable error))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

  • encryptedFile A NSData* of the content of the encrypted file to decrypt.

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

encryptFileFromURI:error:

objc
- (NSString *) encryptFileFromURI:(const NSString *)clearFileURI
                            error:(NSError *_Nullable *)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

  • clearFileURI A NSString* of an URI of the file to encrypt.

  • error The error that occurred while encrypting the file, if any.

Returns

A NSString* of the URI of the encrypted file.

encryptFileAsyncFromURI:completionHandler:

objc
- (void) encryptFileAsyncFromURI:(const NSString *)clearFileURI
               completionHandler:(void(^)(NSString *encryptedFileURI, NSError *_Nullable error))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

  • clearFileURI A NSString* of an URI of the file to encrypt.

  • completionHandler A callback called after function execution. This callback take two arguments, a NSString containing the URI of the encrypted file, and a NSError* that indicates if any error occurred.

decryptFileFromURI:error:

objc
- (NSString *) decryptFileFromURI:(const NSString *)encryptedFileURI
                            error:(NSError *_Nullable *)error;
- (NSString *) decryptFileFromURI:(const NSString *)encryptedFileURI
                            error:(NSError *_Nullable *)error;

Decrypts an encrypted file into the corresponding clear-text file.

Parameters

  • encryptedFileURI A NSString* of an URI of the encrypted file to decrypt.

  • error The error that occurred while decrypting the file, if any.

Returns

A NSString* of the URI of the decrypted file.

decryptFileAsyncFromURI:completionHandler:

objc
- (void) decryptFileAsyncFromURI:(const NSString *)encryptedFileURI
               completionHandler:(void(^)(NSString *clearFileURI, NSError *_Nullable error))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

  • encryptedFileURI A NSString* of an URI of the encrypted file to decrypt.

  • completionHandler A callback called after function execution. This callback take two arguments, a NSString containing the URI of the decrypted file, and a NSError* that indicates if any error occurred.