@bedrock/vc-verifier 22.1.0 → 22.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/vcb.js CHANGED
@@ -27,6 +27,8 @@ const SUPPORTED_BARCODE_FORMATS = new Set([
27
27
  'pdf417'
28
28
  ]);
29
29
 
30
+ const TEXT_DECODER = new TextDecoder();
31
+
30
32
  export async function verifyEnvelopedCredential({
31
33
  config, contents, format, checks
32
34
  } = {}) {
@@ -76,6 +78,10 @@ export async function verifyEnvelopedCredential({
76
78
  async function _parseQrCodeEnvelope({
77
79
  contents, documentLoader, typeTableLoader
78
80
  }) {
81
+ // `fromQrCode` requires text, so convert to text as needed
82
+ if(contents instanceof Uint8Array) {
83
+ contents = TEXT_DECODER.decode(contents);
84
+ }
79
85
  const {jsonldDocument: credential} = await util.fromQrCode({
80
86
  text: contents,
81
87
  documentLoader,
package/lib/verify.js CHANGED
@@ -36,9 +36,13 @@ export async function verifyPresentation({
36
36
  const result = await di.verifyPresentation({
37
37
  config, presentation, challenge, domain, checks
38
38
  });
39
- if(result.verified || !result.presentationResult?.verified) {
40
- // the whole VP and all its VCs were verified or the VP itself failed
41
- // verification, so no extra work needed below
39
+ // if the whole VP and all its VCs were verified or if the VP itself
40
+ // was checked and it failed verification, there is no extra work to be
41
+ // done and we can return early; it is important to note that the
42
+ // presence of `presentationResult` must be confirmed here to ensure that
43
+ // if an unprotected presentation was used and this was allowed, the VC
44
+ // checks will continue below
45
+ if(result.verified || result.presentationResult?.verified === false) {
42
46
  return result;
43
47
  }
44
48
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bedrock/vc-verifier",
3
- "version": "22.1.0",
3
+ "version": "22.1.2",
4
4
  "type": "module",
5
5
  "description": "Bedrock VC Verifier",
6
6
  "main": "./lib/index.js",