Module: Encryption

Methods

(static) base64Decode(data) → {Uint8Array}

Decodes base64 string to binary data
Parameters:
Name Type Description
data string Base64 string to decode
Source:
Returns:
Decoded binary data
Type
Uint8Array

(static) base64Encode(data) → {string}

Encodes binary data to base64 string
Parameters:
Name Type Description
data Uint8Array Binary data to encode
Source:
Returns:
Base64 encoded string
Type
string

(static) decrypt(data) → {Promise.<Uint8Array>}

Decrypts data using AES-CBC
Parameters:
Name Type Description
data Uint8Array Data to decrypt
Source:
Returns:
Decrypted data
Type
Promise.<Uint8Array>

(static) deserialize_payload(payload) → {Promise.<object>}

Deserializes an encrypted base64 payload
Parameters:
Name Type Description
payload string Base64 encoded encrypted payload
Source:
Returns:
Decrypted and parsed JSON object
Type
Promise.<object>

(static) encrypt(data) → {Promise.<Uint8Array>}

Encrypts data using AES-CBC
Parameters:
Name Type Description
data Uint8Array Data to encrypt
Source:
Returns:
Encrypted data
Type
Promise.<Uint8Array>

(static) generate_key(dateopt) → {Promise.<CryptoKey>}

Generates an AES key based on date sequence
Parameters:
Name Type Attributes Default Description
date Date <optional>
null Optional date to use for key generation
Source:
Returns:
Generated AES-CBC key
Type
Promise.<CryptoKey>

(static) generate_local_name(dateopt) → {Promise.<string>}

Generates an encrypted local name for request headers
Parameters:
Name Type Attributes Default Description
date Date <optional>
null Optional date to use for name generation
Source:
Returns:
Base64 encoded encrypted local name
Type
Promise.<string>

(static) serialize_payload(payload) → {Promise.<string>}

Serializes and encrypts a payload object
Parameters:
Name Type Description
payload object Object to serialize and encrypt
Source:
Returns:
Base64 encoded encrypted payload
Type
Promise.<string>