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.x Script Basics and SuiteScript 2.x Script Types.
/**
* @NApiVersion 2.x
*/
require(['N/keyControl','N/file'],function(keyControl,file){
var key = keyControl.createKey();
key.file = file.load(422);
//id of file containing private key (id_ecdsa or id_rsa)
key.name = "SFTP key";
key.save();
})