Skip to content
Sur cette page

Interface: AnonymousEncryptionSession

Properties

sessionId

sessionId: string

The sessionId for this EncryptionSession instance.

Methods

decryptFile

decryptFile<T>(encryptedFile, opts?): Promise< { data: T; filename: string; sessionId: string; size: number; type: FileType; } >

Decrypts an encrypted file

Type parameters

Parameter
T extends string | Blob | ReadableStream< any > | Readable | Buffer

Parameters

ParameterTypeDescription
encryptedFileT
opts?object
opts.fileSize?numberOptional. Size of the file to decrypt. Needed when using progressCallback with a ReadableStream or NodeReadable as input type.
opts.progressCallback?(progress) => void-
opts.signal?AbortSignalOptional. An AbortSignal to cancel the decryption.

Returns

Promise< { data: T; filename: string; sessionId: string; size: number; type: FileType; } >


decryptMessage

decryptMessage(encryptedMessage, options?): Promise< string >

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

Parameters

ParameterTypeDescription
encryptedMessagestring
options?object
options.raw?booleanOptional. Whether or not the message was encrypted raw. Defaults to false.

Returns

Promise< string >


encryptFile

encryptFile<T>( clearFile, filename, opts?): Promise< T >

Encrypts a file

Type parameters

Parameter
T extends string | Blob | ReadableStream< any > | Readable | Buffer

Parameters

ParameterTypeDescription
clearFileT
filenamestring
opts?object
opts.fileSize?numberOptional. Needed when using stream
opts.signal?AbortSignalOptional. An AbortSignal to cancel the encryption.

Returns

Promise< T >


encryptMessage

encryptMessage(clearString, options?): Promise< string >

Encrypts a clear-text string into an encrypted message, for the recipients of this session.

Parameters

ParameterTypeDescription
clearStringstring
options?object
options.raw?booleanOptional. Whether to include or not the sessionID in the encrypted string. If set to true, the encrypted string cannot be used to retrieve the encryption session. Defaults to false.

Returns

Promise< string >