@blockcerts/blockcerts-verifier 1.71.1 → 1.72.0

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.
Files changed (36) hide show
  1. package/bundle-stats.html +1 -1
  2. package/dist/{DataIntegrityProof-elCNKq16-DBDuaDNt.js → DataIntegrityProof-CsicZNrL-BkSRjzkI.js} +1 -1
  3. package/dist/{EcdsaSd2023-B0XPAIp6-K61axvBA.js → EcdsaSd2023-DN9HBdgh-Bc0hVwTd.js} +4 -4
  4. package/dist/EcdsaSecp256k1Signature2019-C3F03t_M-DAJeMTpu.js +1 -0
  5. package/dist/{Ed25519Signature2020-BQsESRnS-TKZI_1AX.js → Ed25519Signature2020-CglkQLKN-CQ6lMzyG.js} +2 -2
  6. package/dist/{EddsaRdfc2022-DQKzWHK4-BILzDBp-.js → EddsaRdfc2022-CfoLi-PP-l7ITLQQT.js} +2 -2
  7. package/dist/{MerkleProof2017-CYM8CJHB-FYpMvld0.js → MerkleProof2017-B_EJmYja-CYd4dJc1.js} +1 -1
  8. package/dist/{MerkleProof2019-BLrywo8h-Bo9rH2Eq.js → MerkleProof2019-B7t13hOo-D8n9YrUw.js} +1 -1
  9. package/dist/{checkCredentialSchemaConformity-CKNtOu_t-B9iaCRUE.js → checkCredentialSchemaConformity-BiggGGMP-Dx992E4t.js} +1 -1
  10. package/dist/{controlVerificationMethod-B4TgLED0-BGpxLjMq.js → controlVerificationMethod-Bh_-e0Fd-BUCC8ctY.js} +1 -1
  11. package/dist/{did-key-common.esm-BIftA62j-hVrUMxjy.js → did-key-common.esm-BELyYVSE-Cqrpf7cy.js} +3 -3
  12. package/dist/{did-key-ed25519.esm-Drn3Y7PF-CqD0ifNk.js → did-key-ed25519.esm-C3GUddDp-BJdBgNDg.js} +1 -1
  13. package/dist/{did-key-secp256k1.esm-DH-f3o5q-C66E7IxB.js → did-key-secp256k1.esm-D-R266jM-BTxlD5VW.js} +1 -1
  14. package/dist/{ed25519-key-pair.esm-DPOFpdJ2-BrwuS0Ia.js → ed25519-key-pair.esm-DQF2kkXh-XX5BXBcl.js} +3 -3
  15. package/dist/{elliptic-BYqApR8Y-CKp7atgR.js → elliptic-6I21PEnR-CsYseRX1.js} +1 -1
  16. package/dist/{index-BgTFEYQ4-DMaz98iZ.js → index-DXh-XAic-B2gT500V.js} +5 -5
  17. package/dist/{index-lyuTDW_o-nyi7dklX.js → index-fQcSLZgh-DpptYyN8.js} +1 -1
  18. package/dist/{jsonld-signatures-BbILf-Q7-DTp6__ud.js → jsonld-signatures-BbHr1fSN-BSospRuX.js} +5 -5
  19. package/dist/{keyUtils-ExMI0fmg-NVOmd8LH.js → keyUtils-ue8EY3Op-DoHdKWgN.js} +1 -1
  20. package/dist/main.js +45 -45
  21. package/dist/{retrieveVerificationMethodPublicKey-C5Gafl1E-Lv4waRy7.js → retrieveVerificationMethodPublicKey-CLBY4G8P-CagFGnNt.js} +1 -1
  22. package/dist/verifyIssuerProfile-BaiZaU2c-Zcu1X0PY.js +1 -0
  23. package/package.json +5 -5
  24. package/dist/EcdsaSecp256k1Signature2019-BHgoxmKI-DT2qHZod.js +0 -1
  25. package/dist/verifyIssuerProfile-DCJyz3ho-BwuCK9F3.js +0 -1
  26. /package/dist/{HashlinkVerifier-BsVlaml5-B4Niv2-b.js → HashlinkVerifier-CTG-OS14-B4Niv2-b.js} +0 -0
  27. /package/dist/{checkRevocationStatusList2021-CMAVXAVE-BEBD8TO8.js → checkRevocationStatusList2021-BDBFhnz6-BEBD8TO8.js} +0 -0
  28. /package/dist/{elliptic-4aZS_cwf-BpaNaVm0.js → elliptic-mDX7fQQx-BpaNaVm0.js} +0 -0
  29. /package/dist/{ensureNotRevoked-hGps0prO-DvMIgM4L.js → ensureNotRevoked-Dc6VA2bO-DvMIgM4L.js} +0 -0
  30. /package/dist/{ensureValidIssuingKey-BMVCi2T2-BdV46XBb.js → ensureValidIssuingKey-wTUvNuDH-BdV46XBb.js} +0 -0
  31. /package/dist/{index-CQYVZlSE-C0eXpZGn.js → index-BrurC4Vt-C0eXpZGn.js} +0 -0
  32. /package/dist/{index-BS134367-Dgus2xdV.js → index-Gr4i_Ned-Dgus2xdV.js} +0 -0
  33. /package/dist/{jsonld-B_Q2jvnp-BJ5uVeOU.js → jsonld-BAMY2WqE-BJ5uVeOU.js} +0 -0
  34. /package/dist/{sha256-u2xsd4MQ-C1PUWFZm.js → sha256-Bwge_vjI-C1PUWFZm.js} +0 -0
  35. /package/dist/{webcrypto.es-DpqeDikX-BnVhHKeM.js → webcrypto.es-DptGOl2T-BnVhHKeM.js} +0 -0
  36. /package/dist/{x25519-Kp6t9B5a-Dh8L0KYb.js → x25519-hG3WOzPe-Dh8L0KYb.js} +0 -0
@@ -1,4 +1,4 @@
1
- import{d as e,e as t}from"./index-DZLKRa_V-D_IQzjvG.js";import{d as r}from"./base64url-Cy03LJLt-vkTPfQOh.js";import{g as i}from"./main.js";import{r as n}from"./elliptic-4aZS_cwf-BpaNaVm0.js";
1
+ import{d as e,e as t}from"./index-DZLKRa_V-D_IQzjvG.js";import{d as r}from"./base64url-Cy03LJLt-vkTPfQOh.js";import{g as i}from"./main.js";import{r as n}from"./elliptic-mDX7fQQx-BpaNaVm0.js";
2
2
  /*!
3
3
  * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
4
4
  */
@@ -9,14 +9,14 @@ const c="ECDSA",u=!0,y="https://w3id.org/security/suites/ecdsa-2019/v1",o="https
9
9
  /*!
10
10
  * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
11
11
  */
