Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Readme #337

Merged
merged 5 commits into from
Dec 7, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 4 additions & 14 deletions packages/credentials/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:
frankhinek marked this conversation as resolved.
Show resolved Hide resolved
```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
frankhinek marked this conversation as resolved.
Show resolved Hide resolved
```javascript
const vcJwt = vc.sign(signOptions)
const vcJwt = vc.sign({did:issuer})
frankhinek marked this conversation as resolved.
Show resolved Hide resolved
```

### Verifying a Verifiable Credential
Expand Down
Loading