The class that deals with storage of the keyring. Currently the only option is to use HTML5 local storage.
new (require("keyring/keyring"))(storeHandler)
Initialization routine for the keyring. This method reads the
keyring from HTML5 local storage and initializes this instance.
Parameters:
Name | Type | Argument | Description |
---|---|---|---|
storeHandler |
class |
<optional> |
class implementing load() and store() methods |
- Source:
- Source:
Requires
Methods
-
clear()
-
Clear the keyring - erase all the keys
- Source:
-
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:
Returns:
armored message representing the key object- Type
- String
-
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:
Returns:
armored message representing the public key object- Type
- String
-
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:
Returns:
public keys found- Type
- Array.<module:key~Key>
-
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:
Returns:
private keys found- Type
- Array.<module:key~Key>
-
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:
Returns:
The public keys associated with provided email address.- Type
- Array.<module:key~Key>
-
importKey(armored)
-
Imports a key from an ascii armored message
Parameters:
Name Type Description armored
String message to read the keys/key from - Source:
-
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:
Returns:
The public key object which has been removed- Type
- module:key~Key
-
store()
-
Calls the storeHandler to save the keys
- Source:
-
<inner> checkForIdentityAndKeyTypeMatch(keys, identityFunction, identityInput, keyType) → {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 keys
Array.<module:key~Key> array of keys to search identityFunction
module:keyring/keyring.checkCallback callback function which checks for a match identityInput
String input to check against keyType
module:enums.packet packet types of keys to check - Source:
Returns:
array of keys which match- Type
- Array.<module:key~Key>
-
<inner> emailCheck(email, key) → {Boolean}
-
Checks a key to see if it matches the specified email address
Parameters:
Name Type Description email
String email address to search for key
module:key~Key The key to be checked. - Source:
Returns:
True if the email address is defined in the specified key- Type
- Boolean
-
<inner> idCheck(id, key) → {Boolean}
-
Checks a key to see if it matches the specified keyid
Parameters:
Name Type Description id
String hex string keyid to search for key
module:key~Key the key to be checked. - Source:
Returns:
true if the email address is defined in the specified key- Type
- Boolean
Type Definitions
-
checkCallback(input, key) → {Boolean}
-
Callback to check if a key matches the input
Parameters:
Name Type Description input
String input to search for key
module:key~Key The key to be checked. - Source:
Returns:
True if the input matches the specified key- Type
- Boolean