Namespace: json

sjcl.json

JSON encapsulation
Source:

Members

(static) defaults

Default values for encryption
Source:

Methods

(static) _decrypt(password, ciphertext, paramsopt, rpopt) → {String}

Simple decryption function.
Parameters:
Name Type Attributes Description
password String | bitArray The password or key.
ciphertext Object The cipher raw data to decrypt.
params Object <optional>
Additional non-default parameters.
rp Object <optional>
A returned object with filled parameters.
Source:
Throws:
Returns:
The plaintext.
Type
String

(static) _encrypt(password, plaintext, paramsopt, rpopt) → {Object}

Simple encryption function.
Parameters:
Name Type Attributes Description
password String | bitArray The password or key.
plaintext String The data to encrypt.
params Object <optional>
The parameters including tag, iv and salt.
rp Object <optional>
A returned version with filled-in parameters.
Source:
Throws:
if a parameter is invalid.
Type
sjcl.exception.invalid
Returns:
The cipher raw data.
Type
Object

(static) decode(str) → {Object}

Decode a simple (flat) JSON string into a structure. The ciphertext, adata, salt and iv will be base64-decoded.
Parameters:
Name Type Description
str String The string.
Source:
Throws:
if str isn't (simple) JSON.
Type
sjcl.exception.invalid
Returns:
The decoded structure.
Type
Object

(static) decrypt(password, ciphertext, paramsopt, rpopt) → {String}

Simple decryption function.
Parameters:
Name Type Attributes Description
password String | bitArray The password or key.
ciphertext String The ciphertext to decrypt.
params Object <optional>
Additional non-default parameters.
rp Object <optional>
A returned object with filled parameters.
Source:
Throws:
Returns:
The plaintext.
Type
String

(static) encode(obj) → {String}

Encode a flat structure into a JSON string.
Parameters:
Name Type Description
obj Object The structure to encode.
Source:
Throws:
Returns:
A JSON string.
Type
String

(static) encrypt(password, plaintext, paramsopt, rpopt) → {String}

Simple encryption function.
Parameters:
Name Type Attributes Description
password String | bitArray The password or key.
plaintext String The data to encrypt.
params Object <optional>
The parameters including tag, iv and salt.
rp Object <optional>
A returned version with filled-in parameters.
Source:
Throws:
if a parameter is invalid.
Type
sjcl.exception.invalid
Returns:
The ciphertext serialized data.
Type
String