12
- const D=new Map([[m,{secret:new Uint8Array([48,103,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,77,48,75,2,1,1,4,32]),public:new Uint8Array([161,36,3,34,0])}],[d,{secret:new Uint8Array([48,129,132,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,109,48,107,2,1,1,4,48]),public:new Uint8Array([161,52,3,50,0])}],[h,{secret:new Uint8Array([48,129,170,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,129,146,48,129,143,2,1,1,4,66]),public:new Uint8Array([161,70,3,68,0])}],[g,{secret:new Uint8Array([48,129,132,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10,4,109,48,107,2,1,1,4,32]),public:new Uint8Array([161,68,3,66,0])}]]),S=new Map([[m,new Uint8Array([48,57,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,34,0])],[d,new Uint8Array([48,70,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,3,50,0])],[h,new Uint8Array([48,88,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,3,68,0])],[g,new Uint8Array([48,86,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10,3,66,0])]]);function q(e){const t=new P.ec("secp256k1");return Uint8Array.from(t.keyFromPublic(e).getPublic(!1,"array"))}async function $({id:t,controller:r,secretKeyMultibase:i,publicKeyMultibase:n,keyAgreement:y=!1}){if(!n)throw new TypeError('The "publicKeyMultibase" property is required.');const o={id:t,controller:r};if(!n||"string"!=typeof n||n[0]!==s)throw new TypeError('"publicKeyMultibase" must be a multibase, base58-encoded string.');const a=e(n.slice(1)),l={name:y?"ECDH":c,namedCurve:j({publicMultikey:a})},p=function({publicMultikey:e}){const t=j({publicMultikey:e});let r=e.subarray(2);t===g&&(r=q(r));return function({curve:e,publicKey:t}){const r=S.get(e),i=new Uint8Array(r.length+t.length);let n=0;return i.set(r,n),n+=r.length,i.set(t,n),i}
12
+ const D=new Map([[m,{secret:new Uint8Array([48,103,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,77,48,75,2,1,1,4,32]),public:new Uint8Array([161,36,3,34,0])}],[d,{secret:new Uint8Array([48,129,132,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,109,48,107,2,1,1,4,48]),public:new Uint8Array([161,52,3,50,0])}],[h,{secret:new Uint8Array([48,129,170,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,129,146,48,129,143,2,1,1,4,66]),public:new Uint8Array([161,70,3,68,0])}],[g,{secret:new Uint8Array([48,129,132,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10,4,109,48,107,2,1,1,4,32]),public:new Uint8Array([161,68,3,66,0])}]]),S=new Map([[m,new Uint8Array([48,57,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,3,34,0])],[d,new Uint8Array([48,70,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,3,50,0])],[h,new Uint8Array([48,88,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,3,68,0])],[g,new Uint8Array([48,86,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,10,3,66,0])]]);function $(e){const t=new P.ec("secp256k1");return Uint8Array.from(t.keyFromPublic(e).getPublic(!1,"array"))}async function O({id:t,controller:r,secretKeyMultibase:i,publicKeyMultibase:n,keyAgreement:y=!1}){if(!n)throw new TypeError('The "publicKeyMultibase" property is required.');const o={id:t,controller:r};if(!n||"string"!=typeof n||n[0]!==s)throw new TypeError('"publicKeyMultibase" must be a multibase, base58-encoded string.');const a=e(n.slice(1)),l={name:y?"ECDH":c,namedCurve:j({publicMultikey:a})},p=function({publicMultikey:e}){const t=j({publicMultikey:e});let r=e.subarray(2);t===g&&(r=$(r));return function({curve:e,publicKey:t}){const r=S.get(e),i=new Uint8Array(r.length+t.length);let n=0;return i.set(r,n),n+=r.length,i.set(t,n),i}
13
13
  /*!
14
14
  * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
15
- */({curve:t,publicKey:r})}({publicMultikey:a}),w=y?[]:["verify"];if(l.namedCurve===g){const{Crypto:e}=await import("./webcrypto.es-DpqeDikX-BnVhHKeM.js"),t=new e;o.publicKey=await t.subtle.importKey("spki",p,l,u,w)}else o.publicKey=await E.subtle.importKey("spki",p,l,u,w);if(i){if("string"!=typeof i||i[0]!==s)throw new TypeError('"secretKeyMultibase" must be a multibase, base58-encoded string.');const t=e(i.slice(1));!function({secretMultikey:e,publicMultikey:t}){const r=j({publicMultikey:t}),i=x({secretMultikey:e});if(r!==i)throw new Error(`Public key curve ('${r}') does not match secret key curve ('${i}').`)}({secretMultikey:t,publicMultikey:a});const r=function({secretMultikey:e,publicMultikey:t}){const r=x({secretMultikey:e}),i=e.subarray(2),n=t.subarray(2);return function({curve:e,secretKey:t,publicKey:r}){const i=D.get(e);if(!i)throw new Error(`Unsupported curve "${e}".`);e===g&&(r=q(r));const n=new Uint8Array(i.secret.length+t.length+i.public.length+r.length);let c=0;return n.set(i.secret,c),c+=i.secret.length,n.set(t,c),c+=t.length,n.set(i.public,c),c+=i.public.length,n.set(r,c),n}({curve:r,secretKey:i,publicKey:n})}({secretMultikey:t,publicMultikey:a}),n=y?["deriveBits"]:["sign"];if(l.namedCurve===g){const{Crypto:e}=await import("./webcrypto.es-DpqeDikX-BnVhHKeM.js"),t=new e;o.secretKey=await t.subtle.importKey("pkcs8",r,l,u,n)}else o.secretKey=await E.subtle.importKey("pkcs8",r,l,u,n)}return o}function X({jwk:e}={}){if("EC"!==e?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:i}=e,n=T({curve:i}),c=r(e.x),u=r(e.y),y=new Uint8Array(2+(n+1));!function({curve:e,buffer:t}){if(e===m)t[0]=l[0],t[1]=l[1];else if(e===d)t[0]=p[0],t[1]=p[1];else if(e===h)t[0]=w[0],t[1]=w[1];else{if(e!==g)throw new TypeError(`Unsupported curve "${e}".`);t[0]=a[0],t[1]=a[1]}}({curve:i,buffer:y});const o=u[u.length-1]%2==0;y[2]=o?2:3,y.set(c,y.length-c.length);return s+t(y)}function H({jwk:e}={}){if("EC"!==e?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:i}=e,n=T({curve:i}),c=r(e.d),u=new Uint8Array(2+n);!function({curve:e,buffer:t}){if(e===m)t[0]=f[0],t[1]=f[1];else if(e===d)t[0]=k[0],t[1]=k[1];else if(e===h)t[0]=K[0],t[1]=K[1];else{if(e!==g)throw new TypeError(`Unsupported curve "${e}".`);t[0]=b[0],t[1]=b[1]}}({curve:e.crv,buffer:u}),u.set(c,u.length-c.length);return s+t(u)}const V=new Set(["EcdsaSecp256r1VerificationKey2019","EcdsaSecp384r1VerificationKey2019","EcdsaSecp521r1VerificationKey2019","EcdsaSecp256k1VerificationKey2019"]);async function B({keyPair:e}){if(!V.has(e.type))throw new TypeError(`Unsupported key type "${e.type}".`);if(e["@context"]||(e["@context"]=y),!function({document:e,contextUrl:t}){const r=e["@context"];return r===t||Array.isArray(r)&&r.includes(t)}
15
+ */({curve:t,publicKey:r})}({publicMultikey:a}),w=y?[]:["verify"];if(l.namedCurve===g){const{Crypto:e}=await import("./webcrypto.es-DptGOl2T-BnVhHKeM.js"),t=new e;o.publicKey=await t.subtle.importKey("spki",p,l,u,w)}else o.publicKey=await E.subtle.importKey("spki",p,l,u,w);if(i){if("string"!=typeof i||i[0]!==s)throw new TypeError('"secretKeyMultibase" must be a multibase, base58-encoded string.');const t=e(i.slice(1));!function({secretMultikey:e,publicMultikey:t}){const r=j({publicMultikey:t}),i=x({secretMultikey:e});if(r!==i)throw new Error(`Public key curve ('${r}') does not match secret key curve ('${i}').`)}({secretMultikey:t,publicMultikey:a});const r=function({secretMultikey:e,publicMultikey:t}){const r=x({secretMultikey:e}),i=e.subarray(2),n=t.subarray(2);return function({curve:e,secretKey:t,publicKey:r}){const i=D.get(e);if(!i)throw new Error(`Unsupported curve "${e}".`);e===g&&(r=$(r));const n=new Uint8Array(i.secret.length+t.length+i.public.length+r.length);let c=0;return n.set(i.secret,c),c+=i.secret.length,n.set(t,c),c+=t.length,n.set(i.public,c),c+=i.public.length,n.set(r,c),n}({curve:r,secretKey:i,publicKey:n})}({secretMultikey:t,publicMultikey:a}),n=y?["deriveBits"]:["sign"];if(l.namedCurve===g){const{Crypto:e}=await import("./webcrypto.es-DptGOl2T-BnVhHKeM.js"),t=new e;o.secretKey=await t.subtle.importKey("pkcs8",r,l,u,n)}else o.secretKey=await E.subtle.importKey("pkcs8",r,l,u,n)}return o}function G({jwk:e}={}){if("EC"!==e?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:i}=e,n=T({curve:i}),c=r(e.x),u=r(e.y),y=new Uint8Array(2+(n+1));!function({curve:e,buffer:t}){if(e===m)t[0]=l[0],t[1]=l[1];else if(e===d)t[0]=p[0],t[1]=p[1];else if(e===h)t[0]=w[0],t[1]=w[1];else{if(e!==g)throw new TypeError(`Unsupported curve "${e}".`);t[0]=a[0],t[1]=a[1]}}({curve:i,buffer:y});const o=u[u.length-1]%2==0;y[2]=o?2:3,y.set(c,y.length-c.length);return s+t(y)}function H({jwk:e}={}){if("EC"!==e?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:i}=e,n=T({curve:i}),c=r(e.d),u=new Uint8Array(2+n);!function({curve:e,buffer:t}){if(e===m)t[0]=f[0],t[1]=f[1];else if(e===d)t[0]=k[0],t[1]=k[1];else if(e===h)t[0]=K[0],t[1]=K[1];else{if(e!==g)throw new TypeError(`Unsupported curve "${e}".`);t[0]=b[0],t[1]=b[1]}}({curve:e.crv,buffer:u}),u.set(c,u.length-c.length);return s+t(u)}const q=new Set(["EcdsaSecp256r1VerificationKey2019","EcdsaSecp384r1VerificationKey2019","EcdsaSecp521r1VerificationKey2019","EcdsaSecp256k1VerificationKey2019"]);async function V({keyPair:e}){if(!q.has(e.type))throw new TypeError(`Unsupported key type "${e.type}".`);if(e["@context"]||(e["@context"]=y),!function({document:e,contextUrl:t}){const r=e["@context"];return r===t||Array.isArray(r)&&r.includes(t)}
16
16
  /*!
17
17
  * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
18
- */({document:e,contextUrl:y}))throw new TypeError(`Context not supported "${e["@context"]}".`);return{"@context":o,id:e.id,type:"Multikey",controller:e.controller,publicKeyMultibase:e.publicKeyMultibase,secretKeyMultibase:e.secretKeyMultibase}}async function _(e,t={}){"boolean"==typeof t&&(t={keyAgreement:t});const{keyAgreement:r}=t;let i={...e};if("Multikey"!==i.type){if(i.publicKeyJwk)return async function({jwk:e,secretKey:t=!1}={}){const r={"@context":o,type:"Multikey",publicKeyMultibase:X({jwk:e})};t&&e.d&&(r.secretKeyMultibase=H({jwk:e}));const i=!e.key_ops||e.key_ops.includes("deriveBits");return _(r,i)}({jwk:i.publicKeyJwk,secretKey:!1});if(i.type)return i=await B({keyPair:i}),L({keyPair:i,keyAgreement:r})}return i.type||(i.type="Multikey"),i["@context"]||(i["@context"]=o),i.controller&&!i.id&&(i.id=`${e.controller}#${e.publicKeyMultibase}`),function(e){if(!e||"object"!=typeof e)throw new TypeError('"key" must be an object.');if("Multikey"!==e.type)throw new TypeError('"key" must be a Multikey with type "Multikey".');if(!(e["@context"]===o||Array.isArray(e["@context"])&&e["@context"].includes(o)))throw new TypeError(`"key" must be a Multikey with context "${o}".`)}(i),L({keyPair:i,keyAgreement:r})}async function J({keyPair:e,secretKey:t=!1}={}){e?.publicKey instanceof U||(e=await $(e));const r=t&&!!e.secretKey?e.secretKey:e.publicKey;let i;if(e.publicKey.algorithm.namedCurve===g){const{Crypto:e}=await import("./webcrypto.es-DpqeDikX-BnVhHKeM.js"),t=new e;i=await t.subtle.exportKey("jwk",r)}else i=await E.subtle.exportKey("jwk",r);return i}async function L({keyPair:e,keyAgreement:t=!1}){e?.publicKey instanceof U||e.publicKey?.algorithm.namedCurve===g||(e=await $(e));const i=async({publicKey:t=!0,secretKey:i=!1,includeContext:n=!0,raw:c=!1}={})=>{if(c){const n=await J({keyPair:e,secretKey:i}),c={};return t&&(c.publicKey=function({jwk:e}={}){if("EC"!==e?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:t}=e,i=T({curve:t}),n=r(e.x),c=r(e.y),u=new Uint8Array(i+1),y=c[c.length-1]%2==0;return u[0]=y?2:3,u.set(n,u.length-n.length),u}({jwk:n})),i&&(c.secretKey=function({jwk:e}={}){if("EC"!==e?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:t}=e,i=T({curve:t}),n=r(e.d),c=new Uint8Array(i);return c.set(n,c.length-n.length),c}({jwk:n})),c}return async function({keyPair:e,secretKey:t,publicKey:r,includeContext:i}={}){if(!r&&!t)throw new TypeError('Export requires specifying either "publicKey" or "secretKey".');const n=t&&!!e.secretKey,c=n?e.secretKey:e.publicKey;let u;if(c.algorithm.namedCurve===g){const{Crypto:e}=await import("./webcrypto.es-DpqeDikX-BnVhHKeM.js"),t=new e;u=await t.subtle.exportKey("jwk",c)}else u=await E.subtle.exportKey("jwk",c);const y={};return i&&(y["@context"]=o),y.id=e.id,y.type="Multikey",y.controller=e.controller,r&&(y.publicKeyMultibase=X({jwk:u})),n&&(y.secretKeyMultibase=H({jwk:u})),y}({keyPair:e,publicKey:t,secretKey:i,includeContext:n})},{publicKeyMultibase:n,secretKeyMultibase:u}=await i({publicKey:!0,secretKey:!0,includeContext:!0});return e={...e,publicKeyMultibase:n,secretKeyMultibase:u,keyAgreement:t,export:i,signer(){const{id:t,secretKey:r}=e;
18
+ */({document:e,contextUrl:y}))throw new TypeError(`Context not supported "${e["@context"]}".`);return{"@context":o,id:e.id,type:"Multikey",controller:e.controller,publicKeyMultibase:e.publicKeyMultibase,secretKeyMultibase:e.secretKeyMultibase}}async function B(e,t={}){"boolean"==typeof t&&(t={keyAgreement:t});const{keyAgreement:r}=t;let i={...e};if("Multikey"!==i.type){if(i.publicKeyJwk)return async function({jwk:e,secretKey:t=!1}={}){const r={"@context":o,type:"Multikey",publicKeyMultibase:G({jwk:e})};t&&e.d&&(r.secretKeyMultibase=H({jwk:e}));const i=!e.key_ops||e.key_ops.includes("deriveBits");return B(r,i)}({jwk:i.publicKeyJwk,secretKey:!1});if(i.type)return i=await V({keyPair:i}),L({keyPair:i,keyAgreement:r})}return i.type||(i.type="Multikey"),i["@context"]||(i["@context"]=o),i.controller&&!i.id&&(i.id=`${e.controller}#${e.publicKeyMultibase}`),function(e){if(!e||"object"!=typeof e)throw new TypeError('"key" must be an object.');if("Multikey"!==e.type)throw new TypeError('"key" must be a Multikey with type "Multikey".');if(!(e["@context"]===o||Array.isArray(e["@context"])&&e["@context"].includes(o)))throw new TypeError(`"key" must be a Multikey with context "${o}".`)}(i),L({keyPair:i,keyAgreement:r})}async function J({keyPair:e,secretKey:t=!1}={}){e?.publicKey instanceof U||(e=await O(e));const r=t&&!!e.secretKey?e.secretKey:e.publicKey;let i;if(e.publicKey.algorithm.namedCurve===g){const{Crypto:e}=await import("./webcrypto.es-DptGOl2T-BnVhHKeM.js"),t=new e;i=await t.subtle.exportKey("jwk",r)}else i=await E.subtle.exportKey("jwk",r);return i}async function L({keyPair:e,keyAgreement:t=!1}){e?.publicKey instanceof U||e.publicKey?.algorithm.namedCurve===g||(e=await O(e));const i=async({publicKey:t=!0,secretKey:i=!1,includeContext:n=!0,raw:c=!1}={})=>{if(c){const n=await J({keyPair:e,secretKey:i}),c={};return t&&(c.publicKey=function({jwk:e}={}){if("EC"!==e?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:t}=e,i=T({curve:t}),n=r(e.x),c=r(e.y),u=new Uint8Array(i+1),y=c[c.length-1]%2==0;return u[0]=y?2:3,u.set(n,u.length-n.length),u}({jwk:n})),i&&(c.secretKey=function({jwk:e}={}){if("EC"!==e?.kty)throw new TypeError('"jwk.kty" must be "EC".');const{crv:t}=e,i=T({curve:t}),n=r(e.d),c=new Uint8Array(i);return c.set(n,c.length-n.length),c}({jwk:n})),c}return async function({keyPair:e,secretKey:t,publicKey:r,includeContext:i}={}){if(!r&&!t)throw new TypeError('Export requires specifying either "publicKey" or "secretKey".');const n=t&&!!e.secretKey,c=n?e.secretKey:e.publicKey;let u;if(c.algorithm.namedCurve===g){const{Crypto:e}=await import("./webcrypto.es-DptGOl2T-BnVhHKeM.js"),t=new e;u=await t.subtle.exportKey("jwk",c)}else u=await E.subtle.exportKey("jwk",c);const y={};return i&&(y["@context"]=o),y.id=e.id,y.type="Multikey",y.controller=e.controller,r&&(y.publicKeyMultibase=G({jwk:u})),n&&(y.secretKeyMultibase=H({jwk:u})),y}({keyPair:e,publicKey:t,secretKey:i,includeContext:n})},{publicKeyMultibase:n,secretKeyMultibase:u}=await i({publicKey:!0,secretKey:!0,includeContext:!0});return e={...e,publicKeyMultibase:n,secretKeyMultibase:u,keyAgreement:t,export:i,signer(){const{id:t,secretKey:r}=e;
19
19
  /*!
20
20
  * Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
21
21
  */
22
- return function({id:e,secretKey:t}){if(!t)throw new Error('"secretKey" is required for signing.');const{namedCurve:r}=t.algorithm,i={name:c,hash:{name:C({curve:r})}};return{algorithm:r,id:e,async sign({data:e}={}){if(r===g){const{Crypto:r}=await import("./webcrypto.es-DpqeDikX-BnVhHKeM.js"),n=new r;return new Uint8Array(await n.subtle.sign(i,t,e))}return new Uint8Array(await E.subtle.sign(i,t,e))}}}({id:t,secretKey:r})},verifier(){const{id:t,publicKey:r}=e;return function({id:e,publicKey:t}){if(!t)throw new Error('"publicKey" is required for verifying.');const{namedCurve:r}=t.algorithm,i={name:c,hash:{name:C({curve:r})}};return{algorithm:r,id:e,async verify({data:e,signature:n}={}){if(r===g){const{Crypto:r}=await import("./webcrypto.es-DpqeDikX-BnVhHKeM.js");return(new r).subtle.verify(i,t,n,e)}return E.subtle.verify(i,t,n,e)}}}({id:t,publicKey:r})},async deriveSecret({publicKey:t,remotePublicKey:r}={}){if(r&&t)throw new Error('Only one of "remotePublicKey" and "publicKey" must be given.');if(!e.keyAgreement){const e=Error('"keyAgreement" is not supported by this keypair.');throw e.name="NotSupportedError",e}return async function({localKeyPair:e,remoteKeyPair:t}){if(!e.secretKey){const e=Error('"secretKey" required to derive secret.');throw e.name="NotSupportedError",e}e=await $({...e,keyAgreement:!0}),t=await $({...t,keyAgreement:!0});const{namedCurve:r}=e.secretKey.algorithm,i=T({curve:r});if(r===g){const{Crypto:n}=await import("./webcrypto.es-DpqeDikX-BnVhHKeM.js"),c=new n,u=await c.subtle.deriveBits({name:"ECDH",namedCurve:r,public:t.publicKey},e.secretKey,8*i);return new Uint8Array(u,0,i)}const n=await E.subtle.deriveBits({name:"ECDH",namedCurve:r,public:t.publicKey},e.secretKey,8*i);return new Uint8Array(n,0,i)}({localKeyPair:this,remoteKeyPair:r||t})}}}export{_ as f,J as t};
22
+ return function({id:e,secretKey:t}){if(!t)throw new Error('"secretKey" is required for signing.');const{namedCurve:r}=t.algorithm,i={name:c,hash:{name:C({curve:r})}};return{algorithm:r,id:e,async sign({data:e}={}){if(r===g){const{Crypto:r}=await import("./webcrypto.es-DptGOl2T-BnVhHKeM.js"),n=new r;return new Uint8Array(await n.subtle.sign(i,t,e))}return new Uint8Array(await E.subtle.sign(i,t,e))}}}({id:t,secretKey:r})},verifier(){const{id:t,publicKey:r}=e;return function({id:e,publicKey:t}){if(!t)throw new Error('"publicKey" is required for verifying.');const{namedCurve:r}=t.algorithm,i={name:c,hash:{name:C({curve:r})}};return{algorithm:r,id:e,async verify({data:e,signature:n}={}){if(r===g){const{Crypto:r}=await import("./webcrypto.es-DptGOl2T-BnVhHKeM.js");return(new r).subtle.verify(i,t,n,e)}return E.subtle.verify(i,t,n,e)}}}({id:t,publicKey:r})},async deriveSecret({publicKey:t,remotePublicKey:r}={}){if(r&&t)throw new Error('Only one of "remotePublicKey" and "publicKey" must be given.');if(!e.keyAgreement){const e=Error('"keyAgreement" is not supported by this keypair.');throw e.name="NotSupportedError",e}return async function({localKeyPair:e,remoteKeyPair:t}){if(!e.secretKey){const e=Error('"secretKey" required to derive secret.');throw e.name="NotSupportedError",e}e=await O({...e,keyAgreement:!0}),t=await O({...t,keyAgreement:!0});const{namedCurve:r}=e.secretKey.algorithm,i=T({curve:r});if(r===g){const{Crypto:n}=await import("./webcrypto.es-DptGOl2T-BnVhHKeM.js"),c=new n,u=await c.subtle.deriveBits({name:"ECDH",namedCurve:r,public:t.publicKey},e.secretKey,8*i);return new Uint8Array(u,0,i)}const n=await E.subtle.deriveBits({name:"ECDH",namedCurve:r,public:t.publicKey},e.secretKey,8*i);return new Uint8Array(n,0,i)}({localKeyPair:this,remoteKeyPair:r||t})}}}export{B as f,J as t};
@@ -1 +1 @@
1
- import{g as r,q as e,v as o,w as t}from"./main.js";import{a as n}from"./elliptic-4aZS_cwf-BpaNaVm0.js";import{r as f}from"./elliptic-BYqApR8Y-CKp7atgR.js";var a,u=e(o),i=e(t),s={exports:{}};function l(){return a||(a=1,function(r,e){var o=n,t=o.Buffer;function f(r,e){for(var o in r)e[o]=r[o]}function a(r,e,o){return t(r,e,o)}t.from&&t.alloc&&t.allocUnsafe&&t.allocUnsafeSlow?r.exports=o:(f(o,e),e.Buffer=a),a.prototype=Object.create(t.prototype),f(t,a),a.from=function(r,e,o){if("number"==typeof r)throw new TypeError("Argument must not be a number");return t(r,e,o)},a.alloc=function(r,e,o){if("number"!=typeof r)throw new TypeError("Argument must be a number");var n=t(r);return void 0!==e?"string"==typeof o?n.fill(e,o):n.fill(e):n.fill(0),n},a.allocUnsafe=function(r){if("number"!=typeof r)throw new TypeError("Argument must be a number");return t(r)},a.allocUnsafeSlow=function(r){if("number"!=typeof r)throw new TypeError("Argument must be a number");return o.SlowBuffer(r)}}(s,s.exports)),s.exports}var m=r(f());export{i as a,l as b,m as c,u as r};
1
+ import{g as r,q as e,v as o,w as t}from"./main.js";import{a as n}from"./elliptic-mDX7fQQx-BpaNaVm0.js";import{r as f}from"./elliptic-6I21PEnR-CsYseRX1.js";var a,u=e(o),i=e(t),m={exports:{}};function s(){return a||(a=1,function(r,e){var o=n,t=o.Buffer;function f(r,e){for(var o in r)e[o]=r[o]}function a(r,e,o){return t(r,e,o)}t.from&&t.alloc&&t.allocUnsafe&&t.allocUnsafeSlow?r.exports=o:(f(o,e),e.Buffer=a),a.prototype=Object.create(t.prototype),f(t,a),a.from=function(r,e,o){if("number"==typeof r)throw new TypeError("Argument must not be a number");return t(r,e,o)},a.alloc=function(r,e,o){if("number"!=typeof r)throw new TypeError("Argument must be a number");var n=t(r);return void 0!==e?"string"==typeof o?n.fill(e,o):n.fill(e):n.fill(0),n},a.allocUnsafe=function(r){if("number"!=typeof r)throw new TypeError("Argument must be a number");return t(r)},a.allocUnsafeSlow=function(r){if("number"!=typeof r)throw new TypeError("Argument must be a number");return o.SlowBuffer(r)}}(m,m.exports)),m.exports}var l=r(f());export{i as a,s as b,l as c,u as r};
@@ -1,4 +1,4 @@
1
- import{g as e,q as t,B as r,i as o}from"./main.js";import{a as n,b as a,c as i}from"./jsonld-B_Q2jvnp-BJ5uVeOU.js";var s,c,u,d,p,h,l,f,m,g,y,w,v,T,b,x,E=(function(e,t){!function(e,t){for(var r in t)e[r]=t[r]}(t,function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){
1
+ import{g as e,q as t,B as r,i as o}from"./main.js";import{a as n,b as a,c as i}from"./jsonld-BAMY2WqE-BJ5uVeOU.js";var s,c,u,d,p,h,l,f,m,g,y,w,v,T,b,x,E=(function(e,t){!function(e,t){for(var r in t)e[r]=t[r]}(t,function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=0)}([function(e,t,r){
2
2
  /*!
3
3
  * Copyright (c) 2021 Digital Bazaar, Inc. All rights reserved.
4
4
  */
@@ -26,19 +26,19 @@ e.exports={SECURITY_CONTEXT_V1_URL:"https://w3id.org/security/v1",SECURITY_CONTE
26
26
  */function U(){if(w)return y;w=1;const e=k(),t=n(),{extendContextLoader:r,strictDocumentLoader:o}=L(),{serializeError:a}=j();function i({document:r}){let o;o=t.getValues(r,"proof");const n=r["@context"]||e.SECURITY_CONTEXT_URL;return o=o.map((e=>{const{cryptosuite:t}=e;return t?.includes?.("-jcs-")?e:{"@context":n,...e}})),o}function s(e){Object.defineProperty(e,"toJSON",{value:function(){return a(this)},configurable:!0,writable:!0})}return y=class{async add(e,{suite:n,purpose:a,documentLoader:s}={}){if(!n)throw new TypeError('"options.suite" is required.');if(!a)throw new TypeError('"options.purpose" is required.');s=s?r(s):o;const c={...e};delete c.proof;const u=i({document:e}),d=await n.createProof({document:c,purpose:a,proofSet:u,documentLoader:s});return t.addValue(e,"proof",d),e}async derive(e,{suite:t,purpose:n,documentLoader:a}={}){if(!t)throw new TypeError('"options.suite" is required.');if(!n)throw new TypeError('"options.purpose" is required.');a=a?r(a):o;const s={...e};delete s.proof;const c=i({document:e});return await t.derive({document:s,purpose:n,proofSet:c,documentLoader:a})}async verify(e,{suite:t,purpose:n,documentLoader:a}={}){if(!t)throw new TypeError('"options.suite" is required.');if(!n)throw new TypeError('"options.purpose" is required.');const c=Array.isArray(t)?t:[t];if(0===c.length)throw new TypeError("At least one suite is required.");a=a?r(a):o;try{const t=i({document:e={...e}});if(0===t.length)throw new Error("No matching proofs found in the given document.");delete e.proof;const r=await async function({document:e,suites:t,proofSet:r,purpose:o,documentLoader:n}){const a=Array.isArray(o)?o:[o],i=new Map,c=new Map,u=new Map;if(await Promise.all(a.map((o=>async function({purposeToProofs:e,proofToSuite:t,purpose:r,proofSet:o,suites:n,suiteMatchQueue:a,document:i,documentLoader:s}){for(const c of o){if(!await r.match(c,{document:i,documentLoader:s}))continue;let o=!1;for(const e of n){let r=a.get(e);r||a.set(e,r=new Map);let n=r.get(c);if(n||(n=e.matchProof({proof:c,document:i,documentLoader:s}),r.set(c,n)),await n){o=!0,t.set(c,e);break}}if(o){const t=e.get(r);t?t.push(c):e.set(r,[c])}}}({purposeToProofs:i,proofToSuite:c,purpose:o,proofSet:r,suites:t,suiteMatchQueue:u,document:e,documentLoader:n})))),i.size<a.length)return[];const d=new Map;return await Promise.all([...c.entries()].map((async([t,o])=>{let a;try{let i;const s={validate:async(e,{verificationMethod:t})=>(i=t,{valid:!0})},{verified:c,verificationMethod:u,error:d}=await o.verifyProof({proof:t,document:e,purpose:s,proofSet:r,documentLoader:n});i||(i=u),a={proof:t,verified:c,verificationMethod:i,error:d}}catch(e){a={proof:t,verified:!1,error:e}}a.error&&s(a.error),d.set(t,a)}))),await Promise.all([...i.entries()].map((async([t,r])=>{for(const o of r){const r=d.get(o);if(!r.verified)continue;const{verificationMethod:a}=r,i=c.get(o);let u;try{u=await t.validate(o,{document:e,suite:i,verificationMethod:a,documentLoader:n})}catch(e){u={valid:!1,error:e}}r.purposeResult?Array.isArray(r.purposeResult)?r.purposeResult.push(u):r.purposeResult=[r.purposeResult,u]:r.purposeResult=u,u.valid||(s(u.error),r.error||(r.verified=!1,r.error=u.error))}}))),[...d.values()]}({document:e,suites:c,proofSet:t,purpose:n,documentLoader:a});if(0===r.length){const e=new Error("Did not verify any proofs; insufficient proofs matched the acceptable suite(s) and required purpose(s).");throw e.name="NotFoundError",e}const o=r.some((e=>e.verified));if(!o){const e=[].concat(...r.filter((e=>e.error)).map((e=>e.error))),t={verified:o,results:r};return e.length>0&&(t.error=e),t}return{verified:o,results:r}}catch(e){return s(e),{verified:!1,error:e}}}},y}
27
27
  /*!
28
28
  * Copyright (c) 2020 Digital Bazaar, Inc. All rights reserved.
29
- */function O(){return x?b:(x=1,b=class{constructor({type:e}={}){if("string"!=typeof e)throw new TypeError('A LinkedDataProof must have a "type".');this.type=e}async createProof({}){throw new Error('"createProof" must be implemented in a derived class.')}async derive({}){throw new Error('"deriveProof" must be implemented in a derived class.')}async verifyProof({}){throw new Error('"verifyProof" must be implemented in a derived class.')}async matchProof({proof:e}){return e.type===this.type}})}var P,K,z={};function V(){return K?P:(K=1,P=class e{constructor(e,t=new Map,r=0){this.prefix=e,this._existing=t,this.counter=r}clone(){const{prefix:t,_existing:r,counter:o}=this;return new e(t,new Map(r),o)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const r=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,r),r}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}})}var F,q,B,$,X,Q,H,Y,W,G,J,Z,ee,te,re,oe,ne,ae,ie,se,ce,ue,de,pe,he,le,fe,me,ge,ye,we,ve,Te,be,xe={};
29
+ */function O(){return x?b:(x=1,b=class{constructor({type:e}={}){if("string"!=typeof e)throw new TypeError('A LinkedDataProof must have a "type".');this.type=e}async createProof({}){throw new Error('"createProof" must be implemented in a derived class.')}async derive({}){throw new Error('"deriveProof" must be implemented in a derived class.')}async verifyProof({}){throw new Error('"verifyProof" must be implemented in a derived class.')}async matchProof({proof:e}){return e.type===this.type}})}var P,K,z={};function V(){return K?P:(K=1,P=class e{constructor(e,t=new Map,r=0){this.prefix=e,this._existing=t,this.counter=r}clone(){const{prefix:t,_existing:r,counter:o}=this;return new e(t,new Map(r),o)}getId(e){const t=e&&this._existing.get(e);if(t)return t;const r=this.prefix+this.counter;return this.counter++,e&&this._existing.set(e,r),r}hasId(e){return this._existing.has(e)}getOldIds(){return[...this._existing.keys()]}})}var q,F,B,$,X,H,Q,Y,W,G,J,Z,ee,te,re,oe,ne,ae,ie,se,ce,ue,de,pe,he,le,fe,me,ge,ye,we,ve,Te,be,xe={};
30
30
  /*!
31
31
  * Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
32
- */function Ee(){if(F)return xe;F=1,i(),xe.setImmediate=setImmediate,xe.crypto=globalThis.crypto;const e=[];for(let t=0;t<=255;++t)e.push(t.toString(16).padStart(2,"0"));return xe.bufferToHex=function(t){let r="";const o=new Uint8Array(t);for(let t=0;t<o.length;++t)r+=e[o[t]];return r},xe}
32
+ */function Ee(){if(q)return xe;q=1,i(),xe.setImmediate=setImmediate,xe.crypto=globalThis.crypto;const e=[];for(let t=0;t<=255;++t)e.push(t.toString(16).padStart(2,"0"));return xe.bufferToHex=function(t){let r="";const o=new Uint8Array(t);for(let t=0;t<o.length;++t)r+=e[o[t]];return r},xe}
33
33
  /*!
34
34
  * Copyright (c) 2016-2023 Digital Bazaar, Inc. All rights reserved.
35
- */function Ie(){if(B)return q;B=1;const{bufferToHex:e,crypto:t}=Ee(),r=new Map([["sha256","SHA-256"],["SHA256","SHA-256"],["SHA-256","SHA-256"],["sha384","SHA-384"],["SHA384","SHA-384"],["SHA-384","SHA-384"],["sha512","SHA-512"],["SHA512","SHA-512"],["SHA-512","SHA-512"]]);return q=class{constructor(e){if(!t||!t.subtle)throw new Error("crypto.subtle not found.");if(!r.has(e))throw new Error(`Unsupported algorithm "${e}".`);this.algorithm=r.get(e),this._content=""}update(e){this._content+=e}async digest(){const r=(new TextEncoder).encode(this._content),o=await t.subtle.digest(this.algorithm,r);return e(o)}}}
35
+ */function Ie(){if(B)return F;B=1;const{bufferToHex:e,crypto:t}=Ee(),r=new Map([["sha256","SHA-256"],["SHA256","SHA-256"],["SHA-256","SHA-256"],["sha384","SHA-384"],["SHA384","SHA-384"],["SHA-384","SHA-384"],["sha512","SHA-512"],["SHA512","SHA-512"],["SHA-512","SHA-512"]]);return F=class{constructor(e){if(!t||!t.subtle)throw new Error("crypto.subtle not found.");if(!r.has(e))throw new Error(`Unsupported algorithm "${e}".`);this.algorithm=r.get(e),this._content=""}update(e){this._content+=e}async digest(){const r=(new TextEncoder).encode(this._content),o=await t.subtle.digest(this.algorithm,r);return e(o)}}}
36
36
  /*!
37
37
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
38
38
  */function _e(){return X?$:(X=1,$=class{constructor(e){this.current=e.sort(),this.done=!1,this.dir=new Map;for(let t=0;t<e.length;++t)this.dir.set(e[t],!0)}hasNext(){return!this.done}next(){const{current:e,dir:t}=this,r=e.slice();let o=null,n=0;const a=e.length;for(let r=0;r<a;++r){const i=e[r],s=t.get(i);(null===o||i>o)&&(s&&r>0&&i>e[r-1]||!s&&r<a-1&&i>e[r+1])&&(o=i,n=r)}if(null===o)this.done=!0;else{const r=t.get(o)?n-1:n+1;e[n]=e[r],e[r]=o;for(const r of e)r>o&&t.set(r,!t.get(r))}return r}})}
39
39
  /*!
40
40
  * Copyright (c) 2016-2022 Digital Bazaar, Inc. All rights reserved.
41
- */function De(){if(H)return Q;H=1;const e="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",t="http://www.w3.org/2001/XMLSchema#string",r="NamedNode",o="BlankNode",n="Literal",a={};function i(e,t){return e.subject.termType===t.subject.termType&&e.object.termType===t.object.termType&&(e.subject.value===t.subject.value&&e.predicate.value===t.predicate.value&&e.object.value===t.object.value&&(e.object.termType!==n||e.object.datatype.termType===t.object.datatype.termType&&e.object.language===t.object.language&&e.object.datatype.value===t.object.datatype.value))}(()=>{const e="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_",t=e+"0-9-·̀-ͯ‿-⁀",r="_:((?:["+e+"0-9])(?:(?:["+t+".])*(?:["+t+"]))?)",o='(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)',n="[ \\t]+",i="[ \\t]*",s="(?:"+o+"|"+r+")"+n,c=o+n,u="(?:"+o+"|"+r+"|"+('(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:'+("(?:\\^\\^"+o+")")+"|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?)")+")"+i,d="(?:\\.|(?:(?:"+o+"|"+r+")"+i+"\\.))";a.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,a.empty=new RegExp("^"+i+"$"),a.quad=new RegExp("^"+i+s+c+u+d+i+"$")})(),Q=class u{static parse(s){const c=[],u={},p=s.split(a.eoln);let h=0;for(const s of p){if(h++,a.empty.test(s))continue;const p=s.match(a.quad);if(null===p)throw new Error("N-Quads parse error on line "+h+".");const l={subject:null,predicate:null,object:null,graph:null};if(void 0!==p[1]?l.subject={termType:r,value:m(p[1])}:l.subject={termType:o,value:p[2]},l.predicate={termType:r,value:m(p[3])},void 0!==p[4]?l.object={termType:r,value:m(p[4])}:void 0!==p[5]?l.object={termType:o,value:p[5]}:(l.object={termType:n,value:void 0,datatype:{termType:r}},void 0!==p[7]?l.object.datatype.value=m(p[7]):void 0!==p[8]?(l.object.datatype.value=e,l.object.language=p[8]):l.object.datatype.value=t,l.object.value=d(p[6])),void 0!==p[9]?l.graph={termType:r,value:m(p[9])}:void 0!==p[10]?l.graph={termType:o,value:p[10]}:l.graph={termType:"DefaultGraph",value:""},l.graph.value in u){let e=!0;const t=u[l.graph.value];for(const r of t)if(i(r,l)){e=!1;break}e&&(t.push(l),c.push(l))}else u[l.graph.value]=[l],c.push(l)}return c}static serialize(e){const t=[];for(const r of e)t.push(u.serializeQuad(r));return t.sort().join("")}static serializeQuadComponents(n,a,i,u){let d="";return n.termType===r?d+=`<${l(n.value)}>`:d+=`_:${n.value}`,a.termType===r?d+=` <${l(a.value)}> `:d+=` _:${a.value} `,i.termType===r?d+=`<${l(i.value)}>`:i.termType===o?d+=`_:${i.value}`:(d+=`"${function(e){if(!s.test(e))return e;return e.replace(s,(function(e){return c[e.codePointAt(0)]}))}(i.value)}"`,i.datatype.value===e?i.language&&(d+=`@${i.language}`):i.datatype.value!==t&&(d+=`^^<${l(i.datatype.value)}>`)),u.termType===r?d+=` <${l(u.value)}>`:u.termType===o&&(d+=` _:${u.value}`),d+=" .\n",d}static serializeQuad(e){return u.serializeQuadComponents(e.subject,e.predicate,e.object,e.graph)}};const s=/[\u0000-\u001F\u007F"\\]/g,c=[];for(let e=0;e<=127;++e)s.test(String.fromCharCode(e))&&(c[e]="\\u"+e.toString(16).toUpperCase().padStart(4,"0"),s.lastIndex=0);c["\b".codePointAt(0)]="\\b",c["\t".codePointAt(0)]="\\t",c["\n".codePointAt(0)]="\\n",c["\f".codePointAt(0)]="\\f",c["\r".codePointAt(0)]="\\r",c['"'.codePointAt(0)]='\\"',c["\\".codePointAt(0)]="\\\\";const u=/(?:\\([btnfr"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function d(e){return u.test(e)?e.replace(u,(function(e,t,r,o){if(t)switch(t){case"b":return"\b";case"t":return"\t";case"n":return"\n";case"f":return"\f";case"r":return"\r";case'"':return'"';case"'":return"'";case"\\":return"\\"}return r?String.fromCharCode(parseInt(r,16)):o?String.fromCodePoint(parseInt(o,16)):void 0})):e}const p=/[\u0000-\u0020<>"{}|^`\\]/g,h=[];for(let e=0;e<=127;++e)p.test(String.fromCharCode(e))&&(h[e]="\\u"+e.toString(16).toUpperCase().padStart(4,"0"),p.lastIndex=0);function l(e){return p.test(e)?e.replace(p,(function(e){return h[e.codePointAt(0)]})):e}const f=/(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function m(e){return f.test(e)?e.replace(f,(function(e,t,r){return t?String.fromCharCode(parseInt(t,16)):r?String.fromCodePoint(parseInt(r,16)):void 0})):e}return Q}
41
+ */function De(){if(Q)return H;Q=1;const e="http://www.w3.org/1999/02/22-rdf-syntax-ns#langString",t="http://www.w3.org/2001/XMLSchema#string",r="NamedNode",o="BlankNode",n="Literal",a={};function i(e,t){return e.subject.termType===t.subject.termType&&e.object.termType===t.object.termType&&(e.subject.value===t.subject.value&&e.predicate.value===t.predicate.value&&e.object.value===t.object.value&&(e.object.termType!==n||e.object.datatype.termType===t.object.datatype.termType&&e.object.language===t.object.language&&e.object.datatype.value===t.object.datatype.value))}(()=>{const e="A-Za-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�_",t=e+"0-9-·̀-ͯ‿-⁀",r="_:((?:["+e+"0-9])(?:(?:["+t+".])*(?:["+t+"]))?)",o='(?:<((?:[^\0- <>"{}|^`\\\\]|\\\\u[0-9A-Fa-f]{4}|\\\\U[0-9A-Fa-f]{8})*)>)',n="[ \\t]+",i="[ \\t]*",s="(?:"+o+"|"+r+")"+n,c=o+n,u="(?:"+o+"|"+r+"|"+('(?:"([^"\\\\]*(?:\\\\.[^"\\\\]*)*)"(?:'+("(?:\\^\\^"+o+")")+"|(?:@([a-zA-Z]+(?:-[a-zA-Z0-9]+)*)))?)")+")"+i,d="(?:\\.|(?:(?:"+o+"|"+r+")"+i+"\\.))";a.eoln=/(?:\r\n)|(?:\n)|(?:\r)/g,a.empty=new RegExp("^"+i+"$"),a.quad=new RegExp("^"+i+s+c+u+d+i+"$")})(),H=class u{static parse(s){const c=[],u={},p=s.split(a.eoln);let h=0;for(const s of p){if(h++,a.empty.test(s))continue;const p=s.match(a.quad);if(null===p)throw new Error("N-Quads parse error on line "+h+".");const l={subject:null,predicate:null,object:null,graph:null};if(void 0!==p[1]?l.subject={termType:r,value:m(p[1])}:l.subject={termType:o,value:p[2]},l.predicate={termType:r,value:m(p[3])},void 0!==p[4]?l.object={termType:r,value:m(p[4])}:void 0!==p[5]?l.object={termType:o,value:p[5]}:(l.object={termType:n,value:void 0,datatype:{termType:r}},void 0!==p[7]?l.object.datatype.value=m(p[7]):void 0!==p[8]?(l.object.datatype.value=e,l.object.language=p[8]):l.object.datatype.value=t,l.object.value=d(p[6])),void 0!==p[9]?l.graph={termType:r,value:m(p[9])}:void 0!==p[10]?l.graph={termType:o,value:p[10]}:l.graph={termType:"DefaultGraph",value:""},l.graph.value in u){let e=!0;const t=u[l.graph.value];for(const r of t)if(i(r,l)){e=!1;break}e&&(t.push(l),c.push(l))}else u[l.graph.value]=[l],c.push(l)}return c}static serialize(e){const t=[];for(const r of e)t.push(u.serializeQuad(r));return t.sort().join("")}static serializeQuadComponents(n,a,i,u){let d="";return n.termType===r?d+=`<${l(n.value)}>`:d+=`_:${n.value}`,a.termType===r?d+=` <${l(a.value)}> `:d+=` _:${a.value} `,i.termType===r?d+=`<${l(i.value)}>`:i.termType===o?d+=`_:${i.value}`:(d+=`"${function(e){if(!s.test(e))return e;return e.replace(s,(function(e){return c[e.codePointAt(0)]}))}(i.value)}"`,i.datatype.value===e?i.language&&(d+=`@${i.language}`):i.datatype.value!==t&&(d+=`^^<${l(i.datatype.value)}>`)),u.termType===r?d+=` <${l(u.value)}>`:u.termType===o&&(d+=` _:${u.value}`),d+=" .\n",d}static serializeQuad(e){return u.serializeQuadComponents(e.subject,e.predicate,e.object,e.graph)}};const s=/[\u0000-\u001F\u007F"\\]/g,c=[];for(let e=0;e<=127;++e)s.test(String.fromCharCode(e))&&(c[e]="\\u"+e.toString(16).toUpperCase().padStart(4,"0"),s.lastIndex=0);c["\b".codePointAt(0)]="\\b",c["\t".codePointAt(0)]="\\t",c["\n".codePointAt(0)]="\\n",c["\f".codePointAt(0)]="\\f",c["\r".codePointAt(0)]="\\r",c['"'.codePointAt(0)]='\\"',c["\\".codePointAt(0)]="\\\\";const u=/(?:\\([btnfr"'\\]))|(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function d(e){return u.test(e)?e.replace(u,(function(e,t,r,o){if(t)switch(t){case"b":return"\b";case"t":return"\t";case"n":return"\n";case"f":return"\f";case"r":return"\r";case'"':return'"';case"'":return"'";case"\\":return"\\"}return r?String.fromCharCode(parseInt(r,16)):o?String.fromCodePoint(parseInt(o,16)):void 0})):e}const p=/[\u0000-\u0020<>"{}|^`\\]/g,h=[];for(let e=0;e<=127;++e)p.test(String.fromCharCode(e))&&(h[e]="\\u"+e.toString(16).toUpperCase().padStart(4,"0"),p.lastIndex=0);function l(e){return p.test(e)?e.replace(p,(function(e){return h[e.codePointAt(0)]})):e}const f=/(?:\\u([0-9A-Fa-f]{4}))|(?:\\U([0-9A-Fa-f]{8}))/g;function m(e){return f.test(e)?e.replace(f,(function(e,t,r){return t?String.fromCharCode(parseInt(t,16)):r?String.fromCodePoint(parseInt(r,16)):void 0})):e}return H}
42
42
  /*!
43
43
  * Copyright (c) 2016-2023 Digital Bazaar, Inc. All rights reserved.
44
44
  */function Ne(){return Z||(Z=1,function(e){const t=function(){if(W)return Y;W=1;const e=V(),t=Ie(),r=_e(),o=De(),{setImmediate:n}=Ee();function a(e,t){return e.hash<t.hash?-1:e.hash>t.hash?1:0}return Y=class{constructor({createMessageDigest:r=null,messageDigestAlgorithm:o="sha256",canonicalIdMap:n=new Map,maxWorkFactor:a=1,maxDeepIterations:i=-1,signal:s=null}={}){this.name="RDFC-1.0",this.blankNodeInfo=new Map,this.canonicalIssuer=new e("c14n",n),this.createMessageDigest=r||(()=>new t(o)),this.maxWorkFactor=a,this.maxDeepIterations=i,this.remainingDeepIterations=0,this.signal=s,this.quads=null}async main(t){this.quads=t;for(const e of t)this._addBlankNodeQuadInfo({quad:e,component:e.subject}),this._addBlankNodeQuadInfo({quad:e,component:e.object}),this._addBlankNodeQuadInfo({quad:e,component:e.graph});const r=new Map,n=[...this.blankNodeInfo.keys()];let i=0;for(const e of n)++i%100==0&&await this._yield(),await this._hashAndTrackBlankNode({id:e,hashToBlankNodes:r});const s=[...r.keys()].sort(),c=[];for(const e of s){const t=r.get(e);if(t.length>1){c.push(t);continue}const o=t[0];this.canonicalIssuer.getId(o)}if(this.maxDeepIterations<0)if(0===this.maxWorkFactor)this.maxDeepIterations=0;else if(this.maxWorkFactor===1/0)this.maxDeepIterations=1/0;else{const e=c.reduce(((e,t)=>e+t.length),0);this.maxDeepIterations=e**this.maxWorkFactor}this.maxDeepIterations>Number.MAX_SAFE_INTEGER&&(this.maxDeepIterations=1/0),this.remainingDeepIterations=this.maxDeepIterations;for(const t of c){const r=[];for(const o of t){if(this.canonicalIssuer.hasId(o))continue;const t=new e("b");t.getId(o);const n=await this.hashNDegreeQuads(o,t);r.push(n)}r.sort(a);for(const e of r){const t=e.issuer.getOldIds();for(const e of t)this.canonicalIssuer.getId(e)}}const u=[];for(const e of this.quads){const t=o.serializeQuadComponents(this._componentWithCanonicalId(e.subject),e.predicate,this._componentWithCanonicalId(e.object),this._componentWithCanonicalId(e.graph));u.push(t)}return u.sort(),u.join("")}async hashFirstDegreeQuads(e){const t=[],r=this.blankNodeInfo.get(e),n=r.quads;for(const r of n)t.push(o.serializeQuadComponents(this.modifyFirstDegreeComponent(e,r.subject,"subject"),r.predicate,this.modifyFirstDegreeComponent(e,r.object,"object"),this.modifyFirstDegreeComponent(e,r.graph,"graph")));t.sort();const a=this.createMessageDigest();for(const e of t)a.update(e);return r.hash=await a.digest(),r.hash}async hashRelatedBlankNode(e,t,r,o){const n=this.createMessageDigest();let a;return n.update(o),"g"!==o&&n.update(this.getRelatedPredicate(t)),a=this.canonicalIssuer.hasId(e)?"_:"+this.canonicalIssuer.getId(e):r.hasId(e)?"_:"+r.getId(e):this.blankNodeInfo.get(e).hash,n.update(a),n.digest()}async hashNDegreeQuads(e,t){if(0===this.remainingDeepIterations)throw new Error(`Maximum deep iterations exceeded (${this.maxDeepIterations}).`);this.remainingDeepIterations--;const o=this.createMessageDigest(),n=await this.createHashToRelated(e,t),a=[...n.keys()].sort();for(const e of a){o.update(e);let a,i="";const s=new r(n.get(e));let c=0;for(;s.hasNext();){const e=s.next();if(++c%3==0){if(this.signal&&this.signal.aborted)throw new Error(`Abort signal received: "${this.signal.reason}".`);await this._yield()}let r=t.clone(),o="";const n=[];let u=!1;for(const t of e)if(this.canonicalIssuer.hasId(t)?o+="_:"+this.canonicalIssuer.getId(t):(r.hasId(t)||n.push(t),o+="_:"+r.getId(t)),0!==i.length&&o>i){u=!0;break}if(!u){for(const e of n){const t=await this.hashNDegreeQuads(e,r);if(o+="_:"+r.getId(e),o+=`<${t.hash}>`,r=t.issuer,0!==i.length&&o>i){u=!0;break}}u||(0===i.length||o<i)&&(i=o,a=r)}}o.update(i),t=a}return{hash:await o.digest(),issuer:t}}modifyFirstDegreeComponent(e,t){return"BlankNode"!==t.termType?t:{termType:"BlankNode",value:t.value===e?"a":"z"}}getRelatedPredicate(e){return`<${e.predicate.value}>`}async createHashToRelated(e,t){const r=new Map,o=this.blankNodeInfo.get(e).quads;let n=0;for(const a of o)++n%100==0&&await this._yield(),await Promise.all([this._addRelatedBlankNodeHash({quad:a,component:a.subject,position:"s",id:e,issuer:t,hashToRelated:r}),this._addRelatedBlankNodeHash({quad:a,component:a.object,position:"o",id:e,issuer:t,hashToRelated:r}),this._addRelatedBlankNodeHash({quad:a,component:a.graph,position:"g",id:e,issuer:t,hashToRelated:r})]);return r}async _hashAndTrackBlankNode({id:e,hashToBlankNodes:t}){const r=await this.hashFirstDegreeQuads(e),o=t.get(r);o?o.push(e):t.set(r,[e])}_addBlankNodeQuadInfo({quad:e,component:t}){if("BlankNode"!==t.termType)return;const r=t.value,o=this.blankNodeInfo.get(r);o?o.quads.add(e):this.blankNodeInfo.set(r,{quads:new Set([e]),hash:null})}async _addRelatedBlankNodeHash({quad:e,component:t,position:r,id:o,issuer:n,hashToRelated:a}){if("BlankNode"!==t.termType||t.value===o)return;const i=t.value,s=await this.hashRelatedBlankNode(i,e,n,r),c=a.get(s);c?c.push(i):a.set(s,[i])}_componentWithCanonicalId(e){return"BlankNode"!==e.termType||e.value.startsWith(this.canonicalIssuer.prefix)?e:{termType:"BlankNode",value:this.canonicalIssuer.getId(e.value)}}async _yield(){return new Promise((e=>n(e)))}}}
@@ -1 +1 @@
1
- import{k as r,s as e,b as t}from"./elliptic-BYqApR8Y-CKp7atgR.js";import{B as n}from"./main.js";import{d as o}from"./base64url-Cy03LJLt-vkTPfQOh.js";const s="undefined"==typeof Buffer?n:Buffer,i=t=>{const n=r.from({...t,crv:"K-256"},"jwk").toString("blk","public"),o=e.publicKeyConvert(s.from(n,"hex"),!0);return s.from(o).toString("hex")},f=r=>t.encode(s.from(r,"hex"));const c=r=>{const e=new Uint8Array([237,1]),n=function(r){const{kty:e,crv:t,x:n}=r;if("OKP"!==e)throw new TypeError('"jwk.kty" must be "OKP".');if("Ed25519"!==t)throw new TypeError('"jwk.crv" must be "Ed25519".');if("string"!=typeof n)throw new TypeError('"jwk.x" must be a string.');const s=o(r.x);if(32!==s.length)throw new Error(`Invalid public key size (${s.length}); expected 32.`);return s}(r),s=new Uint8Array(e.length+n.length);s.set(e),s.set(n,e.length);var i;return`z${i=s,t.encode(i)}`};export{f as a,c as j,i as p};
1
+ import{k as r,s as e,b as t}from"./elliptic-6I21PEnR-CsYseRX1.js";import{B as n}from"./main.js";import{d as o}from"./base64url-Cy03LJLt-vkTPfQOh.js";const s="undefined"==typeof Buffer?n:Buffer,i=t=>{const n=r.from({...t,crv:"K-256"},"jwk").toString("blk","public"),o=e.publicKeyConvert(s.from(n,"hex"),!0);return s.from(o).toString("hex")},f=r=>t.encode(s.from(r,"hex"));const c=r=>{const e=new Uint8Array([237,1]),n=function(r){const{kty:e,crv:t,x:n}=r;if("OKP"!==e)throw new TypeError('"jwk.kty" must be "OKP".');if("Ed25519"!==t)throw new TypeError('"jwk.crv" must be "Ed25519".');if("string"!=typeof n)throw new TypeError('"jwk.x" must be a string.');const s=o(r.x);if(32!==s.length)throw new Error(`Invalid public key size (${s.length}); expected 32.`);return s}(r),s=new Uint8Array(e.length+n.length);s.set(e),s.set(n,e.length);var i;return`z${i=s,t.encode(i)}`};export{f as a,c as j,i as p};