Keychain
Secure storage for credentials.
The keychain is a secure storage for credentials, keys etc. Use the set() method to add values to the keychain. You can then later use the get() method to retrieve the value.
Methods
Section titled “Methods”
contains(key)
Section titled “contains(key)”Check if keychain contains a key.
static contains(key: string): boolChecks if the keychain contains the specified key.
Parameters
Section titled “Parameters”key string
Key to look up in the keychain.
Return value
Section titled “Return value”bool
True if the key exists in the keychain, otherwise false.
get(key)
Section titled “get(key)”Reads a value from the keychain.
static get(key: string): stringReads the value for the specified key. If the key doesn’t exist the method will throw an error. Used the contains method to check if a key exists in the keychain.
Parameters
Section titled “Parameters”key string
Key to read value for.
Return value
Section titled “Return value”string
Value assigned to the specified key.
remove(key)
Section titled “remove(key)”Remove key from keychain.
static remove(key: string)Parameters
Section titled “Parameters”key string
Key to remove from the keychain.
set(key, value)
Section titled “set(key, value)”Add value for a specified key to keychain.
static set(key: string, value: string)Adds the value to the keychain, assigning it to the specified key. If the key already exists in the keychain, the value is overwritten.
Values are securely stored in an encrypted database.
Parameters
Section titled “Parameters”key string
Key which the value should be assigned to.
value string
Value to assign to the specified key.