Giter Site home page Giter Site logo

decentralized-identity / element Goto Github PK

View Code? Open in Web Editor NEW
102.0 15.0 28.0 18.09 MB

DID Method implementation using the Sidetree protocol on top of Ethereum and IPFS

Home Page: https://element-did.com/

License: Apache License 2.0

JavaScript 94.98% HTML 0.55% CSS 0.18% Shell 0.74% Dockerfile 0.11% Solidity 3.44%
sidetree ethereum ipfs did crypto protocol dapp wg-sidetree

element's Introduction

This repo is no longer maintained.

Element

Build Status codecov

๐Ÿ”ฅ Experimental Sidetree Protocol based DID Method elem with Ethereum and IPFS

[OUTDATED] Click below image for demo video.

Element Testnet Demo

See also ion, sidetree, sidetree-ethereum.

Useful resources

Getting Started

git clone [email protected]:decentralized-identity/element.git
cd element
npm install

Element follows the Mono Repo structure. Running npm install will install dependencies in the top level npm project as well as in the following packages:

  • Element LIB: Javascript SDK for using Element. Works with node 10, node 12 and in the browser
  • Element APP: Progressive Web App to create a wallet, create a DID, add and remove keys, search through the Element Block explorer, etc... The PWA allows you to use two different types of Sidetree nodes:
    • The light node (or browser node) which uses element-lib in the browser for Sidetree operations and interacts with Ethereum through Metamask Make sure you have the Metamask browser extension installed if you want to use it the light node.
    • The full node which uses element-api for Sidetree operations
  • Element API: API powered by element-lib that exposes Sidetree operations with an HTTP interface. See Swagger documentation for more details.

How to use element-lib

cd packages/element-lib

Running the tests

In order to run the tests, you need to start Element services

npm run services:start

This will start 3 services:

  • Ganache: A local Ethereum chain initialized with the Element smart contract running with on port 8545
  • IPFS: A local IPFS node running on port 5001
  • CouchDB: A local CouchDB instance running on port 5984. CouchDB will be ran in the Docker container, so you will need Docker installed. If you don't have it and / or don't want to install it, it is fine. Just be aware that the CouchDB tests will fail

Check that services are properly initalized with

npm run services:healthcheck

Then you can run the tests (note that running this command will initialize the services if they have not been initialized)

npm test

When you are done, you can stop the Element services by running

npm run services:stop

Initializing the Sidetree class

In order to use element-lib in node or in the browser, you will need to initalize the Sidetree class by providing three interfaces:

  • A db interface: this is where all the caching artifacts will be stored. While caching is not technically required for Element to work, CRUD operations will be prohibitively slow without it. To initialize, chose one db adapter (several options are available here):

    • RXDB
    • CouchDB
    • Firestore: A good option if you're going to use Element in a Firebase Cloud Function, pretty slow otherwise. Also note that this technology is proprietary as opposed to the two above which are open source..
  • A storage interface: the Content Addressed Storage layer where Sidetree operation data will be stored. To initialize, chose one storage adapter (several options are available here):

    • IPFS
    • IPFS Storage Manager: A layer on top of IPFS that uses a cache and some retry logic when the call to IPFS fails: This one is recommended for production use as the IPFS link provided by Infura tend to fail intermittently
  • A blockchain interface: An interface for the decentralized ledger to be used for anchoring Sidetree operations. Element may only be used with the Ethereum interface, however feel free to reuse this codebase to implement a did method that uses a different ledger.

  • A parameter object. Currently the supported parameters are:

    • maxOperationsPerBatch: recommended value is 10000,
    • batchingIntervalInSeconds: recommended value is 10,
    • didMethodName: recommended value is did:elem:ropsten for Element testnet
    • logLevel: one of [ error, warn, info, http, verbose, debug, silly ]. error would log all the logs, while silly would only capture the most unimportant ones

See several examples for how to initialize the Sidetree class:

Using element-lib to Create Read Update Delete DIDs

Once you have an instance of the Sidetree class with the suitable adapters, you can access all the helper functions (sidetree.func) and perform CRUD operations (sidetree.op). Here are a few code snippet to get you started:

Create a DID

const { Sidetree, MnemonicKeySystem } = require("@transmute/element-lib");

// Instantiate the Sidetree class
const element = new Sidetree(/* See previous section for how to initialize the Sidetree class*/);

// Generate a simple did document model
const mks = new MnemonicKeySystem(MnemonicKeySystem.generateMnemonic());
const primaryKey = await mks.getKeyForPurpose("primary", 0);
const recoveryKey = await mks.getKeyForPurpose("recovery", 0);
const didDocumentModel = element.op.getDidDocumentModel(
  primaryKey.publicKey,
  recoveryKey.publicKey
);

// Generate Sidetree Create payload
const createPayload = element.op.getCreatePayload(didDocumentModel, primaryKey);

// Create the Sidetree transaction.
// This can potentially take a few minutes if you're not on a local network
const createTransaction = await element.batchScheduler.writeNow(createPayload);
const didUniqueSuffix = element.func.getDidUniqueSuffix(createPayload);
const did = `did:elem:ropsten:${didUniqueSuffix}`;
console.log(`${did} was successfully created`);

Read a DID (aka resolve a DID)

const didDocument = await element.resolve(didUniqueSuffix, true);
console.log(
  `${did} was successfully resolved into ${JSON.stringify(
    didDocument,
    null,
    2
  )}`
);

Update a DID document

Add a new key to the did document

// Get last operation data
const operations = await element.db.readCollection(didUniqueSuffix);
const lastOperation = operations.pop();

// Generate update payload for adding a new key
const newKey = await mks.getKeyForPurpose("primary", 1);
const newPublicKey = {
  id: "#newKey",
  usage: "signing",
  type: "Secp256k1VerificationKey2018",
  publicKeyHex: newKey.publicKey,
};
const updatePayload = await element.op.getUpdatePayloadForAddingAKey(
  lastOperation,
  newPublicKey,
  primaryKey.privateKey
);

// Create the Sidetree transaction.
const updateTransaction = await element.batchScheduler.writeNow(updatePayload);
const newDidDocument = await element.resolve(didUniqueSuffix, true);
console.log(`${JSON.stringify(newDidDocument, null, 2)} has a new publicKey`);

Recover a did document

How to recover a did document using the recovery key if the private key is lost:

// Generate a recovery payload with the inital did document model
const recoveryPayload = await element.op.getRecoverPayload(
  didUniqueSuffix,
  didDocumentModel,
  recoveryKey.privateKey
);

// Send Sidetree transaction
const recoveryTransaction = await element.batchScheduler.writeNow(
  recoveryPayload
);
const recoveredDidDocument = await element.resolve(didUniqueSuffix, true);
console.log(`${JSON.stringify(recoveredDidDocument, null, 2)} was recovered`);

Delete a did document

// Generate a delete payload this will brick the did forever
const deletePayload = await element.op.getDeletePayload(
  didUniqueSuffix,
  recoveryKey.privateKey
);

// Send Sidetree transaction
const deleteTransaction = await element.batchScheduler.writeNow(deletePayload);
const deletedDidDocument = await element.resolve(didUniqueSuffix, true);
console.log(`${JSON.stringify(deletedDidDocument, null, 2)} was deleted`);

How to use element-api

Define the environment file

In the root level directory copy the example config

cp example.env .env

then fill the following values:

  • ELEMENT_MNEMONIC: a mnemonic funded with ethereum. See step 1 and 2 of this tutorial
  • ELEMENT_PROVIDER: either http://localhost:8545 for connecting with local ganache network or use an Infura URL that should look like this https://ropsten.infura.io/v3/<API_TOKEN>
  • ELEMENT_IPFS_MULTIADDR: either /ip4/127.0.0.1/tcp/5001 for connecting with local IPFS node or /dns4/ipfs.infura.io/tcp/5001/https for connecting through Infura
  • ELEMENT_CONTRACT_ADDRESS: "0xD49Da2b7C0A15f6ac5A856f026D68A9B9848D96f"
  • ELEMENT_COUCHDB_REMOTE: Only use this if you want to you the replication feature of CouchDB

