@cryptium/id-client
v0.1.0
Published
Client application library for Cryptium ID
Readme
Cryptium ID Client SDK for NodeJS
Back-end part of Cryptium ID SDK for direct integration into a web application.
This library integrates into the website back-end JavaScript using NodeJS.
Use the classes in this library to connect to the Cryptium ID service for user management and authentication.
API
The library provides 2 functions:
- startConnect (to start a request for verified attributes)
- checkConnect (to obtain verified attributes with a token)
start
This is a POST to https://id.cryptium.app/api/client/start/connect.
Required headers:
Authorization: Bearer {{authorizationToken}}
Content-Type: application/json
Accept: application/jsonJSON request format:
{
required: String[],
optional: String[],
input: Object,
readonly: String[],
grant_redirect_uri: String,
}The required value is an array of attribute names such as email or phone.
The user will be required to select a verified value for each attribute that is
listd as required. You should only list an attribute as required if your application
cannot operate without it. For example, a social media posting app would require
the username of the social media account, whereas requiring the same thing for another
app might result in higher bounce rates as users might not want to link their social
media account to an unrelated app, or might not even have a social media account.
Furthermore, Cryptium ID guest users may only verify email, while registered Cryptium ID
users may verify additional attributes. Since registering for Cryptium ID itself could
be an additional step for new users, keep bounce rates low by only requiring email
and make everything else optional (as much as possible).
The optional value is an array of attribute names such as email or phone.
The user will be prompted to select a verified value for attribute that is listed
as optional, but will be allowed to complete the interaction without them.
The input object is optional and may contain attribute names and values that the
application wants to pre-fill in the form. For example, if the application alrady knows
the user's email address but needs to re-verify it, it can include
{ email: '[email protected]' } as the input.
The readonly attribute is optional and may contain attribute names corresponding
to provided input that should be readonly. This means they will be pre-filled in
the form and the user will not be able to change them. If the user has verified that
attribute it can be included in the response. If the user has not verified that
attribute with the provided input value, the user will have an opportunity to do that.
You can use readonly together with input for both required and optional attributes.
The grant_redirect_uri value is the URL to which Cryptium ID should redirect the user
after canceling or completing the form. Cryptium ID will append a token to the query
string of this URL so the application can use that when calling the check API.
JSON response format:
{
redirect: String
}The redirect value is the Cryptium ID URL to which the application should redirect
the user for verifying the requested attributes.
check
This is a POST to https://id.cryptium.app/api/client/check/connect.
Required headers:
Authorization: Bearer {{authorizationToken}}
Content-Type: application/json
Accept: application/jsonJSON request format:
{
token: String,
}The token value comes from query parameter Cryptium ID inserted into grant_redirect_uri when
redirecting the user back to the application.
JSON response format:
{
profile: Object,
}The profile value is an object containing verified attribute names and values that the
user chose to share with the application.
Build
npm run lint
npm run build