1. Docs

User Operations

Since the IronNode SDK requires that it runs in the context of an authenticated user in your application, methods are provided to manage user information as well as generate a set of device public and private keys which can be used to interact with the SDK.

IronNode.User.verify()

IronNode.User.verify(jwt)

Given a valid, signed JSON Web Token (JWT), check if the user specified within the JWT payload has been synced within IronCore.

Parameters

Parameter Name Value Description
jwt string A valid, signed JSON Web Token for the user to verify.

Response

Returns a Promise that resolves with either undefined if the user has not been synced within IronCore or details about the user if they have been synced.

JSON
//If user exists, the Promise will resolve with the following object { //Users synced account ID "accountID": string, //IronCore internal segment ID the user is a part of "segmentID": number, //Users master public key "userMasterPublicKey": { "x": string, "y": string } }

IronNode.User.create()

IronNode.User.create(jwt, password, [options])

Given a valid, signed JSON Web Tokens (JWT) sync the provided user from your application into IronCore. This operation will generate a new “master” key pair for the user and securely encrypt and store their private key using the provided password.

Parameters

Parameter Name Value Description
jwt string A valid, signed JSON Web Token for the user to create/sync.
password string A password used to securely encrypt the users newly created private key.
[options.needsRotation] boolean Set to true if the private key for this user should be rotated when the user “takes control” of their keys. The main use case for this is a workflow that requires that the users account be generated prior to the user logging in for the first time. Optional, defaults to false.

Response

Returns a Promise that resolves with details about the newly synced user.

JSON
{ //Users synced account ID "accountID": string, //IronCore internal segment ID the user is a part of "segmentID": number, //Users master public key "userMasterPublicKey": { "x": string, "y": string } }

IronNode.User.generateDeviceKeys()

IronNode.User.generateDeviceKeys(jwt, password)

Given a valid, signed JSON Web Tokens (JWT) and the users private key encryption password, generate a new device key pair that can then be used to initialize the IronNode SDK.

Parameters

Parameter Name Value Description
jwt string A valid, signed JSON Web Token for the user to create/sync.
password string The users private key decryption password that was set at user creation time.

Response

Returns a Promise that resolves with new device key details.

JSON
{ //Users synced account ID "accountID": string, //IronCore internal segment ID the user is a part of "segmentID": number, //Users master public key "deviceKeys": { "publicKey": { "x": string, "y": string }, "privateKey": string }, "signingKeys": { "publicKey": string, "privateKey": string } }

Was this page helpful?