Giter VIP home page Giter VIP logo

js-3id's Introduction

ceramicnetwork Twitter

3ID-Connect

3ID Connect Image

3ID Connect provides 3ID user account management in a iframe, an easy way to access a DID provider, specifically ThreeIdProvider in the browser. It allows users to authenticate, manage, link and permission their 3ID keys to applications.

The library js-3id-did-provider handles most operations and the parent window (application) communicates with the iframe service over an RPC layer.

Getting started

Installation

npm install @3id/connect

Basic usage

import { EthereumAuthProvider, ThreeIdConnect } from '@3id/connect'

// ethProvider is an Ethereum provider and addresses an array of strings
const authProvider = new EthereumAuthProvider(ethProvider, addresses[0])

const threeIdConnect = new ThreeIdConnect()
await threeIdConnect.connect(authProvider)

See the example app for more details

Developement

Prerequisites

yarn v1 and lerna v4 should be installed globally:

npm install -g lerna yarn

Installation

Run yarn install from the root folder, this will install the dependencies and build the packages

Scripts

In the root folder:

  • lint: lints all apps and packages
  • build: builds all packages
  • test:unit: runs unit test
  • test:management: runs integration tests for the management lib with a Ceramic server
  • test:integration: runs integration tests from the integration app with a Ceramic server

Folders

Packages

Apps

  • example: Example usage of 3ID Connect with Ceramic and IDX
  • iframe: 3ID Connect iframe logic and UI
  • integration: 3ID Connect integration tests
  • management: 3ID accounts management UI used by 3ID Connect

Others

  • public: build assets for 3idconnect.org

Licenses

  • Apache-2.0 OR MIT for published packages
  • UIs used by 3ID Connect may use dependencies under other licenses

js-3id's People

Contributors

decentralgabe avatar dysbulic avatar michaelsena avatar msterle avatar natclark avatar oed avatar paullecam avatar simonovic86 avatar skylar745 avatar sterahi avatar ukstv 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  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  avatar

js-3id's Issues

Codify all supported user paths

Make explicit each case/flow that is supported, and split out clear paths in code base with descriptions

Lots of if x and y, but not z do this, etc and not clear how they map to end user flow or what condition they support.

This will make it easier for others to contribute after.

Build/CI: unpin playwright docker image

Pinned docker image to hash, since we were having problems with dependencies in CI. With the pinned version we may have other issues with upgrading the test dependencies the future.

3id-connect dev config pipeline

we have different build configs for development and deployment, add an additional for prod vs dev. We already have dev pipeline, but should be configured to use dev-unstable (probably), and didv0 migration enabled.

Default migration paths for known failures

Due to past bugs in 3box, there is a few instances where it is not easy to migrate the dids. As implemented the migration will just fail with error, and then reprompt user to create a new instead.

For known failures we can detect ahead of time, we could instead just default to creating a new did without any migration prompts. This is likley best.

Example of an account we cant easily migrate

DID owned by ADDRESS_ONE
https://ipfs.3box.io/did-doc?cid=bafyreihggvtidyvqw42hitvj3veki7wmhnchuok5mcjlosgu5532mrkcya

LINK DID -> ADDRESS_TWO
https://beta.3box.io/address-server/odbAddress/0x12396e8b57b1a64ed18aa6fc2f5fec75ba55de07

It is diffucult to make any default choices about migration (other than just create new), since the user may not want ADDRESS_TWO profile added to ADDRESS_ONE, this may have been linked by accident. And unfortunately when authenticating with ADDRESS_ONE no link will be found and a new did will be created anyways

Requests permission first TWO times instead of once

the permission func is getting domain undefined on first request (not first req per domain, but first when creating local auth did data), so its not properly stored locally, then on second loading domain is passed, thinking it has no permissions, it asks again

Transition to React

As a 3Box Labs developer, I want the 3ID Connect application to be built using React instead of HTML templates so that I can add more rich functionality such as making IDX queries.

UI Feedback Follow Up

Text in permission modal until we have actual permissions
Determine if we are ok with any kind of customization by app in modal
When create account, combine permission modal with account create/link or just remove (will remove at least one prompt)

