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
Parameter | Type | Description |
---|---|---|
encryptedFile | T | |
opts ? | object | |
opts.fileSize ? | number | Optional. Size of the file to decrypt. Needed when using progressCallback with a ReadableStream or NodeReadable as input type. |
opts.progressCallback ? | (progress ) => void | - |
opts.signal ? | AbortSignal | Optional. 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
Parameter | Type | Description |
---|---|---|
encryptedMessage | string | |
options ? | object | |
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
Parameter |
---|
T extends string | Blob | ReadableStream < any > | Readable | Buffer |
Parameters
Parameter | Type | Description |
---|---|---|
clearFile | T | |
filename | string | |
opts ? | object | |
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
Parameter | Type | Description |
---|---|---|
clearString | string | |
options ? | object | |
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
>