https.createSecretKey(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Creates and returns a crypto.SecretKey Object. This method can take a GUID or a secret.

You can place the key in your secure string. SuiteScript decrypts the value (key) and sends it to the server.

Returns

crypto.SecretKey

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/https Module

Since

2015.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

options.guid

string

required if secret is not specified

A GUID used to generate a secret key. Use Form.addCredentialField(options) to generate a GUID.

This parameter is not required if you use the secret parameter. You cannot use both the options.guid parameter and secret parameter in combination.

The GUID can resolve to either data or metadata.

2015.2

options.secret

string

required if options.guid is not specified

The script ID of the secret used for authentication. You can store secrets at Setup > Company > API Secrets. For more information, see Secrets Management.

This parameter is not required if you use the options.guid parameter. You cannot use both the options.guid parameter and secret parameter in combination.

2021.1

options.encoding

https.Encoding

optional

Specifies the encoding for the Secret Key.

2015.2

Syntax
Important:

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 secretKey = https.createSecretKey({
    encoding: https.Encoding.HEX,
    guid: '284CFB2D225B1D76FB94D150207E49DF'
    });
...
// Add additional code 

        

Related Topics

N/https Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices