Class WL.SecurityUtils

WL.SecurityUtils

Description:
Security Utilities

Method Summary
Method Attributes Method Name and Description
 
base64Decode(input)
Decodes input base64 string to a non base64 encoded string.
 
base64Encode(input)
Encodes input as base64 string.
 
decrypt(options)
Decryption function.
 
ONLY FOR IOS.
 
encrypt(options)
Encrypts text with a key.
 
keygen(options)
Generates a key by using the PBKDF2 algorithm.
 
Generates a random hex string locally.
Method Detail
base64Decode
{Promise} base64Decode(input)
Decodes input base64 string to a non base64 encoded string.
Parameters:
{string} input - Required. Input base64 encoded string.
Returns:
{Promise} Resolved when the operation succeeds, first parameter is the input string decoded. Rejected when there is a failure.

base64Encode
{Promise} base64Encode(input)
Encodes input as base64 string.
Parameters:
{string} input - Required. Input string.
Returns:
{Promise} Resolved when the operation succeeds, first parameter is the input string encoded. Rejected when there is a failure.

decrypt
{Promise} decrypt(options)
Decryption function.
Parameters:
{object} options - Required.
{string} options.key - Required. Key.
{string} options.ct - Required. Cipher Text.
{string} options.iv - Required. Initialization Vector.
{string} options.src - Required. Source ('obj' = iOS, 'java' = Android, 'js' = Web).
{number} options.v - Required. Version.
Returns:
{Promise} Resolved when the operation succeeds, first parameter is the decrypted text. Rejected when there is a failure.

enableOSNativeEncryption
{Promise} enableOSNativeEncryption(enable)
ONLY FOR IOS. Choose whether internal/native or OpenSSL based encryption will be applied.
Parameters:
{bool} enable - Required. If true native encryption is used. If false OpenSSL encryption is used.
Returns:
{Promise} Resolved when the operation succeeds. Rejected when there is a failure.

encrypt
{Promise} encrypt(options)
Encrypts text with a key.
Parameters:
{object} options - Required.
{string} options.key - Required. Text to encrypt.
{string} options.text - Required. Key that is used for encryption.
Returns:
{Promise} Resolved when the operation succeeds, first parameter is an object which includes the cipher text. Rejected when there is a failure.

keygen
{Promise} keygen(options)
Generates a key by using the PBKDF2 algorithm.
Parameters:
{object} options - Required.
{string} options.password - Required. Password that is used to generate the key.
{string} options.salt - Required. Salt that is used to to generate the key.
{number} options.iterations - Required. Number of iterations that is used for the key generation algorithm.
Returns:
{Promise} Resolved when the operation succeeds, first parameter is the hex encoded key. Rejected when there is a failure.

localRandomString
{Promise} localRandomString(bytes)
Generates a random hex string locally.
Parameters:
{number} bytes Optional - Optional. Number of bytes that is used to generate the string. Default is 32 bytes.
Returns:
{Promise} Resolved when the operation succeeds, first parameter is the random hex string. Rejected when there is a failure.

© Copyright IBM Corp. 2011, 2016.