Code Sample
The following code sample shows how to reference a secret by using its script ID.
require(['N/file', 'N/sftp', 'N/certificateControl'], (file, sftp, certificateControl) => {
var connection = sftp.createConnection({
username: 'sftpuser',
secret: 'custsecret1', // This is the reference to the script ID.
url: '172.25.182.109',
port: 22,
directory: 'certificates'
});
try {
var cert = certificateControl.createCertificate({
name: 'NAAcert2020',
file: connection.download({
directory: '2020',
filename: 'NAA_cert.pfx'
}),
password: 'custsecret2' // This is the reference to the script ID.
});
var certId = cert.save();
} catch (e) {
log.error(e.message);
}
});