{"id":13567121,"url":"https://github.com/uport-project/ethr-did","last_synced_at":"2025-04-04T01:31:05.685Z","repository":{"id":31867778,"uuid":"129323959","full_name":"uport-project/ethr-did","owner":"uport-project","description":"Create ethr DIDs","archived":false,"fork":false,"pushed_at":"2025-03-24T11:28:35.000Z","size":2727,"stargazers_count":282,"open_issues_count":6,"forks_count":60,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-03-24T12:36:18.444Z","etag":null,"topics":["decentralized-identifiers","ethereum","ethereum-addresses","ethr","identity","jwt"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/uport-project.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-04-12T23:55:15.000Z","updated_at":"2025-03-24T11:28:38.000Z","dependencies_parsed_at":"2023-09-24T07:15:01.106Z","dependency_job_id":"d485d475-acaa-4d1e-9751-5f421e243064","html_url":"https://github.com/uport-project/ethr-did","commit_stats":{"total_commits":227,"total_committers":23,"mean_commits":9.869565217391305,"dds":0.7268722466960352,"last_synced_commit":"6002726aabd9034a0588747092da6433c6a06dac"},"previous_names":[],"tags_count":72,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uport-project%2Fethr-did","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uport-project%2Fethr-did/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uport-project%2Fethr-did/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/uport-project%2Fethr-did/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/uport-project","download_url":"https://codeload.github.com/uport-project/ethr-did/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247107816,"owners_count":20884793,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["decentralized-identifiers","ethereum","ethereum-addresses","ethr","identity","jwt"],"created_at":"2024-08-01T13:02:24.209Z","updated_at":"2025-04-04T01:31:03.134Z","avatar_url":"https://github.com/uport-project.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"[![Discord](https://img.shields.io/discord/878293684620234752?logo=discord\u0026logoColor=white\u0026style=flat-square)](https://discord.gg/huwyNfVkhe)\n[![npm](https://img.shields.io/npm/dt/ethr-did.svg)](https://www.npmjs.com/package/ethr-did)\n[![npm](https://img.shields.io/npm/v/ethr-did.svg)](https://www.npmjs.com/package/ethr-did)\n[![GitHub Discussions](https://img.shields.io/github/discussions/uport-project/veramo?style=flat)](https://github.com/uport-project/veramo/discussions)\n[![Twitter Follow](https://img.shields.io/twitter/follow/veramolabs.svg?style=social\u0026label=Follow)](https://twitter.com/veramolabs)\n\n# Ethr-DID Library\n\n[DID Specification](https://w3c.github.io/did-core/) | [ERC-1056](https://github.com/ethereum/EIPs/issues/1056)\n| [Getting Started](/docs/guides/index.md)\n\nThis library conforms to [ERC-1056](https://github.com/ethereum/EIPs/issues/1056) and is intended to use Ethereum\naddresses as fully self-managed [Decentralized Identifiers](https://w3c.github.io/did-core/#identifier) (DIDs), it\nallows you to easily create and manage keys for these identifiers. It also lets you sign standards\ncompliant [JSON Web Tokens (JWT)](https://jwt.io) that can be consumed using\nthe [DID-JWT](https://github.com/decentralized-identity/did-jwt) library.\n\nThis library can be used to create a new ethr-did identifier. It allows ethr-did identifiers to be represented as an\nobject that can perform actions such as updating its DID document, signing messages, and verifying messages from other\nDIDs.\n\nUse this if you are looking for the easiest way to start using ethr-did identifiers, and want high-level abstractions to\naccess its entire range of capabilities. It encapsulates all the functionality\nof [ethr-did-resolver](https://github.com/decentralized-identity/ethr-did-resolver)\nand [ethr-did-registry](https://github.com/uport-project/ethr-did-registry).\n\nA DID is an Identifier that allows you to lookup a DID document that can be used to authenticate you and messages\ncreated by you.\n\nEthr-DID provides a scalable identity method for public keys and Ethereum addresses that gives them the ability to\ncollect on-chain and off-chain data. Because Ethr-DID allows any Ethereum key pair to become a DID, it is more scalable\nand privacy-preserving than smart contract based identity methods, like our\nprevious [Proxy Contract](https://github.com/uport-project/uport-identity/blob/develop/docs/reference/proxy.md).\n\nThis particular DID method relies on the [Ethr-Did-Registry](https://github.com/uport-project/ethr-did-registry). The\nEthr-DID-Registry is a smart contract that facilitates public key resolution for off-chain (and on-chain)\nauthentication. It also facilitates key rotation, delegate assignment and revocation to allow 3rd party signers on a\nkey's behalf, as well as setting and revoking off-chain attribute data. These interactions and events are used in\naggregate to form a DID's DID document using\nthe [Ethr-Did-Resolver](https://github.com/decentralized-identity/ethr-did-resolver)\n.\n\nAn example of a DID document resolved using\nthe [ethr-did-resolver](https://github.com/decentralized-identity/ethr-did-resolver):\n\n```json5\n{\n  '@context': [\n    'https://www.w3.org/ns/did/v1',\n    'https://w3id.org/security/suites/secp256k1recovery-2020/v2'\n  ],\n  id: 'did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a',\n  verificationMethod: [\n    {\n      id: 'did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a#controller',\n      type: 'EcdsaSecp256k1RecoveryMethod2020',\n      controller: 'did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a',\n      blockchainAccountId: 'eip155:1:0xb9c5714089478a327f09197987f16f9e5d936e8a'\n    }\n  ],\n  assertionMethod: [\n    'did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a#controller'\n  ],\n  authentication: [\n    'did:ethr:0xb9c5714089478a327f09197987f16f9e5d936e8a#controller'\n  ]\n}\n```\n\nOn-chain refers to something that queried or modified with a transaction on a blockchain, while off-chain can refer to\nanything from temporary payment channels to IPFS and regular web services.\n\nIt supports the proposed [Decentralized Identifiers](https://w3c.github.io/did-core/) spec from\nthe [W3C Credentials Community Group](https://w3c-ccg.github.io).\n\n## DID Method\n\nA \"DID method\" is a specific implementation of a DID scheme that is identified by a `method name`. In this case, the\nmethod name is `ethr`, and the method identifier is an Ethereum address or a `secp256k1` publicKey.\n\nTo encode a DID for an Ethereum address, simply prepend `did:ethr:`\n\nFor example:\n\n* DID based on an ethereum address: `did:ethr:0xf3beac30c498d9e26865f34fcaa57dbb935b0d74`\n* DID based on a key: `did:ethr:0x0279be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798`\n\n## Configuration\n\n```typescript\nimport { EthrDID } from 'ethr-did'\n\nconst chainNameOrId = 1 // mainnet\nconst provider = InfuraProvider(\"\u003cinfura project ID\u003e\", chainNameOrId)\nconst ethrDid = new EthrDID({ identifier: '0x...', privateKey: '...', provider, chainNameOrId })\n```\n\n| key | description| required |\n|-----|------------|----------|\n|`identifier`|Ethereum address, public key or a full `did:ethr` representing Identity| yes |\n|`chainNameOrId`|The name or chainId of the ethereum network (defaults to 'mainnet') | no, but recommended |\n|`registry`| registry address (defaults to `0xdca7ef03e98e0dc2b855be647c39abe984fcf21b`) | no |\n|`provider`| web3 provider | either `provider` or `web3` or `rpcUrl` |\n|`web3`| preconfigured web3 object | either `provider` or `web3` or `rpcUrl` |\n|`rpcUrl`| JSON-RPC endpoint url | either `provider` or `web3` or `rpcUrl` |\n|`signer`| [JWS Signing function](https://github.com/uport-project/did-jwt#signer-functions)| either `signer` or `privateKey` |\n|`txSigner`| [Ethers.js Signer](https://docs.ethers.io/v5/api/signer/#Signer)| either `txSigner` or `privateKey` |\n|`privateKey`| Hex encoded private key | yes* |\n\n### Important notes on keys and signers\n\nIf `privateKey` is specified, then `signer` and `txSigner` don't need to be used. Otherwise, a `txSigner` is required to\nperform CRUD operations on the DID document, and a `signer` is required to sign JWTs. To generate valid JWT,\nthe `signer` must use one of the keys listed in the DID document. To be able to perform CRUD operations, the `txSigner`\nmust be backed by the key that governs the `owner` property.\nSee https://github.com/uport-project/ethr-did-registry#looking-up-identity-ownership\n\n## Notes\n\n### Readonly ethr-did\n\nAn instance created using only an address or publicKey (without access to a privateKey or to signers) can only be used\nto encapsulate an external ethr-did . This instance will not have the ability to sign anything, but it can be used for a\nsubset of actions:\n\n* provide its own address (`ethrDid.address`)\n* provide the full DID string (`ethrDid.did`)\n* lookup its owner `await ethrDid.lookupOwner()`\n* verify a JWT `await ethrDid.verifyJwt(jwt)`\n\n### Multiple ethereum networks\n\nEthrDid can be configured to control a DID on any ethereum network. To do this, you mush specify the `chainNameOrId`\nduring construction. Example:\n\n```ts\nconsole.log(new EthrDID({ identifier: '0xb9c5714089478a327f09197987f16f9e5d936e8a', chainNameOrId: 'goerli' }).did)\n// did:ethr:goerli:0xB9C5714089478a327F09197987f16f9E5d936E8a\n```\n\nIf this property is not specified, then the library will attempt to infer it from the `provider` configuration or from\nthe `identifier` if it is specified as a DID. But, be warned that it may lead to inconsistencies since the inference is\nnot perfect. It is highly recommended that you use a `chainNameOrId` property to match the `provider`.\n\n### More\n\nSee [the guide](./docs/guides/index.md) to get a better idea about the capabilities of this lib. And, of course, make\nsure to familiarize yourself with\nthe [`did:ethr` spec](https://github.com/decentralized-identity/ethr-did-resolver/blob/master/doc/did-method-spec.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuport-project%2Fethr-did","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fuport-project%2Fethr-did","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fuport-project%2Fethr-did/lists"}