Interface: AnonymousEncryptionSession
Properties
_sessionSymKey
_sessionSymKey:
SymKey
Instance of the symKey for this EncryptionSession instance. For internal use only. Do not use directly.
sessionId
sessionId:
string
The sessionId for this EncryptionSession instance.
Methods
decryptFile()
decryptFile<
T
>(encryptedFile
:T
,opts
?: {fileSize
:number
;progressCallback
: (progress
:number
) =>void
;signal
:AbortSignal
; }):Promise
<{data
:T
;filename
:string
;sessionId
:string
;size
:number
;type
:FileType
; }>
Decrypts an encrypted file
Type Parameters
• T extends string
| Blob
| ReadableStream
<any
> | Readable
| Buffer
<ArrayBufferLike
>
Parameters
encryptedFile
T
opts?
fileSize
number
Optional. Size of the file to decrypt. Needed when using progressCallback with a ReadableStream or NodeReadable as input type.
progressCallback
(progress
: number
) => void
Optional. Progress callback. The progress is given between 0 and 1.
signal
AbortSignal
Optional. An AbortSignal to cancel the decryption.
Returns
Promise
<{data
: T
;filename
: string
;sessionId
: string
;size
: number
;type
: FileType
; }>
data
data:
T
filename
filename:
string
sessionId
sessionId:
string
size
size:
number
type
type:
FileType
decryptMessage()
decryptMessage(
encryptedMessage
:string
,options
?: {raw
:boolean
; }):Promise
<string
>
Decrypts an encrypted message string into the corresponding clear-text string.
Parameters
encryptedMessage
string
options?
raw
boolean
Optional. Whether or not the message was encrypted raw. Defaults to false
.
Returns
Promise
<string
>
encryptFile()
encryptFile<
T
>(clearFile
:T
,filename
:string
,opts
?: {fileSize
:number
;signal
:AbortSignal
; }):Promise
<T
>
Encrypts a file
Type Parameters
• T extends string
| Blob
| ReadableStream
<any
> | Readable
| Buffer
<ArrayBufferLike
>
Parameters
clearFile
T
filename
string
opts?
fileSize
number
Optional. Needed when using stream
signal
AbortSignal
Optional. An AbortSignal to cancel the encryption.
Returns
Promise
<T
>
encryptMessage()
encryptMessage(
clearString
:string
,options
?: {raw
:boolean
; }):Promise
<string
>
Encrypts a clear-text string into an encrypted message, for the recipients of this session.
Parameters
clearString
string
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
>