Skip to content

Interface: AnonymousEncryptionSession

Properties

sessionId

sessionId: string

The sessionId for this EncryptionSession instance.

Methods

decryptFile()

decryptFile<T>(encryptedFile, opts?): Promise<Object>

Decrypts an encrypted file

Type parameters

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

Parameters

encryptedFile: T

opts?

opts.fileSize?: number

Optional. Size of the file to decrypt. Needed when using progressCallback with a ReadableStream or NodeReadable as input type.

opts.progressCallback?

Optional. Progress callback. The progress is given between 0 and 1.

opts.signal?: AbortSignal

Optional. An AbortSignal to cancel the decryption.

Returns

Promise<Object>

data

data: T

filename

filename: string

sessionId

sessionId: string

size

size: number

type

type: FileType


decryptMessage()

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

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

Parameters

encryptedMessage: string

options?

options.raw?: boolean

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

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

Parameters

clearFile: T

filename: string

opts?

opts.fileSize?: number

Optional. Needed when using stream

opts.signal?: AbortSignal

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

clearString: string

options?

options.raw?: boolean

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