Class: openpgp_keyring

openpgp_keyring

The class that deals with storage of the keyring. Currently the only option is to use HTML5 local storage.

new openpgp_keyring()

Source:

Methods

<inner> exportPrivateKey(index) → {openpgp_msg_privatekey}

returns the openpgp_msg_privatekey representation of the private key at private key ring index
Parameters:
Name Type Description
index Integer the index of the private key within the privateKeys array
Source:
Returns:
the private key object
Type
openpgp_msg_privatekey

<inner> exportPublicKey(index) → {openpgp_msg_privatekey}

returns the openpgp_msg_privatekey representation of the public key at public key ring index
Parameters:
Name Type Description
index Integer the index of the public key within the publicKeys array
Source:
Returns:
the public key object
Type
openpgp_msg_privatekey

<inner> getPrivateKeyForAddress(email_address) → {openpgp_msg_privatekey[]}

Searches the keyring for a private key containing the specified email address
Parameters:
Name Type Description
email_address String email address to search for
Source:
Returns:
private keys found
Type
openpgp_msg_privatekey[]

<inner> getPrivateKeyForKeyId(keyId) → {openpgp_msg_privatekey[]}

Searches the keyring for private keys having the specified key id
Parameters:
Name Type Description
keyId String 8 bytes as string containing the key id to look for
Source:
Returns:
private keys found
Type
openpgp_msg_privatekey[]

<inner> getPublicKeyForAddress(email_address) → {openpgp_msg_publickey[]}

searches all public keys in the keyring matching the address or address part of the user ids
Parameters:
Name Type Description
email_address String
Source:
Returns:
The public keys associated with provided email address.
Type
openpgp_msg_publickey[]

<inner> getPublicKeysForKeyId(keyId) → {openpgp_msg_privatekey[]}

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:
Returns:
public keys found
Type
openpgp_msg_privatekey[]

<inner> hasPrivateKey() → {Boolean}

Checks if at least one private key is in the keyring
Source:
Returns:
True if there are private keys, else false.
Type
Boolean

<inner> importPrivateKey(armored_text)

Imports a private key from an exported ascii armored message
Parameters:
Name Type Description
armored_text String PRIVATE KEY BLOCK message to read the private key from
Source:

<inner> importPublicKey(armored_text)

Imports a public key from an exported ascii armored message
Parameters:
Name Type Description
armored_text String PUBLIC KEY BLOCK message to read the public key from
Source:

<inner> 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:

<inner> removePrivateKey(index) → {openpgp_msg_privatekey}

Removes a private key from the private key keyring at the specified index
Parameters:
Name Type Description
index Integer the index of the private key within the privateKeys array
Source:
Returns:
The private key object which has been removed
Type
openpgp_msg_privatekey

<inner> removePublicKey(index) → {openpgp_msg_privatekey}

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:
Returns:
The public key object which has been removed
Type
openpgp_msg_privatekey

<inner> store()

Saves the current state of the keyring to HTML5 local storage. The privateKeys array and publicKeys array gets Stringified using JSON
Source: