@transmute/bbs-bls12381-signature-2020
Version:
Transmute implementation of https://w3id.org/security/suites/bls12381-2020
3 lines (2 loc) • 21.2 kB
JavaScript
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=(e=require("@transmute/jsonld"))&&"object"==typeof e&&"default"in e?e.default:e,r=require("@transmute/bls12381-key-pair"),n=require("@stablelib/random"),o=require("@mattrglobal/bbs-signatures");function a(e,t,r,n,o,a,i){try{var u=e[a](i),c=u.value}catch(e){return void r(e)}u.done?t(c):Promise.resolve(c).then(n,o)}function i(e){return function(){var t=this,r=arguments;return new Promise((function(n,o){var i=e.apply(t,r);function u(e){a(i,n,o,u,c,"next",e)}function c(e){a(i,n,o,u,c,"throw",e)}u(void 0)}))}}function u(){return(u=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e}).apply(this,arguments)}var c,s=(function(e){var t=function(e){var t=Object.prototype,r=t.hasOwnProperty,n="function"==typeof Symbol?Symbol:{},o=n.iterator||"@@iterator",a=n.asyncIterator||"@@asyncIterator",i=n.toStringTag||"@@toStringTag";function u(e,t,r){return Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(e){u=function(e,t,r){return e[t]=r}}function c(e,t,r,n){var o=Object.create((t&&t.prototype instanceof p?t:p).prototype),a=new M(n||[]);return o._invoke=function(e,t,r){var n="suspendedStart";return function(o,a){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===o)throw a;return{value:void 0,done:!0}}for(r.method=o,r.arg=a;;){var i=r.delegate;if(i){var u=g(i,r);if(u){if(u===f)continue;return u}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var c=s(e,t,r);if("normal"===c.type){if(n=r.done?"completed":"suspendedYield",c.arg===f)continue;return{value:c.arg,done:r.done}}"throw"===c.type&&(n="completed",r.method="throw",r.arg=c.arg)}}}(e,r,a),o}function s(e,t,r){try{return{type:"normal",arg:e.call(t,r)}}catch(e){return{type:"throw",arg:e}}}e.wrap=c;var f={};function p(){}function d(){}function h(){}var l={};l[o]=function(){return this};var v=Object.getPrototypeOf,m=v&&v(v(k([])));m&&m!==t&&r.call(m,o)&&(l=m);var y=h.prototype=p.prototype=Object.create(l);function x(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){var n;this._invoke=function(o,a){function i(){return new t((function(n,i){!function n(o,a,i,u){var c=s(e[o],e,a);if("throw"!==c.type){var f=c.arg,p=f.value;return p&&"object"==typeof p&&r.call(p,"__await")?t.resolve(p.__await).then((function(e){n("next",e,i,u)}),(function(e){n("throw",e,i,u)})):t.resolve(p).then((function(e){f.value=e,i(f)}),(function(e){return n("throw",e,i,u)}))}u(c.arg)}(o,a,n,i)}))}return n=n?n.then(i,i):i()}}function g(e,t){var r=e.iterator[t.method];if(void 0===r){if(t.delegate=null,"throw"===t.method){if(e.iterator.return&&(t.method="return",t.arg=void 0,g(e,t),"throw"===t.method))return f;t.method="throw",t.arg=new TypeError("The iterator does not provide a 'throw' method")}return f}var n=s(r,e.iterator,t.arg);if("throw"===n.type)return t.method="throw",t.arg=n.arg,t.delegate=null,f;var o=n.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,f):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,f)}function b(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function L(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function M(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(b,this),this.reset(!0)}function k(e){if(e){var t=e[o];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var n=-1,a=function t(){for(;++n<e.length;)if(r.call(e,n))return t.value=e[n],t.done=!1,t;return t.value=void 0,t.done=!0,t};return a.next=a}}return{next:P}}function P(){return{value:void 0,done:!0}}return d.prototype=y.constructor=h,h.constructor=d,d.displayName=u(h,i,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===d||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,u(e,i,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},x(w.prototype),w.prototype[a]=function(){return this},e.AsyncIterator=w,e.async=function(t,r,n,o,a){void 0===a&&(a=Promise);var i=new w(c(t,r,n,o),a);return e.isGeneratorFunction(r)?i:i.next().then((function(e){return e.done?e.value:i.next()}))},x(y),u(y,i,"Generator"),y[o]=function(){return this},y.toString=function(){return"[object Generator]"},e.keys=function(e){var t=[];for(var r in e)t.push(r);return t.reverse(),function r(){for(;t.length;){var n=t.pop();if(n in e)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=k,M.prototype={constructor:M,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(L),!e)for(var t in this)"t"===t.charAt(0)&&r.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function n(r,n){return i.type="throw",i.arg=e,t.next=r,n&&(t.method="next",t.arg=void 0),!!n}for(var o=this.tryEntries.length-1;o>=0;--o){var a=this.tryEntries[o],i=a.completion;if("root"===a.tryLoc)return n("end");if(a.tryLoc<=this.prev){var u=r.call(a,"catchLoc"),c=r.call(a,"finallyLoc");if(u&&c){if(this.prev<a.catchLoc)return n(a.catchLoc,!0);if(this.prev<a.finallyLoc)return n(a.finallyLoc)}else if(u){if(this.prev<a.catchLoc)return n(a.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<a.finallyLoc)return n(a.finallyLoc)}}}},abrupt:function(e,t){for(var n=this.tryEntries.length-1;n>=0;--n){var o=this.tryEntries[n];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var a=o;break}}a&&("break"===e||"continue"===e)&&a.tryLoc<=t&&t<=a.finallyLoc&&(a=null);var i=a?a.completion:{};return i.type=e,i.arg=t,a?(this.method="next",this.next=a.finallyLoc,f):this.complete(i)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),f},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.finallyLoc===e)return this.complete(r.completion,r.afterLoc),L(r),f}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var r=this.tryEntries[t];if(r.tryLoc===e){var n=r.completion;if("throw"===n.type){var o=n.arg;L(r)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,r){return this.delegate={iterator:k(e),resultName:t,nextLoc:r},"next"===this.method&&(this.arg=void 0),f}},e}(e.exports);try{regeneratorRuntime=t}catch(e){Function("r","regeneratorRuntime = r")(t)}}(c={exports:{}}),c.exports),f=["https://w3id.org/security/suites/jws-2020/v1","https://w3id.org/security/suites/bls12381-2020/v1"],p=function(){function e(e){var t=void 0===e?{}:e,r=t.key,n=t.date;this.key=r,this.date=n,r&&(this.verificationMethod=r.id)}var n=e.prototype;return n.ensureSuiteContext=function(e){var t=e.document,r="https://w3id.org/security/suites/bls12381-2020/v1";if(!(t["@context"]===r||Array.isArray(t["@context"])&&t["@context"].includes(r)))throw new TypeError("The document to be signed must contain this suite's @context, \""+r+'".')},n.matchProof=function(){var t=i(s.mark((function t(r){return s.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",r.proof.type===e.type);case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),n.canonize=function(){var e=i(s.mark((function e(r,n){return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t.safeCanonize(r,{algorithm:"URDNA2015",format:"application/n-quads",documentLoader:n.documentLoader,expansionMap:n.expansionMap,skipExpansion:n.skipExpansion,useNative:!1}));case 2:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),n.canonizeProof=function(){var e=i(s.mark((function e(t,r){var n,o;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.documentLoader,o=r.expansionMap,delete(t=u({},t)).jws,e.abrupt("return",this.canonize(t,{documentLoader:n,expansionMap:o,skipExpansion:!1}));case 4:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),n.createVerifyProofData=function(){var e=i(s.mark((function e(t,r){var n,o;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.documentLoader,o=r.expansionMap,e.next=3,this.canonizeProof(t,{documentLoader:n,expansionMap:o});case 3:return e.abrupt("return",e.sent.split("\n").filter((function(e){return e.length>0})));case 5:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),n.createVerifyDocumentData=function(){var e=i(s.mark((function e(t,r){var n,o;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.documentLoader,o=r.expansionMap,e.next=3,this.canonize(t,{documentLoader:n,expansionMap:o});case 3:return e.abrupt("return",e.sent.split("\n").filter((function(e){return e.length>0})));case 5:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),n.createVerifyData=function(){var e=i(s.mark((function e(t){var r,n,o,a,i;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.proof,n=t.document,o=t.documentLoader,a=t.expansionMap,e.next=3,this.createVerifyProofData(r,{documentLoader:o,expansionMap:a});case 3:return i=e.sent,e.next=6,this.createVerifyDocumentData(n,{documentLoader:o,expansionMap:a});case 6:return e.abrupt("return",i.concat(e.sent));case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),n.createProof=function(){var t=i(s.mark((function t(r){var n,o,a,i,u,c,f,p,d,h,l;return s.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return i=r.purpose,u=r.documentLoader,c=r.expansionMap,f=r.compactProof,(p={"@context":(a=r.document)["@context"]}).type=e.type,void 0!==this.date&&(p.created=this.date),p.created||(d=(new Date).toISOString(),p.created=d.substr(0,d.length-5)+"Z"),void 0!==(null==(n=this.key)?void 0:n.id)&&(p.verificationMethod=this.key.id),t.next=9,i.update(p,{document:a,suite:this,documentLoader:u,expansionMap:c});case 9:return p=t.sent,t.next=12,this.createVerifyData({document:a,proof:p,documentLoader:u,expansionMap:c,compactProof:f});case 12:return h=t.sent.map((function(e){return new Uint8Array(Buffer.from(e))})),t.next=15,null==(o=this.key)?void 0:o.signer();case 15:return l=t.sent,t.next=18,l.sign({data:h});case 18:return p.proofValue=Buffer.from(t.sent).toString("base64"),t.abrupt("return",p);case 21:case"end":return t.stop()}}),t,this)})));return function(e){return t.apply(this,arguments)}}(),n.getVerificationMethod=function(){var e=i(s.mark((function e(r){var n,o,a;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.documentLoader,"object"==typeof(o=r.proof.verificationMethod)&&(o=o.id),o){e.next=5;break}throw new Error('No "verificationMethod" found in proof.');case 5:return e.next=7,t.frame(o,{"@context":f,"@embed":"@always",id:o},{documentLoader:n,compactToRelative:!1,expandContext:f});case 7:if(a=e.sent){e.next=10;break}throw new Error("Verification method "+o+" not found.");case 10:if(void 0===a.revoked){e.next=12;break}throw new Error("The verification method has been revoked.");case 12:return e.abrupt("return",a);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.verifySignature=function(){var e=i(s.mark((function e(t){var n,o,a,i,u;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.verifyData,o=t.proof,a=t.verificationMethod,e.next=3,r.Bls12381G2KeyPair.from(a);case 3:return i=e.sent.verifier(),u=new Uint8Array(Buffer.from(o.proofValue,"base64")),e.next=8,i.verify({data:n,signature:u});case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),n.verifyProof=function(){var e=i(s.mark((function e(t){var r,n,o,a,i,c,f,p,d,h;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.document,o=t.documentLoader,a=t.expansionMap,i=t.purpose,c=(r=t.proof).proofValue,delete r.proofValue,e.prev=3,e.next=6,this.createVerifyData({document:n,proof:r,documentLoader:o,expansionMap:a,compactProof:!1});case 6:return f=e.sent.map((function(e){return new Uint8Array(Buffer.from(e))})),e.next=9,this.getVerificationMethod({proof:r,document:n,documentLoader:o,expansionMap:a});case 9:return p=e.sent,e.next=12,this.verifySignature({verifyData:f,verificationMethod:p,document:n,proof:u({},r,{proofValue:c}),documentLoader:o,expansionMap:a});case 12:if(e.sent){e.next=15;break}throw new Error("Invalid signature.");case 15:return e.next=17,i.validate(r,{document:n,suite:this,verificationMethod:p,documentLoader:o,expansionMap:a});case 17:if(h=(d=e.sent).error,d.valid){e.next=22;break}throw h;case 22:return e.abrupt("return",{verified:!0});case 25:return e.prev=25,e.t0=e.catch(3),e.abrupt("return",{verified:!1,error:e.t0});case 28:case"end":return e.stop()}}),e,this,[[3,25]])})));return function(t){return e.apply(this,arguments)}}(),e}();p.type="BbsBlsSignature2020";var d=["https://w3id.org/security/suites/jws-2020/v1","https://w3id.org/security/suites/bls12381-2020/v1"],h=function(){function e(){}var a=e.prototype;return a.ensureSuiteContext=function(e){var t=e.document,r="https://w3id.org/security/suites/bls12381-2020/v1";if(!(t["@context"]===r||Array.isArray(t["@context"])&&t["@context"].includes(r)))throw new TypeError("The document to be signed must contain this suite's @context, \""+r+'".')},a.getVerificationMethod=function(){var e=i(s.mark((function e(r){var n,o,a;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:if(n=r.documentLoader,"object"==typeof(o=r.proof.verificationMethod)&&(o=o.id),o){e.next=5;break}throw new Error('No "verificationMethod" found in proof.');case 5:return e.next=7,t.frame(o,{"@context":d,"@embed":"@always",id:o},{documentLoader:n,compactToRelative:!1,expandContext:d});case 7:if(a=e.sent){e.next=10;break}throw new Error("Verification method "+o+" not found.");case 10:if(void 0===a.revoked){e.next=12;break}throw new Error("The verification method has been revoked.");case 12:return e.abrupt("return",a);case 13:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}(),a.deriveProof=function(){var a=i(s.mark((function a(i){var c,f,d,h,l,v,m,y,x,w,g,b,L,M,k,P,E,V,D,B,j,S;return s.wrap((function(a){for(;;)switch(a.prev=a.next){case 0:if(c=i.document,d=i.revealDocument,h=i.documentLoader,l=i.expansionMap,v=i.nonce,"BbsBlsSignature2020"===(f=i.proof).type){a.next=4;break}throw new TypeError('proof type unacceptable, \n expected "BbsBlsSignature2020",\n received '+f.type);case 4:return m=Uint8Array.from(Buffer.from(f.proofValue,"base64")),delete f.proofValue,y=new p,x={"@context":c["@context"],type:e.type},a.next=10,y.createVerifyDocumentData(c,{documentLoader:h,expansionMap:l,compactProof:!0});case 10:return w=a.sent,a.next=13,y.createVerifyProofData(f,{documentLoader:h,expansionMap:l,compactProof:!0});case 13:return g=a.sent,b=w.map((function(e){return e.replace(/(_:c14n[0-9]+)/g,"<urn:bnid:$1>")})),a.next=17,t.fromRDF(b.join("\n"));case 17:return L=a.sent,a.next=20,t.frame(L,d,{documentLoader:h});case 20:return M=a.sent,a.next=23,y.createVerifyDocumentData(M,{documentLoader:h,expansionMap:l});case 23:if(k=a.sent,P=g.length,E=Array.from(Array(P).keys()),(V=k.map((function(e){return b.indexOf(e)+P}))).length===k.length){a.next=29;break}throw new Error("Some statements in the reveal document not found in original proof");case 29:if(D=E.concat(V),v){a.next=34;break}return a.next=33,n.randomBytes(50);case 33:v=a.sent;case 34:return x.nonce=Buffer.from(v).toString("base64"),B=g.concat(w).map((function(e){return new Uint8Array(Buffer.from(e))})),a.next=38,this.getVerificationMethod({proof:f,document:c,documentLoader:h,expansionMap:l});case 38:return j=a.sent,a.next=41,r.Bls12381G2KeyPair.from(j);case 41:return S=a.sent,a.next=44,o.blsCreateProof({messages:B,revealed:D,signature:new Uint8Array(m),nonce:v,publicKey:new Uint8Array(S.publicKey)});case 44:return x.proofValue=Buffer.from(a.sent).toString("base64"),x.verificationMethod=f.verificationMethod,x.proofPurpose=f.proofPurpose,x.created=f.created,a.next=51,t.compact(u({},M),c["@context"],{documentLoader:h});case 51:return a.abrupt("return",{document:u({},a.sent),proof:x});case 53:case"end":return a.stop()}}),a,this)})));return function(e){return a.apply(this,arguments)}}(),a.canonize=function(){var e=i(s.mark((function e(r,n){return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",t.safeCanonize(r,{algorithm:"URDNA2015",format:"application/n-quads",documentLoader:n.documentLoader,expansionMap:n.expansionMap,skipExpansion:n.skipExpansion,useNative:!1}));case 2:case"end":return e.stop()}}),e)})));return function(t,r){return e.apply(this,arguments)}}(),a.canonizeProof=function(){var e=i(s.mark((function e(t,r){var n,o;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.documentLoader,o=r.expansionMap,delete(t=u({},t)).nonce,delete t.proofValue,e.abrupt("return",this.canonize(t,{documentLoader:n,expansionMap:o,skipExpansion:!1}));case 5:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),a.createVerifyData=function(){var e=i(s.mark((function e(t){var r,n,o,a,i;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.proof,n=t.document,o=t.documentLoader,a=t.expansionMap,e.next=3,this.createVerifyProofData(r,{documentLoader:o,expansionMap:a});case 3:return i=e.sent,e.next=6,this.createVerifyDocumentData(n,{documentLoader:o,expansionMap:a});case 6:return e.abrupt("return",i.concat(e.sent));case 8:case"end":return e.stop()}}),e,this)})));return function(t){return e.apply(this,arguments)}}(),a.createVerifyProofData=function(){var e=i(s.mark((function e(t,r){var n,o;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.documentLoader,o=r.expansionMap,e.next=3,this.canonizeProof(t,{documentLoader:n,expansionMap:o});case 3:return e.abrupt("return",e.sent.split("\n").filter((function(e){return e.length>0})));case 5:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),a.createVerifyDocumentData=function(){var e=i(s.mark((function e(t,r){var n,o;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=r.documentLoader,o=r.expansionMap,e.next=3,this.canonize(t,{documentLoader:n,expansionMap:o});case 3:return e.abrupt("return",e.sent.split("\n").filter((function(e){return e.length>0})));case 5:case"end":return e.stop()}}),e,this)})));return function(t,r){return e.apply(this,arguments)}}(),a.verifyProof=function(){var e=i(s.mark((function e(t){var n,a,i,u,c,f,p,d,h,l,v,m,y;return s.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return n=t.document,a=t.documentLoader,i=t.expansionMap,u=t.purpose,c=t.proof,e.prev=2,c.type="BbsBlsSignature2020",e.next=6,this.createVerifyProofData(c,{documentLoader:a,expansionMap:i});case 6:return f=e.sent,e.next=9,this.createVerifyProofData(n,{documentLoader:a,expansionMap:i});case 9:return p=e.sent.map((function(e){return e.replace(/<urn:bnid:(_:c14n[0-9]+)>/g,"$1")})),d=f.concat(p).map((function(e){return new Uint8Array(Buffer.from(e))})),e.next=14,this.getVerificationMethod({proof:c,document:n,documentLoader:a,expansionMap:i});case 14:return h=e.sent,e.next=17,r.Bls12381G2KeyPair.from(h);case 17:return l=e.sent,e.next=20,o.blsVerifyProof({proof:new Uint8Array(Buffer.from(c.proofValue,"base64")),publicKey:new Uint8Array(l.publicKey),messages:d,nonce:new Uint8Array(Buffer.from(c.nonce,"base64"))});case 20:return v=e.sent,e.next=23,u.validate(c,{document:n,suite:this,verificationMethod:h,documentLoader:a,expansionMap:i});case 23:if(y=(m=e.sent).error,m.valid){e.next=28;break}throw y;case 28:return e.abrupt("return",v);case 31:return e.prev=31,e.t0=e.catch(2),e.abrupt("return",{verified:!1,error:e.t0});case 34:case"end":return e.stop()}}),e,this,[[2,31]])})));return function(t){return e.apply(this,arguments)}}(),e}();h.type="BbsBlsSignatureProof2020",Object.keys(r).forEach((function(e){"default"!==e&&Object.defineProperty(exports,e,{enumerable:!0,get:function(){return r[e]}})})),exports.BbsBlsSignature2020=p,exports.BbsBlsSignatureProof2020=h;
//# sourceMappingURL=bbs-bls12381-signature-2020.cjs.production.min.js.map