GithubHelp home page GithubHelp logo

lastmjs / stoic-identity Goto Github PK

View Code? Open in Web Editor NEW

This project forked from toniq-labs/stoic-identity

0.0 2.0 0.0 859 KB

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

JavaScript 100.00%

stoic-identity's Introduction

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

stoic-identity's People

Contributors

jorgenbuilder avatar lastmjs avatar stephenandrews avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.