# Module: keyring/keyring

## keyring/keyring

#### new require("keyring/keyring")()

  Source:
    - keyring/keyring.js, line 26

Source:
  - keyring/keyring.js, line 18

### Methods

#### getPublicKeyForAddress(email) → {Array.<module:key~Key>}

  searches all public keys in the keyring matching the address or address part of the user ids

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `email` | String | email address to search for

  Source:
    - keyring/keyring.js, line 97

  ##### Returns:

  The public keys associated with provided email address.
  Type
    Array.<module:key~Key>

#### init()

  Initialization routine for the keyring. This method reads the keyring from HTML5 local storage and initializes this instance. This method is called by openpgp.init().
  Source:
    - keyring/keyring.js, line 34

#### <inner> exportKey(index) → {String}

  returns the armored message representation of the key at key ring index

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `index` | Integer | the index of the key within the array

  Source:
    - keyring/keyring.js, line 137

  ##### Returns:

  armored message representing the key object
  Type
    String

#### <inner> exportPublicKey(index) → {String}

  returns the armored message representation of the public key portion of the key at key ring index

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `index` | Integer | the index of the key within the array

  Source:
    - keyring/keyring.js, line 159

  ##### Returns:

  armored message representing the public key object
  Type
    String

#### <inner> getKeysForKeyId(keyId) → {Array.<module:key~Key>}

  Searches the keyring for public keys having the specified key id

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `keyId` | String | provided as string of hex number (lowercase)

  Source:
    - keyring/keyring.js, line 116

  ##### Returns:

  public keys found
  Type
    Array.<module:key~Key>

#### <inner> getPrivateKeyForAddress(email) → {Array.<module:key~Key>}

  Searches the keyring for a private key containing the specified email address

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `email` | String | email address to search for

  Source:
    - keyring/keyring.js, line 106

  ##### Returns:

  private keys found
  Type
    Array.<module:key~Key>

#### <inner> importKey(armored)

  Imports a key from an ascii armored message

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `armored` | String | message to read the keys/key from

  Source:
    - keyring/keyring.js, line 125

#### <inner> removeKey(index) → {module:key~Key}

  Removes a public key from the public key keyring at the specified index

  ##### Parameters:

  Name | Type | Description
  --- | --- | ---
  `index` | Integer | the index of the public key within the publicKeys array

  Source:
    - keyring/keyring.js, line 147

  ##### Returns:

  The public key object which has been removed
  Type
    module:key~Key