mxw-reg-sdk-js

Single sign on sdk with Max-Wallet app

The
Last updated 4 months ago by chanmohlun .
ISC · Original npm · Tarball · package.json
$ cnpm install mxw-reg-sdk-js 
SYNC missed versions from official npm registry.

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 <string> : 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 <number> : 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**/
}

Current Tags

  • 0.0.2                                ...           latest (4 months ago)

2 Versions

  • 0.0.2 [deprecated]           ...           4 months ago
  • 0.0.1                                ...           4 months ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (5)
Dev Dependencies (4)
Dependents (0)
None

Copyright 2014 - 2017 © taobao.org |