Package Exports
- @blockcore/identity
- @blockcore/identity/lib/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@blockcore/identity) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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
(These documents are no longer generated by this library, but a prevoius version)