Skip to content
On this page

class SealdEncryptionSession

objc
@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 retrieveEncryptionSessionWithSessionId:useCache:error: (SealdSdk) or retrieveEncryptionSessionFromMessage:useCache:error: (SealdSdk).

MembersDescriptions
sessionIdThe ID of this encryptionSession. 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.
revokeRecipients:error:Revoke some recipients from this session. If you want to revoke all recipients, see revokeAll: instead. If you want to revoke all recipients besides yourself, see revokeOthers:.
revokeRecipientsAsync:completionHandler:Revoke some recipients 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;

The ID of this encryptionSession. Read-only.

addRecipients:error:

objc
- (NSDictionary< NSString *, SealdActionStatus * > *) addRecipients:(const NSArray< NSString * > *)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 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< NSString * > *)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 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.

revokeRecipients:error:

objc
- (NSDictionary< NSString *, SealdActionStatus * > *) revokeRecipients:(const NSArray< NSString * > *)recipients
                                                                 error:(NSError *_Nullable *)error;

Revoke some recipients 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

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

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

Returns

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

revokeRecipientsAsync:completionHandler:

objc
- (void) revokeRecipientsAsync:(const NSArray< NSString * > *)recipients
             completionHandler:(void(^)(NSDictionary< NSString *, SealdActionStatus * > *result, NSError *_Nullable error))completionHandler;

Revoke some recipients 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

  • recipients The Seald IDs of users to revoke from 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.

revokeAll:

objc
- (NSDictionary< NSString *, SealdActionStatus * > *) revokeAll:(NSError *_Nullable *)error;

Revoke this session entirely.

Parameters

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

Returns

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

revokeAllAsyncWithCompletionHandler:

objc
- (void) revokeAllAsyncWithCompletionHandler:(void(^)(NSDictionary< NSString *, SealdActionStatus * > *result, NSError *_Nullable error))completionHandler;

Revoke this session entirely.

Parameters

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

revokeOthers:

objc
- (NSDictionary< NSString *, SealdActionStatus * > *) revokeOthers:(NSError *_Nullable *)error;

Revoke all recipients besides yourself from this session.

Parameters

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

Returns

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

revokeOthersAsyncWithCompletionHandler:

objc
- (void) revokeOthersAsyncWithCompletionHandler:(void(^)(NSDictionary< NSString *, SealdActionStatus * > *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 [NSMutableDictionary<NSString*, SealdActionStatus*>*] instance. and a NSError* that indicates if any error occurred.

encryptMessage:error:

objc
- (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;

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;

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;

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;

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;

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;

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;

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;

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;

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;

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;

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.