Skip to content

v5.0.0

Compare
Choose a tag to compare
@poet-ci poet-ci released this 10 Oct 00:58
· 112 commits to master since this release
9fe5933

5.0.0 (2018-10-10)

Features

  • sign verifiable claims with jsonld-signatures (9fe5933)

BREAKING CHANGES

  • the mechanism to create a verifiable claim and sign it has changed dramatically.

Refer to the README for details. Use the method below to create a claim.

import { configureCreateVerifiableClaim, createIssuerFromPrivateKey, getVerifiableClaimSigner } from '@po.et/poet-js'

const { configureSignVerifiableClaim } = getVerifiableClaimSigner()

const issuerPrivateKey = '<Ed25519Base58PrivateKey>' 
const issuer = createIssuerFromPrivateKey(issuerPrivateKey)

const createVerifiableWorkClaim = configureCreateVerifiableClaim({ issuer })
const signVerifiableClaim = configureSignVerifiableClaim({ privateKey: issuerPrivateKey })

const workClaim = {
  name: 'The Raven',
  author: 'Edgar Allan Poe',
  tags: 'poem',
  dateCreated: '',
  datePublished: '1845-01-29T03:00:00.000Z',
  archiveUrl: 'https://example.com/raven',
  hash: '<hash of content>',
}

const unsignedVerifiableClaim = await createVerifiableWorkClaim(workClaim)
const signedWorkClaim = await signVerifiableClaim(unsignedVerifiableClaim)