# Module: key

## key

Source:
  - key.js, line 18

### Classes

Key
SubKey
User

### Methods

#### <inner> generate(keyType, numBits, userId, passphrase) → {module:key~Key}

  Generates a new OpenPGP key. Currently only supports RSA keys. Primary and subkey will be of same type.

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `keyType` | Integer | to indicate what type of key to make. RSA is 1. See http://tools.ietf.org/html/rfc4880#section-9.1
  `numBits` | Integer | number of bits for the key creation.
  `userId` | String | assumes already in form of "User Name "
  `passphrase` | String | The passphrase used to encrypt the resulting private key

  Source:
    - key.js, line 709

  ##### Returns:

  Type
    module:key~Key

#### <inner> 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:
    - key.js, line 668

  ##### Returns:

  result object with key and error arrays
  Type
    Object