From cc51441e694c6e5f01059d0dfe7066d9b4061bcd Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 15 Aug 2024 08:02:45 -0400 Subject: [PATCH 1/3] Use import * as vc for all es6 imports in README. --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f098de99..116edca8 100644 --- a/README.md +++ b/README.md @@ -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 From 570347b53a00b8476c44da4c9e092cbf273bebb2 Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 15 Aug 2024 08:04:30 -0400 Subject: [PATCH 2/3] Remove 2 require statements from README. --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 116edca8..777570a6 100644 --- a/README.md +++ b/README.md @@ -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 = { @@ -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. From 5994f51b8f076dce4f192ef7145b69f853b24f4e Mon Sep 17 00:00:00 2001 From: Andrew Jones Date: Thu, 15 Aug 2024 08:09:55 -0400 Subject: [PATCH 3/3] Add more import * as vc to README. --- README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/README.md b/README.md index 777570a6..1a99799d 100644 --- a/README.md +++ b/README.md @@ -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 }); @@ -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 @@ -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 });