class SealdAnonymousEncryptionSession
@interface SealdAnonymousEncryptionSession : NSObject
An anonymous encryption session, with which you can then encrypt / decrypt multiple messages or files. This should not be instantiated directly, and should be created with SealdAnonymousSdk.createAnonymousEncryptionSession:error:
Members | Descriptions |
---|---|
sessionId | The ID of this encryptionSession. Read-only. |
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. |
serializeWithError: | Serialize the SealdAnonymousEncryptionSession 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.
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
clearMessage
The message to encrypt.error
The 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
completionHandler
A 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
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:
- (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 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
clearFile
ANSData*
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:
- (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
ANSData*
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 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
encryptedFile
ANSData*
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:
- (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
ANSData*
of the content of the encrypted file to decrypt.completionHandler
A 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
clearFileURI
ANSString*
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:
- (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
ANSString*
of an URI of the file to encrypt.completionHandler
A 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
encryptedFileURI
ANSString*
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:
- (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
ANSString*
of an URI of the encrypted file to decrypt.completionHandler
A 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.
serializeWithError:
- (NSString *) serializeWithError:(NSError *_Nullable *)error;
Serialize the SealdAnonymousEncryptionSession 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
error
A pointer to a SealdError* where details will be stored in case of error.
Returns
Returns the serialized encryption session as a NSString*
.