Crypto Module
Simple, fast crypto service. Import
Methods
md5(string) md5Hmac(string, string) sha1(string) sha1Hmac(string, string) sha256(string) sha256Hmac(string, string) sha512(string) sha512Hmac(string, string) rsa.encrypt(apiKey, payload, outputEncoding=buffer, inputEncoding=utf8) rsa.decrypt(apiKey, payload, outputEncoding=utf8)
md5(string)
Arguments
value
(String) string to hash
Returns
value
(String) hash value
md5Hmac(string, string)
Arguments
secret
(String) secret keyvalue
(String) string to hash
Returns
value
(String) hash value
sha1(string)
Arguments
value
(String) string to hash
Returns
value
(String) hash value
sha1Hmac(string, string)
Arguments
secret
(String) secret keyvalue
(String) string to hash
Returns
value
(String) hash value
sha256(string)
Arguments
value
(String) string to hash
Returns
value
(String) hash value
sha256Hmac(string, string)
Arguments
secret
(String) secret keyvalue
(String) string to hash
Returns
value
(String) hash value
sha512(string)
Arguments
value
(String) string to hash
Returns
value
(String) hash value
sha512Hmac(string, string)
Arguments
secret
(String) secret keyvalue
(String) string to hash
Returns
value
(String) hash value
rsa.encrypt(apiKey, payload, outputEncoding=buffer, inputEncoding=utf8)
Encrypt a JSON object or a string using an app's RSA public key
Arguments
apiKey
(String) The app api key that holds the key pairpayload
(String|Object) string or JSON object to encryptoutputEncoding
(String=buffer) Support output encodings are hex, base64, buffer and binaryinputEncoding
(String=utf8) Supported input encodings are hex, base64 and utf8
Returns
value
(Buffer|String) encrypted value
rsa.decrypt(apiKey, payload, outputEncoding=utf8)
Decrypt a buffer or base64 encoded string app's RSA private key
Arguments
apiKey
(String) The app api key that holds the key pairpayload
(String|Buffer) string or buffer to decryptoutputEncoding
(String=utf8) Support output encodings are hex, base64, buffer, binary, utf8 and json. Ifjson
is specified, decrypt will parse the resulting string..
Returns
value
(String|Object) decrypted value
Examples
Crypto Example
Crypto Example Response
Last updated