Get the salt as base64 string
Get a header string: Bearer sync-v1 ${authTokenB64}
.
Pass in a token, or else this will use the authToken
derived from
the main key.
Optional
tokenString: stringget a promise for the auth token.
Get the auth token as a base64 string
Decrypt in memory, not streaming.
Take an encrypted stream, return a decrypted stream.
The input (encrypted) stream
The decrypted stream
Returns an object containing ranges
, an array of objects
containing offset
and length
integers specifying the encrypted byte
ranges that are needed to decrypt the client's specified range, and a
decrypt
function.
Integer
Integer
Integer
Encrypt and return some data; don't stream.
NOTE: This generates a new key each time it is called, via
this.generateKey
.
Optional
opts: { iv?: Uint8Array<ArrayBufferLike>; size?: number }Optional params,
iv
and size
. If size
is omitted, default is 16 bytes. iv
is
a random 12 bits, will be generated if not passed in.
Derive a new AES-GCM key from the main key.
Optional
keyLength: numberOptional size for the key, in bytes, eg,
16
or 32
.
Set the auth token
Optional
authToken: string | Uint8Array<ArrayBufferLike>The new token
Static
AuthGet an authentication header as a static method.
Static
Header
Get the main key as a
base64url
encoded string