npm.io
0.1.1-unstable.15 • Published 5 years ago

@did-core/did-dag-cbor

Licence
Apache-2.0
Version
0.1.1-unstable.15
Deps
1
Size
204 kB
Vulns
0
Weekly
0
Stars
9

@did-core/did-dag-cbor

npm i @did-core/did-dag-cbor --save

Usage

import { factory, DidDocument } from '@did-core/data-model';
import { representation } from '@did-core/did-dag-cbor';

const didDocument: DidDocument = factory.build({
  entries: {
    // @context is required for use with jsonld verifiable credentials
    // but technically optional here
    '@context': 'https://www.w3.org/ns/did/v1',
    id: 'did:example:123',
  },
});

const representation: Buffer = await didDocument
  .addRepresentation({ 'application/did+dag+cbor': representation })
  .produce('application/did+dag+cbor');