SecureString.hmac(options)
Method Description |
Creates an hmac for a https.SecureString using a specified hash algorithm and secret key. You can optionally specify the encoding used to convert the SecureString content to and the encoding used to encode the result as a string. Use https.HashAlg to set the hash algorithm. |
Returns |
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Since |
2015.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
---|---|---|---|
|
string |
required |
The hash algorithm. Use values from the https.HashAlg enum. |
|
required |
A key returned from https.createSecretKey(options). |
|
|
string |
optional |
Encoding used to convert/decode the current string content into binary data for hmac processing. Use values from the https.Encoding enum. Defaults to current internal encoding of the SecureString. Although a default is provided, we highly encourage the use of this parameter for the most secure and correct encoding. |
|
string |
optional |
Encoding used to encode the binary result as a string. Use values from the https.Encoding enum. Defaults to HEX when |
Errors
Error Code |
Thrown If |
---|---|
|
An invalid attempt was made to encode the binary result to UTF-8 string. |
|
The content of the SecureString is not a valid encoded string according to the |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/https Module Script Samples.
// Add additional code
...
var secureString1 = https.createSecureString({
input: "myString1"
});
var hmacString1 = secureString1.hmac({
algorithm: https.HashAlg.SHA256,
key: mySecretKey
});
...
// Add additional code