@identity.com/dids
v0.1.2
Published
This library is a simple client library for generating DIDs for use with Solana applications.
Downloads
9
Maintainers
Keywords
Readme
DIDS (Decentralized Identity library for Solana)
This library is a simple client library for generating DIDs for use with Solana applications.
It supports two DID methods:
- did-key: A static DID method based on X25519 ECC Curve keys, that are compatible with Solana public keys.
- did-sol: A Solana-native DID method.
Quick Start
To register a DID from a Solana public key:
const DIDs = require('@identity.com/dids');
const dids = new DIDs({ payer: payerAccount.secretKey });
const owner = new Account().publicKey;
const keyIdentifier = await dids.register('key', owner);
const solIdentifier = await dids.register('sol', owner);
To retrieve a DID document:
const identifier = 'did:key:z6MkszyYuyjZ31XZKXT4qdb5HqsWjAZGZoVvGzsoX1Tnno9s';
const document = await dids.get(identifier);
For more examples, see tests/index.test.ts
Testing & Development
Note: Before contributing to this project, please check out the code of conduct and contributing guidelines.
nvm i
yarn
Running the tests
DIDS uses the mocha and chai test libraries
Run the tests using:
yarn test
Note: DIDS was bootstrapped and is packaged using TSDX, which includes Jest. Jest has a bug when importing some dependencies of this project, so mocha is used instead.
Repl
To test using the repl, run
yarn repl
Then try:
await dids.register('sol', new Account().publicKey)
await dids.register('key', new Account().publicKey)
await dids.get('<YOUR IDENTIFIER HERE>')