AuthServer

AuthServer

Facilitates interaction with the auth server.

Constructor

new AuthServer(sdk, serverUrl, opts)

Create a new wallet server instance.

Source:
Parameters:
Name Type Description
sdk ShelfNetwork

Parent SDK instance.

serverUrl string

wallet server URL.

opts Object
Name Type Attributes Default Description
allowHttp boolean <optional>

Allow connecting to http servers, default: false. This must be set to false in production deployments!

proxy Object <optional>

Proxy configuration. Look axios docs for more info

httpBasicAuth Object <optional>

HTTP basic auth credentials. Look axios docs for more info.

customHeaders Object <optional>

Custom headers for request.

withCredentials boolean <optional>

Indicates whether or not cross-site Access-Control requests should be made using credentials.

responseType string <optional>
'json'

Indicates the type of data that the server will respond with options are 'arraybuffer', 'blob', 'document', 'json', 'text', 'stream'.

Methods

(async) changePassword(oldPassword, newPassword) → {Promise.<AuthServerResponse>}

Change the password.

Source:
Parameters:
Name Type Description
oldPassword string

Old user's password.

newPassword string

Desired password.

Returns:
Type:
Promise.<AuthServerResponse>

(async) confirmRecovery(accountId, token, newPassword) → {Promise.<AuthServerResponse>}

Confirm the password recovery.

Source:
Parameters:
Name Type Description
accountId string

User's account ID.

token string

Recovery token from the email.

newPassword string

Desired password.

Returns:
Type:
Promise.<AuthServerResponse>

(async) createCredentials(password, accountIdopt) → {Promise.<AuthServerResponse>}

Create credentials.

Source:
Parameters:
Name Type Attributes Default Description
password string

Desired password.

accountId string <optional>
null

User's account ID.

Returns:
Type:
Promise.<AuthServerResponse>

(async) getToken(email, password, platformIdopt) → {Promise.<Token>}

Get a JWT token using credentials.

Source:
Parameters:
Name Type Attributes Default Description
email string

Email.

password string

Password.

platformId string <optional>
null

User's platform ID.

Returns:
Type:
Promise.<Token>

(async) refreshToken(tokenopt) → {Promise.<Token>}

Refresh a JWT token.

Source:
Parameters:
Name Type Attributes Description
token string <optional>

JWT token to be refreshed. The token attached to the sdk instance will be used by default.

Returns:
Type:
Promise.<Token>

(async) requestRecovery(email) → {Promise.<AuthServerResponse>}

Request password recovery.

Source:
Parameters:
Name Type Description
email string

User's email.

Returns:
Type:
Promise.<AuthServerResponse>