Then run the following create the api config file

cd packages/element-api
npm run env:create:prod

You may now start the API by running

npm run start # if you have setup a firebase project
npm run start:standalone # to run the standalone express version of the API

How to use element-app

All config is checked into source so you can run the app by:

npm run start

Useful commands

Install:

npm i

Run smart contract tests:

npm run test:contracts

Run lib, api and app tests:

npm run test

Lint

npm run lint

Coverage

npm run coverage

Publishing

If you have 2fa enabled for npm (and you should!).

lerna version patch
NPM_CONFIG_OTP=123456 lerna publish

Testing Documentation

npm i -g http-server
serve ./docs

See .travis.yml for setup and test commands for linux.

Docker

To run the APP in docker, run

docker run --rm -p 80:80 gjgd/element-app:latest

To run the API in docker, run

docker run --rm -p 80:5002 gjgd/element-api:latest

How to build Element APP with a different domain for the API:

  1. Clone Element
  2. cd packages/element-app
  3. edit the content of .env.production to the API_URL you want to use
  4. docker build -t my-tag .
  5. docker run --rm -p 80:5002 my-tag
  6. Now the app runs on port 80 and will use the API_URL specified in 3)

Release process

lerna publish

element's People

Contributors

bongani-m avatar dependabot[bot] avatar gjgd avatar jacehensley avatar or13 avatar therecanbeonlyone1969 avatar wrenchworkslabs 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  avatar  avatar  avatar  avatar  avatar  avatar  avatar

element's Issues

Add Semaphore for Blockchain Transactions From the same account.

An invalid nonce error will be thrown if the same account tries to write to ethereum at the same time.

We added a hacky retry in #30

We need to consider what parallel write means for the sidetree protocol.

I think its generally invalid for the same account to try and anchor 2 different files at once.

While this happens in tests, in production each node should have a unique funded hot wallet, and this sort of thing should not be happening.

Connection Not Open

Hi All,
i am having problem with the command "npm run contracts:migrate:dev"

After the command, I have the following logs:

@transmute/element@ contracts:migrate:dev /home/ubuntu/element
lerna run contracts:migrate:dev

lerna notice cli v3.14.1
lerna info Executing command in 2 packages: "npm run contracts:migrate:dev"
lerna ERR! npm run contracts:migrate:dev exited 1 in '@transmute/element-lib'
lerna ERR! npm run contracts:migrate:dev stdout:

@transmute/[email protected] contracts:migrate:dev /home/ubuntu/element/packages/element-lib
truffle migrate --network development --reset

Compiling your contracts...

Everything is up to date, there is nothing to compile.

connection not open
Truffle v5.0.26 (core: 5.0.26)
Node v10.16.0

lerna ERR! npm run contracts:migrate:dev stderr:
connection not open on send()
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @transmute/[email protected] contracts:migrate:dev: truffle migrate --network development --reset
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @transmute/[email protected] contracts:migrate:dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2019-07-04T09_07_51_145Z-debug.log

in "/home/ubuntu/.npm/_logs/2019-07-04T09_07_51_145Z-debug.log" i finds the following:
lerna ERR! npm run contracts:migrate:dev exited 1 in '@transmute/element-lib'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @transmute/element@ contracts:migrate:dev: lerna run contracts:migrate:dev
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @transmute/element@ contracts:migrate:dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

and in "/home/ubuntu/.npm/_logs/2019-07-04T09_07_51_259Z-debug.log" I got the following:

