Skip to content

Latest commit

 

History

History
188 lines (130 loc) · 6.99 KB

API.md

File metadata and controls

188 lines (130 loc) · 6.99 KB

Credentials

Credentials instance

Kind: global class

new Credentials(typeOrData)

Constructor for the Credentials class

Param Type Description
typeOrData String | Object The type (string), or an object representing the Credentials data

credentials.password : String | undefined

The password

Kind: instance property of Credentials

credentials.type : String

The credentials type

Kind: instance property of Credentials
Read only: true

credentials.username : String | undefined

The username

Kind: instance property of Credentials

credentials.getID() ⇒ String

Get A unique ID of the datasource based on its data

Kind: instance method of Credentials
Returns: String - A hash of the data

credentials.getValue(property) ⇒ * | undefined

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

credentials.getValueOrFail(property) ⇒ *

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

credentials.toInsecureString() ⇒ String

Convert the credentials to an insecure string

Kind: instance method of Credentials
Returns: String - The string-encoded credentials

credentials.toSecureString(masterPassword) ⇒ Promise

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

Credentials.isCredentials(target) ⇒ Boolean

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

Credentials.isSecureString(str) ⇒ Boolean

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