Module: key

Requires

Classes

Key
SubKey
User

Methods

(static) generate() → {module:key~Key}

Generates a new OpenPGP key. Currently only supports RSA keys. Primary and subkey will be of same type.
Parameters:
Name Type Attributes Default Description
options.keyType module:enums.publicKey <optional>
module:enums.publicKey.rsa_encrypt_sign to indicate what type of key to make. RSA is 1. See http://tools.ietf.org/html/rfc4880#section-9.1
options.numBits Integer number of bits for the key creation.
options.userIds String | Array.<String> assumes already in form of "User Name " If array is used, the first userId is set as primary user Id
options.passphrase String The passphrase used to encrypt the resulting private key
options.unlocked Boolean <optional>
false The secret part of the generated key is unlocked
options.keyExpirationTime Number <optional>
0 The number of seconds after the key creation time that the key expires
Source:
Returns:
Type
module:key~Key

(static) getPreferredSymAlgo(keys) → {enums.symmetric}

Returns the preferred symmetric algorithm for a set of keys
Parameters:
Name Type Description
keys Array.<module:key~Key> Set of keys
Source:
Returns:
Preferred symmetric algorithm
Type
enums.symmetric

(static) readArmored(armoredText) → {Object}

Reads an OpenPGP armored text and returns one or multiple key objects
Parameters:
Name Type Description
armoredText String text to be parsed
Source:
Returns:
result object with key and error arrays
Type
Object

(static) reformat() → {module:key~Key}

Reformats and signs an OpenPGP with a given User ID. Currently only supports RSA keys.
Parameters:
Name Type Attributes Default Description
options.privateKey module:key~Key The private key to reformat
options.keyType module:enums.publicKey <optional>
module:enums.publicKey.rsa_encrypt_sign
options.userIds String | Array.<String> assumes already in form of "User Name " If array is used, the first userId is set as primary user Id
options.passphrase String The passphrase used to encrypt the resulting private key
options.unlocked Boolean <optional>
false The secret part of the generated key is unlocked
options.keyExpirationTime Number <optional>
0 The number of seconds after the key creation time that the key expires
Source:
Returns:
Type
module:key~Key