/stoic-identity

Identity for DFINITY's IC HttpAgent (to connect to a Stoic wallet via Stoic Connect)

Primary LanguageJavaScriptMIT LicenseMIT

Stoic Identity

Stoic Identity is an ICP Identity that works directly with the @dfinity/agent for signing canister messages using your StoicWallet.com account. Stoic Identity allows 3rd party dapps to connect to your wallet using a local-only bridge. Applications must request authorization to connect to your wallet, and can only access your wallet on your local PC with the web-wallet unlocked.

3rd party developers are not granted direct remote access - only local, and you can revoke local access directly from the StoicWallet app. Your private keys are not exposed, but if you authorize your wallet with an application than that application can sign any canister message on your behalf.

In future, we will add canister scopes to authorization requests, so applications must define which canister ID's they will use with their application.

screen-capture (5)

Installation

npm i ic-stoic-identity --save-dev

In the browser:

import {StoicIdentity} from "ic-stoic-identity";

Usage:

StoicIdentity.load().then(async identity => {
  if (identity !== false) {
    //ID is a already connected wallet!
  } else {
    //No existing connection, lets make one!
    identity = await StoicIdentity.connect();
  }
  
  //Lets display the connected principal!
  console.log(identity.getPrincipal().toText());
  
  //Create an actor canister
  const actor = Actor.createActor(idlFactory, {
    agent: new HttpAgent({
      identity,
    }),
    canisterId,
  });
  
  //Disconnect after
  StoicIdentity.disconnect();
})

Authorization in StoicWallet:

image

Manage Applications in StoicWallet:

image