0.0.12 • Published 10 months ago

@blockcore/identity v0.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
10 months ago

Blockcore Identity Library (JS)

Library that helps working with DIDs (decentralized identities) on Blockcore and the Blockcore DID Server ("did:is" DID Method).

Usage

npm install @blockcore/identity

Example usage:

const privateKey = Uint8Array.from([
  224, 238, 59, 150, 73, 84, 228, 234, 104, 62, 83, 160, 122, 31, 108, 129, 74, 29, 104, 195, 192, 81, 158, 11, 167,
  100, 217, 121, 110, 12, 178, 14,
]);

const tool = new BlockcoreIdentityTools();
const signer = tool.getSigner(privateKey);
const publicKey = tool.getSchnorrPublicKeyFromPrivateKey(privateKey);
const verificationMethod = tool.getVerificationMethod(publicKey, 1);

const identity = new BlockcoreIdentity(verificationMethod);
const didDocument = identity.document({
  service: [
    {
      id: '#blockexplorer',
      type: 'BlockExplorer',
      serviceEndpoint: 'https://explorer.blockcore.net',
    },
  ],
});

const jws = await identity.sign(signer, { version: 0, didDocument: didDocument });

Building and Testing

The library can be built using TypeScript Compiler, either directly or through npm:

npm run build

To generate and update the example documents, use this command:

npm run examples

This will update the example documents available at test/examples

Examples created by the library

did-configuration.json

did.json

(These documents are no longer generated by this library, but a prevoius version)

Resources

https://w3c.github.io/did-core/

0.0.11

10 months ago

0.0.12

10 months ago

0.0.3

1 year ago

0.0.10

1 year ago

0.0.2

1 year ago

0.0.9

1 year ago

0.0.8

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.7

1 year ago

0.0.6

1 year ago

0.0.1

3 years ago