Giter VIP home page Giter VIP logo

js-3id-did-provider's Introduction

⚠️ Library moved

The 3ID DID provider source has been moved to the 3ID repository and the package is now available on npm as @3id/did-provider.

The 3id-did-provider package is no longer maintained.

ThreeIdProvider

ThreeIdProvider is a JavaScript SDK that allows developers to create and manage 3ID identities on the Ceramic network. It exposes a DID Provider interface which exposes JOSE signing and decryption though a JSON-RPC interface. ThreeIdProvider can be used in combination with js-did.

Getting Started

Installation

Install 3id-did-provider in your npm project:

$ npm install 3id-did-provider

Usage

Import ThreeIdProvider into your project

Import the 3id-did-provider module

import { ThreeIdProvider } from '3id-did-provider'

Import using the dist build in your html code

<script type="text/javascript" src="../dist/threeid-provider.js"></script>

Understanding the getPermission function

the getPermission configuration parameter is always required when creating an instance of ThreeIdProvider. It is used to give an application permission to decrypt and sign data. What this function should do is to present a dialog to the user in the wallet UI, asking for permission to access the given paths.

The function is called with one parameter which is the request object. It looks like this:

{
  type: 'authenticate',
  origin: 'https://my.app.origin',
  payload: {
    paths: ['/path/1', '/path/2']
  }
}

In the above example the app with origin https://my.app.origin is requesting access to /path/1 and /path/2. If the user consents to this the function should just return the paths array, otherwise an empty array. Note that an array containing only some of the requested paths may also be returned.

Instantiate ThreeIdProvider with an authentication method

To create an instance with an auth method you can pass two params to the create function as shown below. If the auth method doesn't have a 3ID associated with it yet a new 3ID will be created. This means that a seed will be randomly generated in the background. and the given authSecret will be added as an authentication method to the newly created 3ID.

const authSecret = new Uint8Array([ ... ]) // 32 bytes of entropy used to authenticate
const authId = 'myAuthenticationMethod' // a name of the auth method
const ceramic = ... // An instance of Ceramic (either @ceramicnetwork/core, or @ceramicnetwork/http-client)

const threeId = await ThreeIdProvider.create({ getPermission, authSecret, authId, ceramic })

Instantiate ThreeIdProvider with a seed

To create a wallet with a seed you can simply pass it as an option to the constructor. This will create an instance of the ThreeIdProvider that derives all it's keys from this seed. Be careful, if this seed is lost the DID and all of it's data will be lost as well. Note that you will get different 3IDs every time the create method is invoked with the same seed. An authentication method must be used in order to interact with the same 3ID consistently.

const seed = new Uint8Array([ ... ]) // 32 bytes of entropy used as the seed
const ceramic = ... // An instance of Ceramic (either @ceramicnetwork/core, or @ceramicnetwork/http-client)

const threeId = await ThreeIdProvider.create({ getPermission, seed, ceramic })

Using the ThreeIdProvider with js-did

An instance of the DID provider from ThreeIdProvider can be passed directly to js-did.

import ThreeIdResolver from '@ceramicnetwork/3id-did-resolve'
import Ceramic from '@ceramicnetwork/http-client'

const provider = threeId.getDidProvider()
const resolver = ThreeIdResolver.getResolver(new Ceramic())

const did = new DID({ provider, resolver })

Maintainers

@oed

API Documentation

Keychain

Kind: global class

new Keychain()

The Keychain enables adding and removing of authentication methods.

keychain.list() ⇒ Array.<string>

List all current authentication methods.

Kind: instance method of Keychain
Returns: Array.<string> - A list of authIds.

keychain.add(authId, authSecret)

Add a new authentication method (adds to staging).

Kind: instance method of Keychain

Param Type Description
authId String An identifier for the auth method
authSecret Uint8Array The authSecret to use, should be of sufficient entropy

keychain.remove(authId)

Remove an authentication method (adds to staging).

Kind: instance method of Keychain

Param Type Description
authId String An identifier for the auth method

keychain.status() ⇒ KeychainStatus

Show the staging status of the keychain. Since removing auth methods will rotate the keys of the 3ID its a good idea to remove multiple auth methods at once if desired. Therefore we introduce a commit pattern to do multiple updates to the keychain at once.

