@blockcerts/blockcerts-verifier 1.72.4 → 1.74.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.
- package/README.md +8 -0
- package/bundle-stats.html +1 -1
- package/codecov +0 -0
- package/codecov.SHA256SUM +1 -0
- package/codecov.SHA256SUM.sig +16 -0
- package/coverage/lcov.info +469 -466
- package/dist/{DataIntegrityProof-x-pKdBCc-B_YUlE0Z.js → DataIntegrityProof-DRK-bLb_-CItV0ZXY.js} +1 -1
- package/dist/EcdsaSd2023-CdilbQE4-BlaeM9K_.js +26 -0
- package/dist/EcdsaSecp256k1Signature2019-rfxWS2XE-C73WHAtH.js +1 -0
- package/dist/{Ed25519Signature2020-B6yblwC5-BRlzT2Yc.js → Ed25519Signature2020-CDbX0d2Z-Dc1L-exZ.js} +7 -7
- package/dist/{EddsaRdfc2022-Csk9U_qt-B798omlR.js → EddsaRdfc2022-Do0HFpDb-BcV_n8Fk.js} +4 -4
- package/dist/{HashlinkVerifier-Bi7nn19S-DMjUYzMR.js → HashlinkVerifier-Cdnza1Dw-A9htzw7A.js} +1 -1
- package/dist/MerkleProof2017-5uQFQKSe-dtmePIpg.js +1 -0
- package/dist/MerkleProof2019-DraC60XD-B9XV8wNx.js +5 -0
- package/dist/Suite-BmP2Qu19-D1ucdMDB.js +1 -0
- package/dist/_polyfill-node.path-hKwMKLNw-B7aPtphV.js +1 -0
- package/dist/checkBitStringStatusList-CKk6xxUL-D99R7EXK.js +1 -0
- package/dist/checkCredentialSchemaConformity-U2NlIuJZ-swOY09NS.js +1 -0
- package/dist/controlVerificationMethod-Blm4pE1t-BYBRLxNP.js +1 -0
- package/dist/{downloadPDF-UAsY-nU_.js → downloadPDF-C-y2U2YC.js} +3 -3
- package/dist/ensureValidIssuingKey-D7OT4D35--HN0afRq.js +1 -0
- package/dist/index-BNsIYV4r-BnYxKy2f.js +14 -0
- package/dist/{index-D7PA_QcD-CyttRwCk.js → index-C4ZZHHRx-BOdwDnYa.js} +1 -1
- package/dist/index-CVS5Gn9h-DNgvq6Wk.js +7 -0
- package/dist/index-D2bS6rRi-D_ppNIsb.js +66 -0
- package/dist/index-Dr7MpiEc-D5LHgMik.js +30 -0
- package/dist/{index-DNlz8u7B-CYTlxhyY.js → index-uKBVup0_-Dh4-8Ruv.js} +1 -1
- package/dist/{index.es-CnYWLNZV.js → index.es-BmC2s_4v.js} +1 -1
- package/dist/{Suite-CBLHluYK-Dmvbh142.js → jsonld-DOUjwF6J-dtl20tiV.js} +1 -1
- package/dist/{jsonld-signatures-BtZPa7MV-DTekMXP5.js → jsonld-signatures-BJXipuab-CB799Kkm.js} +7 -7
- package/dist/main.js +122 -122
- package/dist/purify.es-C6IIzwyE.js +2 -0
- package/dist/retrieveVerificationMethodPublicKey-CT9YA_Wr-Djl8Ri41.js +1 -0
- package/dist/verifyIssuerProfile-BG-odQrl-0JjZhiiC.js +1 -0
- package/package.json +9 -9
- package/dist/EcdsaSd2023-CU35O_1w-CISk0lEt.js +0 -30
- package/dist/EcdsaSecp256k1Signature2019-DiXIv8yq-B2kEN_Qo.js +0 -1
- package/dist/MerkleProof2017-BIJKwMk5-CLYAJK4G.js +0 -1
- package/dist/MerkleProof2019-CeAt2OGM-DOuISx_E.js +0 -5
- package/dist/checkCredentialSchemaConformity-CECtM4WI-C1vg05zb.js +0 -1
- package/dist/checkRevocationStatusList2021-B7NFlV-5-C3Zng1tA.js +0 -13
- package/dist/controlVerificationMethod-Cuyek_Vk-C_Uq2iA5.js +0 -1
- package/dist/ensureValidIssuingKey-DN2kpCwj-DY8BTObG.js +0 -1
- package/dist/index-DFOHyoZq-BCuOIg2Z.js +0 -29
- package/dist/pako.esm-BGRKTPxS-Bodm4Eha.js +0 -2
- package/dist/purify.es-Om653OSQ.js +0 -2
- package/dist/retrieveVerificationMethodPublicKey-DcEGtx_h-D1zuvtQB.js +0 -1
- package/dist/sha2-JcCWfgvE-By1_saxP.js +0 -2
- package/dist/verifyIssuerProfile-DQji41Fc-l31-7imR.js +0 -1
- /package/dist/{ensureNotRevoked-CNUfpW4F-BheL-ZKZ.js → ensureNotRevoked-DrQAPfcJ-BheL-ZKZ.js} +0 -0
- /package/dist/{index-6G1g4ypj-Dgus2xdV.js → index-yOIIz7AL-Dgus2xdV.js} +0 -0
- /package/dist/{webcrypto.es-aoUxIxUm-gGk5JRJH.js → webcrypto.es-FKUHCUj--gGk5JRJH.js} +0 -0
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! @license DOMPurify 3.4.13 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.4.13/LICENSE */
|
|
2
|
+
function e(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,o=Array(t);n<t;n++)o[n]=e[n];return o}function t(t,n){return function(e){if(Array.isArray(e))return e}(t)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var o,r,i,a,l=[],c=!0,s=!1;try{if(i=(n=n.call(e)).next,0===t);else for(;!(c=(o=i.call(n)).done)&&(l.push(o.value),l.length!==t);c=!0);}catch(e){s=!0,r=e}finally{try{if(!c&&null!=n.return&&(a=n.return(),Object(a)!==a))return}finally{if(s)throw r}}return l}}(t,n)||function(t,n){if(t){if("string"==typeof t)return e(t,n);var o={}.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?e(t,n):void 0}}(t,n)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}const n=Object.entries,o=Object.setPrototypeOf,r=Object.isFrozen,i=Object.getPrototypeOf,a=Object.getOwnPropertyDescriptor;let l=Object.freeze,c=Object.seal,s=Object.create,u="undefined"!=typeof Reflect&&Reflect,f=u.apply,p=u.construct;l||(l=function(e){return e}),c||(c=function(e){return e}),f||(f=function(e,t){for(var n=arguments.length,o=new Array(n>2?n-2:0),r=2;r<n;r++)o[r-2]=arguments[r];return e.apply(t,o)}),p||(p=function(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),o=1;o<t;o++)n[o-1]=arguments[o];return new e(...n)});const m=L(Array.prototype.forEach),d=L(Array.prototype.lastIndexOf),h=L(Array.prototype.pop),g=L(Array.prototype.push),y=L(Array.prototype.splice),b=Array.isArray,T=L(String.prototype.toLowerCase),S=L(String.prototype.toString),E=L(String.prototype.match),A=L(String.prototype.replace),N=L(String.prototype.indexOf),_=L(String.prototype.trim),w=L(Number.prototype.toString),O=L(Boolean.prototype.toString),v="undefined"==typeof BigInt?null:L(BigInt.prototype.toString),D="undefined"==typeof Symbol?null:L(Symbol.prototype.toString),R=L(Object.prototype.hasOwnProperty),C=L(Object.prototype.toString),I=L(RegExp.prototype.test),k=(x=TypeError,function(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return p(x,t)});var x;function L(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;r<n;r++)o[r-1]=arguments[r];return f(e,t,o)}}function M(e,t){let n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:T;if(o&&o(e,null),!b(t))return e;let i=t.length;for(;i--;){let o=t[i];if("string"==typeof o){const e=n(o);e!==o&&(r(t)||(t[i]=e),o=e)}e[o]=!0}return e}function z(e){for(let t=0;t<e.length;t++){R(e,t)||(e[t]=null)}return e}function P(e){const o=s(null);for(const i of n(e)){var r=t(i,2);const n=r[0],a=r[1];R(e,n)&&(b(a)?o[n]=z(a):a&&"object"==typeof a&&a.constructor===Object?o[n]=P(a):o[n]=a)}return o}function U(e,t){for(;null!==e;){const n=a(e,t);if(n){if(n.get)return L(n.get);if("function"==typeof n.value)return L(n.value)}e=i(e)}return function(){return null}}const F=l(["a","abbr","acronym","address","area","article","aside","audio","b","bdi","bdo","big","blink","blockquote","body","br","button","canvas","caption","center","cite","code","col","colgroup","content","data","datalist","dd","decorator","del","details","dfn","dialog","dir","div","dl","dt","element","em","fieldset","figcaption","figure","font","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","img","input","ins","kbd","label","legend","li","main","map","mark","marquee","menu","menuitem","meter","nav","nobr","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","shadow","slot","small","source","spacer","span","strike","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","track","tt","u","ul","var","video","wbr"]),H=l(["svg","a","altglyph","altglyphdef","altglyphitem","animatecolor","animatemotion","animatetransform","circle","clippath","defs","desc","ellipse","enterkeyhint","exportparts","filter","font","g","glyph","glyphref","hkern","image","inputmode","line","lineargradient","marker","mask","metadata","mpath","part","path","pattern","polygon","polyline","radialgradient","rect","stop","style","switch","symbol","text","textpath","title","tref","tspan","view","vkern"]),j=l(["feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence"]),B=l(["animate","color-profile","cursor","discard","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","foreignobject","hatch","hatchpath","mesh","meshgradient","meshpatch","meshrow","missing-glyph","script","set","solidcolor","unknown","use"]),G=l(["math","menclose","merror","mfenced","mfrac","mglyph","mi","mlabeledtr","mmultiscripts","mn","mo","mover","mpadded","mphantom","mroot","mrow","ms","mspace","msqrt","mstyle","msub","msup","msubsup","mtable","mtd","mtext","mtr","munder","munderover","mprescripts"]),W=l(["maction","maligngroup","malignmark","mlongdiv","mscarries","mscarry","msgroup","mstack","msline","msrow","semantics","annotation","annotation-xml","mprescripts","none"]),Y=l(["#text"]),q=l(["accept","action","align","alt","autocapitalize","autocomplete","autopictureinpicture","autoplay","background","bgcolor","border","capture","cellpadding","cellspacing","checked","cite","class","clear","color","cols","colspan","command","commandfor","controls","controlslist","coords","crossorigin","datetime","decoding","default","dir","disabled","disablepictureinpicture","disableremoteplayback","download","draggable","enctype","enterkeyhint","exportparts","face","for","headers","height","hidden","high","href","hreflang","id","inert","inputmode","integrity","ismap","kind","label","lang","list","loading","loop","low","max","maxlength","media","method","min","minlength","multiple","muted","name","nonce","noshade","novalidate","nowrap","open","optimum","part","pattern","placeholder","playsinline","popover","popovertarget","popovertargetaction","poster","preload","pubdate","radiogroup","readonly","rel","required","rev","reversed","role","rows","rowspan","spellcheck","scope","selected","shape","size","sizes","slot","span","srclang","start","src","srcset","step","style","summary","tabindex","title","translate","type","usemap","valign","value","width","wrap","xmlns"]),X=l(["accent-height","accumulate","additive","alignment-baseline","amplitude","ascent","attributename","attributetype","azimuth","basefrequency","baseline-shift","begin","bias","by","class","clip","clippathunits","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","cx","cy","d","dx","dy","diffuseconstant","direction","display","divisor","dominant-baseline","dur","edgemode","elevation","end","exponent","fill","fill-opacity","fill-rule","filter","filterunits","flood-color","flood-opacity","font-family","font-size","font-size-adjust","font-stretch","font-style","font-variant","font-weight","fx","fy","g1","g2","glyph-name","glyphref","gradientunits","gradienttransform","height","href","id","image-rendering","in","in2","intercept","k","k1","k2","k3","k4","kerning","keypoints","keysplines","keytimes","lang","lengthadjust","letter-spacing","kernelmatrix","kernelunitlength","lighting-color","local","marker-end","marker-mid","marker-start","markerheight","markerunits","markerwidth","maskcontentunits","maskunits","max","mask","mask-type","media","method","mode","min","name","numoctaves","offset","operator","opacity","order","orient","orientation","origin","overflow","paint-order","path","pathlength","patterncontentunits","patterntransform","patternunits","points","preservealpha","preserveaspectratio","primitiveunits","r","rx","ry","radius","refx","refy","repeatcount","repeatdur","restart","result","rotate","scale","seed","shape-rendering","slope","specularconstant","specularexponent","spreadmethod","startoffset","stddeviation","stitchtiles","stop-color","stop-opacity","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke","stroke-width","style","surfacescale","systemlanguage","tabindex","tablevalues","targetx","targety","transform","transform-origin","text-anchor","text-decoration","text-orientation","text-rendering","textlength","type","u1","u2","unicode","values","viewbox","visibility","version","vert-adv-y","vert-origin-x","vert-origin-y","width","word-spacing","wrap","writing-mode","xchannelselector","ychannelselector","x","x1","x2","xmlns","y","y1","y2","z","zoomandpan"]),$=l(["accent","accentunder","align","bevelled","close","columnalign","columnlines","columnspacing","columnspan","denomalign","depth","dir","display","displaystyle","encoding","fence","frame","height","href","id","largeop","length","linethickness","lquote","lspace","mathbackground","mathcolor","mathsize","mathvariant","maxsize","minsize","movablelimits","notation","numalign","open","rowalign","rowlines","rowspacing","rowspan","rspace","rquote","scriptlevel","scriptminsize","scriptsizemultiplier","selection","separator","separators","stretchy","subscriptshift","supscriptshift","symmetric","voffset","width","xmlns"]),K=l(["xlink:href","xml:id","xlink:title","xml:space","xmlns:xlink"]),V=c(/{{[\w\W]*|^[\w\W]*}}/g),Z=c(/<%[\w\W]*|^[\w\W]*%>/g),J=c(/\${[\w\W]*/g),Q=c(/^data-[\-\w.\u00B7-\uFFFF]+$/),ee=c(/^aria-[\-\w]+$/),te=c(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),ne=c(/^(?:\w+script|data):/i),oe=c(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),re=c(/^html$/i),ie=c(/^[a-z][.\w]*(-[.\w]+)+$/i),ae=c(/<[/\w!]/g),le=c(/<[/\w]/g),ce=c(/<\/no(script|embed|frames)/i),se=c(/\/>/i),ue=1,fe=3,pe=7,me=8,de=9,he=11,ge=function(){return"undefined"==typeof window?null:window},ye=function(e,t,n,o){return R(e,t)&&b(e[t])?M(o.base?P(o.base):{},e[t],o.transform):n};var be=function e(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:ge();const o=t=>e(t);if(o.version="3.4.13",o.removed=[],!t||!t.document||t.document.nodeType!==de||!t.Element)return o.isSupported=!1,o;let r=t.document;const i=r,a=i.currentScript;t.DocumentFragment;const u=t.HTMLTemplateElement,f=t.Node,p=t.Element,x=t.NodeFilter,L=t.NamedNodeMap;void 0===L&&(t.NamedNodeMap||t.MozNamedAttrMap),t.HTMLFormElement;const z=t.DOMParser,be=t.trustedTypes,Te=p.prototype,Se=U(Te,"cloneNode"),Ee=U(Te,"remove"),Ae=U(Te,"nextSibling"),Ne=U(Te,"childNodes"),_e=U(Te,"parentNode"),we=U(Te,"shadowRoot"),Oe=U(Te,"attributes"),ve=f&&f.prototype?U(f.prototype,"nodeType"):null,De=f&&f.prototype?U(f.prototype,"nodeName"):null,Re=f&&f.prototype?U(f.prototype,"ownerDocument"):null;if("function"==typeof u){const e=r.createElement("template");e.content&&e.content.ownerDocument&&(r=e.content.ownerDocument)}let Ce,Ie,ke="",xe=!1,Le=0;const Me=function(){if(Le>0)throw k('A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.')},ze=function(e){Me(),Le++;try{return Ce.createHTML(e)}finally{Le--}},Pe=function(){return xe||(Ie=function(e,t){if("object"!=typeof e||"function"!=typeof e.createPolicy)return null;let n=null;const o="data-tt-policy-suffix";t&&t.hasAttribute(o)&&(n=t.getAttribute(o));const r="dompurify"+(n?"#"+n:"");try{return e.createPolicy(r,{createHTML:e=>e,createScriptURL:e=>e})}catch(e){return console.warn("TrustedTypes policy "+r+" could not be created."),null}}(be,a),xe=!0),Ie},Ue=r,Fe=Ue.implementation,He=Ue.createNodeIterator,je=Ue.createDocumentFragment,Be=Ue.getElementsByTagName,Ge=i.importNode;let We={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]};o.isSupported="function"==typeof n&&"function"==typeof _e&&Fe&&void 0!==Fe.createHTMLDocument;const Ye=V,qe=Z,Xe=J,$e=Q,Ke=ee,Ve=ne,Ze=oe,Je=ie;let Qe=te,et=null;const tt=M({},[...F,...H,...j,...G,...Y]);let nt=null;const ot=M({},[...q,...X,...$,...K]);let rt=Object.seal(s(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),it=null,at=null;const lt=Object.seal(s(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}}));let ct=!0,st=!0,ut=!1,ft=!0,pt=!1,mt=!0,dt=!1,ht=!1,gt=null,yt=null,bt=!1,Tt=!1,St=!1,Et=!1,At=!0,Nt=!1;const _t="user-content-";let wt=!0,Ot=!1,vt={},Dt=null;const Rt=M({},["annotation-xml","audio","colgroup","desc","foreignobject","head","iframe","math","mi","mn","mo","ms","mtext","noembed","noframes","noscript","plaintext","script","selectedcontent","style","svg","template","thead","title","video","xmp"]);let Ct=null;const It=M({},["audio","video","img","source","image","track"]);let kt=null;const xt=M({},["alt","class","for","id","label","name","pattern","placeholder","role","summary","title","value","style","xmlns"]),Lt="http://www.w3.org/1998/Math/MathML",Mt="http://www.w3.org/2000/svg",zt="http://www.w3.org/1999/xhtml";let Pt=zt,Ut=!1,Ft=null;const Ht=M({},[Lt,Mt,zt],S),jt=l(["mi","mo","mn","ms","mtext"]);let Bt=M({},jt);const Gt=l(["annotation-xml"]);let Wt=M({},Gt);const Yt=M({},["title","style","font","a","script"]);let qt=null;const Xt=["application/xhtml+xml","text/html"];let $t=null,Kt=null;const Vt=r.createElement("form"),Zt=function(e){return e instanceof RegExp||e instanceof Function},Jt=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(Kt&&Kt===e)return;e&&"object"==typeof e||(e={}),e=P(e),qt=-1===Xt.indexOf(e.PARSER_MEDIA_TYPE)?"text/html":e.PARSER_MEDIA_TYPE,$t="application/xhtml+xml"===qt?S:T,et=ye(e,"ALLOWED_TAGS",tt,{transform:$t}),nt=ye(e,"ALLOWED_ATTR",ot,{transform:$t}),Ft=ye(e,"ALLOWED_NAMESPACES",Ht,{transform:S}),kt=ye(e,"ADD_URI_SAFE_ATTR",xt,{transform:$t,base:xt}),Ct=ye(e,"ADD_DATA_URI_TAGS",It,{transform:$t,base:It}),Dt=ye(e,"FORBID_CONTENTS",Rt,{transform:$t}),it=ye(e,"FORBID_TAGS",P({}),{transform:$t}),at=ye(e,"FORBID_ATTR",P({}),{transform:$t}),vt=!!R(e,"USE_PROFILES")&&(e.USE_PROFILES&&"object"==typeof e.USE_PROFILES?P(e.USE_PROFILES):e.USE_PROFILES),ct=!1!==e.ALLOW_ARIA_ATTR,st=!1!==e.ALLOW_DATA_ATTR,ut=e.ALLOW_UNKNOWN_PROTOCOLS||!1,ft=!1!==e.ALLOW_SELF_CLOSE_IN_ATTR,pt=e.SAFE_FOR_TEMPLATES||!1,mt=!1!==e.SAFE_FOR_XML,dt=e.WHOLE_DOCUMENT||!1,Tt=e.RETURN_DOM||!1,St=e.RETURN_DOM_FRAGMENT||!1,Et=e.RETURN_TRUSTED_TYPE||!1,bt=e.FORCE_BODY||!1,At=!1!==e.SANITIZE_DOM,Nt=e.SANITIZE_NAMED_PROPS||!1,wt=!1!==e.KEEP_CONTENT,Ot=e.IN_PLACE||!1,Qe=function(e){try{return I(e,""),!0}catch(e){return!1}}(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:te,Pt="string"==typeof e.NAMESPACE?e.NAMESPACE:zt,Bt=R(e,"MATHML_TEXT_INTEGRATION_POINTS")&&e.MATHML_TEXT_INTEGRATION_POINTS&&"object"==typeof e.MATHML_TEXT_INTEGRATION_POINTS?P(e.MATHML_TEXT_INTEGRATION_POINTS):M({},jt),Wt=R(e,"HTML_INTEGRATION_POINTS")&&e.HTML_INTEGRATION_POINTS&&"object"==typeof e.HTML_INTEGRATION_POINTS?P(e.HTML_INTEGRATION_POINTS):M({},Gt);const t=R(e,"CUSTOM_ELEMENT_HANDLING")&&e.CUSTOM_ELEMENT_HANDLING&&"object"==typeof e.CUSTOM_ELEMENT_HANDLING?P(e.CUSTOM_ELEMENT_HANDLING):s(null);if(rt=s(null),R(t,"tagNameCheck")&&Zt(t.tagNameCheck)&&(rt.tagNameCheck=t.tagNameCheck),R(t,"attributeNameCheck")&&Zt(t.attributeNameCheck)&&(rt.attributeNameCheck=t.attributeNameCheck),R(t,"allowCustomizedBuiltInElements")&&"boolean"==typeof t.allowCustomizedBuiltInElements&&(rt.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),c(rt),pt&&(st=!1),St&&(Tt=!0),vt&&(et=M({},Y),nt=s(null),!0===vt.html&&(M(et,F),M(nt,q)),!0===vt.svg&&(M(et,H),M(nt,X),M(nt,K)),!0===vt.svgFilters&&(M(et,j),M(nt,X),M(nt,K)),!0===vt.mathMl&&(M(et,G),M(nt,$),M(nt,K))),lt.tagCheck=null,lt.attributeCheck=null,R(e,"ADD_TAGS")&&("function"==typeof e.ADD_TAGS?lt.tagCheck=e.ADD_TAGS:b(e.ADD_TAGS)&&(et===tt&&(et=P(et)),M(et,e.ADD_TAGS,$t))),R(e,"ADD_ATTR")&&("function"==typeof e.ADD_ATTR?lt.attributeCheck=e.ADD_ATTR:b(e.ADD_ATTR)&&(nt===ot&&(nt=P(nt)),M(nt,e.ADD_ATTR,$t))),R(e,"ADD_URI_SAFE_ATTR")&&b(e.ADD_URI_SAFE_ATTR)&&M(kt,e.ADD_URI_SAFE_ATTR,$t),R(e,"FORBID_CONTENTS")&&b(e.FORBID_CONTENTS)&&(Dt===Rt&&(Dt=P(Dt)),M(Dt,e.FORBID_CONTENTS,$t)),R(e,"ADD_FORBID_CONTENTS")&&b(e.ADD_FORBID_CONTENTS)&&(Dt===Rt&&(Dt=P(Dt)),M(Dt,e.ADD_FORBID_CONTENTS,$t)),wt&&(et["#text"]=!0),dt&&M(et,["html","head","body"]),et.table&&(M(et,["tbody"]),delete it.tbody),e.TRUSTED_TYPES_POLICY){if("function"!=typeof e.TRUSTED_TYPES_POLICY.createHTML)throw k('TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.');if("function"!=typeof e.TRUSTED_TYPES_POLICY.createScriptURL)throw k('TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.');const t=Ce;Ce=e.TRUSTED_TYPES_POLICY;try{ke=ze("")}catch(e){throw Ce=t,e}}else null===e.TRUSTED_TYPES_POLICY?(Ce=void 0,ke=""):(void 0===Ce&&(Ce=Pe()),Ce&&"string"==typeof ke&&(ke=ze("")));l&&l(e),Kt=e},Qt=M({},[...H,...j,...B]),en=M({},[...G,...W]),tn=function(e){let t=_e(e);t&&t.tagName||(t={namespaceURI:Pt,tagName:"template"});const n=T(e.tagName),o=T(t.tagName);return!!Ft[e.namespaceURI]&&(e.namespaceURI===Mt?function(e,t,n){return t.namespaceURI===zt?"svg"===e:t.namespaceURI===Lt?"svg"===e&&("annotation-xml"===n||Bt[n]):Boolean(Qt[e])}(n,t,o):e.namespaceURI===Lt?function(e,t,n){return t.namespaceURI===zt?"math"===e:t.namespaceURI===Mt?"math"===e&&Wt[n]:Boolean(en[e])}(n,t,o):e.namespaceURI===zt?function(e,t,n){return!(t.namespaceURI===Mt&&!Wt[n])&&!(t.namespaceURI===Lt&&!Bt[n])&&!en[e]&&(Yt[e]||!Qt[e])}(n,t,o):!("application/xhtml+xml"!==qt||!Ft[e.namespaceURI]))},nn=function(e){g(o.removed,{element:e});try{_e(e).removeChild(e)}catch(t){if(Ee(e),!_e(e))throw k("a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place")}},on=function(e){ln(e);const t=Ne(e);if(t){const e=[];m(t,t=>{g(e,t)}),m(e,e=>{try{Ee(e)}catch(e){}})}const n=Oe(e);if(n)for(let t=n.length-1;t>=0;--t){const o=n[t],r=o&&o.name;if("string"==typeof r)try{e.removeAttribute(r)}catch(e){}}},rn=function(e,t){try{g(o.removed,{attribute:t.getAttributeNode(e),from:t})}catch(e){g(o.removed,{attribute:null,from:t})}if(t.removeAttribute(e),"is"===e)if(Tt||St)try{nn(t)}catch(e){}else try{t.setAttribute(e,"")}catch(e){}},an=function(e){const t=Oe(e);if(t)for(let n=t.length-1;n>=0;--n){const o=t[n],r=o&&o.name;if("string"==typeof r&&!nt[$t(r)])try{e.removeAttribute(r)}catch(e){}}},ln=function(e){const t=[e];for(;t.length>0;){const e=t.pop();(ve?ve(e):e.nodeType)===ue&&an(e);const n=Ne(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},cn=function(e){let t=null,n=null;if(bt)e="<remove></remove>"+e;else{const t=E(e,/^[\r\n\t ]+/);n=t&&t[0]}"application/xhtml+xml"===qt&&Pt===zt&&(e='<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>'+e+"</body></html>");const o=Ce?ze(e):e;if(Pt===zt)try{t=(new z).parseFromString(o,qt)}catch(e){}if(!t||!t.documentElement){t=Fe.createDocument(Pt,"template",null);try{t.documentElement.innerHTML=Ut?ke:o}catch(e){}}const i=t.body||t.documentElement;return e&&n&&i.insertBefore(r.createTextNode(n),i.childNodes[0]||null),Pt===zt?Be.call(t,dt?"html":"body")[0]:dt?t.documentElement:i},sn=function(e){const t=Re?Re(e):e.ownerDocument;return He.call(t||e,e,x.SHOW_ELEMENT|x.SHOW_COMMENT|x.SHOW_TEXT|x.SHOW_PROCESSING_INSTRUCTION|x.SHOW_CDATA_SECTION,null)},un=function(e){return e=A(e,Ye," "),e=A(e,qe," "),e=A(e,Xe," ")},fn=function(e){var t;e.normalize();const n=Re?Re(e):e.ownerDocument,o=He.call(n||e,e,x.SHOW_TEXT|x.SHOW_COMMENT|x.SHOW_CDATA_SECTION|x.SHOW_PROCESSING_INSTRUCTION,null);let r=o.nextNode();for(;r;)r.data=un(r.data),r=o.nextNode();const i=null===(t=e.querySelectorAll)||void 0===t?void 0:t.call(e,"template");i&&m(i,e=>{mn(e.content)&&fn(e.content)})},pn=function(e){const t=De?De(e):null;return"string"==typeof t&&("form"===$t(t)&&("string"!=typeof e.nodeName||"string"!=typeof e.textContent||"function"!=typeof e.removeChild||e.attributes!==Oe(e)||"function"!=typeof e.removeAttribute||"function"!=typeof e.setAttribute||"string"!=typeof e.namespaceURI||"function"!=typeof e.insertBefore||"function"!=typeof e.hasChildNodes||e.nodeType!==ve(e)||e.childNodes!==Ne(e)))},mn=function(e){if(!ve||"object"!=typeof e||null===e)return!1;try{return ve(e)===he}catch(e){return!1}},dn=function(e){if(!ve||"object"!=typeof e||null===e)return!1;try{return"number"==typeof ve(e)}catch(e){return!1}};function hn(e,t,n){0!==e.length&&m(e,e=>{e.call(o,t,n,Kt)})}const gn=function(e,t,n,o){return 0===e.length?t:t===n||t===o?P(t):t},yn=function(e,t){if(hn(We.beforeSanitizeElements,e,null),e!==t&&null===_e(e))return Ot&&ln(e),!0;if(pn(e))return nn(e),!0;const n=$t(De?De(e):e.nodeName);if(et=gn(We.uponSanitizeElement,et,tt,gt),hn(We.uponSanitizeElement,e,{tagName:n,allowedTags:et}),e!==t&&null===_e(e))return Ot&&ln(e),!0;if(function(e,t){return!!(mt&&e.hasChildNodes()&&!dn(e.firstElementChild)&&I(ae,e.textContent)&&I(ae,e.innerHTML))||!(!mt||e.namespaceURI!==zt||"style"!==t||!dn(e.firstElementChild))||e.nodeType===pe||!(!mt||e.nodeType!==me||!I(le,e.data))}(e,n))return nn(e),!0;if(it[n]||!(lt.tagCheck instanceof Function&<.tagCheck(n))&&!et[n]){const o=function(e,t,n){if(!it[t]&&Sn(t)){if(rt.tagNameCheck instanceof RegExp&&I(rt.tagNameCheck,t))return!1;if(rt.tagNameCheck instanceof Function&&rt.tagNameCheck(t))return!1}if(wt&&!Dt[t]){const t=_e(e),o=Ne(e);if(o&&t)for(let r=o.length-1;r>=0;--r){const i=e===n?Se(o[r],!0):o[r];t.insertBefore(i,Ae(e))}}return nn(e),!0}(e,n,t);return!1===o&&hn(We.afterSanitizeElements,e,null),o}if((ve?ve(e):e.nodeType)===ue&&!tn(e))return nn(e),!0;if(("noscript"===n||"noembed"===n||"noframes"===n)&&I(ce,e.innerHTML))return nn(e),!0;if(pt&&e.nodeType===fe){const t=un(e.textContent);e.textContent!==t&&(g(o.removed,{element:e.cloneNode()}),e.textContent=t)}return hn(We.afterSanitizeElements,e,null),!1},bn=function(e,t,n){if(at[t])return!1;if(mt&&"patchsrc"===t)return!1;if(mt&&"for"===t&&"label"!==e&&"output"!==e)return!1;if(At&&("id"===t||"name"===t)&&(n in r||n in Vt))return!1;const o=nt[t]||lt.attributeCheck instanceof Function&<.attributeCheck(t,e);if(st&&I($e,t));else if(ct&&I(Ke,t));else if(o)if(kt[t]);else if(I(Qe,A(n,Ze,"")));else if("src"!==t&&"xlink:href"!==t&&"href"!==t||"script"===e||0!==N(n,"data:")||!Ct[e]){if(ut&&!I(Ve,A(n,Ze,"")));else if(n)return!1}else;else if(!(Sn(e)&&(rt.tagNameCheck instanceof RegExp&&I(rt.tagNameCheck,e)||rt.tagNameCheck instanceof Function&&rt.tagNameCheck(e))&&(rt.attributeNameCheck instanceof RegExp&&I(rt.attributeNameCheck,t)||rt.attributeNameCheck instanceof Function&&rt.attributeNameCheck(t,e))||"is"===t&&rt.allowCustomizedBuiltInElements&&(rt.tagNameCheck instanceof RegExp&&I(rt.tagNameCheck,n)||rt.tagNameCheck instanceof Function&&rt.tagNameCheck(n))))return!1;return!0},Tn=M({},["annotation-xml","color-profile","font-face","font-face-format","font-face-name","font-face-src","font-face-uri","missing-glyph"]),Sn=function(e){return!Tn[T(e)]&&I(Je,e)},En=function(e,t,n,o){if(Ce&&"object"==typeof be&&"function"==typeof be.getAttributeType&&!n)switch(be.getAttributeType(e,t)){case"TrustedHTML":return ze(o);case"TrustedScriptURL":return function(e){Me(),Le++;try{return Ce.createScriptURL(e)}finally{Le--}}(o)}return o},An=function(e,t,n,r){try{n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),pn(e)?nn(e):h(o.removed)}catch(n){rn(t,e)}},Nn=function(e){hn(We.beforeSanitizeAttributes,e,null);const t=e.attributes;if(!t||pn(e))return;nt=gn(We.uponSanitizeAttribute,nt,ot,yt);const n={attrName:"",attrValue:"",keepAttr:!0,allowedAttributes:nt,forceKeepAttr:void 0};let o=t.length;const r=$t(e.nodeName);for(;o--;){const i=t[o],a=i.name,l=i.namespaceURI,c=i.value,s=$t(a),u=c;let f="value"===a?u:_(u);n.attrName=s,n.attrValue=f,n.keepAttr=!0,n.forceKeepAttr=void 0,hn(We.uponSanitizeAttribute,e,n),f=n.attrValue,!Nt||"id"!==s&&"name"!==s||0===N(f,_t)||(rn(a,e),f=_t+f),mt&&I(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)?rn(a,e):"attributename"===s&&E(f,"href")?rn(a,e):n.forceKeepAttr||(n.keepAttr&&(ft||!I(se,f))?(pt&&(f=un(f)),bn(r,s,f)?(f=En(r,s,l,f),f!==u&&An(e,a,l,f)):rn(a,e)):rn(a,e))}hn(We.afterSanitizeAttributes,e,null)},_n=function(e){let t=null;const n=sn(e);for(hn(We.beforeSanitizeShadowDOM,e,null);t=n.nextNode();){hn(We.uponSanitizeShadowNode,t,null),yn(t,e),Nn(t),mn(t.content)&&_n(t.content);if((ve?ve(t):t.nodeType)===ue){const e=we(t);mn(e)&&(wn(e),_n(e))}}hn(We.afterSanitizeShadowDOM,e,null)},wn=function(e){const t=[{node:e,shadow:null}];for(;t.length>0;){const e=t.pop();if(e.shadow){_n(e.shadow);continue}const n=e.node,o=(ve?ve(n):n.nodeType)===ue,r=Ne(n);if(r)for(let e=r.length-1;e>=0;--e)t.push({node:r[e],shadow:null});if(o){const e=De?De(n):null;if("string"==typeof e&&"template"===$t(e)){const e=n.content;mn(e)&&t.push({node:e,shadow:null})}}if(o){const e=we(n);mn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return o.sanitize=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=null,r=null,a=null,l=null;if(Ut=!e,Ut&&(e="\x3c!--\x3e"),"string"!=typeof e&&!dn(e)&&"string"!=typeof(e=function(e){switch(typeof e){case"string":return e;case"number":return w(e);case"boolean":return O(e);case"bigint":return v?v(e):"0";case"symbol":return D?D(e):"Symbol()";case"undefined":default:return C(e);case"function":case"object":{if(null===e)return C(e);const t=e,n=U(t,"toString");if("function"==typeof n){const e=n(t);return"string"==typeof e?e:C(e)}return C(e)}}}(e)))throw k("dirty is not a string, aborting");if(!o.isSupported)return e;ht?(et=gt,nt=yt):Jt(t),(We.uponSanitizeElement.length>0||We.uponSanitizeAttribute.length>0)&&(et=P(et)),We.uponSanitizeAttribute.length>0&&(nt=P(nt)),o.removed=[];const c=Ot&&"string"!=typeof e&&dn(e);if(c){!function(e){if(!mt)return;const t=[e];for(;t.length>0;){const e=t.pop(),n=ve?ve(e):e.nodeType;if(n===pe||n===me&&I(le,e.data)){try{Ee(e)}catch(e){}continue}if(n===ue){const t=e,n=$t(De?De(e):e.nodeName);try{t.hasAttribute&&t.hasAttribute("patchsrc")&&t.removeAttribute("patchsrc"),t.hasAttribute&&t.hasAttribute("for")&&"label"!==n&&"output"!==n&&t.removeAttribute("for")}catch(e){}}const o=Ne(e);if(o)for(let e=o.length-1;e>=0;--e)t.push(o[e])}}(e);const t=De?De(e):e.nodeName;if("string"==typeof t){const n=$t(t);if(!et[n]||it[n])throw on(e),k("root node is forbidden and cannot be sanitized in-place")}if(pn(e))throw on(e),k("root node is clobbered and cannot be sanitized in-place");try{wn(e)}catch(t){throw on(e),t}}else if(dn(e))n=cn("\x3c!----\x3e"),r=n.ownerDocument.importNode(e,!0),r.nodeType===ue&&"BODY"===r.nodeName||"HTML"===r.nodeName?n=r:n.appendChild(r),wn(r);else{if(!Tt&&!pt&&!dt&&-1===e.indexOf("<"))return Ce&&Et?ze(e):e;if(n=cn(e),!n)return Tt?null:Et?ke:""}n&&bt&&nn(n.firstChild);const s=c?e:n;try{const e=sn(s);for(;a=e.nextNode();)yn(a,s),Nn(a),mn(a.content)&&_n(a.content)}catch(t){throw c&&(on(e),m(o.removed,e=>{e.element&&ln(e.element)})),t}if(c)return m(o.removed,e=>{e.element&&ln(e.element)}),pt&&fn(e),e;if(Tt){if(pt&&fn(n),St)for(l=je.call(n.ownerDocument);n.firstChild;)l.appendChild(n.firstChild);else l=n;return(nt.shadowroot||nt.shadowrootmode)&&(l=Ge.call(i,l,!0)),l}let u=dt?n.outerHTML:n.innerHTML;return dt&&et["!doctype"]&&n.ownerDocument&&n.ownerDocument.doctype&&n.ownerDocument.doctype.name&&I(re,n.ownerDocument.doctype.name)&&(u="<!DOCTYPE "+n.ownerDocument.doctype.name+">\n"+u),pt&&(u=un(u)),Ce&&Et?ze(u):u},o.setConfig=function(){Jt(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),ht=!0,gt=et,yt=nt},o.clearConfig=function(){Kt=null,ht=!1,gt=null,yt=null,Ce=Ie,ke=""},o.isValidAttribute=function(e,t,n){Kt||Jt({});const o=$t(e),r=$t(t);return bn(o,r,n)},o.addHook=function(e,t){"function"==typeof t&&R(We,e)&&g(We[e],t)},o.removeHook=function(e,t){if(R(We,e)){if(void 0!==t){const n=d(We[e],t);return-1===n?void 0:y(We[e],n,1)[0]}return h(We[e])}},o.removeHooks=function(e){R(We,e)&&(We[e]=[])},o.removeAllHooks=function(){We={afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},o}();export{be as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{V as e,d as i,P as r}from"./main.js";import{b as t}from"./index-yOIIz7AL-Dgus2xdV.js";function o(o,n){if(!o.verificationMethod)return void console.warn("No verification method found in the issuer document. This will likely become a requirement in the near future");const a=n.split("#")[1],s=o.verificationMethod.find(e=>e.id===`#${a}`||e.id===n);if(!s)throw new e("retrieveVerificationMethodPublicKey",`${t} - ${i.i18n.getText("errors","retrieveVerificationMethodPublicKey")}`,r.CRYPTOGRAPHIC_SECURITY_ERROR);return{...s}}export{o as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{H as r,I as t}from"./main.js";async function e(e){if(!e.proof)return void console.warn("No proof found in the issuer profile.");let o=e.proof.type;"DataIntegrityProof"===o&&(o=r(e.proof.cryptosuite));const a=await async function(r){if(r===t.MerkleProof2019){const{default:r}=await import("./MerkleProof2019-DraC60XD-B9XV8wNx.js");return r}if(r===t.Ed25519Signature2020){const{default:r}=await import("./Ed25519Signature2020-CDbX0d2Z-Dc1L-exZ.js");return r}if(r===t.EcdsaSecp256k1Signature2019){const{default:r}=await import("./EcdsaSecp256k1Signature2019-rfxWS2XE-C73WHAtH.js");return r}if(r===t.EcdsaSd2023){const{default:r}=await import("./EcdsaSd2023-CdilbQE4-BlaeM9K_.js");return r}}(o),i=new a({document:e,proof:e.proof,issuer:e.issuer?e.issuer:e,executeStep:async(r,t,e)=>t()});await i.init();try{await i.verifyProof()}catch(r){throw new Error(`Issuer profile verification failed: ${r.message}`)}}export{e as default};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blockcerts/blockcerts-verifier",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.74.0",
|
|
4
4
|
"description": "A standalone universal viewer and verifier for blockcerts credentials",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"node": ">=20.0.0"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@blockcerts/cert-verifier-js": "^6.
|
|
14
|
+
"@blockcerts/cert-verifier-js": "^6.37.2",
|
|
15
15
|
"@blockcerts/cert-verifier-js-v1-legacy": "^4.0.2",
|
|
16
16
|
"@polymer/lit-element": "0.5.1",
|
|
17
17
|
"@polymer/polymer": "3.5.2",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@commitlint/cli": "^20.1.0",
|
|
34
|
-
"@commitlint/config-conventional": "^
|
|
34
|
+
"@commitlint/config-conventional": "^21.2.0",
|
|
35
35
|
"@eslint/js": "^10.0.1",
|
|
36
36
|
"@open-wc/testing": "^4.0.0",
|
|
37
37
|
"@rollup/plugin-commonjs": "^29.0.2",
|
|
@@ -41,11 +41,11 @@
|
|
|
41
41
|
"@rollup/plugin-typescript": "^12.1.2",
|
|
42
42
|
"@types/mocha": "^10.0.10",
|
|
43
43
|
"@types/qrcode-svg": "^1.1.1",
|
|
44
|
-
"@types/sinon": "^
|
|
44
|
+
"@types/sinon": "^22.0.0",
|
|
45
45
|
"@typescript-eslint/eslint-plugin": "^8.30.1",
|
|
46
46
|
"@typescript-eslint/parser": "^8.23.0",
|
|
47
|
-
"@vitest/coverage-istanbul": "^4.
|
|
48
|
-
"@web/test-runner": "^0.
|
|
47
|
+
"@vitest/coverage-istanbul": "^4.1.10",
|
|
48
|
+
"@web/test-runner": "^1.0.0",
|
|
49
49
|
"concurrently": "^9.1.2",
|
|
50
50
|
"eslint": "^10.0.3",
|
|
51
51
|
"express": "^5.1.0",
|
|
@@ -56,12 +56,12 @@
|
|
|
56
56
|
"rollup-plugin-livereload": "^2.0.0",
|
|
57
57
|
"rollup-plugin-serve": "^3.0.0",
|
|
58
58
|
"rollup-plugin-visualizer": "^7.0.0",
|
|
59
|
-
"sinon": "^
|
|
60
|
-
"stylelint": "^
|
|
59
|
+
"sinon": "^22.0.0",
|
|
60
|
+
"stylelint": "^17.7.0",
|
|
61
61
|
"stylelint-config-standard-scss": "^15.0.1",
|
|
62
62
|
"typescript": "^5.8.3",
|
|
63
63
|
"typescript-eslint": "^8.29.1",
|
|
64
|
-
"vitest": "^4.
|
|
64
|
+
"vitest": "^4.1.10",
|
|
65
65
|
"wc-sass-render": "blockchain-certificates/wc-sass-render"
|
|
66
66
|
},
|
|
67
67
|
"scripts": {
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import{d as e,p as t,V as n,t as r,v as o,u as i}from"./main.js";import{j as a}from"./jsonld-signatures-BtZPa7MV-DTekMXP5.js";import{S as s,j as u}from"./Suite-CBLHluYK-Dmvbh142.js";import{D as c,r as f}from"./DataIntegrityProof-x-pKdBCc-B_YUlE0Z.js";import{f as l}from"./index-DFOHyoZq-BCuOIg2Z.js";import"./pako.esm-BGRKTPxS-Bodm4Eha.js";import"./index-6G1g4ypj-Dgus2xdV.js";import{r as d}from"./retrieveVerificationMethodPublicKey-DcEGtx_h-D1zuvtQB.js";import"./sha2-JcCWfgvE-By1_saxP.js";
|
|
2
|
-
/*!
|
|
3
|
-
* Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
|
|
4
|
-
*/
|
|
5
|
-
const h=globalThis.crypto;
|
|
6
|
-
/*!
|
|
7
|
-
* Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
|
|
8
|
-
*/function p({algorithm:e="sha256"}={}){if("sha256"!==e)throw new Error(`Unsupported algorithm "${e}".`);return{hash:async e=>new Uint8Array(await h.subtle.digest("SHA-256",e))}}
|
|
9
|
-
/*!
|
|
10
|
-
* Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
|
|
11
|
-
*/const y=new TextEncoder;function g(e){return y.encode(e)}
|
|
12
|
-
/*!
|
|
13
|
-
* Copyright (c) 2023-2024 Digital Bazaar, Inc. All rights reserved.
|
|
14
|
-
*/async function w({document:e,labelMapFactoryFunction:t,options:n}={}){const{nquads:r}=await async function({document:e,nquads:t,labelMapFactoryFunction:n,options:r}={}){let o,i=new Map;o=e?await m(e,{...r,canonicalIdMap:i}):await m(t.join(""),{...r,inputFormat:"application/n-quads",canonicalIdMap:i});i=function(e){let t=!1,n=!1,r=!1;const o=new Map;for(const[i,a]of e){if(!t&&(t=!0,n=i.startsWith("_:"),r=a.startsWith("_:"),!n&&!r))return e;o.set(n?i.slice(2):i,r?a.slice(2):a)}return o}(i);const a=await n({canonicalIdMap:i}),s=new Map;for(const[e,t]of a)s.set(i.get(e),t);const u=(e,t,n)=>"_:"+s.get(n);return{nquads:o.split("\n").slice(0,-1).map(e=>e.replace(/(_:([^\s]+))/g,u)+"\n").sort(),labelMap:a}}
|
|
15
|
-
/*!
|
|
16
|
-
* Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
|
|
17
|
-
*/({document:e,labelMapFactoryFunction:t,options:n});return r}async function m(e,t){if(!t||"object"!=typeof t)throw new TypeError('"options" must be an object.');if(t={algorithm:"RDFC-1.0",format:"application/n-quads",base:null,safe:!0,...t},"string"!=typeof e){const n={rdfDirection:"i18n-datatype",...t,produceGeneralizedRdf:!1};delete n.format,e=await u.toRDF(e,n)}return f.canonize(e,t)}async function b({document:e,proof:t,options:n,hasher:r}={}){r||(r=p());const o=await async function({document:e,proof:t,options:n}={}){return delete(t={"@context":e["@context"],...t}).proofValue,m(t,n)}({document:e,proof:t,options:n});return r.hash(g(o))}const v=["string","number","bigint","symbol"],E=["Function","Generator","AsyncGenerator","GeneratorFunction","AsyncGeneratorFunction","AsyncFunction","Observable","Array","Buffer","Object","RegExp","Date","Error","Map","Set","WeakMap","WeakSet","ArrayBuffer","SharedArrayBuffer","DataView","Promise","URL","HTMLElement","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float32Array","Float64Array","BigInt64Array","BigUint64Array"];function M(e){if(null===e)return"null";if(void 0===e)return"undefined";if(!0===e||!1===e)return"boolean";const t=typeof e;if(v.includes(t))return t;if("function"===t)return"Function";if(Array.isArray(e))return"Array";if(function(e){return e&&e.constructor&&e.constructor.isBuffer&&e.constructor.isBuffer.call(null,e)}(e))return"Buffer";const n=function(e){const t=Object.prototype.toString.call(e).slice(8,-1);if(E.includes(t))return t;return}(e);return n||"Object"}class ${constructor(e,t,n){this.major=e,this.majorEncoded=e<<5,this.name=t,this.terminal=n}toString(){return`Type[${this.major}].${this.name}`}compare(e){return this.major<e.major?-1:this.major>e.major?1:0}}$.uint=new $(0,"uint",!0),$.negint=new $(1,"negint",!0),$.bytes=new $(2,"bytes",!0),$.string=new $(3,"string",!0),$.array=new $(4,"array",!1),$.map=new $(5,"map",!1),$.tag=new $(6,"tag",!1),$.float=new $(7,"float",!0),$.false=new $(7,"false",!0),$.true=new $(7,"true",!0),$.null=new $(7,"null",!0),$.undefined=new $(7,"undefined",!0),$.break=new $(7,"break",!0);class A{constructor(e,t,n){this.type=e,this.value=t,this.encodedLength=n,this.encodedBytes=void 0,this.byteValue=void 0}toString(){return`Token[${this.type}].${this.value}`}}const S=globalThis.process&&!globalThis.process.browser&&globalThis.Buffer&&"function"==typeof globalThis.Buffer.isBuffer,T=new TextDecoder,k=new TextEncoder;function j(e){return S&&globalThis.Buffer.isBuffer(e)}const I=S?(e,t,n)=>n-t>64?globalThis.Buffer.from(e.subarray(t,n)).toString("utf8"):x(e,t,n):(e,t,n)=>n-t>64?T.decode(e.subarray(t,n)):x(e,t,n),V=S?e=>e.length>64?globalThis.Buffer.from(e):U(e):e=>e.length>64?k.encode(e):U(e),B=S?(e,t,n)=>j(e)?new Uint8Array(e.subarray(t,n)):e.slice(t,n):(e,t,n)=>e.slice(t,n);function U(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let o=e.charCodeAt(r);o<128?t[n++]=o:o<2048?(t[n++]=o>>6|192,t[n++]=63&o|128):55296==(64512&o)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(o=65536+((1023&o)<<10)+(1023&e.charCodeAt(++r)),t[n++]=o>>18|240,t[n++]=o>>12&63|128,t[n++]=o>>6&63|128,t[n++]=63&o|128):(t[n++]=o>>12|224,t[n++]=o>>6&63|128,t[n++]=63&o|128)}return t}function x(e,t,n){const r=[];for(;t<n;){const o=e[t];let i=null,a=o>239?4:o>223?3:o>191?2:1;if(t+a<=n){let n,r,s,u;switch(a){case 1:o<128&&(i=o);break;case 2:n=e[t+1],128==(192&n)&&(u=(31&o)<<6|63&n,u>127&&(i=u));break;case 3:n=e[t+1],r=e[t+2],128==(192&n)&&128==(192&r)&&(u=(15&o)<<12|(63&n)<<6|63&r,u>2047&&(u<55296||u>57343)&&(i=u));break;case 4:n=e[t+1],r=e[t+2],s=e[t+3],128==(192&n)&&128==(192&r)&&128==(192&s)&&(u=(15&o)<<18|(63&n)<<12|(63&r)<<6|63&s,u>65535&&u<1114112&&(i=u))}}null===i?(i=65533,a=1):i>65535&&(i-=65536,r.push(i>>>10&1023|55296),i=56320|1023&i),r.push(i),t+=a}return function(e){const t=e.length;if(t<=N)return String.fromCharCode.apply(String,e);let n="",r=0;for(;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=N));return n}(r)}const N=4096;const P="CBOR decode error:",D="CBOR encode error:";function K(e,t,n){if(e.length-t<n)throw new Error(`${P} not enough data for type`)}const F=[24,256,65536,4294967296,BigInt("18446744073709551616")];function C(e,t,n){K(e,t,1);const r=e[t];if(!0===n.strict&&r<F[0])throw new Error(`${P} integer encoded in more bytes than necessary (strict decode)`);return r}function H(e,t,n){K(e,t,2);const r=e[t]<<8|e[t+1];if(!0===n.strict&&r<F[1])throw new Error(`${P} integer encoded in more bytes than necessary (strict decode)`);return r}function z(e,t,n){K(e,t,4);const r=16777216*e[t]+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3];if(!0===n.strict&&r<F[2])throw new Error(`${P} integer encoded in more bytes than necessary (strict decode)`);return r}function O(e,t,n){K(e,t,8);const r=16777216*e[t]+(e[t+1]<<16)+(e[t+2]<<8)+e[t+3],o=16777216*e[t+4]+(e[t+5]<<16)+(e[t+6]<<8)+e[t+7],i=(BigInt(r)<<BigInt(32))+BigInt(o);if(!0===n.strict&&i<F[3])throw new Error(`${P} integer encoded in more bytes than necessary (strict decode)`);if(i<=Number.MAX_SAFE_INTEGER)return Number(i);if(!0===n.allowBigInt)return i;throw new Error(`${P} integers outside of the safe integer range are not supported`)}function _(e,t){return L(e,0,t.value)}function L(e,t,n){if(n<F[0]){const r=Number(n);e.push([t|r])}else if(n<F[1]){const r=Number(n);e.push([24|t,r])}else if(n<F[2]){const r=Number(n);e.push([25|t,r>>>8,255&r])}else if(n<F[3]){const r=Number(n);e.push([26|t,r>>>24&255,r>>>16&255,r>>>8&255,255&r])}else{const r=BigInt(n);if(!(r<F[4]))throw new Error(`${P} encountered BigInt larger than allowable range`);{const n=[27|t,0,0,0,0,0,0,0];let o=Number(r&BigInt(4294967295)),i=Number(r>>BigInt(32)&BigInt(4294967295));n[8]=255&o,o>>=8,n[7]=255&o,o>>=8,n[6]=255&o,o>>=8,n[5]=255&o,n[4]=255&i,i>>=8,n[3]=255&i,i>>=8,n[2]=255&i,i>>=8,n[1]=255&i,e.push(n)}}}_.encodedSize=function(e){return L.encodedSize(e.value)},L.encodedSize=function(e){return e<F[0]?1:e<F[1]?2:e<F[2]?3:e<F[3]?5:9},_.compareTokens=function(e,t){return e.value<t.value?-1:e.value>t.value?1:0};const G=BigInt(-1),R=BigInt(1);function q(e,t){const n=t.value,r="bigint"==typeof n?n*G-R:-1*n-1;L(e,t.type.majorEncoded,r)}function W(e,t,n,r){K(e,t,n+r);const o=B(e,t+n,t+n+r);return new A($.bytes,o,n+r)}function J(e,t,n,r){return W(e,t,1,n)}function Z(e){return void 0===e.encodedBytes&&(e.encodedBytes=e.type===$.string?V(e.value):e.value),e.encodedBytes}function X(e,t){const n=Z(t);L(e,t.type.majorEncoded,n.length),e.push(n)}function Y(e,t,n,r,o){const i=n+r;K(e,t,i);const a=new A($.string,I(e,t+n,t+i),i);return!0===o.retainStringBytes&&(a.byteValue=B(e,t+n,t+i)),a}function Q(e,t,n,r){return Y(e,t,1,n,r)}q.encodedSize=function(e){const t=e.value,n="bigint"==typeof t?t*G-R:-1*t-1;return n<F[0]?1:n<F[1]?2:n<F[2]?3:n<F[3]?5:9},q.compareTokens=function(e,t){return e.value<t.value?1:e.value>t.value?-1:0},X.encodedSize=function(e){const t=Z(e);return L.encodedSize(t.length)+t.length},X.compareTokens=function(e,t){return n=Z(e),r=Z(t),n.length<r.length?-1:n.length>r.length?1:function(e,t){if(j(e)&&j(t))return e.compare(t);for(let n=0;n<e.length;n++)if(e[n]!==t[n])return e[n]<t[n]?-1:1;return 0}(n,r);var n,r};const ee=X;function te(e,t,n,r){return new A($.array,r,n)}function ne(e,t,n,r){return te(0,0,1,n)}function re(e,t){L(e,$.array.majorEncoded,t.value)}function oe(e,t,n,r){return new A($.map,r,n)}function ie(e,t,n,r){return oe(0,0,1,n)}function ae(e,t){L(e,$.map.majorEncoded,t.value)}function se(e,t,n,r){return new A($.tag,n,1)}function ue(e,t){L(e,$.tag.majorEncoded,t.value)}re.compareTokens=_.compareTokens,re.encodedSize=function(e){return L.encodedSize(e.value)},ae.compareTokens=_.compareTokens,ae.encodedSize=function(e){return L.encodedSize(e.value)},ue.compareTokens=_.compareTokens,ue.encodedSize=function(e){return L.encodedSize(e.value)};function ce(e,t,n){if(n){if(!1===n.allowNaN&&Number.isNaN(e))throw new Error(`${P} NaN values are not supported`);if(!1===n.allowInfinity&&(e===1/0||e===-1/0))throw new Error(`${P} Infinity values are not supported`)}return new A($.float,e,t)}function fe(e,t,n){const r=t.value;if(!1===r)e.push([20|$.float.majorEncoded]);else if(!0===r)e.push([21|$.float.majorEncoded]);else if(null===r)e.push([22|$.float.majorEncoded]);else if(void 0===r)e.push([23|$.float.majorEncoded]);else{let t,i=!1;n&&!0===n.float64||(pe(r),t=ye(he,1),r===t||Number.isNaN(r)?(he[0]=249,e.push(he.slice(0,3)),i=!0):(ge(r),t=we(he,1),r===t&&(he[0]=250,e.push(he.slice(0,5)),i=!0))),i||(o=r,de.setFloat64(0,o,!1),t=me(he,1),he[0]=251,e.push(he.slice(0,9)))}var o}fe.encodedSize=function(e,t){const n=e.value;if(!1===n||!0===n||null==n)return 1;if(!t||!0!==t.float64){pe(n);let e=ye(he,1);if(n===e||Number.isNaN(n))return 3;if(ge(n),e=we(he,1),n===e)return 5}return 9};const le=new ArrayBuffer(9),de=new DataView(le,1),he=new Uint8Array(le,0);function pe(e){if(e===1/0)de.setUint16(0,31744,!1);else if(e===-1/0)de.setUint16(0,64512,!1);else if(Number.isNaN(e))de.setUint16(0,32256,!1);else{de.setFloat32(0,e);const t=de.getUint32(0),n=(2139095040&t)>>23,r=8388607&t;if(255===n)de.setUint16(0,31744,!1);else if(0===n)de.setUint16(0,(2147483648&e)>>16|r>>13,!1);else{const e=n-127;e<-24?de.setUint16(0,0):e<-14?de.setUint16(0,(2147483648&t)>>16|1<<24+e,!1):de.setUint16(0,(2147483648&t)>>16|e+15<<10|r>>13,!1)}}}function ye(e,t){if(e.length-t<2)throw new Error(`${P} not enough data for float16`);const n=(e[t]<<8)+e[t+1];if(31744===n)return 1/0;if(64512===n)return-1/0;if(32256===n)return NaN;const r=n>>10&31,o=1023&n;let i;return i=0===r?o*2**-24:31!==r?(o+1024)*2**(r-25):0===o?1/0:NaN,32768&n?-i:i}function ge(e){de.setFloat32(0,e,!1)}function we(e,t){if(e.length-t<4)throw new Error(`${P} not enough data for float32`);const n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,4).getFloat32(0,!1)}function me(e,t){if(e.length-t<8)throw new Error(`${P} not enough data for float64`);const n=(e.byteOffset||0)+t;return new DataView(e.buffer,n,8).getFloat64(0,!1)}function be(e,t,n){throw new Error(`${P} encountered invalid minor (${n}) for major ${e[t]>>>5}`)}function ve(e){return()=>{throw new Error(`${P} ${e}`)}}fe.compareTokens=_.compareTokens;const Ee=[];for(let e=0;e<=23;e++)Ee[e]=be;Ee[24]=function(e,t,n,r){return new A($.uint,C(e,t+1,r),2)},Ee[25]=function(e,t,n,r){return new A($.uint,H(e,t+1,r),3)},Ee[26]=function(e,t,n,r){return new A($.uint,z(e,t+1,r),5)},Ee[27]=function(e,t,n,r){return new A($.uint,O(e,t+1,r),9)},Ee[28]=be,Ee[29]=be,Ee[30]=be,Ee[31]=be;for(let e=32;e<=55;e++)Ee[e]=be;Ee[56]=function(e,t,n,r){return new A($.negint,-1-C(e,t+1,r),2)},Ee[57]=function(e,t,n,r){return new A($.negint,-1-H(e,t+1,r),3)},Ee[58]=function(e,t,n,r){return new A($.negint,-1-z(e,t+1,r),5)},Ee[59]=function(e,t,n,r){const o=O(e,t+1,r);if("bigint"!=typeof o){const e=-1-o;if(e>=Number.MIN_SAFE_INTEGER)return new A($.negint,e,9)}if(!0!==r.allowBigInt)throw new Error(`${P} integers outside of the safe integer range are not supported`);return new A($.negint,G-BigInt(o),9)},Ee[60]=be,Ee[61]=be,Ee[62]=be,Ee[63]=be;for(let e=64;e<=87;e++)Ee[e]=J;Ee[88]=function(e,t,n,r){return W(e,t,2,C(e,t+1,r))},Ee[89]=function(e,t,n,r){return W(e,t,3,H(e,t+1,r))},Ee[90]=function(e,t,n,r){return W(e,t,5,z(e,t+1,r))},Ee[91]=function(e,t,n,r){const o=O(e,t+1,r);if("bigint"==typeof o)throw new Error(`${P} 64-bit integer bytes lengths not supported`);return W(e,t,9,o)},Ee[92]=be,Ee[93]=be,Ee[94]=be,Ee[95]=ve("indefinite length bytes/strings are not supported");for(let e=96;e<=119;e++)Ee[e]=Q;Ee[120]=function(e,t,n,r){return Y(e,t,2,C(e,t+1,r),r)},Ee[121]=function(e,t,n,r){return Y(e,t,3,H(e,t+1,r),r)},Ee[122]=function(e,t,n,r){return Y(e,t,5,z(e,t+1,r),r)},Ee[123]=function(e,t,n,r){const o=O(e,t+1,r);if("bigint"==typeof o)throw new Error(`${P} 64-bit integer string lengths not supported`);return Y(e,t,9,o,r)},Ee[124]=be,Ee[125]=be,Ee[126]=be,Ee[127]=ve("indefinite length bytes/strings are not supported");for(let e=128;e<=151;e++)Ee[e]=ne;Ee[152]=function(e,t,n,r){return te(0,0,2,C(e,t+1,r))},Ee[153]=function(e,t,n,r){return te(0,0,3,H(e,t+1,r))},Ee[154]=function(e,t,n,r){return te(0,0,5,z(e,t+1,r))},Ee[155]=function(e,t,n,r){const o=O(e,t+1,r);if("bigint"==typeof o)throw new Error(`${P} 64-bit integer array lengths not supported`);return te(0,0,9,o)},Ee[156]=be,Ee[157]=be,Ee[158]=be,Ee[159]=function(e,t,n,r){if(!1===r.allowIndefinite)throw new Error(`${P} indefinite length items not allowed`);return te(0,0,1,1/0)};for(let e=160;e<=183;e++)Ee[e]=ie;Ee[184]=function(e,t,n,r){return oe(0,0,2,C(e,t+1,r))},Ee[185]=function(e,t,n,r){return oe(0,0,3,H(e,t+1,r))},Ee[186]=function(e,t,n,r){return oe(0,0,5,z(e,t+1,r))},Ee[187]=function(e,t,n,r){const o=O(e,t+1,r);if("bigint"==typeof o)throw new Error(`${P} 64-bit integer map lengths not supported`);return oe(0,0,9,o)},Ee[188]=be,Ee[189]=be,Ee[190]=be,Ee[191]=function(e,t,n,r){if(!1===r.allowIndefinite)throw new Error(`${P} indefinite length items not allowed`);return oe(0,0,1,1/0)};for(let e=192;e<=215;e++)Ee[e]=se;Ee[216]=function(e,t,n,r){return new A($.tag,C(e,t+1,r),2)},Ee[217]=function(e,t,n,r){return new A($.tag,H(e,t+1,r),3)},Ee[218]=function(e,t,n,r){return new A($.tag,z(e,t+1,r),5)},Ee[219]=function(e,t,n,r){return new A($.tag,O(e,t+1,r),9)},Ee[220]=be,Ee[221]=be,Ee[222]=be,Ee[223]=be;for(let e=224;e<=243;e++)Ee[e]=ve("simple values are not supported");Ee[244]=be,Ee[245]=be,Ee[246]=be,Ee[247]=function(e,t,n,r){if(!1===r.allowUndefined)throw new Error(`${P} undefined values are not supported`);return!0===r.coerceUndefinedToNull?new A($.null,null,1):new A($.undefined,void 0,1)},Ee[248]=ve("simple values are not supported"),Ee[249]=function(e,t,n,r){return ce(ye(e,t+1),3,r)},Ee[250]=function(e,t,n,r){return ce(we(e,t+1),5,r)},Ee[251]=function(e,t,n,r){return ce(me(e,t+1),9,r)},Ee[252]=be,Ee[253]=be,Ee[254]=be,Ee[255]=function(e,t,n,r){if(!1===r.allowIndefinite)throw new Error(`${P} indefinite length items not allowed`);return new A($.break,void 0,1)};const Me=[];for(let e=0;e<24;e++)Me[e]=new A($.uint,e,1);for(let e=-1;e>=-24;e--)Me[31-e]=new A($.negint,e,1);Me[64]=new A($.bytes,new Uint8Array(0),1),Me[96]=new A($.string,"",1),Me[128]=new A($.array,0,1),Me[160]=new A($.map,0,1),Me[244]=new A($.false,!1,1),Me[245]=new A($.true,!0,1),Me[246]=new A($.null,null,1),function(){const e=[];e[$.uint.major]=_,e[$.negint.major]=q,e[$.bytes.major]=X,e[$.string.major]=ee,e[$.array.major]=re,e[$.map.major]=ae,e[$.tag.major]=ue,e[$.float.major]=fe}();class $e{constructor(e,t){this.obj=e,this.parent=t}includes(e){let t=this;do{if(t.obj===e)return!0}while(t=t.parent);return!1}static createCheck(e,t){if(e&&e.includes(t))throw new Error(`${D} object contains circular references`);return new $e(t,e)}}const Ae={null:new A($.null,null),undefined:new A($.undefined,void 0),true:new A($.true,!0),false:new A($.false,!1),emptyArray:new A($.array,0),emptyMap:new A($.map,0)},Se={number:(e,t,n,r)=>Number.isInteger(e)&&Number.isSafeInteger(e)?new A(e>=0?$.uint:$.negint,e):new A($.float,e),bigint:(e,t,n,r)=>e>=BigInt(0)?new A($.uint,e):new A($.negint,e),Uint8Array:(e,t,n,r)=>new A($.bytes,e),string:(e,t,n,r)=>new A($.string,e),boolean:(e,t,n,r)=>e?Ae.true:Ae.false,null:(e,t,n,r)=>Ae.null,undefined:(e,t,n,r)=>Ae.undefined,ArrayBuffer:(e,t,n,r)=>new A($.bytes,new Uint8Array(e)),DataView:(e,t,n,r)=>new A($.bytes,new Uint8Array(e.buffer,e.byteOffset,e.byteLength)),Array(e,t,n,r){if(!e.length)return!0===n.addBreakTokens?[Ae.emptyArray,new A($.break)]:Ae.emptyArray;r=$e.createCheck(r,e);const o=[];let i=0;for(const t of e)o[i++]=Te(t,n,r);return n.addBreakTokens?[new A($.array,e.length),o,new A($.break)]:[new A($.array,e.length),o]},Object(e,t,n,r){const o="Object"!==t,i=o?e.keys():Object.keys(e),a=o?e.size:i.length;if(!a)return!0===n.addBreakTokens?[Ae.emptyMap,new A($.break)]:Ae.emptyMap;r=$e.createCheck(r,e);const s=[];let u=0;for(const t of i)s[u++]=[Te(t,n,r),Te(o?e.get(t):e[t],n,r)];return function(e,t){t.mapSorter&&e.sort(t.mapSorter)}(s,n),n.addBreakTokens?[new A($.map,a),s,new A($.break)]:[new A($.map,a),s]}};Se.Map=Se.Object,Se.Buffer=Se.Uint8Array;for(const e of"Uint8Clamped Uint16 Uint32 Int8 Int16 Int32 BigUint64 BigInt64 Float32 Float64".split(" "))Se[`${e}Array`]=Se.DataView;function Te(e,t={},n){const r=M(e),o=t&&t.typeEncoders&&t.typeEncoders[r]||Se[r];if("function"==typeof o){const i=o(e,r,t,n);if(null!=i)return i}const i=Se[r];if(!i)throw new Error(`${D} unsupported type: ${r}`);return i(e,r,t,n)}const ke={strict:!1,allowIndefinite:!0,allowUndefined:!0,allowBigInt:!0};class je{constructor(e,t={}){this._pos=0,this.data=e,this.options=t}pos(){return this._pos}done(){return this._pos>=this.data.length}next(){const e=this.data[this._pos];let t=Me[e];if(void 0===t){const n=Ee[e];if(!n)throw new Error(`${P} no decoder for major type ${e>>>5} (byte 0x${e.toString(16).padStart(2,"0")})`);const r=31&e;t=n(this.data,this._pos,r,this.options)}return this._pos+=t.encodedLength,t}}const Ie=Symbol.for("DONE"),Ve=Symbol.for("BREAK");function Be(e,t){if(e.done())return Ie;const n=e.next();if(n.type===$.break)return Ve;if(n.type.terminal)return n.value;if(n.type===$.array)return function(e,t,n){const r=[];for(let o=0;o<e.value;o++){const i=Be(t,n);if(i===Ve){if(e.value===1/0)break;throw new Error(`${P} got unexpected break to lengthed array`)}if(i===Ie)throw new Error(`${P} found array but not enough entries (got ${o}, expected ${e.value})`);r[o]=i}return r}(n,e,t);if(n.type===$.map)return function(e,t,n){const r=!0===n.useMaps,o=r?void 0:{},i=r?new Map:void 0;for(let a=0;a<e.value;a++){const s=Be(t,n);if(s===Ve){if(e.value===1/0)break;throw new Error(`${P} got unexpected break to lengthed map`)}if(s===Ie)throw new Error(`${P} found map but not enough entries (got ${a} [no key], expected ${e.value})`);if(!0!==r&&"string"!=typeof s)throw new Error(`${P} non-string keys not supported (got ${typeof s})`);if(!0===n.rejectDuplicateMapKeys&&(r&&i.has(s)||!r&&s in o))throw new Error(`${P} found repeat map key "${s}"`);const u=Be(t,n);if(u===Ie)throw new Error(`${P} found map but not enough entries (got ${a} [no value], expected ${e.value})`);r?i.set(s,u):o[s]=u}return r?i:o}(n,e,t);if(n.type===$.tag){if(t.tags&&"function"==typeof t.tags[n.value]){const r=Be(e,t);return t.tags[n.value](r)}throw new Error(`${P} tag not supported (${n.value})`)}throw new Error("unsupported")}function Ue(e,t){const[n,r]=function(e,t){if(!(e instanceof Uint8Array))throw new Error(`${P} data to decode must be a Uint8Array`);const n=(t=Object.assign({},ke,t)).tokenizer||new je(e,t),r=Be(n,t);if(r===Ie)throw new Error(`${P} did not find any content to decode`);if(r===Ve)throw new Error(`${P} got unexpected break`);return[r,e.subarray(n.pos())]}(e,t);if(r.length>0)throw new Error(`${P} too many terminals, data makes no sense`);return n}
|
|
18
|
-
/*!
|
|
19
|
-
* Copyright (c) 2023-2024 Digital Bazaar, Inc. All rights reserved.
|
|
20
|
-
*/const xe=new Uint8Array([217,93,1]),Ne=[];function Pe({proof:e}={}){try{if("string"!=typeof e?.proofValue)throw new TypeError('"proof.proofValue" must be a string.');if("u"!==e.proofValue[0])throw new Error("Only base64url multibase encoding is supported.");const t=r(e.proofValue.slice(1));if(!function(e,t){for(let n=0;n<t.length;++n)if(e[n]!==t[n])return!1;return!0}(t,xe))throw new TypeError('"proof.proofValue" must be a derived proof.');const n=t.subarray(xe.length),[o,a,s,u,c]=Ue(n,{useMaps:!0,tags:Ne}),f=function(e){const t=new Map;for(const[n,r]of e.entries())t.set(`c14n${n}`,`u${i(r)}`);return t}(u),l={baseSignature:o,publicKey:a,signatures:s,labelMap:f,mandatoryIndexes:c};return function({baseSignature:e,publicKey:t,signatures:n,labelMap:r,mandatoryIndexes:o}){if(!(e instanceof Uint8Array&&64===e.length))throw new TypeError('"baseSignature" must be a Uint8Array of length 64.');if(!(t instanceof Uint8Array&&35===t.length))throw new TypeError('"publicKey" must be a Uint8Array of length 35.');if(!Array.isArray(n)||!n.every(e=>e instanceof Uint8Array))throw new TypeError('"signatures" must be an array of Uint8Arrays.');if(!(r instanceof Map&&[...r.entries()].every(([e,t])=>"string"==typeof e&&"string"==typeof t)))throw new TypeError('"labelMap" must be a Map of strings to strings.');if(!Array.isArray(o)||!o.every(Number.isInteger))throw new TypeError('"mandatoryIndexes" must be an array of integers.')}(l),l}catch(e){const t=new TypeError('The proof does not include a valid "proofValue" property.');throw t.cause=e,t}}function De({proofHash:e,publicKey:t,mandatoryHash:n}={}){!function({proofHash:e,publicKey:t,mandatoryHash:n}){if(!(e instanceof Uint8Array&&32===e.length))throw new TypeError('"proofHash" must be a Uint8Array of length 32.');if(!(t instanceof Uint8Array&&35===t.length))throw new TypeError('"publicKey" must be a Uint8Array of length 35.');if(!(n instanceof Uint8Array&&32===n.length))throw new TypeError('"mandatoryHash" must be a Uint8Array of length 32.')}({proofHash:e,publicKey:t,mandatoryHash:n});return function(e){const t=new Uint8Array(e.reduce((e,t)=>e+t.length,0));let n=0;for(const r of e)t.set(r,n),n+=r.length;return t}([e,t,n])}Ne[64]=function(e){return e}
|
|
21
|
-
/*!
|
|
22
|
-
* Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
|
|
23
|
-
*/;const Ke="ecdsa-sd-2023";
|
|
24
|
-
/*!
|
|
25
|
-
* Copyright (c) 2022-2023 Digital Bazaar, Inc. All rights reserved.
|
|
26
|
-
*/
|
|
27
|
-
/*!
|
|
28
|
-
* Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
|
|
29
|
-
*/
|
|
30
|
-
function Fe({requiredAlgorithm:e="P-256"}={}){return{name:Ke,requiredAlgorithm:e,createVerifier:Ce,createVerifyData:He}}async function Ce({verificationMethod:e}){const t=(await l(e)).verifier();return{algorithm:t.algorithm,id:t.id,verify:async({data:e})=>async function({verifier:e,data:t}={}){const{baseSignature:n,proofHash:r,publicKey:i,signatures:a,nonMandatory:s,mandatoryHash:u}=t,c="z"+o(i),f=await l({publicKeyMultibase:c});if(a.length!==s.length)throw new Error(`Signature count (${a.length}) does not match non-mandatory message count (${s.length}).`);const{verify:d}=f.verifier();if((await Promise.all(a.map((e,t)=>d({data:g(s[t]),signature:e})))).some(e=>!e))return!1;const h=await De({proofHash:r,publicKey:i,mandatoryHash:u});return e.verify({data:h,signature:n})}({verifier:t,data:e})}}async function He({cryptosuite:e,document:t,proof:n,documentLoader:r}){if(e?.name!==Ke)throw new TypeError(`"cryptosuite.name" must be "${Ke}".`);const o={documentLoader:r},i=b({document:t,proof:n,options:o}).catch(e=>e),{baseSignature:a,publicKey:s,signatures:u,labelMap:c,mandatoryIndexes:f}=await Pe({proof:n}),l=await function({labelMap:e}={}){return async({canonicalIdMap:t})=>{const n=new Map;for(const[r,o]of t)n.set(r,e.get(o));return n}}({labelMap:c}),d=await w({document:t,labelMapFactoryFunction:l,options:o}),h=[],y=[];for(const[e,t]of d.entries())f.includes(e)?h.push(t):y.push(t);const{mandatoryHash:m}=await async function({mandatory:e,hasher:t}={}){return t||(t=p()),{mandatoryHash:await t.hash(g(e.join("")))}}({mandatory:h}),v=await i;if(v instanceof Error)throw v;return{baseSignature:a,proofHash:v,publicKey:s,signatures:u,nonMandatory:y,mandatoryHash:m}}const{purposes:{AssertionProofPurpose:ze,AuthenticationProofPurpose:Oe}}=a;var _e;!function(e){e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.ensureVerificationMethodValidity="ensureVerificationMethodValidity",e.checkDocumentSignature="checkDocumentSignature"}(_e||(_e={}));class Le extends s{verificationProcess=[_e.retrieveVerificationMethodPublicKey,_e.ensureVerificationMethodValidity,_e.checkDocumentSignature];documentToVerify;issuer;proof;type="EcdsaSd2023";cryptosuite="ecdsa-sd-2023";publicKey;verificationKey;verificationMethod;proofPurpose;challenge;domain;proofPurposeMap;constructor(e){super(e),e.executeStep&&(this.executeStep=e.executeStep),this.documentToVerify=e.document,this.issuer=e.issuer,this.proof=e.proof,this.proofPurpose=e.proofPurpose??"assertionMethod",this.challenge=e.proofChallenge??"",this.domain=e.proofDomain,this.proofPurposeMap={authentication:Oe,assertionMethod:ze},this.validateProofType()}async init(){}async verifyProof(){for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}}async verifyIdentity(){}getProofVerificationSteps(t){return this.verificationProcess.map(n=>e.verifier.convertToVerificationSubsteps(t,n))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return this.publicKey}getIssuerName(){return this.issuer.name??""}getIssuerProfileDomain(){try{return new URL(this.getIssuerProfileUrl()).hostname??""}catch(e){return""}}getIssuerProfileUrl(){return this.issuer.id??""}getSigningDate(){return this.proof.created}async executeStep(e,t,n){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}validateProofType(){const e=this.proof.type;if("DataIntegrityProof"===e){const e=this.proof.cryptosuite;if(!e)throw new Error(`Malformed proof passed. With DataIntegrityProof a cryptosuite must be defined. Expected: ${this.cryptosuite}`);if(e!==this.cryptosuite)throw new Error(`Incompatible proof cryptosuite passed. Expected: ${this.cryptosuite}, Got: ${e}`);return}if(e!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${e}`)}generateDocumentLoader(e=[]){e.forEach(e=>{t[e.url]=e.value}),t[this.documentToVerify.issuer]=this.getTargetVerificationMethodContainer();return function(e){return e in t?{contextUrl:null,document:t[e],documentUrl:e}:u.documentLoader(e)}}getErrorMessage(e){return e.error.errors[0].message}getTargetVerificationMethodContainer(){if(this.issuer.didDocument){if(this.findVerificationMethod(this.issuer.didDocument.verificationMethod,this.issuer.didDocument.id))return this.issuer.didDocument}const e={...this.issuer};return delete e.didDocument,e}findVerificationMethod(e,t){return e.find(e=>e.id===this.proof.verificationMethod||t+e.id===this.proof.verificationMethod)??null}async retrieveVerificationMethodPublicKey(){this.verificationKey=await this.executeStep(_e.retrieveVerificationMethodPublicKey,async()=>{if(this.verificationMethod=d(this.getTargetVerificationMethodContainer(),this.proof.verificationMethod),!this.verificationMethod)throw new n(_e.retrieveVerificationMethodPublicKey,"Could not derive the verification key");if(this.verificationMethod.revoked)throw new n(_e.retrieveVerificationMethodPublicKey,"The verification key has been revoked");return this.verificationMethod},this.type)}async ensureVerificationMethodValidity(){await this.executeStep(_e.ensureVerificationMethodValidity,async()=>{if(this.verificationMethod.expires){if(new Date(this.verificationMethod.expires).getTime()<Date.now())throw new n(_e.ensureVerificationMethodValidity,"The verification key has expired")}if(this.verificationMethod.revoked)throw new n(_e.ensureVerificationMethodValidity,"The verification key has been revoked")},this.type)}async checkDocumentSignature(){await this.executeStep(_e.checkDocumentSignature,async()=>{const e=new c({cryptosuite:Fe({requiredAlgorithm:"K-256"})}),t=this.documentToVerify.proof.verificationMethod;"authentication"!==this.proofPurpose||this.proof.challenge||(this.proof.challenge="");const r=await a.verify(this.documentToVerify,{suite:e,purpose:new this.proofPurposeMap[this.proofPurpose]({controller:this.getTargetVerificationMethodContainer(),challenge:this.challenge,domain:this.domain}),documentLoader:this.generateDocumentLoader([{url:t,value:this.verificationKey}])});if(!r.verified)throw console.error(JSON.stringify(r,null,2)),new n(_e.checkDocumentSignature,`The document's ${this.type} signature could not be confirmed: ${this.getErrorMessage(r)}`);console.log(`Credential ${this.type} signature successfully verified`)},this.type)}}export{Le as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as e,p as t,a as i,w as o,x as r,E as n,V as s}from"./main.js";import{j as c}from"./jsonld-signatures-BtZPa7MV-DTekMXP5.js";import{S as a,j as d}from"./Suite-CBLHluYK-Dmvbh142.js";import"./pako.esm-BGRKTPxS-Bodm4Eha.js";import"./index-6G1g4ypj-Dgus2xdV.js";import{r as h}from"./retrieveVerificationMethodPublicKey-DcEGtx_h-D1zuvtQB.js";const u="https://ns.did.ai/suites/secp256k1-2019/v1",p="https://www.w3.org/ns/credentials/v2",f=({document:e,contextUrl:t})=>{const i=e["@context"];return Array.isArray(i)?t.some(e=>i.includes(e)):t.includes(i)},y=({document:e})=>{const t=f({document:e,contextUrl:[u,"https://w3id.org/security/suites/secp256k1-2019/v1"]}),i=f({document:e,contextUrl:["https://www.w3.org/2018/credentials/v1"]}),o=f({document:e,contextUrl:[p]}),r=f({document:e,contextUrl:["https://w3id.org/security/v2"]});return t&&i?(console.warn("Warning: The secp256k1-2019/v1 and credentials/v1 contexts are incompatible."),console.warn("For VCs using EcdsaSecp256k1Signature2019 suite, using the credentials/v1 context is sufficient."),!1):!t&&o?(console.warn("This library does not (yet) follow the Data Integrity Proof format."),console.warn("When using the credentials/v2 context, consumers need to specify the secp256k1-2019/v1 context."),!1):t&&r?(console.warn("Warning: The secp256k1-2019/v1 and security/v2 contexts are incompatible."),console.warn("For VCs using EcdsaSecp256k1Signature2019 suite, using the security/v2 context is sufficient."),!1):t||i||r};let l=class extends c.suites.LinkedDataSignature{requiredKeyType;constructor(e={}){super({type:"EcdsaSecp256k1Signature2019",LDKeyClass:n,contextUrl:u,...e}),this.requiredKeyType="EcdsaSecp256k1VerificationKey2019"}async sign({verifyData:e,proof:t}){if(!this.signer||"function"!=typeof this.signer.sign)throw new Error("A signer API has not been specified.");return{...t,jws:await this.signer.sign({data:e})}}async verifySignature({verifyData:e,verificationMethod:t,proof:i}){const{jws:o}=i;if(!o||"string"!=typeof o)throw new TypeError('The proof does not include a valid "jws" property.');let{verifier:r}=this;if(!r){r=(await this.LDKeyClass.from(t)).verifier()}return r.verify({data:e,signature:o})}async assertVerificationMethod({verificationMethod:e}){if(!y({document:e}))throw new TypeError(`The verification method (key) must contain "${this.contextUrl}".`);if(!d.hasValue(e,"type",this.requiredKeyType))throw new Error(`Invalid key type. Key type must be "${this.requiredKeyType}".`);if(void 0!==e.revoked)throw new Error("The verification method has been revoked.")}async getVerificationMethod({proof:e,documentLoader:t}){if(this.key)return this.key.export({publicKey:!0});const i="object"==typeof e.verificationMethod?e.verificationMethod.id:e.verificationMethod;if(!i)throw new Error('No "verificationMethod" found in proof.');const o=await d.frame(i,{"@context":this.contextUrl,"@embed":"@always",id:i},{documentLoader:t,compactToRelative:!1});if(!o)throw new Error(`Verification method ${i} not found.`);if(void 0!==o.revoked)throw new Error("The verification method has been revoked.");return await this.assertVerificationMethod({verificationMethod:o}),o}async matchProof({proof:e,document:t,purpose:i,documentLoader:o,expansionMap:r}){if(!y({document:t}))return!1;if(!await super.matchProof({proof:e,document:t,purpose:i,documentLoader:o,expansionMap:r}))return!1;if(!this.key)return!0;const{verificationMethod:n}=e,s="object"==typeof n?n.id:n;return this.isVerificationMethodMatchingKeyId(s)}ensureSuiteContext({document:e,addSuiteContext:t}){y({document:e})&&!f({document:e,contextUrl:[p]})||super.ensureSuiteContext({document:e,addSuiteContext:t})}isVerificationMethodMatchingKeyId(e){return e===this.key.id||e===`${this.key.controller}${this.key.id}`}};l.CONTEXT_URL=u,l.CONTEXT={"@context":{id:"@id",type:"@type","@protected":!0,proof:{"@id":"https://w3id.org/security#proof","@type":"@id","@container":"@graph"},EcdsaSecp256k1VerificationKey2019:{"@id":"https://w3id.org/security#EcdsaSecp256k1VerificationKey2019","@context":{"@protected":!0,id:"@id",type:"@type",controller:{"@id":"https://w3id.org/security#controller","@type":"@id"},revoked:{"@id":"https://w3id.org/security#revoked","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},blockchainAccountId:{"@id":"https://w3id.org/security#blockchainAccountId"},publicKeyJwk:{"@id":"https://w3id.org/security#publicKeyJwk","@type":"@json"},publicKeyBase58:{"@id":"https://w3id.org/security#publicKeyBase58"},publicKeyMultibase:{"@id":"https://w3id.org/security#publicKeyMultibase","@type":"https://w3id.org/security#multibase"}}},EcdsaSecp256k1Signature2019:{"@id":"https://w3id.org/security#EcdsaSecp256k1Signature2019","@context":{"@protected":!0,id:"@id",type:"@type",challenge:"https://w3id.org/security#challenge",created:{"@id":"http://purl.org/dc/terms/created","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},domain:"https://w3id.org/security#domain",expires:{"@id":"https://w3id.org/security#expiration","@type":"http://www.w3.org/2001/XMLSchema#dateTime"},nonce:"https://w3id.org/security#nonce",proofPurpose:{"@id":"https://w3id.org/security#proofPurpose","@type":"@vocab","@context":{"@protected":!0,id:"@id",type:"@type",assertionMethod:{"@id":"https://w3id.org/security#assertionMethod","@type":"@id","@container":"@set"},authentication:{"@id":"https://w3id.org/security#authenticationMethod","@type":"@id","@container":"@set"},capabilityInvocation:{"@id":"https://w3id.org/security#capabilityInvocationMethod","@type":"@id","@container":"@set"},capabilityDelegation:{"@id":"https://w3id.org/security#capabilityDelegationMethod","@type":"@id","@container":"@set"},keyAgreement:{"@id":"https://w3id.org/security#keyAgreementMethod","@type":"@id","@container":"@set"}}},jws:{"@id":"https://w3id.org/security#jws"},verificationMethod:{"@id":"https://w3id.org/security#verificationMethod","@type":"@id"}}}}};const{purposes:{AssertionProofPurpose:g,AuthenticationProofPurpose:w}}=c;var m;!function(e){e.retrieveVerificationMethodPublicKey="retrieveVerificationMethodPublicKey",e.ensureVerificationMethodValidity="ensureVerificationMethodValidity",e.checkDocumentSignature="checkDocumentSignature"}(m||(m={}));class v extends a{verificationProcess=[m.retrieveVerificationMethodPublicKey,m.ensureVerificationMethodValidity,m.checkDocumentSignature];documentToVerify;issuer;proof;type="EcdsaSecp256k1Signature2019";verificationKey;verificationMethod;publicKey;proofPurpose;challenge;domain;proofPurposeMap;constructor(e){super(e),e.executeStep&&(this.executeStep=e.executeStep),this.documentToVerify=e.document,this.issuer=e.issuer,this.proof=e.proof,this.proofPurpose=e.proofPurpose??"assertionMethod",this.challenge=e.proofChallenge??"",this.domain=e.proofDomain,this.proofPurposeMap={authentication:w,assertionMethod:g},this.validateProofType()}async init(){}async verifyProof(){for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}}async verifyIdentity(){}getProofVerificationSteps(t){return this.verificationProcess.map(i=>e.verifier.convertToVerificationSubsteps(t,i))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return this.publicKey}getIssuerName(){return this.issuer.name??""}getIssuerProfileDomain(){try{return new URL(this.getIssuerProfileUrl()).hostname??""}catch(e){return""}}getIssuerProfileUrl(){return this.issuer.id??""}getSigningDate(){return this.proof.created}async executeStep(e,t,i){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}validateProofType(){const e=this.isProofChain()?this.proof.chainedProofType:this.proof.type;if(e!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${e}`)}isProofChain(){return"ChainedProof2021"===this.proof.type}generateDocumentLoader(){t[this.documentToVerify.issuer]=this.getTargetVerificationMethodContainer();return function(e){return e in t?{contextUrl:null,document:t[e],documentUrl:e}:d.documentLoader(e)}}retrieveInitialDocument(){const e=i(this.documentToVerify);if(Array.isArray(e.proof)){const t=e.proof.find(e=>e.type===this.type);delete e.proof,e.proof=t}return e}getTargetVerificationMethodContainer(){if(this.issuer.didDocument){if(this.findVerificationMethod(this.issuer.didDocument.verificationMethod,this.issuer.didDocument.id))return this.issuer.didDocument}const e={...this.issuer};return delete e.didDocument,e}findVerificationMethod(e,t){return e.find(e=>e.id===this.proof.verificationMethod||t+e.id===this.proof.verificationMethod)??null}getErrorMessage(e){return e.error.errors[0].message}async retrieveVerificationMethodPublicKey(){this.verificationKey=await this.executeStep(m.retrieveVerificationMethodPublicKey,async()=>{if(this.verificationMethod=h(this.getTargetVerificationMethodContainer(),this.proof.verificationMethod),this.verificationMethod.publicKeyJwk&&!this.verificationMethod.publicKeyBase58){const e=o(this.verificationMethod.publicKeyJwk);this.verificationMethod.publicKeyBase58=r(e),this.documentToVerify["@context"].includes("https://www.w3.org/ns/credentials/v2")&&!this.documentToVerify["@context"].includes("https://w3id.org/security/suites/secp256k1-2019/v1")&&this.documentToVerify["@context"].push("https://w3id.org/security/suites/secp256k1-2019/v1")}this.publicKey=this.verificationMethod.publicKeyBase58;const e=n.from({...this.verificationMethod});if(!e)throw new s(m.retrieveVerificationMethodPublicKey,"Could not derive the verification key");if(e.revoked)throw new s(m.retrieveVerificationMethodPublicKey,"The verification key has been revoked");return e},this.type)}async ensureVerificationMethodValidity(){await this.executeStep(m.ensureVerificationMethodValidity,async()=>{if(this.verificationMethod.expires){if(new Date(this.verificationMethod.expires).getTime()<Date.now())throw new s(m.ensureVerificationMethodValidity,"The verification key has expired")}if(this.verificationMethod.revoked)throw new s(m.ensureVerificationMethodValidity,"The verification key has been revoked")},this.type)}async checkDocumentSignature(){await this.executeStep(m.checkDocumentSignature,async()=>{const e=new l({key:this.verificationKey});e.date=new Date(Date.now()).toISOString(),"authentication"!==this.proofPurpose||this.proof.challenge||(this.proof.challenge="");const t=await c.verify(this.retrieveInitialDocument(),{suite:e,purpose:new this.proofPurposeMap[this.proofPurpose]({controller:this.getTargetVerificationMethodContainer(),challenge:this.challenge,domain:this.domain}),documentLoader:this.generateDocumentLoader()});if(!t.verified)throw console.error(JSON.stringify(t,null,2)),new s(m.checkDocumentSignature,`The document's ${this.type} signature could not be confirmed: ${this.getErrorMessage(t)}`);console.log("Credential Secp256k1 signature successfully verified")},this.type)}}export{v as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as e,r as t,V as i,g as s,i as r,B as o,a,p as n}from"./main.js";import"./pako.esm-BGRKTPxS-Bodm4Eha.js";import{S as c,j as h}from"./Suite-CBLHluYK-Dmvbh142.js";import{s as u}from"./sha2-JcCWfgvE-By1_saxP.js";import{e as p}from"./ensureValidIssuingKey-DN2kpCwj-DY8BTObG.js";import"./index-6G1g4ypj-Dgus2xdV.js";function f(e){e=e.trim();const t=[];for(let i=0;i<e.length;i+=2)t.push(parseInt(e.substring(i,i+2),16));return t}function l(e){const t=a(e);return"proof"in t?function(e){const t=a(e);if(!Array.isArray(e.proof))return delete t.proof,t;const i=e.proof.find(e=>"ChainedProof2021"!==e.type);return t.proof=i,t}(t):("signature"in t&&delete t.signature,t)}async function d(e){e["@context"].find(e=>r(e)&&"@vocab"in e)||e["@context"].push({"@vocab":"http://fallback.org/"});const t=l(e),a={algorithm:"URDNA2015",format:"application/nquads",documentLoader:function(e){return e in n?{contextUrl:null,document:n[e],documentUrl:e}:h.documentLoader(e)}};let c;try{c=await h.normalize(t,a)}catch(e){throw console.error(e),new i("computeLocalHash",s("errors","failedJsonLdNormalization"))}const p=function(e){const t=e.split("\n"),i=/<http:\/\/fallback\.org\/(.*)>/,s=t.map(e=>i.exec(e)).filter(e=>null!=e);if(s.length>0){const e=s.map(e=>e[1]).sort();return Array.from(new Set(e))}return null}(c);if(p)throw new i("computeLocalHash",`${s("errors","foundUnmappedFields")}: ${p.join(", ")}`);return o.from(u(Uint8Array.from(function(e){const t=[];for(let i=0;i<e.length;i++){let s=e.charCodeAt(i);s<128?t.push(s):s<2048?t.push(192|s>>6,128|63&s):s<55296||s>=57344?t.push(224|s>>12,128|s>>6&63,128|63&s):(i++,s=65536+((1023&s)<<10|1023&e.charCodeAt(i)),t.push(240|s>>18,128|s>>12&63,128|s>>6&63,128|63&s))}return t}(c)))).toString("hex")}var y;!function(e){e.getTransactionId="getTransactionId",e.computeLocalHash="computeLocalHash",e.fetchRemoteHash="fetchRemoteHash",e.parseIssuerKeys="parseIssuerKeys",e.compareHashes="compareHashes",e.checkMerkleRoot="checkMerkleRoot",e.checkReceipt="checkReceipt",e.checkAuthenticity="checkAuthenticity"}(y||(y={}));class m extends c{verificationProcess=[y.getTransactionId,y.computeLocalHash,y.fetchRemoteHash,y.compareHashes,y.checkMerkleRoot,y.checkReceipt,y.parseIssuerKeys,y.checkAuthenticity];transactionId;localHash;documentToVerify;txData;chain;explorerAPIs;receipt;issuerPublicKeyList;issuer;proof;type="MerkleProof2017";constructor(t){super(t),t.executeStep&&(this.executeStep=t.executeStep),this.documentToVerify=t.document,this.explorerAPIs=t.explorerAPIs,this.issuer=t.issuer,this.proof=t.proof,this.validateProofType(),this.receipt=this.documentToVerify.signature,this.chain=e.certificates.getChain("",this.receipt),this.transactionId=e.certificates.getTransactionId(this.receipt),this.adaptVerificationProcessToChain()}async init(){}async verifyProof(){for(const e of this.verificationProcess){if(!this[e])return void console.error("verification logic for",e,"not implemented");await this[e]()}}async verifyIdentity(){}getProofVerificationSteps(t){return this.verificationProcess.map(i=>e.verifier.convertToVerificationSubsteps(t,i))}getIdentityVerificationSteps(){return[]}getIssuerPublicKey(){return e.chains.isMockChain(this.chain)?"This mock chain does not support issuing addresses":this.txData?this.txData.issuingAddress:void console.error("Trying to access issuing address when txData not available yet. Did you run the `verify` method yet?")}getIssuerName(){return this.issuer.name}getIssuerProfileDomain(){const e=new URL(this.getIssuerProfileUrl());return e?.hostname}getIssuerProfileUrl(){return this.issuer.id}getSigningDate(){return this.documentToVerify.issuedOn}getChain(){return this.chain}getReceipt(){return this.receipt}getTransactionIdString(){return e.certificates.getTransactionId(this.getReceipt())}getTransactionLink(){return e.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).transactionLink}getRawTransactionLink(){return e.certificates.getTransactionLink(this.getTransactionIdString(),this.getChain()).rawTransactionLink}validateProofType(){if(this.proof.type[0]!==this.type)throw new Error(`Incompatible proof type passed. Expected: ${this.type}, Got: ${this.proof.type[0]}`)}adaptVerificationProcessToChain(){e.chains.isMockChain(this.chain)&&(t(this.verificationProcess,y.getTransactionId),t(this.verificationProcess,y.fetchRemoteHash),t(this.verificationProcess,y.parseIssuerKeys),t(this.verificationProcess,y.checkMerkleRoot),t(this.verificationProcess,y.checkAuthenticity))}async executeStep(e,t,i){throw new Error("doAction method needs to be overwritten by injecting from CVJS")}async getTransactionId(){await this.executeStep(y.getTransactionId,()=>function(e){if("string"==typeof e&&e.length>0)return e;throw new i("getTransactionId",s("errors","isTransactionIdValid"))}(this.transactionId),this.type)}async computeLocalHash(){this.localHash=await this.executeStep(y.computeLocalHash,async()=>await d(this.documentToVerify),this.type)}async fetchRemoteHash(){this.txData=await this.executeStep(y.fetchRemoteHash,async()=>await e.verifier.lookForTx({transactionId:this.transactionId,chain:this.chain.code,explorerAPIs:this.explorerAPIs}),this.type)}async compareHashes(){await this.executeStep(y.compareHashes,()=>function(e,t){if(e!==t)throw new i("compareHashes",s("errors","ensureHashesEqual"));return!0}(this.localHash,this.receipt.targetHash),this.type)}async checkMerkleRoot(){await this.executeStep(y.checkMerkleRoot,()=>function(e,t){if(e!==t)throw new i("checkMerkleRoot",s("errors","ensureMerkleRootEqual"));return!0}(this.receipt.merkleRoot,this.txData.remoteHash),this.type)}async checkReceipt(){await this.executeStep(y.checkReceipt,()=>{!function(e){let t=e.targetHash;const r=e.merkleRoot;try{const s=e.proof??e.path;if(s)for(const e in s){const r=s[e];let a;if(void 0!==r.left)a=f(`${r.left}${t}`),t=o.from(u(Uint8Array.from(a))).toString("hex");else{if(void 0===r.right)throw new i("checkReceipt","Trigger catch error.");a=f(`${t}${r.right}`),t=o.from(u(Uint8Array.from(a))).toString("hex")}}}catch(e){throw new i("checkReceipt",s("errors","ensureValidReceipt"))}if(t!==r)throw new i("checkReceipt",s("errors","invalidMerkleReceipt"))}(this.receipt)},this.type)}async parseIssuerKeys(){this.issuerPublicKeyList=await this.executeStep(y.parseIssuerKeys,()=>e.verifier.parseIssuerKeys(this.issuer),this.type)}async checkAuthenticity(){await this.executeStep(y.checkAuthenticity,()=>{p(this.issuerPublicKeyList,this.txData.issuingAddress,this.txData.time)},this.type)}}export{m as default};
|