pgp.loadKeyFromSecret(options)
The content in this help topic pertains to SuiteScript 2.1.
Method Description |
Loads a key contents that are securely stored in a secret. |
Returns |
|
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types. |
Governance |
None |
Module |
|
Sibling Module Members |
|
Since |
2022.2 |
Parameters
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
Secret |
required |
Secret that contains a PGP key in ASCII armored format. |
2022.2 |
|
Secret |
optional |
Secret that contains a password to unlock the key. Applicable for private keys. |
2022.2 |
Errors
Error Code |
Thrown If |
---|---|
REFERENCED_SECRET_IS_NOT_AVAILABLE |
The secret/password parameter references a non-existing secret or you lack permission. |
PGP_ |
Parsing of the key fails. |
PGP_YOU_CANNOT_PROVIDE_PASSWORD_FOR_A_PUBLIC_KEY |
You provide a password, but the key is public. |
PGP_INVALID_KEY_PASSWORD |
You provide a password, but it is wrong or the private key is not password protected. |
PGP_THIS_KEY_IS_PASSWORD_PROTECTED |
You do not provide any password, but the private key is password protected. |
Syntax
The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/pgp Module Script Samples.
// Add additional code
...
const keys = pgp.loadKeyFromSecret({
secret: { scriptId: "custsecret_pgp_key_ours_private" },
password: { scriptId: "custsecret_pgp_key_ours_private_password" },
}),
...
// Add additional code