0.0.2-rc.1 • Published 5 years ago
sso-sdk-test-publish v0.0.2-rc.1
SSO SDK Documentation
Install
npm install --save sso-sdk-test-publish
Importing
JavaScript (ES3)
var SSO = require('sso-sdk-test-publish');
JavaScript (ES5 or ES6)
const SSO = require('sso-sdk-test-publish');
JavaScript (ES6) / TypeScript
import { SSO } from 'sso-sdk-test-publish';
Constructor
SSO(id : string)
Creates a new SSO
const sso = new SSO('a sample wallet address');
Parameters:
id \ : a Maxonrow wallet address
Methods
signOn & signUp both returns json
objects which can be used to generate QrCode to be scanned with the Max-wallet app.
signOn()
Returns a json
object
const a = sso.signOn();
Response:
{
ac: string,
ch: string,
id: string
}
signUp(id : number)
Returns a json
object
const a = sso.signUp(1);
Parameters:
id \ : the package id for which users can sign up to
Response:
{
ac: string,
ch: string,
id: string
pk: number
}
Events
onConnect
Returns true
when connected
sso.onConnect = (connected)=>{
if(connected){
/**do something in here**/
}
}
onSignOn
sso.onSignOn = (data)=>{
/**do something with data here**/
}
Response:
{
payload: {
data: {
ac: string,
ch: string,
id: string
}
timestamp: number,
type: string
},
pubKey: {
type: string,
value: string,
},
signature: string
}
onSignUp
sso.onSignUp = (data)=>{
/**do something with data here**/
}
Response:
{
payload: {
data: {
ac: string,
ch: string,
id: string
}
items:{
[key]: string | number
},
timestamp: number,
type: string
},
pubKey: {
type: string,
value: string,
},
signature: string
}
onError
sso.onError = (error)=>{
/**do something with error here**/
}