Credentials instance
Kind: global class
- Credentials
- new Credentials(typeOrData)
- instance
- .password :
String
|undefined
- .type :
String
- .username :
String
|undefined
- .getID() ⇒
String
- .getValue(property) ⇒
*
|undefined
- .getValueOrFail(property) ⇒
*
- .setValue(property, value) ⇒
Credentials
- .toInsecureString() ⇒
String
- .toSecureString(masterPassword) ⇒
Promise
- .password :
- static
Constructor for the Credentials class
Param | Type | Description |
---|---|---|
typeOrData | String | Object |
The type (string), or an object representing the Credentials data |
The password
Kind: instance property of Credentials
The credentials type
Kind: instance property of Credentials
Read only: true
The username
Kind: instance property of Credentials
Get A unique ID of the datasource based on its data
Kind: instance method of Credentials
Returns: String
- A hash of the data
Get a value from the credentials
Kind: instance method of Credentials
Returns: *
| undefined
- Returns the value if found, or undefined
Param | Type | Description |
---|---|---|
property | String |
The property to fetch |
Get a value, or fail if it doesn't exist or isn't set
Kind: instance method of Credentials
Returns: *
- The value (not undefined)
Throws:
Error
Throws if the value is undefined
Param | Type | Description |
---|---|---|
property | String |
The property to fetch |
credentials.setValue(property, value) ⇒ Credentials
Set a value for a property
Kind: instance method of Credentials
Returns: Credentials
- Returns self, for chaining
Param | Type | Description |
---|---|---|
property | String |
The property to set |
value | * |
The value to set for the property |
Convert the credentials to an insecure string
Kind: instance method of Credentials
Returns: String
- The string-encoded credentials
Convert the credentials to an encrypted string, for storage
Kind: instance method of Credentials
Returns: Promise
- A promise that resolves with the encrypted credentials
Throws:
Error
Rejects when masterPassword is not a string
See: signEncryptedContent
Param | Type | Description |
---|---|---|
masterPassword | string |
The password for encrypting |
Credentials.fromInsecureString(content) ⇒ Credentials
Create a new instance from an insecure string
Kind: static method of Credentials
Returns: Credentials
- A new instance
Param | Type | Description |
---|---|---|
content | String |
The insecure string representation |
Credentials.fromPassword(password) ⇒ Credentials
Create a new instance from a password
Kind: static method of Credentials
Returns: Credentials
- A new instance
Param | Type | Description |
---|---|---|
password | String |
The password |
Credentials.fromSecureString(content, password) ⇒ Promise.<Credentials>
Create a new instance from a secure string
Kind: static method of Credentials
Returns: Promise.<Credentials>
- A promise that resolves with the new instance
Param | Type | Description |
---|---|---|
content | String |
Encrypted content |
password | String |
The password for decryption |
Check if an item is a Credentials instance
Kind: static method of Credentials
Returns: Boolean
- True if a credentials instance
Param | Type | Description |
---|---|---|
target | Object |
The target to check |
Check if a string is a secure string
Kind: static method of Credentials
Returns: Boolean
- True if the string is a secure string
Param | Type | Description |
---|---|---|
str | String |
The string to check |