@identity.com/dids
TypeScript icon, indicating that this package has built-in type declarations

0.1.2 • Public • Published

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.

DIDS uses nvm and yarn

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>')

/@identity.com/dids/

    Package Sidebar

    Install

    npm i @identity.com/dids

    Weekly Downloads

    1

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    226 kB

    Total Files

    16

    Last publish

    Collaborators

    • rleonard333
    • tbarri
    • chriteixeira
    • rado0x54
    • mitchcivic
    • dankelleher
    • flippiescholtz
    • kevinhcolgan
    • pbshoemaker
    • tyronemichael
    • lucmir