info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/usr/bin/npm',
1 verbose cli 'run',
1 verbose cli 'contracts:migrate:dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'precontracts:migrate:dev',
4 verbose run-script 'contracts:migrate:dev',
4 verbose run-script 'postcontracts:migrate:dev' ]
5 info lifecycle @transmute/[email protected]precontracts:migrate:dev: @transmute/[email protected]
6 info lifecycle @transmute/[email protected]
contracts:migrate:dev: @transmute/[email protected]
7 verbose lifecycle @transmute/[email protected]contracts:migrate:dev: unsafe-perm in lifecycle true
8 verbose lifecycle @transmute/[email protected]
contracts:migrate:dev: PATH: /usr/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/ubuntu/element/packages/element-lib/node_modules/$
9 verbose lifecycle @transmute/[email protected]contracts:migrate:dev: CWD: /home/ubuntu/element/packages/element-lib
10 silly lifecycle @transmute/[email protected]
contracts:migrate:dev: Args: [ '-c', 'truffle migrate --network development --reset' ]
11 silly lifecycle @transmute/[email protected]contracts:migrate:dev: Returned: code: 1 signal: null
12 info lifecycle @transmute/[email protected]
contracts:migrate:dev: Failed to exec contracts:migrate:dev script
13 verbose stack Error: @transmute/[email protected] contracts:migrate:dev: truffle migrate --network development --reset
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid @transmute/[email protected]
15 verbose cwd /home/ubuntu/element/packages/element-lib
16 verbose Linux 4.15.0-1043-aws
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "contracts:migrate:dev"
18 verbose node v10.16.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 1
22 error @transmute/[email protected] contracts:migrate:dev: truffle migrate --network development --reset
22 error Exit status 1
23 error Failed at the @transmute/[email protected] contracts:migrate:dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]

Anyone knows where is the problem?

I thought I had to opens some ports, but opening 30303 and 30304 didn't work either.

Thanks!

Demo is down

Not sure what has changed, will report back when it is recovered.

Better batch tests

Batch size is configurable.

It would be nice to add some stress tests around different sizes, and maybe even profile performance of the web client with different batch sizes.

Batching was the last feature implemented in our first release, so it could use more confidence.

Element Lib not installable in create-react-app

create-react-app element-test 
cd ./element-test 
npm i @transmute/element-lib --save

edit App.js

import element from '@transmute/element-lib';

Experience truffle graceful fs error:

TypeError: Cannot read property 'toString' of undefined
(anonymous function)
node_modules/truffle-hdwallet-provider/dist/index.js:2688
  2685 |   }), e.exports.closeSync = (l = n.closeSync, function (e) {
  2686 |     var t = l.apply(n, arguments);
  2687 |     return d(), t;
> 2688 |   }), /\bgraceful-fs\b/.test(n.closeSync.toString()) || (n.closeSync = e.exports.closeSync, n.close = e.exports.close);
       | ^  2689 | }, function (e, t) {
  2690 |   e.exports = require("url");
  2691 | }, function (e, t) {TypeError: Cannot read property 'toString' of undefined
(anonymous function)
node_modules/truffle-hdwallet-provider/dist/index.js:2688
  2685 |   }), e.exports.closeSync = (l = n.closeSync, function (e) {
  2686 |     var t = l.apply(n, arguments);
  2687 |     return d(), t;
> 2688 |   }), /\bgraceful-fs\b/.test(n.closeSync.toString()) || (n.closeSync = e.exports.closeSync, n.close = e.exports.close);
       | ^  2689 | }, function (e, t) {
  2690 |   e.exports = require("url");
  2691 | }, function (e, t) {

Maybe truffle version drift

Add Storybook

Encourage reusable, shareable components, this will be valuable to any Sidetree implementer (ION) or even other DID Methods.

Standardize elementService

https://github.com/decentralized-identity/element/blob/master/packages/element-app/src/services/element.js

https://github.com/decentralized-identity/element/blob/master/packages/element-api/src/lib/elementService.js

element-lib provides a JavaScript SDK for Sidetree (with support for ethereum and ipfs out fo the box).

This abstraction is meant to support the creation of full and light node implementations, but its does not really provide the client interface that is desirable, "elementService".

The goal of element service is to provide a client friendly APIs that abstract the sidetree data model from the developer, for example:

https://github.com/decentralized-identity/element/blob/master/packages/element-app/src/services/element.js#L137

This is still not quiet right.

What we want is 2 sdks, one for working with a full node (would be compatible with ION), the other for working with a light node.

The methods of the SDK should not require a developer to understand sidetree at all. Instead, the developer should think "I want to add this key to this did". The sdks should expose a method for accomplishing this.

One challenge is operation signing.... probably we need to support a signer interface, and use that instead of passing the wallet.

Add Azure Deployment Instructions

I think we can build the element-api and element-app as docker images, and add instructions for Azure Deployment.

Maybe we want to have a single docker image for exposing the web app and api together.

Once they are docker images, it should be easier to deploy them on other providers.

Automate Release Documentation

We need a top level script and documentation for how mono repo releases should work.

  • how to checkout, build, publish and commit a new version
  • how a standard root level change log is built for each new version of element.
  • how commit hooks are used to produce this change log
  • how documentation is generated hosted (for now only 1 version of documentation should be hosted, in the future we will need to preserve older versions).

element-core has a lot of this defined already, we need to pull some of that up a level, and test some releases to see that things are running smoothly.

Cannot install any dependencies in element-lib

A faulty version of websocket was released (.git included in the package) causes an error when npm i --save <any-dependency>

Example:

โžœ npm i rxjs --save
npm ERR! path /Users/guillaume/workspace/work/elem/packages/element-lib/node_modules/web3/node_modules/websocket
npm ERR! code EISGIT
npm ERR! git /Users/guillaume/workspace/work/elem/packages/element-lib/node_modules/web3/node_modules/websocket: Appears to be a git repo or submodule.
npm ERR! git     /Users/guillaume/workspace/work/elem/packages/element-lib/node_modules/web3/node_modules/websocket
npm ERR! git Refusing to remove it. Update manually,
npm ERR! git or move it out of the way first.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/guillaume/.npm/_logs/2019-08-01T11_20_08_862Z-debug.log

The issue was solved here in v1.0.29: https://github.com/theturtle32/WebSocket-Node/blob/master/CHANGELOG.md#version-1029

We have 2 sub dependencies who use websocket:

  • web3-providers-ws
  • web3

Memory leak on resolver page


Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
    in Snackbar (created by Context.Consumer)
    in Connect(Snackbar) (at DefaultPageWithNavigation.js:12)
    in div (at DefaultPage.js:11)
    in MuiThemeProviderOld (at Theme.js:101)
    in Theme (at DefaultPage.js:10)
    in DefaultPage (at DefaultPageWithNavigation.js:10)
    in DefaultPageWithNavigation (at wallet.js:8)
    in Wallet (at src/index.js:29)

Element Failing to build on AWS EC2 (t2.micro). ErrorNo: 137

I have already build element locally on my PC.
I am trying to build on AWS EC2 too.
Specs i am using are: t2.micro:1GB ram and storage of 8 GB.

Command: npm i //ran perfectly
Command npm run services:start //Failing and its killing the contracts.

ubuntu@ip:~/decentralized-identity/element$ sudo npm run services:start

@transmute/element@ services:start /home/ubuntu/decentralized-identity/element
lerna run services:start --stream

lerna notice cli v3.15.0
lerna info Executing command in 1 package: "npm run services:start"
@transmute/element-lib: > @transmute/[email protected] services:start /home/ubuntu/decentralized-identity/element/packages/element-lib
@transmute/element-lib: > ./scripts/start_services.sh
@transmute/element-lib: ๐Ÿง™ Starting Element Services...
@transmute/element-lib: โœจ Starting GANACHE on 8545
@transmute/element-lib: > @transmute/[email protected] contracts:migrate:dev /home/ubuntu/decentralized-identity/element/packages/element-lib
@transmute/element-lib: > truffle migrate --network development --reset
@transmute/element-lib: Compiling your contracts...
@transmute/element-lib: ===========================
@transmute/element-lib: Killed
@transmute/element-lib: npm ERR! code ELIFECYCLE
@transmute/element-lib: npm ERR! errno 137
@transmute/element-lib: npm ERR! @transmute/[email protected] contracts:migrate:dev: truffle migrate --network development --reset
@transmute/element-lib: npm ERR! Exit status 137
@transmute/element-lib: npm ERR!
@transmute/element-lib: npm ERR! Failed at the @transmute/[email protected] contracts:migrate:dev script.
@transmute/element-lib: npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
@transmute/element-lib: npm ERR! A complete log of this run can be found in:
@transmute/element-lib: npm ERR! /home/ubuntu/.npm/_logs/2019-07-30T06_18_24_902Z-debug.log
@transmute/element-lib: lerna notice cli v3.15.0
@transmute/element-lib: lerna info Executing command in 1 package: "npm run env:create:local"
@transmute/element-lib: @transmute/element-api: > @transmute/[email protected] env:create:local /home/ubuntu/decentralized-identity/element/packages/element-api
@transmute/element-lib: @transmute/element-api: > node ./scripts/env_to_json_config.js local ../../example.env ./local.runtimeconfig.json && ./scripts/update_runtimeconfig_contract.sh ./local.runtimeconfig.json
@transmute/element-lib: @transmute/element-api: ๐Ÿ‘ท Modifying ./local.runtimeconfig.json
@transmute/element-lib: @transmute/element-api: โœ… element.ethereum.anchor_contract_address: 0x1DABA81D326Ae274d5b18111440a05cD9581b305
@transmute/element-lib: lerna success run Ran npm script 'env:create:local' in 1 package in 0.7s:
@transmute/element-lib: lerna success - @transmute/element-api
@transmute/element-lib: /home/ubuntu/decentralized-identity/element/packages/element-lib
@transmute/element-lib: โœจ Starting IPFS on 5001
lerna success run Ran npm script 'services:start' in 1 package in 16.2s:
lerna success - @transmute/element-lib

Add Docker Compose Setup

Should be easy to add docker files for app, and api.

We should support a mode that relies on infura / metamask, and in the future, one that uses the docker images for ethereum / ipfs.

Fix API Tests

I disabled API tests and coverage in CI, because my batch processing implementation was uncomfortably tied to firebase, and I was concerned about security issues in the CI server.

I think we want the restore API tests ;)