Kind: instance method of Keychain
Returns: KeychainStatus - Object that states the staging status of the keychain

keychain.commit()

Commit the staged changes to the keychain.

Kind: instance method of Keychain

Permissions

Kind: global class

new Permissions()

The Permissions class exposes methods to read and update the given permissions

permissions.request(origin, paths) ⇒ Array.<String>

Request permission for given paths for a given origin.

Kind: instance method of Permissions
Returns: Array.<String> - The paths that where granted permission for

Param Type Description
origin String Application domain
paths Array.<String> The desired paths

permissions.has(origin, paths) ⇒ Boolean

Determine if permission has been given for paths for a given origin.

Kind: instance method of Permissions
Returns: Boolean - True if permission has previously been given

Param Type Description
origin String Application domain
paths Array.<String> The desired paths

permissions.get(origin) ⇒ Array.<String>

Get the paths which the given origin has permission for.

Kind: instance method of Permissions
Returns: Array.<String> - The permissioned paths

Param Type Description
origin String Application domain

permissions.set(origin, paths)

Set the paths which the given origin should have permission for.

Kind: instance method of Permissions

Param Type Description
origin String Application domain
paths Array.<String> The desired paths

ThreeIdProvider

Kind: global class

new ThreeIdProvider()

Use ThreeIdProvider.create() to create an ThreeIdProvider instance

threeIdProvider.keychain

Kind: instance property of ThreeIdProvider
Properties

Name Type Description
keychain Keychain Edit the keychain

threeIdProvider.permissions

Kind: instance property of ThreeIdProvider
Properties

Name Type Description
permissions Permissions Edit permissions

threeIdProvider.id

Kind: instance property of ThreeIdProvider
Properties

Name Type Description
id string The DID of the ThreeIdProvider instance

threeIdProvider.getDidProvider() ⇒ DidProvider

Get the DIDProvider

Kind: instance method of ThreeIdProvider
Returns: DidProvider - The DIDProvider for this ThreeIdProvider instance

ThreeIdProvider.create(config) ⇒ ThreeIdProvider

Creates an instance of ThreeIdProvider

Kind: static method of ThreeIdProvider
Returns: ThreeIdProvider - An ThreeIdProvider instance

Param Type Description
config Object The configuration to be used
config.getPermission function The function that is called to ask the user for permission
config.ceramic CeramicApi The ceramic instance to use
config.loader TileLoader An optional TileLoader instance to use
config.seed Uint8Array The seed of the 3ID, 32 bytes
config.authSecret Uint8Array The authSecret to use, 32 bytes
config.authId String The authId is used to identify the authSecret
config.disableIDX Boolean Disable creation of the IDX document
config.v03ID String A v0 3ID, has to be passed if a migration is being preformed

js-3id-did-provider's People

Contributors

decentralgabe avatar dependabot[bot] avatar msterle avatar oed avatar paullecam avatar simonovic86 avatar ukstv avatar x5engine avatar zachferland avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

js-3id-did-provider's Issues

Opening 3box space using IdentityWallet and seed succeed only once (the first time)

Describe the bug
Using IdentityWallet with a seed to open a box and then a space doesn't work after a page reloading (also using Empty Cache and Hard Reload choice) .
Actually it works only when a space is open for the first time and fails from the second time on.
Removing cached consent for the space from the localStorage, it works

To Reproduce
Steps to reproduce the behavior:

  1. Open a box using an IdentityWallet with a seed
    this.idWallet = new IdentityWallet(this.getConsent.bind(this), {seed});
    const threeIdProvider = this.idWallet.get3idProvider();
    this.box = await Box.openBox(null, threeIdProvider);
  2. Open a space on this box, providing a name
    spaceName = await this.box.openSpace(spaceName);
  3. Set and get some key/value pair
  4. Reload the page (or hard reload it), and re-execute step 1 and 2, using the same seed and the same space name.
  5. See the error in console

Expected behavior
After a page reload, it should be possible to reopen a box using the IdentityWallet and the same seed and then reopen a spce using the same name.

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser: Chrome, Brave and firefox
  • 3box-js: 1.14.0
  • IdentityWallet: 1.0.0

