https://github.com/ceramicnetwork/key-did-provider-ed25519
https://github.com/ceramicnetwork/key-did-provider-ed25519
Last synced: 9 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/ceramicnetwork/key-did-provider-ed25519
- Owner: ceramicnetwork
- License: other
- Created: 2020-11-08T07:40:45.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2023-03-14T23:52:56.000Z (over 3 years ago)
- Last Synced: 2025-01-20T23:06:57.221Z (over 1 year ago)
- Language: TypeScript
- Size: 1.01 MB
- Stars: 20
- Watchers: 6
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
# ed25519 key did provider
This is a DID Provider which implements [EIP2844](https://eips.ethereum.org/EIPS/eip-2844) for `did:key:` using ed25519. It also supports decryption using x25519.
## Installation
```
npm install --save key-did-provider-ed25519
```
## Usage
```js
import { Ed25519Provider } from 'key-did-provider-ed25519'
import KeyResolver from 'key-did-resolver'
import { DID } from 'dids'
const seed = new Uint8Array(...) // 32 bytes with high entropy
const provider = new Ed25519Provider(seed)
const did = new DID({ provider, resolver: KeyResolver.getResolver() })
await did.authenticate()
// log the DID
console.log(did.id)
// create JWS
const { jws, linkedBlock } = await did.createDagJWS({ hello: 'world' })
// verify JWS
await did.verifyJWS(jws)
// create JWE
const jwe = await did.createDagJWE({ very: 'secret' }, [did.id])
// decrypt JWE
const decrypted = await did.decryptDagJWE(jwe)
```
## License
Apache-2.0 OR MIT