Implement more advanced anchor contracts

We have requests for supporting a more complex anchor contract. It would be nice to add support for staking and rate limiting by address.

As a stretch goal, we could show that a migration from the default anchor contract to a more restricted one is possible, while preserving DIDs. This would give us event more confidence to proceed with the simple and more open contract we have today, knowing that we can protect users later with a migration.

Implement protocol attack tests

A late anchorFile and batchFile Publish is the same as a private/protected anchorFile batchFile, which might have legitimate uses for certain clients / nodes in the future.

We should add tests:

  • Late publish attack => non transferability under dishonest actors assumption
  • Private Transactions => Private DIDs => indistinguishable from a late publish attack
  • Private Transactions => safely published later => path from private to public for DIDs

Update Universal Resolver example

{
  "@context": "https://w3id.org/did/v0.11",
  "id": "did:elem:sscP2_bGvj2z6qnSV68ja-WR8WKCLTvNoRJjYSBvDZs",
  "publicKey": [
    {
      "id": "#recovery",
      "type": "Secp256k1VerificationKey2018",
      "publicKeyHex": "02f3bde38facf80e4ecd0ad97c9ddd23e8f9b4176370a8c6b5e504f83c13df0817"
    }
  ]
}

It would be nice to show an example that has both authentication and services in it.

Cannot find "@transmute/element-core" after "npm run test"

After running,

npm run test

The test suit is failing.