Key cache state

Currently:
caip10 -> did
did -> seed

Not freindly for key rotations, auth data may not be necessarily either. Need to change implementation once key rotations are more widely supported and/or make additional network requests.

Non-interactive auth check

"background"/non-interactive auth where an app could check if it's allowed to connect directly or needs user consent (= showing user prompts), so the app's UX can be adapted accordingly.

Use blockchain-utils-linking from ceramic repo

Now it makes sense to replace 3id-blockchain-utils with linking utils from ceramic repo.

Reasons:

  • 3id-blockchain-utils package is effectively deprecated AFAIK,
  • new linking utils package is lighter, thus making the resulting 3id-connect lighter too.

Codify all supported user paths

Make explicit each case/flow that is supported, and split out clear paths in code base with descriptions

Lots of if x and y, but not z do this, etc and not clear how they map to end user flow or what condition they support.

This will make it easier for others to contribute after.

3ID Connect: Basic Developer Customization and UI improvements

User story: As a developer, I want my users to enjoy a seamless and secure authentication experience so that I can increase trust with users and improve conversion in my onboarding/login flow.

Goals:

  • Increase user trust by providing a more transparent and user-friendly experience
  • Reduce developer objections (and rolling their own 3ID DID Provider interface solutions) by providing basic customization and a better user experience

Definition of done:

We will know this initiative is done by:

  • All stories are agreed on and completed
  • Sharing it with users and getting positive feedback
  • Sharing it with developers and getting positive feedback
  • Testing the implementation to ensure everything works smoothly

Filecoin authentication

The tutorial hosted here states that the Filecoin or EOS blockchains are already supported for authentication, but 3id-connect package doesn't export any FilecoinAuthProvider or smth similar. Do you have any additional instructions or hints about how to add authentication using Ethereum, Filecoin, Cosmos or EOS?

Mobile and mobile wallet testing

Mostly been used in desktop, no need to optimize mobile design yet, but confirm that it minimally works (visually) and that it works with major mobile wallets.

Add simple feedback to permission continue

Most times this is instant, but the case of account already exist in network, not in local storage and first time using app will take some time and needs visual feedback

Feedback already exist for create and migrate modals, just not the permissions modal.

Allow configuration by url and network

  • allow configuration by url and network (ie mainnet -> app.3idconnect.org, clay-testnet -> app-dev.3idconnect.org)
  • allow ceramic api url be passed for prod build as well
  • have pipeline deploy dev with testnet, master with mainnet

"Stay connected" option

Add a "Stay connected" option in the prompt so that 3ID Connect would persist the last time this consent prompt showed up and only ask for consent again at a certain frequency (every 2 weeks for example).

Codify all supported user paths

Make explicit each case/flow that is supported, and split out clear paths in code base with descriptions

Lots of if x and y, but not z do this, etc and not clear how they map to end user flow or what condition they support.

This will make it easier for others to contribute after.

Build configs and pipelines for mainnet

Just confirm configs aligned for management app and 3id-connect, and add option to config for mainnet (consider if any other parts of deployment, ie infra will have to change as well)

Migrate an existing 3Box profile to IDX on first connect

I spoke to @michaelsena on Discord and they said that when a user first authenticates using 3ID Connect eventually it will automatically migrate their 3Box profile to IDX.

I'm just creating this issue to track the progress of that since MyMeta already has everyone using 3Box, and until that information can be migrated we're blocked on the migration to IDX.

Authereum - Invalid proof for signed commit

After authenticating with Authereum, I'm getting '{"error":"Invalid proof for signed commit"}' after the POST to https://ceramic-clay.3boxlabs.com/api/v0/commits. This happens right after my code calls this: 'await ceramic.setDIDProvider(provider)'.

Code:

const ethProvider = await web3Modal.connect()
const addresses = await ethProvider.enable()
const authProvider = new EthereumAuthProvider(ethProvider, addresses[0])
threeIdConnect = new ThreeIdConnect()
await threeIdConnect.connect(authProvider)
const didProvider = await threeIdConnect.getDidProvider()

