Quick Start
JS SDK for relation IM: A simple API for building IM services.
Quick start
Quick start
Download using NPM
npm install --save @relationlabs/im
npm install --save @relationlabs/auth
then
use authByMetamask
to activate Metamask
signing and acquire an addressAuthToken
import { authByMetamask } from "@relationlabs/auth";
const { error, token: addressAuthToken } = await authByMetamask()
then
use getRelationToken
to acquire unifiedAuthToken
. The APIKEY
should be acquired from the Admin.
import RelationIM from "@relationlabs/im";
import { authByMetamask } from "@relationlabs/auth";
const { error, token: addressAuthToken } = await authByMetamask()
const APIKEY = '581c6c4fa0b54912b00088aa563342a4'
if (!error && addressAuthToken) {
const { error, token: unifiedAuthToken } = await RelationIM.getRelationToken(addressAuthToken, APIKEY)
if (!error && unifiedAuthToken) {
}
}
then
instantiate an im
instance
const myIm = RelationIM.init({token: unifiedAuthToken, apiKey: APIKEY, connect: true})
Last updated