User Operations

Since the IronNode SDK requires that it run 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 Tokens (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.

//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)

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 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.

Response

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

{
    //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.

{
    //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
    }
}