Steps to reproduce:

  1. At web3Modal.connect(), browser opens second windows with Authereum login.
  2. Login with Authereum login (on Mainnet).
  3. In popup window, a new page is loaded with prompt to 'Sign Message': "Create a new account link to your identity. did:3:xxx Timestamp: 1611281995". Click 'Sign'
  4. After clicking Sign, window closes. Popup (like a toast) pops up inside of first browser (where code is executing) with message: Signed Message "Create a new account link to your identity. did:3:xxx, Timestamp: xx" 6:20pm. I close it.
  5. Another message inside first browser window pops and says 'Signed message: Add this account as a Ceramic authentication message." I close this.
  6. In browser console, an error throws with: I'm getting '{"error":"Invalid proof for signed commit"}' after the POST to https://ceramic-clay.3boxlabs.com/api/v0/commits.

Package versions:

+-- [email protected]
+-- [email protected]
+-- @ceramicnetwork/[email protected]
+-- @ceramicnetwork/[email protected]
+-- @ceramicstudio/[email protected]
+-- @portis/[email protected]
+-- @stablelib/[email protected]
+-- @testing-library/[email protected]
+-- @testing-library/[email protected]
+-- @testing-library/[email protected]
+-- @walletconnect/[email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- UNMET PEER DEPENDENCY [email protected] - 3
+-- [email protected]
+-- UNMET PEER DEPENDENCY popper.js@^1.16.1
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
+-- [email protected]
`-- [email protected]

BUG: Error: Unable to connect

Describe the bug
Error: Unable to connect on ceramic popup

To Reproduce
Steps to reproduce the behavior:

  1. Using package '@3id/connect'
  2. Connecting with 3id with the following code
import { ThreeIdConnect, EthereumAuthProvider } from '@3id/connect'
const threeIdConnect = new ThreeIdConnect()
let authProvider = new EthereumAuthProvider(window.ethereum, address)
yield threeIdConnect.connect(authProvider)
const didProvider = yield threeIdConnect.getDidProvider()
const CERAMIC_URL = "https://ceramic-clay.3boxlabs.com";
const ceramic = new Ceramic(CERAMIC_URL)
yield ceramic.setDIDProvider(didProvider)

Screenshots
Pic 1 - These APIs are getting called only, after which i get the error in Pic 2
Screenshot from 2021-06-07 11-56-45

Pic 2
Screenshot from 2021-06-07 11-56-53

Pic 3 and Pic 4 - Getting error on this API only for now but still other APIs are getting called which further gives the error on popup.
Screenshot from 2021-06-07 13-08-15
Screenshot from 2021-06-07 13-08-27

Ceramic versions
"@3id/connect": "^0.1.3",
"@ceramicnetwork/http-client": "^0.9.3",
"@ceramicstudio/idx": "^0.7.0",

Machine, OS, browser information (please complete the following information):
Linux,testing on Chrome and Brave only for right now.

Management app in self.id not displaying

It does load management page, and appears to load fine
seems to only be visual issue
need to make sure we can force overlay the management app in most all context

Migrating existing 3ID fails with invalid signature

Describe the bug
Receiving a failure when trying to connect an existing 3ID in 0.1.3

To Reproduce
Steps to reproduce the behavior:

  1. Via the web playground connect a wallet that has an existing 3ID
  2. Select "Continue" when prompted "The site wants to access your personal data"
  3. Select "Continue" when prompted "Your 3Box DID <> will be migrated"
  4. Sign two messages in wallet
  5. Receive error "Unable to connect"

Expected behavior
No error is expected.

Versions
Produced using the web playground using @3id/[email protected]

Screenshots
Screen Shot 2021-05-13 at 10 20 41
Screen Shot 2021-05-13 at 10 20 48
Screen Shot 2021-05-13 at 10 21 16

Additional context

  • Same error was received using the same 3id-connect version in a different app
  • I'm not sure if the 3ID I'm attempting with had an old 3Box profile, or a not-so-old 3ID from Ceramic < 1.0

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.