From 00425b6dba2c74748acded394fac749fcccd5bb0 Mon Sep 17 00:00:00 2001 From: nitro-neal <5314059+nitro-neal@users.noreply.github.com> Date: Thu, 7 Dec 2023 13:23:36 -0600 Subject: [PATCH] Update Readme (#337) * add readme * Update packages/credentials/README.md * Update packages/credentials/README.md * Update packages/credentials/README.md * Update packages/credentials/README.md --------- Co-authored-by: Frank Hinek --- packages/credentials/README.md | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/packages/credentials/README.md b/packages/credentials/README.md index 54580c164..e597abc3a 100644 --- a/packages/credentials/README.md +++ b/packages/credentials/README.md @@ -41,27 +41,17 @@ const vc = new VerifiableCredential({ ### Signing a Verifiable Credential Sign a `VerifiableCredential` with a DID: -- `signOptions`: The sign options used to sign the credential. +- `did`: The did that is signing the VC -First create a SignOptions object as follows: +First create a `Did` object as follows: ```javascript -import { Ed25519, Jose } from '@web5/crypto'; import { DidKeyMethod } from '@web5/dids'; - const issuer = await DidKeyMethod.create(); -const privateKey = (await Jose.jwkToKey({ key: issuer.keySet.verificationMethodKeys![0].privateKeyJwk! })).keyMaterial; - -const signOptions = { - issuerDid: issuer.did, - subjectDid: "did:example:subject", - kid: `${issuer.did}#${issuer.did.split(':')[2]}`, - signer: async (data) => await Ed25519.sign({ data, key: privateKey }) -}; ``` -Then sign the VC using the signoptions object +Then sign the VC using the `did` object ```javascript -const vcJwt = vc.sign(signOptions) +const vcJwt = vc.sign({ did: issuer }); ``` ### Verifying a Verifiable Credential