Observed since 20 Oct, 19:45 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
3id-blockchain-utils
Blockchain utils for 3ID
This package contains a bunch of utilities that is used by 3ID and 3Box in order to create and verify links from blockchain addresses.
$ npm install --save 3id-blockchain-utils
Import the package into your project
import { createLink, validateLink, authenticate } from '3id-blockchain-utils'
Use the library to create and verify links:
const did = 'did:3:bafypwg9834gf...'
const proof = await createLink(did, '0x123abc...', ethereumProvider)
console.log(proof)
const verified = await validateLink(proof)
if (verified) {
console.log('Proof is valid', proof)
} else {
console.log('Proof is invalid')
}
Use the library for 3ID authenticate:
await authenticate(message, '0x123abc...', ethereumProvider)
Below you can see a table which lists supported blockchains and their provider objects.
| Blockchain | CAIP-2 namespace | Supported providers |
|---|---|---|
| Ethereum | eip155 | metamask-like ethereum provider |
| Filecoin | fil | Filecoin Wallet Provider |
If you want to add support for a new blockchain to 3ID this is the place to do so. This library uses CAIP-10 to represent accounts in a blockchain agnostic way. If the blockchain you want to add isn't already part of the CAIP standards you shold make sure to add it there.
To begin adding support for a given blockchain add a file with the path: src/blockchains/<blockchain-name>.js. This module needs to export three functions:
createLink - creates a LinkProof object which associates the specified AccountID with the DIDvalidateLink - validates the given LinkProofauthenticate - signs a message and returns some entropy based on the signature. Needs to be deterministicIt also needs to export a constant called namespace. This constant is a string which contains the CAIP-2 chainId namespace.
Please see src/blockchains/ethereum.js for an example of how this is implemented for the eip155 (ethereum) CAIP-2 namespace.
Finally add support for your blockchain in src/index.js. Simply add it to the handlers array.
Test the code by running:
$ npm test
Apache-2.0 OR MIT
Download counts and popularity will appear here as the collector receives them.
| Package / target | Requirement | Relationship |
|---|---|---|
@babel/runtimeEnvironment{
"local_name": "@babel/runtime",
"alias": false,
"peer_metadata": null
} | ^7.9.2 | runtime |
@ethersproject/contractsEnvironment{
"local_name": "@ethersproject/contracts",
"alias": false,
"peer_metadata": null
} | ^5.0.1 | runtime |
@ethersproject/providersEnvironment{
"local_name": "@ethersproject/providers",
"alias": false,
"peer_metadata": null
} | ^5.0.4 | runtime |
@ethersproject/walletEnvironment{
"local_name": "@ethersproject/wallet",
"alias": false,
"peer_metadata": null
} | ^5.0.1 | runtime |
caipEnvironment{
"local_name": "caip",
"alias": false,
"peer_metadata": null
} | ^0.9.2 | runtime |
js-sha256Environment{
"local_name": "js-sha256",
"alias": false,
"peer_metadata": null
} | ^0.9.0 | runtime |
uint8arraysEnvironment{
"local_name": "uint8arrays",
"alias": false,
"peer_metadata": null
} | ^1.1.0 | runtime |
@babel/coreEnvironment{
"local_name": "@babel/core",
"alias": false,
"peer_metadata": null
} | ^7.9.0 | development |
@babel/preset-envEnvironment{
"local_name": "@babel/preset-env",
"alias": false,
"peer_metadata": null
} | ^7.8.4 | development |
@babel/preset-typescriptEnvironment{
"local_name": "@babel/preset-typescript",
"alias": false,
"peer_metadata": null
} | ^7.9.0 | development |
@polkadot/apiEnvironment{
"local_name": "@polkadot/api",
"alias": false,
"peer_metadata": null
} | ^2.4.1 | development |
@polkadot/keyringEnvironment{
"local_name": "@polkadot/keyring",
"alias": false,
"peer_metadata": null
} | ^3.6.1 | development |
@polkadot/typesEnvironment{
"local_name": "@polkadot/types",
"alias": false,
"peer_metadata": null
} | ^2.7.1 | development |
@polkadot/util-cryptoEnvironment{
"local_name": "@polkadot/util-crypto",
"alias": false,
"peer_metadata": null
} | ^3.6.1 | development |
@types/jestEnvironment{
"local_name": "@types/jest",
"alias": false,
"peer_metadata": null
} | ^25.2.3 | development |
@typescript-eslint/eslint-pluginEnvironment{
"local_name": "@typescript-eslint/eslint-plugin",
"alias": false,
"peer_metadata": null
} | ^2.19.0 | development |
@typescript-eslint/parserEnvironment{
"local_name": "@typescript-eslint/parser",
"alias": false,
"peer_metadata": null
} | ^2.19.0 | development |
babel-jestEnvironment{
"local_name": "babel-jest",
"alias": false,
"peer_metadata": null
} | ^25.1.0 | development |
@glif/local-managed-providerEnvironment{
"local_name": "@glif/local-managed-provider",
"alias": false,
"peer_metadata": null
} | ^1.1.0-beta.1 | development |
@glif/filecoin-addressEnvironment{
"local_name": "@glif/filecoin-address",
"alias": false,
"peer_metadata": null
} | ^1.1.0-beta.1 | development |
eslintEnvironment{
"local_name": "eslint",
"alias": false,
"peer_metadata": null
} | ^6.8.0 | development |
eslint-plugin-jestEnvironment{
"local_name": "eslint-plugin-jest",
"alias": false,
"peer_metadata": null
} | ^23.8.2 | development |
eth-sig-utilEnvironment{
"local_name": "eth-sig-util",
"alias": false,
"peer_metadata": null
} | ^2.5.3 | development |
ganache-coreEnvironment{
"local_name": "ganache-core",
"alias": false,
"peer_metadata": null
} | ^2.13.1 | development |
jestEnvironment{
"local_name": "jest",
"alias": false,
"peer_metadata": null
} | ^25.1.0 | development |
typescriptEnvironment{
"local_name": "typescript",
"alias": false,
"peer_metadata": null
} | ^3.9.3 | development |
@zondax/filecoin-signing-toolsEnvironment{
"local_name": "@zondax/filecoin-signing-tools",
"alias": false,
"peer_metadata": null
} | ^0.12.0 | development |
@polkadot/util-cryptoEnvironment{
"local_name": "@polkadot/util-crypto",
"alias": false,
"peer_metadata": null
} | ^3.6.1 | optional |
@zondax/filecoin-signing-toolsEnvironment{
"local_name": "@zondax/filecoin-signing-tools",
"alias": false,
"peer_metadata": null
} | ^0.12.0 | optional |
Source distribution
{
"integrity": "sha512-Uq7gJm7LvIIGy3QB6mL05jpdyioUY93KR58pC2KPyiCaIAJCcyPR7PPP0/qhFD1EHTc7FIDWGJbFmCvdrDSUqg==",
"shasum": "57b55550e709ce5a1afaa0a089ad6b88ce144e61",
"tarball": "https://registry.npmjs.org/3id-blockchain-utils/-/3id-blockchain-utils-1.2.0.tgz",
"fileCount": 46,
"unpackedSize": 94171,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJf0BllCRA9TVsSAnZWagAAtKkP/iYOP056Www6PfpPxTjU\nWVjwTDM4dHaMZJhsvtcTjAy6YOFE10cRFbbaEK3YPssx5o2pvzawszxAzDRK\nPd0vCpHL9CoBzFD1AqO07nq9aL7ylJEaujUqDABrjRGxUPavVRNbbqYvcWFa\noz9J4L1Wn3YL4cPCToPSyYiF9w2VgfZssci6MAbFWu84mqR8vCtG2OHno+GZ\nChvqslyZwL1uMI1rwQ8fss3nKc06HnbCyXPd71gDHE/Uo5ivhwM8kXKQUL2C\nq1qL/tTPT1sLtcQP0u9KPhLY7Z0KTgD2U1FcO98p9SQctQ2YFHbl/Ptw5F1y\nIEfeQDNYrKu1gVlULVGrty7HYVeHG+oshEjNmIA4X23zOxXC1xW+Vp+55ZV7\ndbgmPYeP0Wbvtm6GlOFtWOsf7ox+L43VdfKMR6ib83GPNIz0g7TlFkn2qbh4\nE3tHoUCnWsq4mIoLc6Q5gfP3jkmcPyqz7qENKVdvH83SHebhWs6r31hmLI1V\nVJ1F7EFRrFcCrTtOCAe3+L4hTx/3Qi656t8V6nTSCIfkNupTS0owl1SJr98A\na41gnAShNqUt5DKKAi4QU+VJs3KRW9y935q40eEuiipomStig3asp3GAXHOG\n67ql/xAvGkPWO7lgsEg2TzzPyZZ3syf7YRzSeTSAruksO7lPOiErztzSvTOt\nYJk5\r\n=eZyR\r\n-----END PGP SIGNATURE-----\r\n",
"signatures": [
{
"keyid": "SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA",
"sig": "MEUCIDzw9E5GCOV8d7bykKTRMPSImPjV2Bl3xDjQPXGBAYLNAiEAzbXX1qy7W7MhynwnY9hVeV0a6MmQU+m0WNWeaN8HgYg="
}
]
}Observed since 20 Oct, 19:45 UTC
No superseded metadata states collected. Unchanged observations do not create new revisions.
package_version:cb216d2d3e0027e9e587012eb4b1f30332a4c4f195906ea083e1e7ef3e58e4bf