Create a Secret Key

The following sample shows how to create a key.

Note:

This sample script uses the require function so that you can copy it into the SuiteScript Debugger and test it. You must use the define function in an entry point script (the script you attach to a script record and deploy). For more information, see SuiteScript 2.1 Script Basics and SuiteScript 2.1 Script Types.

          /**
 * @NApiVersion 2.1
 */
require(['N/keyControl', 'N/file'], (keyControl, file) => {
    const key = keyControl.createKey();

    // Replace 422 with the internal ID of the PEM private-key file.
    key.file = file.load({
        id: 422
    });
    key.name = 'SFTP key';
    key.save();
}); 

        

General Notices