@toznysecure/account-sdk / Exports / Account
Account creates connections to a specific Tozny account
Mixing together a Tozny client SDK and an API URL, various methods for creating an account level connection are made available. Each method returns an account Client, which represents an active connection to the API for a specific account. Actual account operations are performed using the returned account Client.
- changeAccountPassword
- completeLogin
- fromObject
- initiateRecoverAccount
- login
- loginWithMFA
- register
- resetMFA
- verifyEmail
- verifyRecoverAccountChallenge
- verifyTotp
- verifyWebAuthn
• new Account(sdk
, apiUrl?
)
Creates an Account object mixing the SDK and API URL together.
Name | Type | Default value | Description |
---|---|---|---|
sdk |
Tozny |
undefined |
An instance of a Tozny client SDK. |
apiUrl |
string |
DEFAULT_API_URL |
The URL of the Tozny Platform instance to connect to. |
• get
Identity(): any
Gets the Tozny Identity constructor provided by the Tozny client SDK.
any
• get
Storage(): any
Gets the Tozny Storage constructor provided by the Tozny client SDK.
any
The Storage constructor
• get
crypto(): Crypto
gets the current crypto implementation provided by the Tozny client SDK.
Crypto
• get
toznyTypes(): object
Gets the Tozny types defined in the Tozny client SDK.
object
All of the Tozny client SDK defined types.
▸ changeAccountPassword(password
, accountToken
): Promise
<object
>
Chance the account password to a new one with an account token.
Name | Type | Description |
---|---|---|
password |
string |
The new password to set for the account. |
accountToken |
string |
The token for making account requests. |
Promise
<object
>
An object with the new queen client and paper key.
▸ completeLogin(username
, sigKeys
, encKey
, profile
): Promise
<Client
>
Name | Type |
---|---|
username |
any |
sigKeys |
any |
encKey |
any |
profile |
any |
Promise
<Client
>
▸ fromObject(obj
): Client
Recreate an account client from one that was serialized to JSON.
After calling Client.serialize()
plain javascript object is created with
all of the values needed to recreate that client. This can be safely stored
as JSON. This method is used to turn the object created by Client.serialize()
back into a Client instance with all of the available methods.
Name | Type | Description |
---|---|---|
obj |
object |
The serialized object created from an existing account client. |
A new Client created with all provided values from the object.
▸ initiateRecoverAccount(email
): Promise
<any
>
Begin to recover lost account access.
Name | Type | Description |
---|---|---|
email |
string |
The email address associate with the account. |
Promise
<any
>
▸ login(username
, password
, type?
): Promise
<Client
>
Use the normal login flow to create a connection to a Tozny account.
Name | Type | Default value | Description |
---|---|---|---|
username |
string |
undefined |
The username for the account. |
password |
string |
undefined |
The secret password for the account. |
type |
string |
'standard' |
Either standard or paper depending on the password type. |
Promise
<Client
>
The Client instance for the provided credentials.
▸ loginWithMFA(username
, password
, type?
): Promise
<object
>
Use the normal login flow to create a connection to a Tozny account.
Name | Type | Default value | Description |
---|---|---|---|
username |
string |
undefined |
The username for the account. |
password |
string |
undefined |
The secret password for the account. |
type |
string |
'standard' |
Either standard or paper depending on the password type. |
Promise
<object
>
▸ register(name
, email
, password
): Promise
<object
>
Creates a new account using the credentials provided.
Name | Type | Description |
---|---|---|
name |
string |
The name to use for the account. |
email |
string |
The email address for the account. |
password |
string |
The secret password for the account. |
Promise
<object
>
An object containing the paper key generated at and
object[paperKey]
and the client instance associated
with the new client at object[client]
.
▸ resetMFA(username
, paperKey
): Promise
<object
>
Reset MFA
Name | Type | Description |
---|---|---|
username |
string |
The name to use for the account. |
paperKey |
string |
The paperKey for the account. |
Promise
<object
>
▸ verifyEmail(id
, otp
): Promise
<any
>
Requests email verification for a Tozny account.
Name | Type | Description |
---|---|---|
id |
string |
id to identify the otp challenge |
otp |
string |
otp secret to authenticate the challenge |
Promise
<any
>
response
▸ verifyRecoverAccountChallenge(id
, otp
): Promise
<any
>
Verify the recovery challenge information.
Name | Type | Description |
---|---|---|
id |
string |
The recovery challenge ID |
otp |
string |
The recovery one time password for recovery |
Promise
<any
>
The recovery object for the account
▸ verifyTotp(username
, sigKeys
, challenge
, totp
): Promise
<any
>
Name | Type |
---|---|
username |
any |
sigKeys |
any |
challenge |
any |
totp |
any |
Promise
<any
>
▸ verifyWebAuthn(username
, payload
): Promise
<any
>
Name | Type |
---|---|
username |
any |
payload |
any |
Promise
<any
>