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 read me imports #186

Merged
merged 3 commits into from
Aug 15, 2024
Merged
Changes from all commits
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
12 changes: 9 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ For signing, when setting up a signature suite, you will need to pass in
a key pair containing a private key.

```js
import vc from '@digitalbazaar/vc';
import * as vc from '@digitalbazaar/vc';

// Required to set up a suite instance with private key
import {Ed25519VerificationKey2020} from
Expand All @@ -94,7 +94,7 @@ Pre-requisites:
Document and Public Key

```js
const vc = require('@digitalbazaar/vc');
import * as vc from '@digitalbazaar/vc';

// Sample unsigned credential
const credential = {
Expand Down Expand Up @@ -477,8 +477,8 @@ Pre-requisites:
// by requiring this first you ensure security
// contexts are loaded from jsonld-signatures
// and not an insecure source.
import * as vc from '@digitalbazaar/vc';
const {extendContextLoader} = require('jsonld-signatures');
const vc = require('@digitalbazaar/vc');
// @digitalbazaar/vc exports its own secure documentLoader.
const {defaultDocumentLoader} = vc;
// a valid json-ld @context.
Expand Down Expand Up @@ -516,6 +516,8 @@ Once you've created the presentation (either via `createPresentation()` or
manually), you can sign it using `signPresentation()`:

```js
import * as vc from '@digitalbazaar/vc';

const vp = await vc.signPresentation({
presentation, suite, challenge, documentLoader
});
Expand Down Expand Up @@ -578,6 +580,8 @@ Pre-requisites:
To verify a verifiable presentation:

```js
import * as vc from '@digitalbazaar/vc';

// challenge has been received from the requesting party - see 'challenge'
// section below

Expand All @@ -590,6 +594,8 @@ To verify an unsigned presentation, you must set the `unsignedPresentation`
flag:

```js
import * as vc from '@digitalbazaar/vc';

const result = await vc.verify({
presentation, suite, documentLoader, unsignedPresentation: true
});
Expand Down
Loading