Additional context
Opening the space after a page reload there is an exception due to an undefined id from Identities as the provided threeId is not fully initialized

Stack trace:

Error: id needed to get a key
    at Keystore.getKey (keystore.js:125)
    at Identities.signId (identities.js:50)
    at Identities.createIdentity (identities.js:43)

Attached a simple test page that highlights the exception (caught in seedWallet.js:42).
Execute:

yarn
yarn dev

the open the browser to

https://localhost:8000/seededWallet.html

and try.

identityWalletStudy.zip

Node Support for integration 3Box.js

Describe the bug
Add support for 3box.js - the current window dependency breaks build.

(node:55098) UnhandledPromiseRejectionWarning: ReferenceError: window is not defined

Example code

 /* --------------- */
    /* Initialize Identity Wallet
    /* A new identity walley is initialied to issue claims.
    /* --------------- */
    const seed = process.env.PRIVATE_KEY
    const wallet = new IdentityWallet({ seed })
    const DID = 'did:ethr:'

    /* --------------- */
    /* Initialize Box Storage
    /* Connect to the server DID storage and messaging.
    /* --------------- */
    let provider = await ethers.getDefaultProvider()
    const BoxServer = await Box.openBox(wallet, provider)
BREAKs HERE

Error: authMap is undefined

Reported on discord:


Paul 3⃣12/11/2020
@oed 3⃣ I got Uncaught (in promise) Error: authMap is undefined error thrown by https://github.com/ceramicstudio/js-3id-did-provider/blob/main/src/three-idx.ts#L138 it seems trying to create a new account in 3ID Connect, is this a known issue please?

keshavg96Yesterday at 10:49 PM
Hi @oed 3⃣ @paul 3⃣, I am still getting this issue. I am using the following versions.

"3id-blockchain-utils": "^1.3.1",
"3id-connect": "^1.0.0-alpha.8",
"3id-did-provider": "0.2.0",


I think there are two main things to do to mitigate this:

  • LoadIDX should return null if authMap is not found
  • Properly order the creation of documents (the link from authSecret to DID/idx should happen last, once other documents have been created)

Finalize partial migration

May be some work in other repos, but bulk of finalizing for initial migration is here. Move from POC to release state.

Some small final todos (mostly marked in codebase) to complete
Unit and integration tests
Make sure reconciles well with later complete migration

Breaking change in @ethersproject/sha2-beta.134 causes error when authenticating

When instantiating an IdentityWallet with a seed, the following error occurs

UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'sha512' of undefined

Sample code:

const IdentityWallet = require('identity-wallet')
const seed = '0x95838ece1ac93a51b68823b21ce9f564bc536eebb9c3500fa6da81f17086a6be'
const idWallet = new IdentityWallet(() => true, { seed })
idWallet.authenticate()

This seems to occur in the @ethersproject/sha2 package - in version beta.134, the top-level member SupportedAlgorithms was renamed SupportedAlgorithm

Different 3ID generated after nuking ceramic environment

  1. Spin up ceramic daemon
  2. create new 3ID, get a did
  3. spin down ceramic
  4. delete the entire pin store (nuke environment)
  5. spin up ceramic
  6. create new 3id, get a did

The did in step 2 and step 6 do not match, even when using the same seed.

I'm not entirely sure if this is expected or not, but it seems problematic - what if I want to change the ceramic node I'm connected to?

Unsure if this is a relic of my own tsconfig, but ceramic types throw ts error

The follow ts code:

const authSecret = fromString(process.env.PDM_SEED!);
  const ceramic = new Ceramic(process.env.NEXT_PUBLIC_CERAMIC_URL!);
  try {
    const threeID = await ThreeID.create({
      authId: "genesis",
      authSecret,
      getPermission: () => Promise.resolve([]),
      ceramic,
    });
    await ceramic.setDIDProvider(threeID.getDidProvider());
  } finally {
    await ceramic.close();
  }

Throws the error:

