arisenid-js
v1.0.0
Published
<p align="center"> <img src="https://raw.githubusercontent.com/ArisenIO/arisen-media/master/repo-headers/arkid-js.png"/> </p>
Downloads
1
Readme
Right now you should still be using arisenid-js
and not this arisenid-js-core
library as it is still in alpha. Click Here to go to the latest version of arisenid-js
which is being used in production applications and is stable.
Installation
To use ArisenIdJS you must have at least the core. You can also use ArisenId without any blockchain support by simply importing only the core without any blockchain specific plugins.
This is great for sites that want to authenticate with users in a decentralized way, but don't need any blockchain functionality.
npm i -S arisenid-js-core
Plugins
To keep this library small and focused only on the blockchains you want to use you can import each blockchain separately. The blockchains you don't import can't be used.
ARISENIO
npm i -S arisenid-js-plugin-arisenjs
Ethereum
npm i -S arisenid-js-plugin-web3
The same works with yarn
as well if you prefer to use that.
yarn link arisenid-js-core
yarn link arisenid-js-plugin-arisenjs
Importing ArisenIdJS into your project.
Now that you have arisenid-js-core and a plugin of your choosing you can go ahead and import it into your project.
You should be doing this early in your application, somewhere like your main.js or app.js, and not inside sub-pages.
Let's take arisenjs
as an example.
import ArisenIdJS from 'arisenid-js-core';
import ArisenIdRSN from 'arisenid-js-plugin-arisenjs'
ArisenIdJS.plugins( new ArisenIdRSN() );
ArisenIdJS Usage
This library catches ArisenId Desktop, ArisenId Mobile and ArisenId Classic ( extension ). You only need to write code once, and you will instantly support any ArisenId the user has.
Making a connection
ArisenIdJS.arisenid.connect("Put_Your_App_Name_Here").then(connected => {
if(!connected) {
// User does not have ArisenId installed/unlocked.
return false;
}
// Use `arisenid` normally now.
ArisenIdJS.arisenid.getIdentity(...);
});
Connection Options
{
// You may specify a maximum timeout for checking if a user has ArisenId installed
initTimeout:10000,
}
What now?
Head over to the ArisenId Developer Documentation to learn about all the amazing things you can do with ArisenId.
There's also a lot more information about proper setup in the Setting up for Web Applications section which will help you get the most out of ArisenIdJS, and make sure you aren't exposing your users to malicious non-ArisenId plugins.