@transmute/element-modules: FAIL src/Node/ElementCore.Node.spec.js
@transmute/element-modules: โ— Test suite failed to run
@transmute/element-modules: Cannot find module '@transmute/element-core' from 'ElementCore.Node.spec.js'
@transmute/element-modules: > 1 | const ElementCore = require("@transmute/element-core");
@transmute/element-modules: | ^
@transmute/element-modules: 2 |
@transmute/element-modules: 3 | describe("ElementCore", () => {
@transmute/element-modules: 4 | describe("MnemonicKeySystem", () => {
@transmute/element-modules: at Resolver.resolveModule (node_modules/jest-runtime/node_modules/jest-resolve/build/index.js:230:17)
@transmute/element-modules: at Object.require (src/Node/ElementCore.Node.spec.js:1:21)
@transmute/element-modules: Test Suites: 1 failed, 1 total
@transmute/element-modules: Tests: 0 total
@transmute/element-modules: Snapshots: 0 total
@transmute/element-modules: Time: 0.951s
@transmute/element-modules: Ran all test suites.

Even i change the path to "home/adityaishan/decentralized-identity/element/packages/element-modules/node_modules/@transmute/element-core", the test is still failing.

Storybook is broken in element-app

There are errors that prevent storybook to run, mostly dependencies that can't be resolved

These errors should have been caught by eslint, but *.stories.js files are ignored by eslint. (#46)

Implement My DID view

We need a consolidated edit view of a given Element DID.

  • View of the DID Document, and all related transactions.
  • Support for Add Public Key, Remove Public Key
  • Support for Add Service, Remove Service
  • Support for Recover
  • Support for Deactivate

Warning when running the element-app


../element-lib/node_modules/web3/node_modules/web3-eth-accounts/src/scrypt.js
Critical dependency: the request of a dependency is an expression

Add Azure Pipelines

It would be nice to have another CI integration, in case Travis becomes terrible now that it is acquired.

invalid nonce

the tx doesn't have the correct nonce. account has nonce of: 5 tx has nonce of: 2

occurs when multiple instances of sidetree are created, because the account used to sign will not have the nonce correct after the same account is used in another connection.

  1. we need to catch and throw a better error warning about multiple connections using the same account.
  2. can we get multiple connections to use the same account safely? (retry with correct nonce?)

in practice this should never be happening, but its very common when testing, especially when testing service and api together in a single test or the suite as a whole.

Cannot find "@transmute/element-core" after running npm run test

When running:

npm run test

The test suit fails at:

FAIL src/Node/ElementCore.Node.spec.js
@transmute/element-modules: โ— Test suite failed to run
@transmute/element-modules: Cannot find module '@transmute/element-core' from 'ElementCore.Node.spec.js'
@transmute/element-modules: 1 | // const ElementCore = require("@transmute/element-core");
@transmute/element-modules: > 2 | import * as ElementCore from "home/adityaishan/decentralized-identity/element/packages/element-modules/node_modules/@transmute/element-core"
@transmute/element-modules: | ^
@transmute/element-modules: 3 |
@transmute/element-modules: 4 | describe("ElementCore", () => {
@transmute/element-modules: 5 | describe("MnemonicKeySystem", () => {
@transmute/element-modules: at Resolver.resolveModule (node_modules/jest-runtime/node_modules/jest-resolve/build/index.js:230:17)
@transmute/element-modules: at Object. (src/Node/ElementCore.Node.spec.js:2:1)
@transmute/element-modules: Test Suites: 1 failed, 1 total
@transmute/element-modules: Tests: 0 total
@transmute/element-modules: Snapshots: 0 total
@transmute/element-modules: Time: 1.837s
@transmute/element-modules: Ran all test suites.

Even i am providing the full path:
"home/adityaishan/decentralized-identity/element/packages/element-modules/node_modules/@transmute/element-core", the test suit is still failing.

Add better db for local api testing

the element-api relies on firebase / firestore... When testing locally, it should use something that does not require authentication, maybe in memory.

api tests should work for anybody and not require secrets.

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.