Type 'CeramicClient' is not assignable to type 'CeramicApi'.
  Types of property 'did' are incompatible.
    Type 'import("/Users/jonathanschwartz/Documents/daemon-land/pdm/node_modules/@ceramicnetwork/http-client/node_modules/dids/lib/index").DID | undefined' is not assignable to type 'import("/Users/jonathanschwartz/Documents/daemon-land/pdm/node_modules/dids/lib/index").DID | undefined'.
      Type 'import("/Users/jonathanschwartz/Documents/daemon-land/pdm/node_modules/@ceramicnetwork/http-client/node_modules/dids/lib/index").DID' is not assignable to type 'import("/Users/jonathanschwartz/Documents/daemon-land/pdm/node_modules/dids/lib/index").DID'.
        Types have separate declarations of a private property '_client'.ts(2322)
threeid-provider.d.ts(19, 5): The expected type comes from property 'ceramic' which is declared here on type 'IDWConfig'

I'm running @ceramicnetwork/[email protected] and [email protected]

Create architecture diagrams for IdentityWallet configurations

We likely need a few diagrams that include the various modules and components, including: device/browser, third-party app, wallet, web3.js, eth rpc, 3id rpc, IdentityWallet SDK, 3Box.js SDK

Without IdentityWallet:

  • Current situation for web apps

With IdentityWallet:

  • New situation for web apps
  • New situation for mobile wallets interacting with a web app
  • ... any more?

Implement Full Migration

This will implement complete migration to IDW in iframe. Ideally this can just be feature flagged. (will help make sure in release state, and will help keep up to date, between first partial migration release and this)

Can likely refactor a lot of code in 3boxjs later, but not included in first implementation.

space.syncDone hangs

Describe the bug
space.syncDone when using identity-wallet provider with 3box-js

To Reproduce
Steps to reproduce the behavior:

        const provider = idWallet.get3idProvider();
        const box = await Box.openBox(null, provider);
        await box.syncDone; 
        const space = await box.openSpace('relevant');
        await space.syncDone; // <---- this hangs, no reject, no resolve

Expected behavior
Resolved promise

Desktop (please complete the following information):

  • OS: MacOS
  • Browser Chrome
  • Version 80

Additional context
3box version: 1.17.0
identity-wallet version: 1.1.1

'given.filter is not a function'

Not sure if this is a bug in the identity-wallet or js-did, but generally, I think this is how to replicate this bug (this is a much simpler version of my code). Two instances of IdentityWallets, 2 instances of js-did, where the identity wallet provider is created from the same seed and the getPermission functions start and finish in reverse order, see pseudo code:

const seed = '0x1';
const idWallet1 = await IdentityWallet.create({
    seed,
   // the idea is that this getPermission will get invoked first, but resolve second
    getPermission: () => new Promise((resolve) => setTimeout(() => resolve(true), 5000))
});

const idWallet2 = await IdentityWallet.create({
    seed,
   // this getPermission func will get invoked second, but resolve first
    getPermission: async () => true,
});

func authDid1() {
       const did1 = new DID({ provider: idWallet1.getDidProvider() });
       return did1.authenticate();
}

func authDid2() {
       const did2 = new DID({ provider: idWallet2.getDidProvider() });
       return did2.authenticate();
}

try {
  Promise.all([authDid1(), authDid2()])
} catch (err) {
  /*
  From getPermission invoked by authDid1
 
    Unhandled handler error {
  jsonrpc: '2.0',
  id: '5I2y9c5YTiktjHfUa5aMp',
  method: 'did_authenticate',
  params: undefined
} TypeError: given.filter is not a function
    at Permissions.<anonymous> (/Users/jonathanschwartz/Documents/owl/streams/identity-manager/node_modules/identity-wallet/lib/permissions.js:47:53)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/jonathanschwartz/Documents/owl/streams/identity-manager/node_modules/identity-wallet/lib/permissions.js:5:58)
*/
}

Happy to share the actual code i'm writing if thats more helpful

Built & Test Config Cleanup

pull shared test utils
cleanup babel and updates, should be able to remove most babel dependencies
use jest-environment-ceramic (like js-idx)

IDW Full Migration Support

Remaining, tests, asym enc, maybe reconcile externalAuth with authprovider. Would be nice to release with optional migration flag, so already ready for later.

Cannot create a new 3id provider

I'm using:

[email protected]
@ceramicnetwork/[email protected]
@ceramicnetwork/[email protected]

These are the only packages I depend on, so versions of any other related packages would be determined by the package.json's of the packages I listed above ^^^.

const ceramic = new Ceramic();
const idWallet = await IdentityWallet.create({
    authId: auth.ID,
    authSecret: auth.secret,
    getPermission: () => Promise.resolve([]),
    ceramic,
});

This call throws:

(node:52009) UnhandledPromiseRejectionWarning: Error: request timed out
    at Object.fetchJson (/Users/jonathanschwartz/Documents/daemon-land/js-sdk/services/api/node_modules/@ceramicnetwork/http-client/src/utils.ts:17:26)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at Function.applyRecord (/Users/jonathanschwartz/Documents/daemon-land/js-sdk/services/api/node_modules/@ceramicnetwork/http-client/src/document.ts:70:23)
    at CeramicClient.applyRecord (/Users/jonathanschwartz/Documents/daemon-land/js-sdk/services/api/node_modules/@ceramicnetwork/http-client/src/ceramic-http-client.ts:175:12)
    at TileDoctype.change (/Users/jonathanschwartz/Documents/daemon-land/js-sdk/services/api/node_modules/@ceramicnetwork/doctype-tile/src/tile-doctype.ts:48:25)
    at Document.change (/Users/jonathanschwartz/Documents/daemon-land/js-sdk/services/api/node_modules/@ceramicnetwork/http-client/src/document.ts:101:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:52009) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:52009) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Can't resolve 'multicodec/src/base-table.json'

Describe the bug
In a React application, running with Yarn (react-scripts start). I get this error message:

Module not found: Can't resolve 'multicodec/src/base-table.json' in SOME_FOLDER

Tried with version 0.4.0, 0.5.0 and 0.5.1,all give this error. I'm using the same versions in another Node project, where it does not give this error message.

Saw some cases in Discord: https://discord.com/channels/682786569857662976/682789574249807918/822200993122877451

It resolved by following this:
https://discord.com/channels/682786569857662976/682789574249807918/822250993932173322
yarn add multicodec@^0.5.4

Just adding an issue here to keep track. If not necessary, tell me and I will close it :)

To Reproduce
Not applicable

Expected behavior
Don't have to install additional packages.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser Brave
  • Version 89

authMap is undefined

This issue seems to sporadically pop up for me, but occasionally when i create a new instance of ThreeID, I get an error authMap is undefined

Sorry that I don't have great replication steps... It seems very random

My ceramic daemon looks like:

ceramic_1  | Ceramic API running on port 7007
ceramic_1  | (node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'codec' of undefined
ceramic_1  |     at ClassIsWrapper.equals (/js-ceramic/node_modules/cids/src/index.js:297:33)
ceramic_1  |     at Document._findIndex (/js-ceramic/packages/core/lib/document.js:178:19)
ceramic_1  |     at Document._isCidIncluded (/js-ceramic/packages/core/lib/document.js:189:28)
ceramic_1  |     at Document._fetchLog (/js-ceramic/packages/core/lib/document.js:151:24)
ceramic_1  |     at /js-ceramic/packages/core/lib/document.js:137:40
ceramic_1  |     at run (/js-ceramic/node_modules/p-queue/dist/index.js:157:104)
ceramic_1  |     at PQueue._tryToStartAnother (/js-ceramic/node_modules/p-queue/dist/index.js:105:17)
ceramic_1  |     at /js-ceramic/node_modules/p-queue/dist/index.js:171:18
ceramic_1  |     at new Promise (<anonymous>)
ceramic_1  |     at PQueue.add (/js-ceramic/node_modules/p-queue/dist/index.js:152:16)
ceramic_1  | (Use `node --trace-warnings ...` to show where the warning was created)
ceramic_1  | (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
ceramic_1  | (node:1) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
ceramic_1  | (node:1) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'codec' of undefined
ceramic_1  |     at ClassIsWrapper.equals (/js-ceramic/node_modules/cids/src/index.js:297:33)
ceramic_1  |     at Document._findIndex (/js-ceramic/packages/core/lib/document.js:178:19)
ceramic_1  |     at Document._isCidIncluded (/js-ceramic/packages/core/lib/document.js:189:28)
ceramic_1  |     at Document._fetchLog (/js-ceramic/packages/core/lib/document.js:151:24)
ceramic_1  |     at /js-ceramic/packages/core/lib/document.js:137:40
ceramic_1  |     at run (/js-ceramic/node_modules/p-queue/dist/index.js:157:104)
ceramic_1  |     at PQueue._tryToStartAnother (/js-ceramic/node_modules/p-queue/dist/index.js:105:17)
ceramic_1  |     at /js-ceramic/node_modules/p-queue/dist/index.js:171:18
ceramic_1  |     at new Promise (<anonymous>)
ceramic_1  |     at PQueue.add (/js-ceramic/node_modules/p-queue/dist/index.js:152:16)
ceramic_1  | (node:1) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)

But it's unclear if these issues with codec are causing the problem

Unable to find auth data

I'm not totally sure why/how this started happening. Seemed totally random?

(node:4780) UnhandledPromiseRejectionWarning: Error: Unable to find auth data
    at Function.<anonymous> (/Users/jonathanschwartz/Documents/daemon-land/js-sdk/services/api/node_modules/3id-did-provider/src/keychain.ts:203:38)
    at Generator.next (<anonymous>)
    at fulfilled (/Users/jonathanschwartz/Documents/daemon-land/js-sdk/services/api/node_modules/3id-did-provider/lib/keychain.js:24:58)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:4780) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)

This is on a ThreeId.create with a new auth seed

Wallet.Create with authId and authSecret results in type error

      const ceramic = new CeramicClient();
      const idWallet = await IdentityWallet.create({
        authId: 'randomString',
        authSecret: nacl.randomBytes(32),
        getPermission: () => Promise.resolve([]),
        ceramic,
      });

results in:

TypeError: Cannot read property 'doctype' of undefined

Identity wallet version 2.0.0-alpha.3
Ceramic http client version 0.5.11

box.verified.email() returns null

Describe the bug
box.verified.email() returns null when using identity-wallet

To Reproduce
Steps to reproduce the behavior:

        const idWallet = new IdentityWallet(async () => true, { seed });
        await idWallet.authenticate(['relevant', '3Box']);
        await idWallet.linkAddress(address, metamask);
        const provider = idWallet.get3idProvider();
        const box = await Box.openBox(address, provider);
        const emailObj = await box.verified.email(); // <-- return null with idProvider

Expected behavior
When using metamask ethereum provider the method returns the verified email object

Desktop (please complete the following information):

  • OS: macOS
  • Browser Chrome
  • Version 80

Additional context
3box-js version: 1.17.0
identity-wallet version: 1.1.1

Implement JSON-RPC provider & consumer

Implement an IDW provider which has the same API as the IDW but outputs correctly fomated JSON-RPC calls.
Implement an IDW consumer which consumes RPC calls and responds correctly.

Docs do not show `ceramic` as an arg to `IDWConfig`

The documentation in the repo shows 3 arguments passed to the ThreeIdProvider - getPermission, authID, authSecret, but it does not show ceramic which is a required config argument. This will likely cause confusion

IDWallet.create => error: digest should be a Uint8Array

Describe the bug
When I try to create a new identity-wallet instance, I get:

digest should be a Uint8Array error, thrown from the multihashes library

    digest should be a Uint8Array

      at Object.encode (node_modules/multihashes/src/index.js:135:11)
      at Multihashing (node_modules/multihashing-async/src/index.js:17:20)
      at Object.<anonymous>.exports.cid (node_modules/ipld-dag-cbor/src/util.js:180:21)

I'm running node v14.9.0 and:

    "identity-wallet": "^2.0.0-alpha.18",
    "dids": "^0.7.0",
    "@ceramicnetwork/ceramic-cli": "^0.13.0",
    "@ceramicnetwork/ceramic-http-client": "^0.7.1",
    "@ceramicstudio/idx": "^0.3.0",
    "@ceramicstudio/idx-schemas": "^0.1.5",
    "@ceramicstudio/idx-tools": "^0.3.1",

I've tried with several authId's and authSecrets as well as raw seed, all of them report this error when creating an identity wallet.

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.