From 71d6f0cc8177695eb37f734bccf95eb468ab2d13 Mon Sep 17 00:00:00 2001 From: dajiaji Date: Sat, 4 Nov 2023 15:01:01 +0000 Subject: [PATCH] deploy: 86c544a60261d9e9f403700aa041f3f2ffab2f28 --- chacha20poly1305/docs/assets/main.js | 2 +- .../docs/classes/Chacha20Poly1305.html | 154 +------ chacha20poly1305/docs/index.html | 77 +--- chacha20poly1305/docs/modules.html | 45 +- chacha20poly1305/src/hpke-chacha20poly1305.js | 2 +- core/docs/assets/main.js | 2 +- core/docs/classes/Aes128Gcm.html | 187 +------- core/docs/classes/Aes256Gcm.html | 184 +------- core/docs/classes/BaseError.html | 142 +----- core/docs/classes/CipherSuite.html | 340 ++------------ core/docs/classes/DecapError.html | 140 +----- core/docs/classes/DeriveKeyPairError.html | 140 +----- core/docs/classes/DeserializeError.html | 140 +----- core/docs/classes/DhkemP256HkdfSha256.html | 300 +----------- core/docs/classes/DhkemP384HkdfSha384.html | 300 +----------- core/docs/classes/DhkemP521HkdfSha512.html | 300 +----------- core/docs/classes/EncapError.html | 140 +----- core/docs/classes/ExportError.html | 140 +----- core/docs/classes/ExportOnly.html | 185 +------- core/docs/classes/HkdfSha256.html | 332 +------------- core/docs/classes/HkdfSha384.html | 332 +------------- core/docs/classes/HkdfSha512.html | 332 +------------- core/docs/classes/HpkeError.html | 153 +------ core/docs/classes/InvalidParamError.html | 140 +----- .../classes/MessageLimitReachedError.html | 140 +----- core/docs/classes/NotSupportedError.html | 140 +----- core/docs/classes/OpenError.html | 140 +----- core/docs/classes/SealError.html | 140 +----- core/docs/classes/SerializeError.html | 140 +----- core/docs/classes/ValidationError.html | 140 +----- core/docs/index.html | 98 +--- .../interfaces/AeadEncryptionContext.html | 160 +------ core/docs/interfaces/AeadInterface.html | 164 +------ core/docs/interfaces/CipherSuiteParams.html | 118 +---- .../interfaces/CipherSuiteSealResponse.html | 108 +---- core/docs/interfaces/EncryptionContext.html | 192 +------- core/docs/interfaces/KdfInterface.html | 385 ++-------------- core/docs/interfaces/KemInterface.html | 391 ++-------------- core/docs/interfaces/PreSharedKey.html | 108 +---- .../interfaces/RecipientContextParams.html | 142 +----- core/docs/interfaces/SenderContext.html | 209 +-------- core/docs/interfaces/SenderContextParams.html | 142 +----- core/docs/modules.html | 81 +--- core/docs/types/AeadId.html | 69 +-- core/docs/types/KdfId.html | 69 +-- core/docs/types/KemId.html | 69 +-- core/docs/types/RecipientContext.html | 68 +-- core/docs/variables/AeadId-1.html | 80 +--- core/docs/variables/KdfId-1.html | 78 +--- core/docs/variables/KemId-1.html | 88 +--- dhkem-secp256k1/docs/assets/main.js | 2 +- .../classes/DhkemSecp256k1HkdfSha256.html | 300 +----------- dhkem-secp256k1/docs/index.html | 77 +--- dhkem-secp256k1/docs/modules.html | 45 +- dhkem-x25519/docs/assets/main.js | 2 +- .../docs/classes/DhkemX25519HkdfSha256.html | 300 +----------- dhkem-x25519/docs/index.html | 77 +--- dhkem-x25519/docs/modules.html | 45 +- dhkem-x448/docs/assets/main.js | 2 +- .../docs/classes/DhkemX448HkdfSha512.html | 300 +----------- dhkem-x448/docs/index.html | 77 +--- dhkem-x448/docs/modules.html | 45 +- docs/assets/main.js | 2 +- docs/classes/BaseError.html | 142 +----- docs/classes/CipherSuite.html | 427 ++---------------- docs/classes/DecapError.html | 140 +----- docs/classes/DeriveKeyPairError.html | 140 +----- docs/classes/DeserializeError.html | 140 +----- docs/classes/EncapError.html | 140 +----- docs/classes/ExportError.html | 140 +----- docs/classes/HpkeError.html | 153 +------ docs/classes/InvalidParamError.html | 140 +----- docs/classes/MessageLimitReachedError.html | 140 +----- docs/classes/NotSupportedError.html | 140 +----- docs/classes/OpenError.html | 140 +----- docs/classes/SealError.html | 140 +----- docs/classes/SerializeError.html | 140 +----- docs/classes/ValidationError.html | 140 +----- docs/index.html | 134 +----- docs/interfaces/AeadEncryptionContext.html | 160 +------ docs/interfaces/AeadInterface.html | 159 +------ docs/interfaces/CipherSuiteParams.html | 118 +---- docs/interfaces/CipherSuiteSealResponse.html | 108 +---- docs/interfaces/EncryptionContext.html | 192 +------- docs/interfaces/KdfInterface.html | 385 ++-------------- docs/interfaces/KemInterface.html | 391 ++-------------- docs/interfaces/PreSharedKey.html | 108 +---- docs/interfaces/RecipientContextParams.html | 142 +----- docs/interfaces/SenderContext.html | 209 +-------- docs/interfaces/SenderContextParams.html | 142 +----- docs/modules.html | 81 +--- docs/types/Aead.html | 72 +-- docs/types/AeadId.html | 69 +-- docs/types/Kdf.html | 72 +-- docs/types/KdfId.html | 69 +-- docs/types/Kem.html | 72 +-- docs/types/KemId.html | 69 +-- docs/types/RecipientContext.html | 68 +-- docs/variables/Aead-1.html | 83 +--- docs/variables/AeadId-1.html | 80 +--- docs/variables/Kdf-1.html | 81 +--- docs/variables/KdfId-1.html | 78 +--- docs/variables/Kem-1.html | 91 +--- docs/variables/KemId-1.html | 88 +--- hybridkem-x25519-kyber768/docs/assets/main.js | 2 +- .../docs/classes/HybridkemX25519Kyber768.html | 299 +----------- hybridkem-x25519-kyber768/docs/index.html | 77 +--- hybridkem-x25519-kyber768/docs/modules.html | 45 +- src/hpke.js | 2 +- 109 files changed, 835 insertions(+), 14455 deletions(-) diff --git a/chacha20poly1305/docs/assets/main.js b/chacha20poly1305/docs/assets/main.js index 01bcad55f..d0aa8d5f9 100644 --- a/chacha20poly1305/docs/assets/main.js +++ b/chacha20poly1305/docs/assets/main.js @@ -1,6 +1,6 @@ "use strict"; "use strict";(()=>{var Pe=Object.create;var ne=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Ie(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Pe(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. -`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s=i?r.index.search(`*${i}*`):[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` ${ce(l.parent,i)}.${d}`);let v=document.createElement("li");v.classList.value=l.classes??"";let f=document.createElement("a");f.href=r.base+l.url,f.innerHTML=u+d,v.append(f),e.appendChild(v)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var Be={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>Be[e])}var C=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",pe="mousemove",B="mouseup",J={x:0,y:0},fe=!1,ee=!1,He=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(He=!0,F="touchstart",pe="touchmove",B="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(pe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{ee=!1});document.addEventListener("click",t=>{fe&&(t.preventDefault(),t.stopImmediatePropagation(),fe=!1)});var X=class extends C{constructor(n){super(n);this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(F,r=>this.onDocumentPointerDown(r)),document.addEventListener(B,r=>this.onDocumentPointerUp(r))}setActive(n){if(this.active==n)return;this.active=n,document.documentElement.classList.toggle("has-"+this.className,n),this.el.classList.toggle("active",n);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(n){D||(this.setActive(!0),n.preventDefault())}onDocumentPointerDown(n){if(this.active){if(n.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(n){if(!D&&this.active&&n.target.closest(".col-sidebar")){let r=n.target.closest("a");if(r){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),r.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ve=document.head.appendChild(document.createElement("style"));ve.dataset.for="filters";var Y=class extends C{constructor(n){super(n);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ve.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } `}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.checked}setLocalStorage(n){Q.setItem(this.key,n.toString()),this.value=n,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),document.querySelectorAll(".tsd-index-section").forEach(n=>{n.style.display="block";let r=Array.from(n.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);n.style.display=r?"none":"block"})}};var Z=class extends C{constructor(n){super(n);this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let r=Q.getItem(this.key);this.el.open=r?r==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let i=this.summary.querySelector("a");i&&i.addEventListener("click",()=>{location.assign(i.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ye(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ye(t.value)})}function ye(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.href===r.href&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); /*! Bundled license information: diff --git a/chacha20poly1305/docs/classes/Chacha20Poly1305.html b/chacha20poly1305/docs/classes/Chacha20Poly1305.html index a0e5a7166..937dd1fa2 100644 --- a/chacha20poly1305/docs/classes/Chacha20Poly1305.html +++ b/chacha20poly1305/docs/classes/Chacha20Poly1305.html @@ -1,153 +1,19 @@ -Chacha20Poly1305 | @hpke/chacha20poly1305
-
- -
-
-
-
- -

Class Chacha20Poly1305

-
-

The ChaCha20Poly1305 for HPKE AEAD implementing AeadInterface.

+Chacha20Poly1305 | @hpke/chacha20poly1305

The ChaCha20Poly1305 for HPKE AEAD implementing AeadInterface.

When using @hpke/core, the instance of this class can be specified to the aead parameter of CipherSuiteParams instead of AeadId.Chacha20Poly1305 as follows:

-
-
-

Example

import {
CipherSuite,
DhkemP256HkdfSha256,
HkdfSha256,
} from "http://deno.land/x/hpke/core/mod.ts";
import {
Chacha20Poly1305,
} from "https://deno.land/x/hpke/x/chach20poly1305/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Chacha20Poly1305(),
}); +

Example

import {
CipherSuite,
DhkemP256HkdfSha256,
HkdfSha256,
} from "http://deno.land/x/hpke/core/mod.ts";
import {
Chacha20Poly1305,
} from "https://deno.land/x/hpke/x/chach20poly1305/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Chacha20Poly1305(),
});

This class is implemented using @noble/ciphers.

-
-
-

Hierarchy

-
    -
  • Chacha20Poly1305
-
-

Implements

-
    -
  • AeadInterface
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
id +

Hierarchy

  • Chacha20Poly1305

Implements

  • AeadInterface

Constructors

Properties

-
-

Methods

-
-
-

Constructors

-
- -
-
-

Properties

-
- -
id: AeadId = AeadId.Chacha20Poly1305
-

AeadId.Chacha20Poly1305 (0x0003)

-
-
-
- -
keySize: number = 32
-

32

-
-
-
- -
nonceSize: number = 12
-

12

-
-
-
- -
tagSize: number = 16
-

16

-
-
-
-

Methods

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
    -

    Returns AeadEncryptionContext

-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Methods

Constructors

Properties

id: AeadId = AeadId.Chacha20Poly1305

AeadId.Chacha20Poly1305 (0x0003)

+
keySize: number = 32

32

+
nonceSize: number = 12

12

+
tagSize: number = 16

16

+

Methods

  • Parameters

    • key: ArrayBuffer

    Returns AeadEncryptionContext

Generated using TypeDoc

\ No newline at end of file diff --git a/chacha20poly1305/docs/index.html b/chacha20poly1305/docs/index.html index a3eb1ab5d..a59bd8c01 100644 --- a/chacha20poly1305/docs/index.html +++ b/chacha20poly1305/docs/index.html @@ -1,18 +1,4 @@ -@hpke/chacha20poly1305
-
- -
-
-
-
-

@hpke/chacha20poly1305

-

@hpke/chacha20poly1305

+@hpke/chacha20poly1305

@hpke/chacha20poly1305

@hpke/chacha20poly1305

A TypeScript Hybrid Public Key Encryption (HPKE) module extension for AEAD with ChaCha20-Poly1305, which is implemented by using @noble/ciphers
@@ -27,15 +13,15 @@

@hpke/chacha20poly1305

Index

Contributing

We welcome all kind of contributions, filing issues, suggesting new features or sending PRs.

-
-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/chacha20poly1305/docs/modules.html b/chacha20poly1305/docs/modules.html index 455b2f40f..d1a9f8b09 100644 --- a/chacha20poly1305/docs/modules.html +++ b/chacha20poly1305/docs/modules.html @@ -1,43 +1,2 @@ -@hpke/chacha20poly1305
-
- -
-
-
-
-

@hpke/chacha20poly1305

-
-
-

Index

-
-

Classes

-
-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +@hpke/chacha20poly1305

@hpke/chacha20poly1305

Index

Classes

Generated using TypeDoc

\ No newline at end of file diff --git a/chacha20poly1305/src/hpke-chacha20poly1305.js b/chacha20poly1305/src/hpke-chacha20poly1305.js index e039c6b46..27df045fb 100644 --- a/chacha20poly1305/src/hpke-chacha20poly1305.js +++ b/chacha20poly1305/src/hpke-chacha20poly1305.js @@ -1,4 +1,4 @@ -var yt=e=>e instanceof Uint8Array;var R=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),st=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),gt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!gt)throw new Error("Non little-endian hardware is not supported");function J(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function Q(e){if(typeof e=="string"&&(e=J(e)),!yt(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var wt=e=>Object.prototype.toString.call(e)==="[object Object]"&&e.constructor===Object;function it(e,t){if(t!==void 0&&(typeof t!="object"||!wt(t)))throw new Error("options must be object or undefined");return Object.assign(e,t)}function M(e,t){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");if(typeof t=="number"&&e.length!==t)throw new Error(`Uint8Array length ${t} expected`)}function ct(e,t){if(e.length!==t.length)throw new Error("equalBytes: Different size of Uint8Arrays");let n=!0;for(let r=0;r>c&f),o=Number(n&f),y=r?4:0,l=r?0:4;e.setUint32(t+y,s,r),e.setUint32(t+l,o,r)}function et(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function dt(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function ht(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function bt(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("hash must be wrapped by utils.wrapConstructor");et(e.outputLen),et(e.blockLen)}function mt(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Ut(e,t){ht(e);let n=t.outputLen;if(e.lengthe[t++]&255|(e[t++]&255)<<8,rt=class{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=Q(t),M(t,32);let n=H(t,0),r=H(t,2),c=H(t,4),f=H(t,6),s=H(t,8),o=H(t,10),y=H(t,12),l=H(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|r<<3)&8191,this.r[2]=(r>>>10|c<<6)&7939,this.r[3]=(c>>>7|f<<9)&8191,this.r[4]=(f>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|o<<2)&8191,this.r[7]=(o>>>11|y<<5)&8065,this.r[8]=(y>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let a=0;a<8;a++)this.pad[a]=H(t,16+2*a)}process(t,n,r=!1){let c=r?0:2048,{h:f,r:s}=this,o=s[0],y=s[1],l=s[2],a=s[3],b=s[4],B=s[5],P=s[6],C=s[7],d=s[8],$=s[9],N=H(t,n+0),D=H(t,n+2),T=H(t,n+4),F=H(t,n+6),z=H(t,n+8),_=H(t,n+10),j=H(t,n+12),I=H(t,n+14),h=f[0]+(N&8191),g=f[1]+((N>>>13|D<<3)&8191),w=f[2]+((D>>>10|T<<6)&8191),x=f[3]+((T>>>7|F<<9)&8191),p=f[4]+((F>>>4|z<<12)&8191),m=f[5]+(z>>>1&8191),U=f[6]+((z>>>14|_<<2)&8191),A=f[7]+((_>>>11|j<<5)&8191),E=f[8]+((j>>>8|I<<8)&8191),L=f[9]+(I>>>5|c),i=0,k=i+h*o+g*(5*$)+w*(5*d)+x*(5*C)+p*(5*P);i=k>>>13,k&=8191,k+=m*(5*B)+U*(5*b)+A*(5*a)+E*(5*l)+L*(5*y),i+=k>>>13,k&=8191;let O=i+h*y+g*o+w*(5*$)+x*(5*d)+p*(5*C);i=O>>>13,O&=8191,O+=m*(5*P)+U*(5*B)+A*(5*b)+E*(5*a)+L*(5*l),i+=O>>>13,O&=8191;let S=i+h*l+g*y+w*o+x*(5*$)+p*(5*d);i=S>>>13,S&=8191,S+=m*(5*C)+U*(5*P)+A*(5*B)+E*(5*b)+L*(5*a),i+=S>>>13,S&=8191;let v=i+h*a+g*l+w*y+x*o+p*(5*$);i=v>>>13,v&=8191,v+=m*(5*d)+U*(5*C)+A*(5*P)+E*(5*B)+L*(5*b),i+=v>>>13,v&=8191;let q=i+h*b+g*a+w*l+x*y+p*o;i=q>>>13,q&=8191,q+=m*(5*$)+U*(5*d)+A*(5*C)+E*(5*P)+L*(5*B),i+=q>>>13,q&=8191;let V=i+h*B+g*b+w*a+x*l+p*y;i=V>>>13,V&=8191,V+=m*o+U*(5*$)+A*(5*d)+E*(5*C)+L*(5*P),i+=V>>>13,V&=8191;let X=i+h*P+g*B+w*b+x*a+p*l;i=X>>>13,X&=8191,X+=m*y+U*o+A*(5*$)+E*(5*d)+L*(5*C),i+=X>>>13,X&=8191;let G=i+h*C+g*P+w*B+x*b+p*a;i=G>>>13,G&=8191,G+=m*l+U*y+A*o+E*(5*$)+L*(5*d),i+=G>>>13,G&=8191;let W=i+h*d+g*C+w*P+x*B+p*b;i=W>>>13,W&=8191,W+=m*a+U*l+A*y+E*o+L*(5*$),i+=W>>>13,W&=8191;let Z=i+h*$+g*d+w*C+x*P+p*B;i=Z>>>13,Z&=8191,Z+=m*b+U*a+A*l+E*y+L*o,i+=Z>>>13,Z&=8191,i=(i<<2)+i|0,i=i+k|0,k=i&8191,i=i>>>13,O+=i,f[0]=k,f[1]=O,f[2]=S,f[3]=v,f[4]=q,f[5]=V,f[6]=X,f[7]=G,f[8]=W,f[9]=Z}finalize(){let{h:t,pad:n}=this,r=new Uint16Array(10),c=t[1]>>>13;t[1]&=8191;for(let o=2;o<10;o++)t[o]+=c,c=t[o]>>>13,t[o]&=8191;t[0]+=c*5,c=t[0]>>>13,t[0]&=8191,t[1]+=c,c=t[1]>>>13,t[1]&=8191,t[2]+=c,r[0]=t[0]+5,c=r[0]>>>13,r[0]&=8191;for(let o=1;o<10;o++)r[o]=t[o]+c,c=r[o]>>>13,r[o]&=8191;r[9]-=8192;let f=(c^1)-1;for(let o=0;o<10;o++)r[o]&=f;f=~f;for(let o=0;o<10;o++)t[o]=t[o]&f|r[o];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let s=t[0]+n[0];t[0]=s&65535;for(let o=1;o<8;o++)s=(t[o]+n[o]|0)+(s>>>16)|0,t[o]=s&65535}update(t){K.exists(this);let{buffer:n,blockLen:r}=this;t=Q(t);let c=t.length;for(let f=0;f>>0,t[f++]=r[s]>>>8;return t}digest(){let{buffer:t,outputLen:n}=this;this.digestInto(t);let r=t.slice(0,n);return this.destroy(),r}};function Et(e){let t=(r,c)=>e(c).update(Q(r)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=r=>e(r),t}var lt=Et(e=>new rt(e));var Lt=J("expand 16-byte k"),Bt=J("expand 32-byte k"),St=R(Lt),Ct=R(Bt),Y=e=>!(e.byteOffset%4),at=e=>{let{core:t,rounds:n,counterRight:r,counterLen:c,allow128bitKeys:f,extendNonceFn:s,blockLen:o}=it({rounds:20,counterRight:!1,counterLen:8,allow128bitKeys:!0,blockLen:64},e);K.number(c),K.number(n),K.number(o),K.bool(r),K.bool(f);let y=o/4;if(o%4!==0)throw new Error("Salsa/ChaCha: blockLen must be aligned to 4 bytes");return(l,a,b,B,P=0)=>{if(K.bytes(l),K.bytes(a),K.bytes(b),B||(B=new Uint8Array(b.length)),K.bytes(B),K.number(P),P<0||P>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");if(B.length=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");let w=Math.min(o,I-h);if(w===o&&j&&_){let x=h/4;if(h%4!==0)throw new Error("Salsa/ChaCha: invalid block position");for(let p=0;pe<>>32-t;function kt(e,t,n,r,c,f=20){let s=e[0],o=e[1],y=e[2],l=e[3],a=t[0],b=t[1],B=t[2],P=t[3],C=t[4],d=t[5],$=t[6],N=t[7],D=c,T=n[0],F=n[1],z=n[2],_=s,j=o,I=y,h=l,g=a,w=b,x=B,p=P,m=C,U=d,A=$,E=N,L=D,i=T,k=F,O=z;for(let v=0;v{e.update(t);let n=t.length%16;n&&e.update(_t.subarray(n))},ut=(e,t,n,r,c)=>{let f=e(t,n,new Uint8Array(32)),s=lt.create(f);c&&xt(s,c),xt(s,r);let o=new Uint8Array(16),y=st(o);tt(y,0,BigInt(c?c.length:0),!0),tt(y,8,BigInt(r.length),!0),s.update(o);let l=s.digest();return f.fill(0),l},jt=e=>(t,n,r)=>(M(t,32),M(n),{tagLength:16,encrypt:(f,s)=>{let o=f.length,y=o+16;s?M(s,y):s=new Uint8Array(y),e(t,n,f,s,1);let l=ut(e,t,n,s.subarray(0,-16),r);return s.set(l,o),s},decrypt:(f,s)=>{let o=f.length,y=o-16;if(o<16)throw new Error("encrypted data must be at least 16 bytes");s?M(s,y):s=new Uint8Array(y);let l=f.subarray(0,-16),a=f.subarray(-16),b=ut(e,t,n,l,r);if(!ct(a,b))throw new Error("invalid tag");return e(t,n,l,s,1),s}}),nt=jt(Ot);var It={Aes128Gcm:1,Aes256Gcm:2,Chacha20Poly1305:3,ExportOnly:65535},pt=It;var ot=class{constructor(t){Object.defineProperty(this,"_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._key=new Uint8Array(t)}async seal(t,n,r){return await this._seal(t,n,r)}async open(t,n,r){return await this._open(t,n,r)}_seal(t,n,r){return new Promise(c=>{let f=nt(this._key,new Uint8Array(t),new Uint8Array(r)).encrypt(new Uint8Array(n));c(f.buffer)})}_open(t,n,r){return new Promise(c=>{let f=nt(this._key,new Uint8Array(t),new Uint8Array(r)).decrypt(new Uint8Array(n));c(f.buffer)})}},ft=class{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:pt.Chacha20Poly1305}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}createEncryptionContext(t){return new ot(t)}};export{ft as Chacha20Poly1305}; +var Et=e=>e instanceof Uint8Array;var F=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),at=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),Lt=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Lt)throw new Error("Non little-endian hardware is not supported");function Y(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function J(e){if(typeof e=="string")e=Y(e);else if(Et(e))e=e.slice();else throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var _t=e=>Object.prototype.toString.call(e)==="[object Object]"&&e.constructor===Object;function xt(e,t){if(t!==void 0&&(typeof t!="object"||!_t(t)))throw new Error("options must be object or undefined");return Object.assign(e,t)}function M(e,t){if(!(e instanceof Uint8Array))throw new Error("Uint8Array expected");if(typeof t=="number"&&e.length!==t)throw new Error(`Uint8Array length ${t} expected`)}function ut(e,t){if(e.length!==t.length)throw new Error("equalBytes: Different size of Uint8Arrays");let s=!0;for(let r=0;r(Object.assign(t,e),t);function rt(e,t,s,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,s,r);let c=BigInt(32),n=BigInt(4294967295),f=Number(s>>c&n),o=Number(s&n),h=r?4:0,a=r?0:4;e.setUint32(t+h,f,r),e.setUint32(t+a,o,r)}function Q(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function nt(e){if(typeof e!="boolean")throw new Error(`Expected boolean, not ${e}`)}function Z(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function ot(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function pt(e,t){Z(e);let s=t.outputLen;if(e.lengthe[t++]&255|(e[t++]&255)<<8,ft=class{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=J(t),M(t,32);let s=N(t,0),r=N(t,2),c=N(t,4),n=N(t,6),f=N(t,8),o=N(t,10),h=N(t,12),a=N(t,14);this.r[0]=s&8191,this.r[1]=(s>>>13|r<<3)&8191,this.r[2]=(r>>>10|c<<6)&7939,this.r[3]=(c>>>7|n<<9)&8191,this.r[4]=(n>>>4|f<<12)&255,this.r[5]=f>>>1&8190,this.r[6]=(f>>>14|o<<2)&8191,this.r[7]=(o>>>11|h<<5)&8065,this.r[8]=(h>>>8|a<<8)&8191,this.r[9]=a>>>5&127;for(let x=0;x<8;x++)this.pad[x]=N(t,16+2*x)}process(t,s,r=!1){let c=r?0:2048,{h:n,r:f}=this,o=f[0],h=f[1],a=f[2],x=f[3],y=f[4],d=f[5],w=f[6],p=f[7],g=f[8],u=f[9],b=N(t,s+0),m=N(t,s+2),C=N(t,s+4),$=N(t,s+6),v=N(t,s+8),H=N(t,s+10),k=N(t,s+12),R=N(t,s+14),U=n[0]+(b&8191),A=n[1]+((b>>>13|m<<3)&8191),E=n[2]+((m>>>10|C<<6)&8191),L=n[3]+((C>>>7|$<<9)&8191),_=n[4]+(($>>>4|v<<12)&8191),B=n[5]+(v>>>1&8191),S=n[6]+((v>>>14|H<<2)&8191),O=n[7]+((H>>>11|k<<5)&8191),j=n[8]+((k>>>8|R<<8)&8191),T=n[9]+(R>>>5|c),l=0,P=l+U*o+A*(5*u)+E*(5*g)+L*(5*p)+_*(5*w);l=P>>>13,P&=8191,P+=B*(5*d)+S*(5*y)+O*(5*x)+j*(5*a)+T*(5*h),l+=P>>>13,P&=8191;let K=l+U*h+A*o+E*(5*u)+L*(5*g)+_*(5*p);l=K>>>13,K&=8191,K+=B*(5*w)+S*(5*d)+O*(5*y)+j*(5*x)+T*(5*a),l+=K>>>13,K&=8191;let I=l+U*a+A*h+E*o+L*(5*u)+_*(5*g);l=I>>>13,I&=8191,I+=B*(5*p)+S*(5*w)+O*(5*d)+j*(5*y)+T*(5*x),l+=I>>>13,I&=8191;let z=l+U*x+A*a+E*h+L*o+_*(5*u);l=z>>>13,z&=8191,z+=B*(5*g)+S*(5*p)+O*(5*w)+j*(5*d)+T*(5*y),l+=z>>>13,z&=8191;let D=l+U*y+A*x+E*a+L*h+_*o;l=D>>>13,D&=8191,D+=B*(5*u)+S*(5*g)+O*(5*p)+j*(5*w)+T*(5*d),l+=D>>>13,D&=8191;let X=l+U*d+A*y+E*x+L*a+_*h;l=X>>>13,X&=8191,X+=B*o+S*(5*u)+O*(5*g)+j*(5*p)+T*(5*w),l+=X>>>13,X&=8191;let q=l+U*w+A*d+E*y+L*x+_*a;l=q>>>13,q&=8191,q+=B*h+S*o+O*(5*u)+j*(5*g)+T*(5*p),l+=q>>>13,q&=8191;let V=l+U*p+A*w+E*d+L*y+_*x;l=V>>>13,V&=8191,V+=B*a+S*h+O*o+j*(5*u)+T*(5*g),l+=V>>>13,V&=8191;let G=l+U*g+A*p+E*w+L*d+_*y;l=G>>>13,G&=8191,G+=B*x+S*a+O*h+j*o+T*(5*u),l+=G>>>13,G&=8191;let W=l+U*u+A*g+E*p+L*w+_*d;l=W>>>13,W&=8191,W+=B*y+S*x+O*a+j*h+T*o,l+=W>>>13,W&=8191,l=(l<<2)+l|0,l=l+P|0,P=l&8191,l=l>>>13,K+=l,n[0]=P,n[1]=K,n[2]=I,n[3]=z,n[4]=D,n[5]=X,n[6]=q,n[7]=V,n[8]=G,n[9]=W}finalize(){let{h:t,pad:s}=this,r=new Uint16Array(10),c=t[1]>>>13;t[1]&=8191;for(let o=2;o<10;o++)t[o]+=c,c=t[o]>>>13,t[o]&=8191;t[0]+=c*5,c=t[0]>>>13,t[0]&=8191,t[1]+=c,c=t[1]>>>13,t[1]&=8191,t[2]+=c,r[0]=t[0]+5,c=r[0]>>>13,r[0]&=8191;for(let o=1;o<10;o++)r[o]=t[o]+c,c=r[o]>>>13,r[o]&=8191;r[9]-=8192;let n=(c^1)-1;for(let o=0;o<10;o++)r[o]&=n;n=~n;for(let o=0;o<10;o++)t[o]=t[o]&n|r[o];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let f=t[0]+s[0];t[0]=f&65535;for(let o=1;o<8;o++)f=(t[o]+s[o]|0)+(f>>>16)|0,t[o]=f&65535}update(t){ot(this);let{buffer:s,blockLen:r}=this;t=J(t);let c=t.length;for(let n=0;n>>0,t[n++]=r[f]>>>8;return t}digest(){let{buffer:t,outputLen:s}=this;this.digestInto(t);let r=t.slice(0,s);return this.destroy(),r}};function Bt(e){let t=(r,c)=>e(c).update(J(r)).digest(),s=e(new Uint8Array(32));return t.outputLen=s.outputLen,t.blockLen=s.blockLen,t.create=r=>e(r),t}var gt=Bt(e=>new ft(e));var St=Y("expand 16-byte k"),Ot=Y("expand 32-byte k"),jt=F(St),Tt=F(Ot);function i(e,t){return e<>>32-t}function st(e){return e.byteOffset%4===0}var tt=64,It=16,wt=2**32-1,yt=new Uint32Array;function Pt(e,t,s,r,c,n,f,o){let h=c.length,a=new Uint8Array(tt),x=F(a),y=st(c)&&st(n),d=y?F(c):yt,w=y?F(n):yt;for(let p=0;p=wt)throw new Error("arx: counter overflow");let g=Math.min(tt,h-p);if(y&&g===tt){let u=p/4;if(p%4!==0)throw new Error("arx: invalid block position");for(let b=0,m;b{Z(o),Z(h),Z(a);let d=a.length;if(x||(x=new Uint8Array(d)),Z(x),Q(y),y<0||y>=wt)throw new Error("arx: counter overflow");if(x.length0;)w.pop().fill(0);return x}}function mt(e,t,s,r,c,n=20){let f=e[0],o=e[1],h=e[2],a=e[3],x=t[0],y=t[1],d=t[2],w=t[3],p=t[4],g=t[5],u=t[6],b=t[7],m=c,C=s[0],$=s[1],v=s[2],H=f,k=o,R=h,U=a,A=x,E=y,L=d,_=w,B=p,S=g,O=u,j=b,T=m,l=C,P=$,K=v;for(let z=0;z{e.update(t);let s=t.length%16;s&&e.update(Nt.subarray(s))},Ht=new Uint8Array(32);function bt(e,t,s,r,c){let n=e(t,s,Ht),f=gt.create(n);c&&dt(f,c),dt(f,r);let o=new Uint8Array(16),h=at(o);rt(h,0,BigInt(c?c.length:0),!0),rt(h,8,BigInt(r.length),!0),f.update(o);let a=f.digest();return n.fill(0),a}var Ut=e=>(t,s,r)=>(M(t,32),M(s),{encrypt:(n,f)=>{let o=n.length,h=o+16;f?M(f,h):f=new Uint8Array(h),e(t,s,n,f,1);let a=bt(e,t,s,f.subarray(0,-16),r);return f.set(a,o),f},decrypt:(n,f)=>{let o=n.length,h=o-16;if(o<16)throw new Error("encrypted data must be at least 16 bytes");f?M(f,h):f=new Uint8Array(h);let a=n.subarray(0,-16),x=n.subarray(-16),y=bt(e,t,s,a,r);if(!ut(x,y))throw new Error("invalid tag");return e(t,s,a,f,1),f}}),ct=et({blockSize:64,nonceLength:12,tagLength:16},Ut(Kt)),Zt=et({blockSize:64,nonceLength:24,tagLength:16},Ut($t));var kt={Aes128Gcm:1,Aes256Gcm:2,Chacha20Poly1305:3,ExportOnly:65535},At=kt;var ht=class{constructor(t){Object.defineProperty(this,"_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._key=new Uint8Array(t)}async seal(t,s,r){return await this._seal(t,s,r)}async open(t,s,r){return await this._open(t,s,r)}_seal(t,s,r){return new Promise(c=>{let n=ct(this._key,new Uint8Array(t),new Uint8Array(r)).encrypt(new Uint8Array(s));c(n.buffer)})}_open(t,s,r){return new Promise(c=>{let n=ct(this._key,new Uint8Array(t),new Uint8Array(r)).decrypt(new Uint8Array(s));c(n.buffer)})}},lt=class{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:At.Chacha20Poly1305}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}createEncryptionContext(t){return new ht(t)}};export{lt as Chacha20Poly1305}; /*! Bundled license information: @noble/ciphers/esm/utils.js: diff --git a/core/docs/assets/main.js b/core/docs/assets/main.js index 01bcad55f..d0aa8d5f9 100644 --- a/core/docs/assets/main.js +++ b/core/docs/assets/main.js @@ -1,6 +1,6 @@ "use strict"; "use strict";(()=>{var Pe=Object.create;var ne=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Ie(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Pe(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. -`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s=i?r.index.search(`*${i}*`):[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` ${ce(l.parent,i)}.${d}`);let v=document.createElement("li");v.classList.value=l.classes??"";let f=document.createElement("a");f.href=r.base+l.url,f.innerHTML=u+d,v.append(f),e.appendChild(v)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var Be={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>Be[e])}var C=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",pe="mousemove",B="mouseup",J={x:0,y:0},fe=!1,ee=!1,He=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(He=!0,F="touchstart",pe="touchmove",B="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(pe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{ee=!1});document.addEventListener("click",t=>{fe&&(t.preventDefault(),t.stopImmediatePropagation(),fe=!1)});var X=class extends C{constructor(n){super(n);this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(F,r=>this.onDocumentPointerDown(r)),document.addEventListener(B,r=>this.onDocumentPointerUp(r))}setActive(n){if(this.active==n)return;this.active=n,document.documentElement.classList.toggle("has-"+this.className,n),this.el.classList.toggle("active",n);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(n){D||(this.setActive(!0),n.preventDefault())}onDocumentPointerDown(n){if(this.active){if(n.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(n){if(!D&&this.active&&n.target.closest(".col-sidebar")){let r=n.target.closest("a");if(r){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),r.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ve=document.head.appendChild(document.createElement("style"));ve.dataset.for="filters";var Y=class extends C{constructor(n){super(n);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ve.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } `}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.checked}setLocalStorage(n){Q.setItem(this.key,n.toString()),this.value=n,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),document.querySelectorAll(".tsd-index-section").forEach(n=>{n.style.display="block";let r=Array.from(n.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);n.style.display=r?"none":"block"})}};var Z=class extends C{constructor(n){super(n);this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let r=Q.getItem(this.key);this.el.open=r?r==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let i=this.summary.querySelector("a");i&&i.addEventListener("click",()=>{location.assign(i.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ye(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ye(t.value)})}function ye(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.href===r.href&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); /*! Bundled license information: diff --git a/core/docs/classes/Aes128Gcm.html b/core/docs/classes/Aes128Gcm.html index 2dd7a86de..0815c0c5b 100644 --- a/core/docs/classes/Aes128Gcm.html +++ b/core/docs/classes/Aes128Gcm.html @@ -1,180 +1,19 @@ -Aes128Gcm | @hpke/core
-
- -
-
-
-
- -

Class Aes128Gcm

-
-

The AES-128-GCM for HPKE AEAD implementing AeadInterface.

+Aes128Gcm | @hpke/core

Class Aes128Gcm

The AES-128-GCM for HPKE AEAD implementing AeadInterface.

When using @hpke/core, the instance of this class must be specified to the aead parameter of CipherSuiteParams instead of AeadId.Aes128Gcm.

-
-
-

Example

import {
Aes128Gcm,
CipherSuite,
DhkemP256HkdfSha256,
HkdfSha256,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Aes128Gcm(),
}); +

Example

import {
Aes128Gcm,
CipherSuite,
DhkemP256HkdfSha256,
HkdfSha256,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Aes128Gcm(),
});
-
-
-

Hierarchy

-
-
-

Implements

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
id +

Hierarchy

Implements

Constructors

Properties

-
-

Methods

-
-
-

Constructors

-
- -
-
-

Properties

-
- -
id: AeadId = AeadId.Aes128Gcm
-

AeadId.Aes128Gcm (0x0001)

-
-
-
- -
keySize: number = 16
-

16

-
-
-
- -
nonceSize: number = 12
-

12

-
-
-
- -
tagSize: number = 16
-

16

-
-
-
-

Methods

-
- -
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Methods

Constructors

Properties

id: AeadId = AeadId.Aes128Gcm

AeadId.Aes128Gcm (0x0001)

+
keySize: number = 16

16

+
nonceSize: number = 12

12

+
tagSize: number = 16

16

+

Methods

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/Aes256Gcm.html b/core/docs/classes/Aes256Gcm.html index 013e856af..d5f05d91b 100644 --- a/core/docs/classes/Aes256Gcm.html +++ b/core/docs/classes/Aes256Gcm.html @@ -1,178 +1,20 @@ -Aes256Gcm | @hpke/core
-
- -
-
-
-
- -

Class Aes256Gcm

-
-

The AES-256-GCM for HPKE AEAD implementing AeadInterface.

+Aes256Gcm | @hpke/core

Class Aes256Gcm

The AES-256-GCM for HPKE AEAD implementing AeadInterface.

When using @hpke/core, the instance of this class must be specified to the aead parameter of CipherSuiteParams instead of AeadId.Aes256Gcm as follows:

-
-
-

Example

import {
Aes256Gcm,
CipherSuite,
DhkemP256HkdfSha256,
HkdfSha256,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Aes256Gcm(),
}); +

Example

import {
Aes256Gcm,
CipherSuite,
DhkemP256HkdfSha256,
HkdfSha256,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Aes256Gcm(),
});
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
id +

Hierarchy

Constructors

Properties

-
-

Methods

-
-
-

Constructors

-
- -
-
-

Properties

-
- -
id: AeadId = AeadId.Aes256Gcm
-

AeadId.Aes256Gcm (0x0002)

-
-
-
- -
keySize: number = 32
-

32

-
-
-
- -
nonceSize: number = 12
-

12

-
-
-
- -
tagSize: number = 16
-

16

-
-
-
-

Methods

-
- -
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Methods

Constructors

Properties

id: AeadId = AeadId.Aes256Gcm

AeadId.Aes256Gcm (0x0002)

+
keySize: number = 32

32

+
nonceSize: number = 12

12

+
tagSize: number = 16

16

+

Methods

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/BaseError.html b/core/docs/classes/BaseError.html index e5a9cb732..7951727a0 100644 --- a/core/docs/classes/BaseError.html +++ b/core/docs/classes/BaseError.html @@ -1,141 +1,7 @@ -BaseError | @hpke/core
-
- -
-
-
-
- -

Class BaseError

-
-

The base error class of hpke-js.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +BaseError | @hpke/core

Class BaseError

The base error class of hpke-js.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/CipherSuite.html b/core/docs/classes/CipherSuite.html index f0be5f843..2edd5e5ae 100644 --- a/core/docs/classes/CipherSuite.html +++ b/core/docs/classes/CipherSuite.html @@ -1,22 +1,4 @@ -CipherSuite | @hpke/core
-
- -
-
-
-
- -

Class CipherSuite

-
-

The Hybrid Public Key Encryption (HPKE) ciphersuite, +CipherSuite | @hpke/core

Class CipherSuite

The Hybrid Public Key Encryption (HPKE) ciphersuite, which is implemented using only Web Cryptography API.

This class is the same as @@ -49,310 +31,52 @@

Class CipherSuite

The calling of the constructor of this class is the starting point for HPKE operations for both senders and recipients.

-
-
-

Example

Use only ciphersuites supported by Web Cryptography API.

+

Example

Use only ciphersuites supported by Web Cryptography API.

import {
Aes128Gcm,
DhkemP256HkdfSha256,
HkdfSha256,
CipherSuite,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Aes128Gcm(),
});
-

Example

Use a ciphersuite which is currently not supported by Web Cryptography API.

import { Aes128Gcm, HkdfSha256, CipherSuite } from "http://deno.land/x/hpke/core/mod.ts";
import { DhkemX25519HkdfSha256 } from "https://deno.land/x/hpke/x/dhkem-x25519/mod.ts";
const suite = new CipherSuite({
kem: new DhkemX25519HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Aes128Gcm(),
});
-
-
-

Hierarchy

-
    -
  • CipherSuiteNative -
      -
    • CipherSuite
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-

Hierarchy

  • CipherSuiteNative
    • CipherSuite

Constructors

Properties

-
-

Accessors

-

Accessors

-
-

Methods

-

Methods

-
-

Constructors

-
- -

Constructors

-
-

Properties

-
- -
_api: SubtleCrypto = undefined
-
- -
-
-

Accessors

-
- -
-
- -
-
- -
-
-

Methods

-
- -
    - -
  • -

    Returns Promise<void>

-
- -
    - -
  • -

    Creates an encryption context for a recipient.

    +

Returns CipherSuite

Properties

_api: SubtleCrypto = undefined

Accessors

Methods

  • Returns Promise<void>

-
- -
-
- -
  • Decrypts a message from a sender.

    If the error occurred, throws DecapError | DeserializeError | OpenError | ValidationError.

    -
    -
    -

    Parameters

    -
      -
    • -
      params: RecipientContextParams
      -

      A set of parameters for building a recipient encryption context.

      -
      -
    • -
    • -
      ct: ArrayBuffer
      -

      An encrypted text as bytes to be decrypted.

      -
      -
    • -
    • -
      aad: ArrayBuffer = EMPTY
      -

      Additional authenticated data as bytes fed by an application.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A decrypted plain text as bytes.

    - -
-
- -
- -
-

Generated using TypeDoc

-
\ No newline at end of file +

Parameters

  • params: SenderContextParams

    A set of parameters for building a sender encryption context.

    +
  • pt: ArrayBuffer

    A plain text as bytes to be encrypted.

    +
  • aad: ArrayBuffer = EMPTY

    Additional authenticated data as bytes fed by an application.

    +

Returns Promise<CipherSuiteSealResponse>

A cipher text and an encapsulated key as bytes.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/DecapError.html b/core/docs/classes/DecapError.html index edfb382b0..afe4cebb6 100644 --- a/core/docs/classes/DecapError.html +++ b/core/docs/classes/DecapError.html @@ -1,139 +1,7 @@ -DecapError | @hpke/core
-
- -
-
-
-
- -

Class DecapError

-
-

decap() failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +DecapError | @hpke/core

Class DecapError

decap() failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/DeriveKeyPairError.html b/core/docs/classes/DeriveKeyPairError.html index c6082a70d..9b2a74597 100644 --- a/core/docs/classes/DeriveKeyPairError.html +++ b/core/docs/classes/DeriveKeyPairError.html @@ -1,139 +1,7 @@ -DeriveKeyPairError | @hpke/core
-
- -
-
-
-
- -

Class DeriveKeyPairError

-
-

Key pair derivation failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +DeriveKeyPairError | @hpke/core

Class DeriveKeyPairError

Key pair derivation failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/DeserializeError.html b/core/docs/classes/DeserializeError.html index 06af281da..18fb148d2 100644 --- a/core/docs/classes/DeserializeError.html +++ b/core/docs/classes/DeserializeError.html @@ -1,139 +1,7 @@ -DeserializeError | @hpke/core
-
- -
-
-
-
- -

Class DeserializeError

-
-

Public or private key deserialization failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +DeserializeError | @hpke/core

Class DeserializeError

Public or private key deserialization failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/DhkemP256HkdfSha256.html b/core/docs/classes/DhkemP256HkdfSha256.html index 921bdbf9f..8a90d1cbe 100644 --- a/core/docs/classes/DhkemP256HkdfSha256.html +++ b/core/docs/classes/DhkemP256HkdfSha256.html @@ -1,60 +1,18 @@ -DhkemP256HkdfSha256 | @hpke/core
-
- -
-
-
-
- -

Class DhkemP256HkdfSha256

-
-

The DHKEM(P-256, HKDF-SHA256) for HPKE KEM implementing KemInterface.

+DhkemP256HkdfSha256 | @hpke/core

Class DhkemP256HkdfSha256

The DHKEM(P-256, HKDF-SHA256) for HPKE KEM implementing KemInterface.

When using @hpke/core, the instance of this class must be specified to the kem parameter of CipherSuiteParams instead of KemId.DhkemP256HkdfSha256 as follows:

-
-
-

Example

import {
Aes128Gcm,
CipherSuite,
DhkemP256HkdfSha256,
HkdfSha256,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Aes128Gcm(),
}); +

Example

import {
Aes128Gcm,
CipherSuite,
DhkemP256HkdfSha256,
HkdfSha256,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Aes128Gcm(),
});
-
-
-

Hierarchy

-
    -
  • DhkemP256HkdfSha256Native -
      -
    • DhkemP256HkdfSha256
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-

Hierarchy

  • DhkemP256HkdfSha256Native
    • DhkemP256HkdfSha256
-
-

Constructors

-
- -
-
-

Properties

-
- -
-
- -
_prim: DhkemPrimitives
-
- -
encSize: number = 65
-
- -
id: KemId = KemId.DhkemP256HkdfSha256
-
- -
privateKeySize: number = 32
-
- -
publicKeySize: number = 65
-
- -
secretSize: number = 32
-
-

Methods

-
- -
-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      ikm: ArrayBuffer
    -

    Returns Promise<CryptoKeyPair>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
    -

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

-
- -
    - -
  • -

    Returns Promise<CryptoKeyPair>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      format: "raw" | "jwk"
    • -
    • -
      key: ArrayBuffer | JsonWebKey
    • -
    • -
      isPublic: boolean = true
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
    -

    Returns Promise<ArrayBuffer>

-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

_prim: DhkemPrimitives
encSize: number = 65
id: KemId = KemId.DhkemP256HkdfSha256
privateKeySize: number = 32
publicKeySize: number = 65
secretSize: number = 32

Methods

  • Parameters

    • ikm: ArrayBuffer

    Returns Promise<CryptoKeyPair>

  • Parameters

    • key: ArrayBuffer

    Returns Promise<CryptoKey>

  • Parameters

    • key: ArrayBuffer

    Returns Promise<CryptoKey>

  • Parameters

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

  • Returns Promise<CryptoKeyPair>

  • Parameters

    • format: "raw" | "jwk"
    • key: ArrayBuffer | JsonWebKey
    • isPublic: boolean = true

    Returns Promise<CryptoKey>

  • Parameters

    • key: CryptoKey

    Returns Promise<ArrayBuffer>

  • Parameters

    • key: CryptoKey

    Returns Promise<ArrayBuffer>

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/DhkemP384HkdfSha384.html b/core/docs/classes/DhkemP384HkdfSha384.html index 96f811bb6..1c58c46be 100644 --- a/core/docs/classes/DhkemP384HkdfSha384.html +++ b/core/docs/classes/DhkemP384HkdfSha384.html @@ -1,60 +1,18 @@ -DhkemP384HkdfSha384 | @hpke/core
-
- -
-
-
-
- -

Class DhkemP384HkdfSha384

-
-

The DHKEM(P-384, HKDF-SHA384) for HPKE KEM implementing KemInterface.

+DhkemP384HkdfSha384 | @hpke/core

Class DhkemP384HkdfSha384

The DHKEM(P-384, HKDF-SHA384) for HPKE KEM implementing KemInterface.

When using @hpke/core, the instance of this class must be specified to the kem parameter of CipherSuiteParams instead of KemId.DhkemP384HkdfSha384 as follows:

-
-
-

Example

import {
Aes128Gcm,
CipherSuite,
DhkemP384HkdfSha384,
HkdfSha384,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP384HkdfSha384(),
kdf: new HkdfSha384(),
aead: new Aes128Gcm(),
}); +

Example

import {
Aes128Gcm,
CipherSuite,
DhkemP384HkdfSha384,
HkdfSha384,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP384HkdfSha384(),
kdf: new HkdfSha384(),
aead: new Aes128Gcm(),
});
-
-
-

Hierarchy

-
    -
  • DhkemP384HkdfSha384Native -
      -
    • DhkemP384HkdfSha384
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-

Hierarchy

  • DhkemP384HkdfSha384Native
    • DhkemP384HkdfSha384
-
-

Constructors

-
- -
-
-

Properties

-
- -
-
- -
_prim: DhkemPrimitives
-
- -
encSize: number = 97
-
- -
id: KemId = KemId.DhkemP384HkdfSha384
-
- -
privateKeySize: number = 48
-
- -
publicKeySize: number = 97
-
- -
secretSize: number = 48
-
-

Methods

-
- -
-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      ikm: ArrayBuffer
    -

    Returns Promise<CryptoKeyPair>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
    -

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

-
- -
    - -
  • -

    Returns Promise<CryptoKeyPair>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      format: "raw" | "jwk"
    • -
    • -
      key: ArrayBuffer | JsonWebKey
    • -
    • -
      isPublic: boolean = true
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
    -

    Returns Promise<ArrayBuffer>

-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

_prim: DhkemPrimitives
encSize: number = 97
id: KemId = KemId.DhkemP384HkdfSha384
privateKeySize: number = 48
publicKeySize: number = 97
secretSize: number = 48

Methods

  • Parameters

    • ikm: ArrayBuffer

    Returns Promise<CryptoKeyPair>

  • Parameters

    • key: ArrayBuffer

    Returns Promise<CryptoKey>

  • Parameters

    • key: ArrayBuffer

    Returns Promise<CryptoKey>

  • Parameters

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

  • Returns Promise<CryptoKeyPair>

  • Parameters

    • format: "raw" | "jwk"
    • key: ArrayBuffer | JsonWebKey
    • isPublic: boolean = true

    Returns Promise<CryptoKey>

  • Parameters

    • key: CryptoKey

    Returns Promise<ArrayBuffer>

  • Parameters

    • key: CryptoKey

    Returns Promise<ArrayBuffer>

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/DhkemP521HkdfSha512.html b/core/docs/classes/DhkemP521HkdfSha512.html index 37c736f9c..f37be76d3 100644 --- a/core/docs/classes/DhkemP521HkdfSha512.html +++ b/core/docs/classes/DhkemP521HkdfSha512.html @@ -1,60 +1,18 @@ -DhkemP521HkdfSha512 | @hpke/core
-
- -
-
-
-
- -

Class DhkemP521HkdfSha512

-
-

The DHKEM(P-521, HKDF-SHA512) for HPKE KEM implementing KemInterface.

+DhkemP521HkdfSha512 | @hpke/core

Class DhkemP521HkdfSha512

The DHKEM(P-521, HKDF-SHA512) for HPKE KEM implementing KemInterface.

When using @hpke/core, the instance of this class must be specified to the kem parameter of CipherSuiteParams instead of KemId.DhkemP521HkdfSha512 as follows:

-
-
-

Example

import {
Aes256Gcm,
CipherSuite,
DhkemP521HkdfSha512,
HkdfSha512,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP521HkdfSha512(),
kdf: new HkdfSha512(),
aead: new Aes256Gcm(),
}); +

Example

import {
Aes256Gcm,
CipherSuite,
DhkemP521HkdfSha512,
HkdfSha512,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP521HkdfSha512(),
kdf: new HkdfSha512(),
aead: new Aes256Gcm(),
});
-
-
-

Hierarchy

-
    -
  • DhkemP521HkdfSha512Native -
      -
    • DhkemP521HkdfSha512
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-

Hierarchy

  • DhkemP521HkdfSha512Native
    • DhkemP521HkdfSha512
-
-

Constructors

-
- -
-
-

Properties

-
- -
-
- -
_prim: DhkemPrimitives
-
- -
encSize: number = 133
-
- -
id: KemId = KemId.DhkemP521HkdfSha512
-
- -
privateKeySize: number = 64
-
- -
publicKeySize: number = 133
-
- -
secretSize: number = 64
-
-

Methods

-
- -
-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      ikm: ArrayBuffer
    -

    Returns Promise<CryptoKeyPair>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
    -

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

-
- -
    - -
  • -

    Returns Promise<CryptoKeyPair>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      format: "raw" | "jwk"
    • -
    • -
      key: ArrayBuffer | JsonWebKey
    • -
    • -
      isPublic: boolean = true
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
    -

    Returns Promise<ArrayBuffer>

-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

_prim: DhkemPrimitives
encSize: number = 133
id: KemId = KemId.DhkemP521HkdfSha512
privateKeySize: number = 64
publicKeySize: number = 133
secretSize: number = 64

Methods

  • Parameters

    • ikm: ArrayBuffer

    Returns Promise<CryptoKeyPair>

  • Parameters

    • key: ArrayBuffer

    Returns Promise<CryptoKey>

  • Parameters

    • key: ArrayBuffer

    Returns Promise<CryptoKey>

  • Parameters

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

  • Returns Promise<CryptoKeyPair>

  • Parameters

    • format: "raw" | "jwk"
    • key: ArrayBuffer | JsonWebKey
    • isPublic: boolean = true

    Returns Promise<CryptoKey>

  • Parameters

    • key: CryptoKey

    Returns Promise<ArrayBuffer>

  • Parameters

    • key: CryptoKey

    Returns Promise<ArrayBuffer>

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/EncapError.html b/core/docs/classes/EncapError.html index 73d8c9ffb..12e69f9d7 100644 --- a/core/docs/classes/EncapError.html +++ b/core/docs/classes/EncapError.html @@ -1,139 +1,7 @@ -EncapError | @hpke/core
-
- -
-
-
-
- -

Class EncapError

-
-

encap() failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +EncapError | @hpke/core

Class EncapError

encap() failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/ExportError.html b/core/docs/classes/ExportError.html index 9d2204dea..2942e3fe6 100644 --- a/core/docs/classes/ExportError.html +++ b/core/docs/classes/ExportError.html @@ -1,139 +1,7 @@ -ExportError | @hpke/core
-
- -
-
-
-
- -

Class ExportError

-
-

Secret export failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +ExportError | @hpke/core

Class ExportError

Secret export failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/ExportOnly.html b/core/docs/classes/ExportOnly.html index 371fc9669..fa3c85ea2 100644 --- a/core/docs/classes/ExportOnly.html +++ b/core/docs/classes/ExportOnly.html @@ -1,179 +1,20 @@ -ExportOnly | @hpke/core
-
- -
-
-
-
- -

Class ExportOnly

-
-

The ExportOnly mode for HPKE AEAD implementing AeadInterface.

+ExportOnly | @hpke/core

Class ExportOnly

The ExportOnly mode for HPKE AEAD implementing AeadInterface.

When using @hpke/core, the instance of this class must be specified to the aead parameter of CipherSuiteParams instead of AeadId.ExportOnly as follows:

-
-
-

Example

import {
CipherSuite,
DhkemP256HkdfSha256,
ExportOnly,
HkdfSha256,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new ExportOnly(),
}); +

Example

import {
CipherSuite,
DhkemP256HkdfSha256,
ExportOnly,
HkdfSha256,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new ExportOnly(),
});
-
-
-

Hierarchy

-
    -
  • ExportOnly
-
-

Implements

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
id +

Hierarchy

  • ExportOnly

Implements

Constructors

Properties

-
-

Methods

-
-
-

Constructors

-
- -
-
-

Properties

-
- -
id: AeadId = AeadId.ExportOnly
-

The KDF identifier.

-
-
-
- -
keySize: number = 0
-

The length in bytes of an AEAD key (Nk).

-
-
-
- -
nonceSize: number = 0
-

The length in bytes of an AEAD nonce (Nn).

-
-
-
- -
tagSize: number = 0
-

The length in bytes of an AEAD authentication tag (Nt).

-
-
-
-

Methods

-
- -
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Methods

Constructors

Properties

id: AeadId = AeadId.ExportOnly

The KDF identifier.

+
keySize: number = 0

The length in bytes of an AEAD key (Nk).

+
nonceSize: number = 0

The length in bytes of an AEAD nonce (Nn).

+
tagSize: number = 0

The length in bytes of an AEAD authentication tag (Nt).

+

Methods

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/HkdfSha256.html b/core/docs/classes/HkdfSha256.html index 8e5de2f0f..8c706c8b7 100644 --- a/core/docs/classes/HkdfSha256.html +++ b/core/docs/classes/HkdfSha256.html @@ -1,60 +1,18 @@ -HkdfSha256 | @hpke/core
-
- -
-
-
-
- -

Class HkdfSha256

-
-

The HKDF-SHA256 for HPKE KDF implementing KdfInterface.

+HkdfSha256 | @hpke/core

Class HkdfSha256

The HKDF-SHA256 for HPKE KDF implementing KdfInterface.

When using @hpke/core, the instance of this class must be specified to the kem parameter of CipherSuiteParams instead of KdfId.HkdfSha256.

The KDF class can only derive keys of the same length as the hashSize. If you want to derive keys longer than the hashSize, please use hpke-js#CipherSuite.

-
-
-

Example

import {
Aes128Gcm,
CipherSuite,
DhkemP256HkdfSha256,
HkdfSha256,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Aes128Gcm(),
}); +

Example

import {
Aes128Gcm,
CipherSuite,
DhkemP256HkdfSha256,
HkdfSha256,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP256HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Aes128Gcm(),
});
-
-
-

Hierarchy

-
    -
  • HkdfSha256Native -
      -
    • HkdfSha256
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-

Hierarchy

  • HkdfSha256Native
    • HkdfSha256

Constructors

Properties

-
-

Methods

-

Methods

-
-

Constructors

-
- -
-
-

Properties

-
- -
_api: SubtleCrypto = undefined
-
- -
_suiteId: Uint8Array = EMPTY
-
- -
algHash: HmacKeyGenParams = ...
-

The parameters for Web Cryptography API

-
-
-
- -
hashSize: number = 32
-

32

-
-
-
- -
id: KdfId = KdfId.HkdfSha256
-

KdfId.HkdfSha256 (0x0001)

-
-
-
-

Methods

-
- -
    - -
  • -

    Returns void

-
- -
    - -
  • -

    Returns Promise<void>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      label: Uint8Array
    • -
    • -
      ikm: Uint8Array
    -

    Returns Uint8Array

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      label: Uint8Array
    • -
    • -
      info: Uint8Array
    • -
    • -
      len: number
    -

    Returns Uint8Array

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      prk: ArrayBuffer
    • -
    • -
      info: ArrayBuffer
    • -
    • -
      len: number
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      salt: ArrayBuffer
    • -
    • -
      ikm: ArrayBuffer
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      salt: ArrayBuffer
    • -
    • -
      ikm: ArrayBuffer
    • -
    • -
      info: ArrayBuffer
    • -
    • -
      len: number
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      suiteId: Uint8Array
    -

    Returns void

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      prk: ArrayBuffer
    • -
    • -
      label: Uint8Array
    • -
    • -
      info: Uint8Array
    • -
    • -
      len: number
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      salt: ArrayBuffer
    • -
    • -
      label: Uint8Array
    • -
    • -
      ikm: Uint8Array
    -

    Returns Promise<ArrayBuffer>

-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

_api: SubtleCrypto = undefined
_suiteId: Uint8Array = EMPTY
algHash: HmacKeyGenParams = ...

The parameters for Web Cryptography API

+
hashSize: number = 32

32

+
id: KdfId = KdfId.HkdfSha256

KdfId.HkdfSha256 (0x0001)

+

Methods

  • Returns Promise<void>

  • Parameters

    • label: Uint8Array
    • ikm: Uint8Array

    Returns Uint8Array

  • Parameters

    • label: Uint8Array
    • info: Uint8Array
    • len: number

    Returns Uint8Array

  • Parameters

    • prk: ArrayBuffer
    • info: ArrayBuffer
    • len: number

    Returns Promise<ArrayBuffer>

  • Parameters

    • salt: ArrayBuffer
    • ikm: ArrayBuffer

    Returns Promise<ArrayBuffer>

  • Parameters

    • salt: ArrayBuffer
    • ikm: ArrayBuffer
    • info: ArrayBuffer
    • len: number

    Returns Promise<ArrayBuffer>

  • Parameters

    • suiteId: Uint8Array

    Returns void

  • Parameters

    • prk: ArrayBuffer
    • label: Uint8Array
    • info: Uint8Array
    • len: number

    Returns Promise<ArrayBuffer>

  • Parameters

    • salt: ArrayBuffer
    • label: Uint8Array
    • ikm: Uint8Array

    Returns Promise<ArrayBuffer>

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/HkdfSha384.html b/core/docs/classes/HkdfSha384.html index 024fa06ea..1f0580baf 100644 --- a/core/docs/classes/HkdfSha384.html +++ b/core/docs/classes/HkdfSha384.html @@ -1,60 +1,18 @@ -HkdfSha384 | @hpke/core
-
- -
-
-
-
- -

Class HkdfSha384

-
-

The HKDF-SHA384 for HPKE KDF implementing KdfInterface.

+HkdfSha384 | @hpke/core

Class HkdfSha384

The HKDF-SHA384 for HPKE KDF implementing KdfInterface.

When using @hpke/core, the instance of this class must be specified to the kem parameter of CipherSuiteParams instead of KdfId.HkdfSha384.

The KDF class can only derive keys of the same length as the hashSize. If you want to derive keys longer than the hashSize, please use hpke-js#CipherSuite.

-
-
-

Example

import {
Aes128Gcm,
CipherSuite,
DhkemP384HkdfSha384,
HkdfSha384,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP384HkdfSha384(),
kdf: new HkdfSha384(),
aead: new Aes128Gcm(),
}); +

Example

import {
Aes128Gcm,
CipherSuite,
DhkemP384HkdfSha384,
HkdfSha384,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP384HkdfSha384(),
kdf: new HkdfSha384(),
aead: new Aes128Gcm(),
});
-
-
-

Hierarchy

-
    -
  • HkdfSha384Native -
      -
    • HkdfSha384
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-

Hierarchy

  • HkdfSha384Native
    • HkdfSha384

Constructors

Properties

-
-

Methods

-

Methods

-
-

Constructors

-
- -
-
-

Properties

-
- -
_api: SubtleCrypto = undefined
-
- -
_suiteId: Uint8Array = EMPTY
-
- -
algHash: HmacKeyGenParams = ...
-

The parameters for Web Cryptography API

-
-
-
- -
hashSize: number = 48
-

48

-
-
-
- -
id: KdfId = KdfId.HkdfSha384
-

KdfId.HkdfSha384 (0x0002)

-
-
-
-

Methods

-
- -
    - -
  • -

    Returns void

-
- -
    - -
  • -

    Returns Promise<void>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      label: Uint8Array
    • -
    • -
      ikm: Uint8Array
    -

    Returns Uint8Array

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      label: Uint8Array
    • -
    • -
      info: Uint8Array
    • -
    • -
      len: number
    -

    Returns Uint8Array

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      prk: ArrayBuffer
    • -
    • -
      info: ArrayBuffer
    • -
    • -
      len: number
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      salt: ArrayBuffer
    • -
    • -
      ikm: ArrayBuffer
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      salt: ArrayBuffer
    • -
    • -
      ikm: ArrayBuffer
    • -
    • -
      info: ArrayBuffer
    • -
    • -
      len: number
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      suiteId: Uint8Array
    -

    Returns void

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      prk: ArrayBuffer
    • -
    • -
      label: Uint8Array
    • -
    • -
      info: Uint8Array
    • -
    • -
      len: number
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      salt: ArrayBuffer
    • -
    • -
      label: Uint8Array
    • -
    • -
      ikm: Uint8Array
    -

    Returns Promise<ArrayBuffer>

-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

_api: SubtleCrypto = undefined
_suiteId: Uint8Array = EMPTY
algHash: HmacKeyGenParams = ...

The parameters for Web Cryptography API

+
hashSize: number = 48

48

+
id: KdfId = KdfId.HkdfSha384

KdfId.HkdfSha384 (0x0002)

+

Methods

  • Returns Promise<void>

  • Parameters

    • label: Uint8Array
    • ikm: Uint8Array

    Returns Uint8Array

  • Parameters

    • label: Uint8Array
    • info: Uint8Array
    • len: number

    Returns Uint8Array

  • Parameters

    • prk: ArrayBuffer
    • info: ArrayBuffer
    • len: number

    Returns Promise<ArrayBuffer>

  • Parameters

    • salt: ArrayBuffer
    • ikm: ArrayBuffer

    Returns Promise<ArrayBuffer>

  • Parameters

    • salt: ArrayBuffer
    • ikm: ArrayBuffer
    • info: ArrayBuffer
    • len: number

    Returns Promise<ArrayBuffer>

  • Parameters

    • suiteId: Uint8Array

    Returns void

  • Parameters

    • prk: ArrayBuffer
    • label: Uint8Array
    • info: Uint8Array
    • len: number

    Returns Promise<ArrayBuffer>

  • Parameters

    • salt: ArrayBuffer
    • label: Uint8Array
    • ikm: Uint8Array

    Returns Promise<ArrayBuffer>

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/HkdfSha512.html b/core/docs/classes/HkdfSha512.html index d78c7d6fa..3fb7b0ed7 100644 --- a/core/docs/classes/HkdfSha512.html +++ b/core/docs/classes/HkdfSha512.html @@ -1,60 +1,18 @@ -HkdfSha512 | @hpke/core
-
- -
-
-
-
- -

Class HkdfSha512

-
-

The HKDF-SHA512 for HPKE KDF implementing KdfInterface.

+HkdfSha512 | @hpke/core

Class HkdfSha512

The HKDF-SHA512 for HPKE KDF implementing KdfInterface.

When using @hpke/core, the instance of this class must be specified to the kem parameter of CipherSuiteParams instead of KdfId.HkdfSha512.

The KDF class can only derive keys of the same length as the hashSize. If you want to derive keys longer than the hashSize, please use hpke-js#CipherSuite.

-
-
-

Example

import {
Aes256Gcm,
CipherSuite,
DhkemP521HkdfSha512,
HkdfSha512,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP521HkdfSha512(),
kdf: new HkdfSha512(),
aead: new Aes256Gcm(),
}); +

Example

import {
Aes256Gcm,
CipherSuite,
DhkemP521HkdfSha512,
HkdfSha512,
} from "http://deno.land/x/hpke/core/mod.ts";

const suite = new CipherSuite({
kem: new DhkemP521HkdfSha512(),
kdf: new HkdfSha512(),
aead: new Aes256Gcm(),
});
-
-
-

Hierarchy

-
    -
  • HkdfSha512Native -
      -
    • HkdfSha512
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-

Hierarchy

  • HkdfSha512Native
    • HkdfSha512

Constructors

Properties

-
-

Methods

-

Methods

-
-

Constructors

-
- -
-
-

Properties

-
- -
_api: SubtleCrypto = undefined
-
- -
_suiteId: Uint8Array = EMPTY
-
- -
algHash: HmacKeyGenParams = ...
-

The parameters for Web Cryptography API

-
-
-
- -
hashSize: number = 64
-

64

-
-
-
- -
id: KdfId = KdfId.HkdfSha512
-

KdfId.HkdfSha512 (0x0003)

-
-
-
-

Methods

-
- -
    - -
  • -

    Returns void

-
- -
    - -
  • -

    Returns Promise<void>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      label: Uint8Array
    • -
    • -
      ikm: Uint8Array
    -

    Returns Uint8Array

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      label: Uint8Array
    • -
    • -
      info: Uint8Array
    • -
    • -
      len: number
    -

    Returns Uint8Array

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      prk: ArrayBuffer
    • -
    • -
      info: ArrayBuffer
    • -
    • -
      len: number
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      salt: ArrayBuffer
    • -
    • -
      ikm: ArrayBuffer
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      salt: ArrayBuffer
    • -
    • -
      ikm: ArrayBuffer
    • -
    • -
      info: ArrayBuffer
    • -
    • -
      len: number
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      suiteId: Uint8Array
    -

    Returns void

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      prk: ArrayBuffer
    • -
    • -
      label: Uint8Array
    • -
    • -
      info: Uint8Array
    • -
    • -
      len: number
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      salt: ArrayBuffer
    • -
    • -
      label: Uint8Array
    • -
    • -
      ikm: Uint8Array
    -

    Returns Promise<ArrayBuffer>

-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

_api: SubtleCrypto = undefined
_suiteId: Uint8Array = EMPTY
algHash: HmacKeyGenParams = ...

The parameters for Web Cryptography API

+
hashSize: number = 64

64

+
id: KdfId = KdfId.HkdfSha512

KdfId.HkdfSha512 (0x0003)

+

Methods

  • Returns Promise<void>

  • Parameters

    • label: Uint8Array
    • ikm: Uint8Array

    Returns Uint8Array

  • Parameters

    • label: Uint8Array
    • info: Uint8Array
    • len: number

    Returns Uint8Array

  • Parameters

    • prk: ArrayBuffer
    • info: ArrayBuffer
    • len: number

    Returns Promise<ArrayBuffer>

  • Parameters

    • salt: ArrayBuffer
    • ikm: ArrayBuffer

    Returns Promise<ArrayBuffer>

  • Parameters

    • salt: ArrayBuffer
    • ikm: ArrayBuffer
    • info: ArrayBuffer
    • len: number

    Returns Promise<ArrayBuffer>

  • Parameters

    • suiteId: Uint8Array

    Returns void

  • Parameters

    • prk: ArrayBuffer
    • label: Uint8Array
    • info: Uint8Array
    • len: number

    Returns Promise<ArrayBuffer>

  • Parameters

    • salt: ArrayBuffer
    • label: Uint8Array
    • ikm: Uint8Array

    Returns Promise<ArrayBuffer>

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/HpkeError.html b/core/docs/classes/HpkeError.html index c1a069e8c..015ae54a5 100644 --- a/core/docs/classes/HpkeError.html +++ b/core/docs/classes/HpkeError.html @@ -1,152 +1,7 @@ -HpkeError | @hpke/core
-
- -
-
-
-
- -

Class HpkeError

-
-

The base error class of hpke-js.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +HpkeError | @hpke/core

Class HpkeError

The base error class of hpke-js.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/InvalidParamError.html b/core/docs/classes/InvalidParamError.html index 6d0efce68..dac672058 100644 --- a/core/docs/classes/InvalidParamError.html +++ b/core/docs/classes/InvalidParamError.html @@ -1,139 +1,7 @@ -InvalidParamError | @hpke/core
-
- -
-
-
-
- -

Class InvalidParamError

-
-

Invalid parameter.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +InvalidParamError | @hpke/core

Class InvalidParamError

Invalid parameter.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/MessageLimitReachedError.html b/core/docs/classes/MessageLimitReachedError.html index dd3021065..48e78b7b5 100644 --- a/core/docs/classes/MessageLimitReachedError.html +++ b/core/docs/classes/MessageLimitReachedError.html @@ -1,139 +1,7 @@ -MessageLimitReachedError | @hpke/core
-
- -
-
-
-
- -

Class MessageLimitReachedError

-
-

Sequence number overflow on the encryption context.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +MessageLimitReachedError | @hpke/core

Class MessageLimitReachedError

Sequence number overflow on the encryption context.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/NotSupportedError.html b/core/docs/classes/NotSupportedError.html index 5c3cc875c..c2a6456cc 100644 --- a/core/docs/classes/NotSupportedError.html +++ b/core/docs/classes/NotSupportedError.html @@ -1,139 +1,7 @@ -NotSupportedError | @hpke/core
-
- -
-
-
-
- -

Class NotSupportedError

-
-

Not supported failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +NotSupportedError | @hpke/core

Class NotSupportedError

Not supported failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/OpenError.html b/core/docs/classes/OpenError.html index 151d517c7..7a51cbbde 100644 --- a/core/docs/classes/OpenError.html +++ b/core/docs/classes/OpenError.html @@ -1,139 +1,7 @@ -OpenError | @hpke/core
-
- -
-
-
-
- -

Class OpenError

-
-

open() failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +OpenError | @hpke/core

Class OpenError

open() failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/SealError.html b/core/docs/classes/SealError.html index 2500d3ab2..c96a4be54 100644 --- a/core/docs/classes/SealError.html +++ b/core/docs/classes/SealError.html @@ -1,139 +1,7 @@ -SealError | @hpke/core
-
- -
-
-
-
- -

Class SealError

-
-

seal() failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +SealError | @hpke/core

Class SealError

seal() failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/SerializeError.html b/core/docs/classes/SerializeError.html index a920548e6..d69fe255b 100644 --- a/core/docs/classes/SerializeError.html +++ b/core/docs/classes/SerializeError.html @@ -1,139 +1,7 @@ -SerializeError | @hpke/core
-
- -
-
-
-
- -

Class SerializeError

-
-

Public or private key serialization failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +SerializeError | @hpke/core

Class SerializeError

Public or private key serialization failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/classes/ValidationError.html b/core/docs/classes/ValidationError.html index 641039aa4..989aa9bb7 100644 --- a/core/docs/classes/ValidationError.html +++ b/core/docs/classes/ValidationError.html @@ -1,139 +1,7 @@ -ValidationError | @hpke/core
-
- -
-
-
-
- -

Class ValidationError

-
-

KEM input or output validation failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +ValidationError | @hpke/core

Class ValidationError

KEM input or output validation failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/index.html b/core/docs/index.html index c5b484a6a..d04f7eb9b 100644 --- a/core/docs/index.html +++ b/core/docs/index.html @@ -1,18 +1,4 @@ -@hpke/core
-
- -
-
-
-
-

@hpke/core

-

@hpke/core

+@hpke/core

@hpke/core

@hpke/core

A TypeScript Hybrid Public Key Encryption (HPKE) core module implemented using only Web Cryptography API. It does not support the X25519/X448-based KEMs and the ChaCha20Poly1305 AEAD, but it has no external module dependencies. It's small in size and tree-shaking friendly.
@@ -26,15 +12,15 @@

@hpke/core

Index

Contributing

We welcome all kind of contributions, filing issues, suggesting new features or sending PRs.

-
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/interfaces/AeadEncryptionContext.html b/core/docs/interfaces/AeadEncryptionContext.html index 562607043..7fec455d5 100644 --- a/core/docs/interfaces/AeadEncryptionContext.html +++ b/core/docs/interfaces/AeadEncryptionContext.html @@ -1,148 +1,14 @@ -AeadEncryptionContext | @hpke/core
-
- -
-
-
-
- -

Interface AeadEncryptionContext

-
-

The AEAD encryption context interface.

-
-
-
-

Hierarchy

-
    -
  • AeadEncryptionContext
-
-
-
- -
-
-

Methods

-
open +AeadEncryptionContext | @hpke/core

Interface AeadEncryptionContext

The AEAD encryption context interface.

+

Hierarchy

  • AeadEncryptionContext

Methods

-
-

Methods

-
- -
    - -
  • -

    Decrypts data with an initialization vector and additional authenticated data.

    -
    -
    -

    Parameters

    -
      -
    • -
      iv: ArrayBuffer
      -

      An initialization vector.

      -
      -
    • -
    • -
      data: ArrayBuffer
      -

      A plain text as bytes to be encrypted.

      -
      -
    • -
    • -
      aad: ArrayBuffer
      -

      Additional authenticated data as bytes fed by an application.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A decrypted plain text as bytes.

    - -
-
- -
    - -
  • -

    Encrypts data with an initialization vector and additional authenticated data.

    -
    -
    -

    Parameters

    -
      -
    • -
      iv: ArrayBuffer
      -

      An initialization vector.

      -
      -
    • -
    • -
      data: ArrayBuffer
      -

      A plain text as bytes to be encrypted.

      -
      -
    • -
    • -
      aad: ArrayBuffer
      -

      Additional authenticated data as bytes fed by an application.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A cipher text as bytes.

    - -
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Methods

  • Decrypts data with an initialization vector and additional authenticated data.

    +

    Parameters

    • iv: ArrayBuffer

      An initialization vector.

      +
    • data: ArrayBuffer

      A plain text as bytes to be encrypted.

      +
    • aad: ArrayBuffer

      Additional authenticated data as bytes fed by an application.

      +

    Returns Promise<ArrayBuffer>

    A decrypted plain text as bytes.

    +
  • Encrypts data with an initialization vector and additional authenticated data.

    +

    Parameters

    • iv: ArrayBuffer

      An initialization vector.

      +
    • data: ArrayBuffer

      A plain text as bytes to be encrypted.

      +
    • aad: ArrayBuffer

      Additional authenticated data as bytes fed by an application.

      +

    Returns Promise<ArrayBuffer>

    A cipher text as bytes.

    +

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/interfaces/AeadInterface.html b/core/docs/interfaces/AeadInterface.html index cd67d553a..11d059991 100644 --- a/core/docs/interfaces/AeadInterface.html +++ b/core/docs/interfaces/AeadInterface.html @@ -1,156 +1,14 @@ -AeadInterface | @hpke/core
-
- -
-
-
-
- -

Interface AeadInterface

-
-

The AEAD interface.

-
-
-
-

Hierarchy

-
    -
  • AeadInterface
-
-

Implemented by

-
-
-
-
- -
-
-

Properties

-
id +AeadInterface | @hpke/core

Interface AeadInterface

The AEAD interface.

+

Hierarchy

  • AeadInterface

Implemented by

-
-

Properties

-
- -
id: AeadId
-

The KDF identifier.

-
-
-
- -
keySize: number
-

The length in bytes of an AEAD key (Nk).

-
-
-
- -
nonceSize: number
-

The length in bytes of an AEAD nonce (Nn).

-
-
-
- -
tagSize: number
-

The length in bytes of an AEAD authentication tag (Nt).

-
-
-
-

Methods

-
- -
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Methods

Properties

id: AeadId

The KDF identifier.

+
keySize: number

The length in bytes of an AEAD key (Nk).

+
nonceSize: number

The length in bytes of an AEAD nonce (Nn).

+
tagSize: number

The length in bytes of an AEAD authentication tag (Nt).

+

Methods

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/interfaces/CipherSuiteParams.html b/core/docs/interfaces/CipherSuiteParams.html index df9f6cbcc..1c1128101 100644 --- a/core/docs/interfaces/CipherSuiteParams.html +++ b/core/docs/interfaces/CipherSuiteParams.html @@ -1,114 +1,8 @@ -CipherSuiteParams | @hpke/core
-
- -
-
-
-
- -

Interface CipherSuiteParams

-
-

The parameters used to configure the CipherSuite.

-
-
-
-

Hierarchy

-
    -
  • CipherSuiteParams
-
-
-
- -
-
-

Properties

-
aead +CipherSuiteParams | @hpke/core

Interface CipherSuiteParams

The parameters used to configure the CipherSuite.

+

Hierarchy

  • CipherSuiteParams

Properties

-
-

Properties

-
- - -

The AEAD (Authenticated Encryption with Addtional Data) identifier or the AEAD object.

-
-
-
- - -

The KDF (Key Derivation Function) identifier or the KDF object.

-
-
-
- - -

The KEM (Key Encapsulation Mechanism) identifier or the KEM object.

-
-
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Properties

The AEAD (Authenticated Encryption with Addtional Data) identifier or the AEAD object.

+

The KDF (Key Derivation Function) identifier or the KDF object.

+

The KEM (Key Encapsulation Mechanism) identifier or the KEM object.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/interfaces/CipherSuiteSealResponse.html b/core/docs/interfaces/CipherSuiteSealResponse.html index f89371eb9..5ce3e9540 100644 --- a/core/docs/interfaces/CipherSuiteSealResponse.html +++ b/core/docs/interfaces/CipherSuiteSealResponse.html @@ -1,104 +1,6 @@ -CipherSuiteSealResponse | @hpke/core
-
- -
-
-
-
- -

Interface CipherSuiteSealResponse

-
-

The response of the single-shot seal API.

-
-
-
-

Hierarchy

-
    -
  • CipherSuiteSealResponse
-
-
-
- -
-
-

Properties

-
ct +CipherSuiteSealResponse | @hpke/core

Interface CipherSuiteSealResponse

The response of the single-shot seal API.

+

Hierarchy

  • CipherSuiteSealResponse

Properties

-
-

Properties

-
- -
ct: ArrayBuffer
-

The ciphertext as bytes.

-
-
-
- -
enc: ArrayBuffer
-

The encapsulated key.

-
-
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Properties

ct: ArrayBuffer

The ciphertext as bytes.

+
enc: ArrayBuffer

The encapsulated key.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/interfaces/EncryptionContext.html b/core/docs/interfaces/EncryptionContext.html index ea350d71a..4f00b1a40 100644 --- a/core/docs/interfaces/EncryptionContext.html +++ b/core/docs/interfaces/EncryptionContext.html @@ -1,179 +1,23 @@ -EncryptionContext | @hpke/core
-
- -
-
-
-
- -

Interface EncryptionContext

-
-

The encryption context interface for a recipient and a sender.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Methods

-
export +EncryptionContext | @hpke/core

Interface EncryptionContext

The encryption context interface for a recipient and a sender.

+

Hierarchy

Methods

-
-

Methods

-
- -
    - -
  • -

    Exports a secret using a variable-length pseudorandom function.

    +

Methods

  • Exports a secret using a variable-length pseudorandom function.

    If the error occurred, throws ExportError.

    -
    -
    -

    Parameters

    -
      -
    • -
      exporterContext: ArrayBuffer
      -

      An exporter context string as bytes. The maximum length is 128 bytes.

      -
      -
    • -
    • -
      len: number
      -

      A desired length in bytes of the output secret.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A secret string as bytes.

    - -
    -

    Throws

    ExportError

    -
-
- -
    - -
  • -

    Decrypts data.

    +

    Parameters

    • exporterContext: ArrayBuffer

      An exporter context string as bytes. The maximum length is 128 bytes.

      +
    • len: number

      A desired length in bytes of the output secret.

      +

    Returns Promise<ArrayBuffer>

    A secret string as bytes.

    +

    Throws

    ExportError

    +
  • Decrypts data.

    If the error occurred, throws OpenError.

    -
    -
    -

    Parameters

    -
      -
    • -
      data: ArrayBuffer
      -

      An encrypted text as bytes to be decrypted.

      -
      -
    • -
    • -
      Optional aad: ArrayBuffer
      -

      Additional authenticated data as bytes fed by an application.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A decrypted plain text as bytes.

    - -
    -

    Throws

    OpenError

    -
-
- -
    - -
  • -

    Encrypts data.

    +

    Parameters

    • data: ArrayBuffer

      An encrypted text as bytes to be decrypted.

      +
    • Optional aad: ArrayBuffer

      Additional authenticated data as bytes fed by an application.

      +

    Returns Promise<ArrayBuffer>

    A decrypted plain text as bytes.

    +

    Throws

    OpenError

    +
  • Encrypts data.

    If the error occurred, throws SealError | MessageLimitReachedError.

    -
    -
    -

    Parameters

    -
      -
    • -
      data: ArrayBuffer
      -

      A plain text as bytes to be encrypted.

      -
      -
    • -
    • -
      Optional aad: ArrayBuffer
      -

      Additional authenticated data as bytes fed by an application.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A cipher text as bytes.

    - -
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Parameters

  • data: ArrayBuffer

    A plain text as bytes to be encrypted.

    +
  • Optional aad: ArrayBuffer

    Additional authenticated data as bytes fed by an application.

    +

Returns Promise<ArrayBuffer>

A cipher text as bytes.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/interfaces/KdfInterface.html b/core/docs/interfaces/KdfInterface.html index 58026fcb9..14467db58 100644 --- a/core/docs/interfaces/KdfInterface.html +++ b/core/docs/interfaces/KdfInterface.html @@ -1,43 +1,7 @@ -KdfInterface | @hpke/core
-
- -
-
-
-
- -

Interface KdfInterface

-
-

The KDF interface.

-
-
-
-

Hierarchy

-
    -
  • KdfInterface
-
-
-
- -
-
-

Properties

-
hashSize +KdfInterface | @hpke/core

Interface KdfInterface

The KDF interface.

+

Hierarchy

  • KdfInterface

Properties

-
-

Methods

-

Methods

-
-

Properties

-
- -
hashSize: number
-

The output size of the extract() function in bytes (Nh).

-
-
-
- -
id: KdfId
-

The KDF identifier.

-
-
-
-

Methods

-
- -
    - -
  • -

    Builds a labeled input keying material.

    -
    -
    -

    Parameters

    -
      -
    • -
      label: Uint8Array
      -

      A byte string indicating the cryptographic context/operation.

      -
      -
    • -
    • -
      ikm: Uint8Array
    -

    Returns Uint8Array

    An input keying material as bytes.

    - -
-
- -
    - -
  • -

    Builds a labeled info string.

    -
    -
    -

    Parameters

    -
      -
    • -
      label: Uint8Array
      -

      A byte string indicating the cryptographic context/operation.

      -
      -
    • -
    • -
      info: Uint8Array
      -

      An additional byte string.

      -
      -
    • -
    • -
      len: number
      -

      The length of the output byte string.

      -
      -
    -

    Returns Uint8Array

    An info string as bytes.

    - -
-
- -
    - -
  • -

    Expands a pseudorandom key prk.

    -
    -
    -

    Parameters

    -
      -
    • -
      prk: ArrayBuffer
      -

      A pseudorandom key.

      -
      -
    • -
    • -
      info: ArrayBuffer
      -

      An additional byte string.

      -
      -
    • -
    • -
      len: number
      -

      The length in bytes of the output keying material.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    An output keying material as bytes.

    - -
-
- -
    - -
  • -

    Extracts a pseudorandom key of fixed length (Nh) bytes.

    -
    -
    -

    Parameters

    -
      -
    • -
      salt: ArrayBuffer
      -

      An additional random byte string.

      -
      -
    • -
    • -
      ikm: ArrayBuffer
      -

      An input keying material

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A pseudorandom key as bytes.

    - -
-
- -
    - -
  • -

    Extracts a pseudorandom key and expand it to a specified length keying material.

    -
    -
    -

    Parameters

    -
      -
    • -
      salt: ArrayBuffer
      -

      An additional random byte string.

      -
      -
    • -
    • -
      ikm: ArrayBuffer
      -

      An input keying material

      -
      -
    • -
    • -
      info: ArrayBuffer
      -

      An additional byte string.

      -
      -
    • -
    • -
      len: number
      -

      The length in bytes of the output keying material.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    An output keying material as bytes.

    - -
-
- -
    - -
  • -

    Initializes the instance by setting a suite_id defined in RFC9180.

    -
    -
    -

    Parameters

    -
      -
    • -
      suiteId: Uint8Array
      -

      A suite_id defined in RFC9180.

      -
      -
    -

    Returns void

    -
-
- -
    - -
  • -

    Extracts a pseudorandom key with label.

    -
    -
    -

    Parameters

    -
      -
    • -
      prk: ArrayBuffer
      -

      A pseudorandom key.

      -
      -
    • -
    • -
      label: Uint8Array
      -

      A byte string indicating the cryptographic context/operation.

      -
      -
    • -
    • -
      info: Uint8Array
      -

      An additional byte string.

      -
      -
    • -
    • -
      len: number
      -

      The length in bytes of the output keying material.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    An output keying material as bytes.

    - -
-
- -
    - -
  • -

    Extracts a pseudorandom key with label.

    -
    -
    -

    Parameters

    -
      -
    • -
      salt: ArrayBuffer
      -

      An additional random byte string.

      -
      -
    • -
    • -
      label: Uint8Array
      -

      A byte string indicating the cryptographic context/operation.

      -
      -
    • -
    • -
      ikm: Uint8Array
      -

      An input keying material

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A pseudorandom key as bytes.

    - -
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Properties

hashSize: number

The output size of the extract() function in bytes (Nh).

+
id: KdfId

The KDF identifier.

+

Methods

  • Builds a labeled input keying material.

    +

    Parameters

    • label: Uint8Array

      A byte string indicating the cryptographic context/operation.

      +
    • ikm: Uint8Array

    Returns Uint8Array

    An input keying material as bytes.

    +
  • Builds a labeled info string.

    +

    Parameters

    • label: Uint8Array

      A byte string indicating the cryptographic context/operation.

      +
    • info: Uint8Array

      An additional byte string.

      +
    • len: number

      The length of the output byte string.

      +

    Returns Uint8Array

    An info string as bytes.

    +
  • Expands a pseudorandom key prk.

    +

    Parameters

    • prk: ArrayBuffer

      A pseudorandom key.

      +
    • info: ArrayBuffer

      An additional byte string.

      +
    • len: number

      The length in bytes of the output keying material.

      +

    Returns Promise<ArrayBuffer>

    An output keying material as bytes.

    +
  • Extracts a pseudorandom key of fixed length (Nh) bytes.

    +

    Parameters

    • salt: ArrayBuffer

      An additional random byte string.

      +
    • ikm: ArrayBuffer

      An input keying material

      +

    Returns Promise<ArrayBuffer>

    A pseudorandom key as bytes.

    +
  • Extracts a pseudorandom key and expand it to a specified length keying material.

    +

    Parameters

    • salt: ArrayBuffer

      An additional random byte string.

      +
    • ikm: ArrayBuffer

      An input keying material

      +
    • info: ArrayBuffer

      An additional byte string.

      +
    • len: number

      The length in bytes of the output keying material.

      +

    Returns Promise<ArrayBuffer>

    An output keying material as bytes.

    +
  • Initializes the instance by setting a suite_id defined in RFC9180.

    +

    Parameters

    • suiteId: Uint8Array

      A suite_id defined in RFC9180.

      +

    Returns void

  • Extracts a pseudorandom key with label.

    +

    Parameters

    • prk: ArrayBuffer

      A pseudorandom key.

      +
    • label: Uint8Array

      A byte string indicating the cryptographic context/operation.

      +
    • info: Uint8Array

      An additional byte string.

      +
    • len: number

      The length in bytes of the output keying material.

      +

    Returns Promise<ArrayBuffer>

    An output keying material as bytes.

    +
  • Extracts a pseudorandom key with label.

    +

    Parameters

    • salt: ArrayBuffer

      An additional random byte string.

      +
    • label: Uint8Array

      A byte string indicating the cryptographic context/operation.

      +
    • ikm: Uint8Array

      An input keying material

      +

    Returns Promise<ArrayBuffer>

    A pseudorandom key as bytes.

    +

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/interfaces/KemInterface.html b/core/docs/interfaces/KemInterface.html index 9e6139ee1..7ee88300b 100644 --- a/core/docs/interfaces/KemInterface.html +++ b/core/docs/interfaces/KemInterface.html @@ -1,46 +1,10 @@ -KemInterface | @hpke/core
-
- -
-
-
-
- -

Interface KemInterface

-
-

The KEM interface.

-
-
-
-

Hierarchy

-
    -
  • KemInterface
-
-
-
- -
-
-

Properties

-
encSize +KemInterface | @hpke/core

Interface KemInterface

The KEM interface.

+

Hierarchy

  • KemInterface
-
-

Properties

-
- -
encSize: number
-

The length in bytes of an encapsulated key produced by this KEM (Nenc).

-
-
-
- -
id: KemId
-

The KEM identifier.

-
-
-
- -
privateKeySize: number
-

The length in bytes of an encoded private key for this KEM (Nsk).

-
-
-
- -
publicKeySize: number
-

The length in bytes of an encoded public key for this KEM (Npk).

-
-
-
- -
secretSize: number
-

The length in bytes of a KEM shared secret produced by this KEM (Nsecret).

-
-
-
-

Methods

-
- -
    - -
  • -

    Recovers the ephemeral symmetric key from its encapsulated representation enc.

    +

Properties

encSize: number

The length in bytes of an encapsulated key produced by this KEM (Nenc).

+
id: KemId

The KEM identifier.

+
privateKeySize: number

The length in bytes of an encoded private key for this KEM (Nsk).

+
publicKeySize: number

The length in bytes of an encoded public key for this KEM (Npk).

+
secretSize: number

The length in bytes of a KEM shared secret produced by this KEM (Nsecret).

+

Methods

  • Recovers the ephemeral symmetric key from its encapsulated representation enc.

    If the error occurred, throws DecapError.

    -
    -
    -

    Parameters

    -
    -

    Returns Promise<ArrayBuffer>

    A shared secret as the output of the decapsulation step.

    - -
    -

    Throws

    DecapError

    -
-
- -
-
- -
    - -
  • -

    Deserializes a private key as a byte string of length Nsk to CryptoKey.

    +

    Parameters

    • ikm: ArrayBuffer

      An input keying material.

      +

    Returns Promise<CryptoKeyPair>

    A key pair derived.

    +
  • Deserializes a private key as a byte string of length Nsk to CryptoKey.

    If the error occurred, throws DeserializeError.

    -
    -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
      -

      A key as bytes.

      -
      -
    -

    Returns Promise<CryptoKey>

    A CryptoKey.

    - -
-
- -
    - -
  • -

    Deserializes a public key as a byte string of length Npk to CryptoKey.

    +

    Parameters

    • key: ArrayBuffer

      A key as bytes.

      +

    Returns Promise<CryptoKey>

    A CryptoKey.

    +
  • Deserializes a public key as a byte string of length Npk to CryptoKey.

    If the error occurred, throws DeserializeError.

    -
    -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
      -

      A key as bytes.

      -
      -
    -

    Returns Promise<CryptoKey>

    A CryptoKey.

    - -
-
- -
    - -
  • -

    Generates an ephemeral, fixed-length symmetric key and +

    Parameters

    • key: ArrayBuffer

      A key as bytes.

      +

    Returns Promise<CryptoKey>

    A CryptoKey.

    +
  • Generates an ephemeral, fixed-length symmetric key and a fixed-length encapsulation of the key that can be decapsulated by the holder of the private key corresponding to pkR.

    If the error occurred, throws EncapError.

    -
    -
    -

    Parameters

    -
    -

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

    A shared secret and an encapsulated key as the output of the encapsulation step.

    - -
    -

    Throws

    EncapError

    -
-
- -
    - -
  • -

    Generates a key pair.

    +

    Parameters

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

    A shared secret and an encapsulated key as the output of the encapsulation step.

    +

    Throws

    EncapError

    +
-
- -
  • Imports a public or private key and converts to a CryptoKey.

    Since key parameters for createSenderContext or createRecipientContext are CryptoKey format, you have to use this function to convert provided keys to CryptoKey.

    Basically, this is a thin wrapper function of SubtleCrypto.importKey.

    If the error occurred, throws DeserializeError.

    -
    -
    -

    Parameters

    -
      -
    • -
      format: "raw" | "jwk"
      -

      For now, 'raw' and 'jwk' are supported.

      -
      -
    • -
    • -
      key: ArrayBuffer | JsonWebKey
      -

      A byte string of a raw key or A JsonWebKey object.

      -
      -
    • -
    • -
      Optional isPublic: boolean
      -

      The indicator whether the provided key is a public key or not, which is used only for 'raw' format.

      -
      -
    -

    Returns Promise<CryptoKey>

    A public or private CryptoKey.

    - -
-
- -
    - -
  • -

    Serializes a private key as CryptoKey to a byte string of length Nsk.

    +

    Parameters

    • format: "raw" | "jwk"

      For now, 'raw' and 'jwk' are supported.

      +
    • key: ArrayBuffer | JsonWebKey

      A byte string of a raw key or A JsonWebKey object.

      +
    • Optional isPublic: boolean

      The indicator whether the provided key is a public key or not, which is used only for 'raw' format.

      +

    Returns Promise<CryptoKey>

    A public or private CryptoKey.

    +
  • Serializes a private key as CryptoKey to a byte string of length Nsk.

    If the error occurred, throws SerializeError.

    -
    -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
      -

      A CryptoKey.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A key as bytes.

    - -
    -

    Throws

    SerializeError

    -
-
- -
    - -
  • -

    Serializes a public key as CryptoKey to a byte string of length Npk.

    +

    Parameters

    • key: CryptoKey

      A CryptoKey.

      +

    Returns Promise<ArrayBuffer>

    A key as bytes.

    +
  • Serializes a public key as CryptoKey to a byte string of length Npk.

    If the error occurred, throws SerializeError.

    -
    -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
      -

      A CryptoKey.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A key as bytes.

    - -
    -

    Throws

    SerializeError

    -
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Parameters

  • key: CryptoKey

    A CryptoKey.

    +

Returns Promise<ArrayBuffer>

A key as bytes.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/interfaces/PreSharedKey.html b/core/docs/interfaces/PreSharedKey.html index 10f1836eb..e31eb7195 100644 --- a/core/docs/interfaces/PreSharedKey.html +++ b/core/docs/interfaces/PreSharedKey.html @@ -1,104 +1,6 @@ -PreSharedKey | @hpke/core
-
- -
-
-
-
- -

Interface PreSharedKey

-
-

The pre-shared key interface.

-
-
-
-

Hierarchy

-
    -
  • PreSharedKey
-
-
-
- -
-
-

Properties

-
id +PreSharedKey | @hpke/core

Interface PreSharedKey

The pre-shared key interface.

+

Hierarchy

  • PreSharedKey

Properties

-
-

Properties

-
- -
id: ArrayBuffer
-

The key identifier.

-
-
-
- -
key: ArrayBuffer
-

The body of the pre-shared key.

-
-
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Properties

id: ArrayBuffer

The key identifier.

+
key: ArrayBuffer

The body of the pre-shared key.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/interfaces/RecipientContextParams.html b/core/docs/interfaces/RecipientContextParams.html index 6a0bffb77..59087d588 100644 --- a/core/docs/interfaces/RecipientContextParams.html +++ b/core/docs/interfaces/RecipientContextParams.html @@ -1,139 +1,13 @@ -RecipientContextParams | @hpke/core
-
- -
-
-
-
- -

Interface RecipientContextParams

-
-

The parameters used to setup the RecipientContext.

-
-
-
-

Hierarchy

-
    -
  • KeyScheduleParams -
      -
    • RecipientContextParams
-
-
-
- -
-
-

Properties

-
enc +RecipientContextParams | @hpke/core

Interface RecipientContextParams

The parameters used to setup the RecipientContext.

+

Hierarchy

  • KeyScheduleParams
    • RecipientContextParams
-
-

Properties

-
- -
enc: ArrayBuffer
-

A byte string of the encapsulated key received from a sender.

-
-
-
- -
info?: ArrayBuffer
-

Application supplied information. The maximum length is 128 bytes.

-
-
-
- - -

A pre-shared key (PSK) held by both the sender and recipient. +

Properties

enc: ArrayBuffer

A byte string of the encapsulated key received from a sender.

+
info?: ArrayBuffer

Application supplied information. The maximum length is 128 bytes.

+

A pre-shared key (PSK) held by both the sender and recipient. The PSK should have at least 32 bytes :and the maxmum length of the PSK is 128 bytes.

-
-
-
- -
recipientKey: CryptoKeyPair | CryptoKey
-

A recipient private key or a key pair.

-
-
-
- -
senderPublicKey?: CryptoKey
-

A sender public key for Auth mode.

-
-
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +
recipientKey: CryptoKeyPair | CryptoKey

A recipient private key or a key pair.

+
senderPublicKey?: CryptoKey

A sender public key for Auth mode.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/interfaces/SenderContext.html b/core/docs/interfaces/SenderContext.html index 68f51ab14..ecad9d09f 100644 --- a/core/docs/interfaces/SenderContext.html +++ b/core/docs/interfaces/SenderContext.html @@ -1,194 +1,25 @@ -SenderContext | @hpke/core
-
- -
-
-
-
- -

Interface SenderContext

-
-

The sender encryption context.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Properties

-
enc -
-
-

Methods

-
export +SenderContext | @hpke/core

Interface SenderContext

The sender encryption context.

+

Hierarchy

Properties

enc +

Methods

-
-

Properties

-
- -
enc: ArrayBuffer
-

The encapsulated key generated by the sender.

-
-
-
-

Methods

-
- -
    - -
  • -

    Exports a secret using a variable-length pseudorandom function.

    +

Properties

enc: ArrayBuffer

The encapsulated key generated by the sender.

+

Methods

  • Exports a secret using a variable-length pseudorandom function.

    If the error occurred, throws ExportError.

    -
    -
    -

    Parameters

    -
      -
    • -
      exporterContext: ArrayBuffer
      -

      An exporter context string as bytes. The maximum length is 128 bytes.

      -
      -
    • -
    • -
      len: number
      -

      A desired length in bytes of the output secret.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A secret string as bytes.

    - -
    -

    Throws

    ExportError

    -
-
- -
    - -
  • -

    Decrypts data.

    +

    Parameters

    • exporterContext: ArrayBuffer

      An exporter context string as bytes. The maximum length is 128 bytes.

      +
    • len: number

      A desired length in bytes of the output secret.

      +

    Returns Promise<ArrayBuffer>

    A secret string as bytes.

    +

    Throws

    ExportError

    +
  • Decrypts data.

    If the error occurred, throws OpenError.

    -
    -
    -

    Parameters

    -
      -
    • -
      data: ArrayBuffer
      -

      An encrypted text as bytes to be decrypted.

      -
      -
    • -
    • -
      Optional aad: ArrayBuffer
      -

      Additional authenticated data as bytes fed by an application.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A decrypted plain text as bytes.

    - -
    -

    Throws

    OpenError

    -
-
- -
    - -
  • -

    Encrypts data.

    +

    Parameters

    • data: ArrayBuffer

      An encrypted text as bytes to be decrypted.

      +
    • Optional aad: ArrayBuffer

      Additional authenticated data as bytes fed by an application.

      +

    Returns Promise<ArrayBuffer>

    A decrypted plain text as bytes.

    +

    Throws

    OpenError

    +
  • Encrypts data.

    If the error occurred, throws SealError | MessageLimitReachedError.

    -
    -
    -

    Parameters

    -
      -
    • -
      data: ArrayBuffer
      -

      A plain text as bytes to be encrypted.

      -
      -
    • -
    • -
      Optional aad: ArrayBuffer
      -

      Additional authenticated data as bytes fed by an application.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A cipher text as bytes.

    - -
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Parameters

  • data: ArrayBuffer

    A plain text as bytes to be encrypted.

    +
  • Optional aad: ArrayBuffer

    Additional authenticated data as bytes fed by an application.

    +

Returns Promise<ArrayBuffer>

A cipher text as bytes.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/interfaces/SenderContextParams.html b/core/docs/interfaces/SenderContextParams.html index 260b395f4..0e8d035e4 100644 --- a/core/docs/interfaces/SenderContextParams.html +++ b/core/docs/interfaces/SenderContextParams.html @@ -1,139 +1,13 @@ -SenderContextParams | @hpke/core
-
- -
-
-
-
- -

Interface SenderContextParams

-
-

The parameters used to setup the SenderContext.

-
-
-
-

Hierarchy

-
    -
  • KeyScheduleParams -
      -
    • SenderContextParams
-
-
-
- -
-
-

Properties

-
ekm? +SenderContextParams | @hpke/core

Interface SenderContextParams

The parameters used to setup the SenderContext.

+

Hierarchy

  • KeyScheduleParams
    • SenderContextParams
-
-

Properties

-
- -
ekm?: ArrayBuffer | CryptoKeyPair
-

DO NOT USE. FOR DEBUGGING/TESTING PURPOSES ONLY.

-
-
-
- -
info?: ArrayBuffer
-

Application supplied information. The maximum length is 128 bytes.

-
-
-
- - -

A pre-shared key (PSK) held by both the sender and recipient. +

Properties

ekm?: ArrayBuffer | CryptoKeyPair

DO NOT USE. FOR DEBUGGING/TESTING PURPOSES ONLY.

+
info?: ArrayBuffer

Application supplied information. The maximum length is 128 bytes.

+

A pre-shared key (PSK) held by both the sender and recipient. The PSK should have at least 32 bytes :and the maxmum length of the PSK is 128 bytes.

-
-
-
- -
recipientPublicKey: CryptoKey
-

A recipient public key.

-
-
-
- -
senderKey?: CryptoKeyPair | CryptoKey
-

A sender private key or a key pair for Auth mode.

-
-
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +
recipientPublicKey: CryptoKey

A recipient public key.

+
senderKey?: CryptoKeyPair | CryptoKey

A sender private key or a key pair for Auth mode.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/modules.html b/core/docs/modules.html index f1afcb09e..67d5fea0e 100644 --- a/core/docs/modules.html +++ b/core/docs/modules.html @@ -1,23 +1,4 @@ -@hpke/core
-
- -
-
-
-
-

@hpke/core

-
-
-

Index

-
-

Classes

-
Aes128Gcm +@hpke/core
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/types/AeadId.html b/core/docs/types/AeadId.html index 66dceae8d..7631768a8 100644 --- a/core/docs/types/AeadId.html +++ b/core/docs/types/AeadId.html @@ -1,67 +1,2 @@ -AeadId | @hpke/core
-
- -
-
-
-
- -

Type alias AeadId

-
AeadId: typeof AeadId[keyof typeof AeadId]
-

The type alias of the supported AEAD identifiers.

-
-
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +AeadId | @hpke/core

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/types/KdfId.html b/core/docs/types/KdfId.html index d4a297662..c9503c134 100644 --- a/core/docs/types/KdfId.html +++ b/core/docs/types/KdfId.html @@ -1,67 +1,2 @@ -KdfId | @hpke/core
-
- -
-
-
-
- -

Type alias KdfId

-
KdfId: typeof KdfId[keyof typeof KdfId]
-

The type alias of the supported KDF identifiers.

-
-
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +KdfId | @hpke/core

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/types/KemId.html b/core/docs/types/KemId.html index b30123de6..6f2f32f86 100644 --- a/core/docs/types/KemId.html +++ b/core/docs/types/KemId.html @@ -1,67 +1,2 @@ -KemId | @hpke/core
-
- -
-
-
-
- -

Type alias KemId

-
KemId: typeof KemId[keyof typeof KemId]
-

The type alias of the supported KEM identifiers.

-
-
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +KemId | @hpke/core

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/types/RecipientContext.html b/core/docs/types/RecipientContext.html index b37fd07f8..d4d3f68b0 100644 --- a/core/docs/types/RecipientContext.html +++ b/core/docs/types/RecipientContext.html @@ -1,66 +1,2 @@ -RecipientContext | @hpke/core
-
- -
-
-
-
- -

Type alias RecipientContext

-
RecipientContext: EncryptionContext
-

The recipient encryption context.

-
-
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +RecipientContext | @hpke/core

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/variables/AeadId-1.html b/core/docs/variables/AeadId-1.html index 8b3d6aa00..b113877b9 100644 --- a/core/docs/variables/AeadId-1.html +++ b/core/docs/variables/AeadId-1.html @@ -1,78 +1,2 @@ -AeadId | @hpke/core
-
- -
-
-
-
- -

Variable AeadIdConst

-
AeadId: {
    Aes128Gcm: 1;
    Aes256Gcm: 2;
    Chacha20Poly1305: 3;
    ExportOnly: 65535;
} = Aead
-

The supported Authenticated Encryption with Associated Data (AEAD) identifiers.

-
-
-

Type declaration

-
    -
  • -
    Readonly Aes128Gcm: 1
  • -
  • -
    Readonly Aes256Gcm: 2
  • -
  • -
    Readonly Chacha20Poly1305: 3
  • -
  • -
    Readonly ExportOnly: 65535
-
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +AeadId | @hpke/core

Variable AeadIdConst

AeadId: {
    Aes128Gcm: 1;
    Aes256Gcm: 2;
    Chacha20Poly1305: 3;
    ExportOnly: 65535;
} = Aead

The supported Authenticated Encryption with Associated Data (AEAD) identifiers.

+

Type declaration

  • Readonly Aes128Gcm: 1
  • Readonly Aes256Gcm: 2
  • Readonly Chacha20Poly1305: 3
  • Readonly ExportOnly: 65535

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/variables/KdfId-1.html b/core/docs/variables/KdfId-1.html index 72376c4ff..e3cb89a3f 100644 --- a/core/docs/variables/KdfId-1.html +++ b/core/docs/variables/KdfId-1.html @@ -1,76 +1,2 @@ -KdfId | @hpke/core
-
- -
-
-
-
- -

Variable KdfIdConst

-
KdfId: {
    HkdfSha256: 1;
    HkdfSha384: 2;
    HkdfSha512: 3;
} = Kdf
-

The supported Key Derivation Function (KDF) identifiers.

-
-
-

Type declaration

-
    -
  • -
    Readonly HkdfSha256: 1
  • -
  • -
    Readonly HkdfSha384: 2
  • -
  • -
    Readonly HkdfSha512: 3
-
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +KdfId | @hpke/core

Variable KdfIdConst

KdfId: {
    HkdfSha256: 1;
    HkdfSha384: 2;
    HkdfSha512: 3;
} = Kdf

The supported Key Derivation Function (KDF) identifiers.

+

Type declaration

  • Readonly HkdfSha256: 1
  • Readonly HkdfSha384: 2
  • Readonly HkdfSha512: 3

Generated using TypeDoc

\ No newline at end of file diff --git a/core/docs/variables/KemId-1.html b/core/docs/variables/KemId-1.html index c0f4e7981..a2923298e 100644 --- a/core/docs/variables/KemId-1.html +++ b/core/docs/variables/KemId-1.html @@ -1,86 +1,2 @@ -KemId | @hpke/core
-
- -
-
-
-
- -

Variable KemIdConst

-
KemId: {
    DhkemP256HkdfSha256: 16;
    DhkemP384HkdfSha384: 17;
    DhkemP521HkdfSha512: 18;
    DhkemSecp256k1HkdfSha256: 19;
    DhkemX25519HkdfSha256: 32;
    DhkemX448HkdfSha512: 33;
    HybridkemX25519Kyber768: 48;
    NotAssigned: 0;
} = Kem
-

The supported Key Encapsulation Mechanism (KEM) identifiers.

-
-
-

Type declaration

-
    -
  • -
    Readonly DhkemP256HkdfSha256: 16
  • -
  • -
    Readonly DhkemP384HkdfSha384: 17
  • -
  • -
    Readonly DhkemP521HkdfSha512: 18
  • -
  • -
    Readonly DhkemSecp256k1HkdfSha256: 19
  • -
  • -
    Readonly DhkemX25519HkdfSha256: 32
  • -
  • -
    Readonly DhkemX448HkdfSha512: 33
  • -
  • -
    Readonly HybridkemX25519Kyber768: 48
  • -
  • -
    Readonly NotAssigned: 0
-
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +KemId | @hpke/core

Variable KemIdConst

KemId: {
    DhkemP256HkdfSha256: 16;
    DhkemP384HkdfSha384: 17;
    DhkemP521HkdfSha512: 18;
    DhkemSecp256k1HkdfSha256: 19;
    DhkemX25519HkdfSha256: 32;
    DhkemX448HkdfSha512: 33;
    HybridkemX25519Kyber768: 48;
    NotAssigned: 0;
} = Kem

The supported Key Encapsulation Mechanism (KEM) identifiers.

+

Type declaration

  • Readonly DhkemP256HkdfSha256: 16
  • Readonly DhkemP384HkdfSha384: 17
  • Readonly DhkemP521HkdfSha512: 18
  • Readonly DhkemSecp256k1HkdfSha256: 19
  • Readonly DhkemX25519HkdfSha256: 32
  • Readonly DhkemX448HkdfSha512: 33
  • Readonly HybridkemX25519Kyber768: 48
  • Readonly NotAssigned: 0

Generated using TypeDoc

\ No newline at end of file diff --git a/dhkem-secp256k1/docs/assets/main.js b/dhkem-secp256k1/docs/assets/main.js index 01bcad55f..d0aa8d5f9 100644 --- a/dhkem-secp256k1/docs/assets/main.js +++ b/dhkem-secp256k1/docs/assets/main.js @@ -1,6 +1,6 @@ "use strict"; "use strict";(()=>{var Pe=Object.create;var ne=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Ie(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Pe(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. -`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s=i?r.index.search(`*${i}*`):[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` ${ce(l.parent,i)}.${d}`);let v=document.createElement("li");v.classList.value=l.classes??"";let f=document.createElement("a");f.href=r.base+l.url,f.innerHTML=u+d,v.append(f),e.appendChild(v)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var Be={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>Be[e])}var C=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",pe="mousemove",B="mouseup",J={x:0,y:0},fe=!1,ee=!1,He=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(He=!0,F="touchstart",pe="touchmove",B="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(pe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{ee=!1});document.addEventListener("click",t=>{fe&&(t.preventDefault(),t.stopImmediatePropagation(),fe=!1)});var X=class extends C{constructor(n){super(n);this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(F,r=>this.onDocumentPointerDown(r)),document.addEventListener(B,r=>this.onDocumentPointerUp(r))}setActive(n){if(this.active==n)return;this.active=n,document.documentElement.classList.toggle("has-"+this.className,n),this.el.classList.toggle("active",n);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(n){D||(this.setActive(!0),n.preventDefault())}onDocumentPointerDown(n){if(this.active){if(n.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(n){if(!D&&this.active&&n.target.closest(".col-sidebar")){let r=n.target.closest("a");if(r){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),r.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ve=document.head.appendChild(document.createElement("style"));ve.dataset.for="filters";var Y=class extends C{constructor(n){super(n);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ve.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } `}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.checked}setLocalStorage(n){Q.setItem(this.key,n.toString()),this.value=n,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),document.querySelectorAll(".tsd-index-section").forEach(n=>{n.style.display="block";let r=Array.from(n.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);n.style.display=r?"none":"block"})}};var Z=class extends C{constructor(n){super(n);this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let r=Q.getItem(this.key);this.el.open=r?r==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let i=this.summary.querySelector("a");i&&i.addEventListener("click",()=>{location.assign(i.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ye(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ye(t.value)})}function ye(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.href===r.href&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); /*! Bundled license information: diff --git a/dhkem-secp256k1/docs/classes/DhkemSecp256k1HkdfSha256.html b/dhkem-secp256k1/docs/classes/DhkemSecp256k1HkdfSha256.html index 9e520c61d..7a12c2d88 100644 --- a/dhkem-secp256k1/docs/classes/DhkemSecp256k1HkdfSha256.html +++ b/dhkem-secp256k1/docs/classes/DhkemSecp256k1HkdfSha256.html @@ -1,70 +1,27 @@ -DhkemSecp256k1HkdfSha256 | @hpke/dhkem-secp256k1
-
- -
-
-
-
- -

Class DhkemSecp256k1HkdfSha256Experimental

-
-

The DHKEM(secp256k1, HKDF-SHA256) for HPKE KEM implementing KemInterface.

+DhkemSecp256k1HkdfSha256 | @hpke/dhkem-secp256k1

Class DhkemSecp256k1HkdfSha256Experimental

The DHKEM(secp256k1, HKDF-SHA256) for HPKE KEM implementing KemInterface.

This class is implemented using @noble/curves.

The public keys are assumed to be compressed.

The instance of this class can be specified to the CipherSuiteParams as follows:

-
-
-

Example

Use with hpke-js (https://deno.land/x/hpke/mod.ts).

+

Example

Use with hpke-js (https://deno.land/x/hpke/mod.ts).

import { AeadId, CipherSuite, KdfId } from "https://deno.land/x/hpke/mod.ts";
import { DhkemSecp256k1HkdfSha256 } from "https://deno.land/x/hpke/x/dhkem-secp256k1/mod.ts";

const suite = new CipherSuite({
kem: new DhkemSecp256k1HkdfSha256(),
kdf: KdfId.HkdfSha256,
aead: AeadId.Aes128Gcm,
});

When using hpke-js (https://deno.land/x/hpke/mod.ts), KemId.DhkemSecp256k1HkdfSha256 cannot be used as well. So you need to specify the instance of this class as follows:

-

Example

Use with @hpke/core (https://deno.land/x/hpke/core/mod.ts).

import {
Aes128Gcm,
CipherSuite,
HkdfSha256,
} from "https://deno.land/x/hpke/core/mod.ts";
import { DhkemSecp256k1HkdfSha256 } from "https://deno.land/x/hpke/x/dhkem-secp256k1/mod.ts";

const suite = new CipherSuite({
kem: new DhkemSecp256k1HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Aes128Gcm(),
});

Note that it is experimental and not standardized.

-
-
-

Hierarchy

-
    -
  • Dhkem -
      -
    • DhkemSecp256k1HkdfSha256
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-

Hierarchy

  • Dhkem
    • DhkemSecp256k1HkdfSha256
-
-

Constructors

-
- -
-
-

Properties

-
- -
_kdf: KdfInterface
-
- -
_prim: DhkemPrimitives
-
- -
encSize: number = 33
-

33

-
-
-
- -
id: KemId = KemId.DhkemSecp256k1HkdfSha256
-

KemId.DhkemSecp256k1HkdfSha256 (0x0013) EXPERIMENTAL

-
-
-
- -
privateKeySize: number = 32
-

32

-
-
-
- -
publicKeySize: number = 33
-

33

-
-
-
- -
secretSize: number = 32
-

32

-
-
-
-

Methods

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      params: RecipientContextParams
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      ikm: ArrayBuffer
    -

    Returns Promise<CryptoKeyPair>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      params: SenderContextParams
    -

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

-
- -
    - -
  • -

    Returns Promise<CryptoKeyPair>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      format: "raw" | "jwk"
    • -
    • -
      key: ArrayBuffer | JsonWebKey
    • -
    • -
      isPublic: boolean = true
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
    -

    Returns Promise<ArrayBuffer>

-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

_kdf: KdfInterface
_prim: DhkemPrimitives
encSize: number = 33

33

+
id: KemId = KemId.DhkemSecp256k1HkdfSha256

KemId.DhkemSecp256k1HkdfSha256 (0x0013) EXPERIMENTAL

+
privateKeySize: number = 32

32

+
publicKeySize: number = 33

33

+
secretSize: number = 32

32

+

Methods

  • Parameters

    • params: RecipientContextParams

    Returns Promise<ArrayBuffer>

  • Parameters

    • ikm: ArrayBuffer

    Returns Promise<CryptoKeyPair>

  • Parameters

    • key: ArrayBuffer

    Returns Promise<CryptoKey>

  • Parameters

    • key: ArrayBuffer

    Returns Promise<CryptoKey>

  • Parameters

    • params: SenderContextParams

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

  • Returns Promise<CryptoKeyPair>

  • Parameters

    • format: "raw" | "jwk"
    • key: ArrayBuffer | JsonWebKey
    • isPublic: boolean = true

    Returns Promise<CryptoKey>

  • Parameters

    • key: CryptoKey

    Returns Promise<ArrayBuffer>

  • Parameters

    • key: CryptoKey

    Returns Promise<ArrayBuffer>

Generated using TypeDoc

\ No newline at end of file diff --git a/dhkem-secp256k1/docs/index.html b/dhkem-secp256k1/docs/index.html index 37484d47f..236c38f00 100644 --- a/dhkem-secp256k1/docs/index.html +++ b/dhkem-secp256k1/docs/index.html @@ -1,18 +1,4 @@ -@hpke/dhkem-secp256k1
-
- -
-
-
-
-

@hpke/dhkem-secp256k1

-

@hpke/dhkem-secp256k1

+@hpke/dhkem-secp256k1

@hpke/dhkem-secp256k1

@hpke/dhkem-secp256k1

A TypeScript Hybrid Public Key Encryption (HPKE) module extension for DH-KEM with secp256k1 curve, which is implemented by using @noble/curves/secp256k1. Note that the extension is EXPERIMENTAL and NOT STANDARDIZED.
@@ -27,15 +13,15 @@

@hpke/dhkem-secp256k1

Index

Contributing

We welcome all kind of contributions, filing issues, suggesting new features or sending PRs.

-
-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/dhkem-secp256k1/docs/modules.html b/dhkem-secp256k1/docs/modules.html index e611a6eeb..57515ae6a 100644 --- a/dhkem-secp256k1/docs/modules.html +++ b/dhkem-secp256k1/docs/modules.html @@ -1,43 +1,2 @@ -@hpke/dhkem-secp256k1
-
- -
-
-
-
-

@hpke/dhkem-secp256k1

-
-
-

Index

-
-

Classes

-
-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +@hpke/dhkem-secp256k1

@hpke/dhkem-secp256k1

Index

Classes

Generated using TypeDoc

\ No newline at end of file diff --git a/dhkem-x25519/docs/assets/main.js b/dhkem-x25519/docs/assets/main.js index 01bcad55f..d0aa8d5f9 100644 --- a/dhkem-x25519/docs/assets/main.js +++ b/dhkem-x25519/docs/assets/main.js @@ -1,6 +1,6 @@ "use strict"; "use strict";(()=>{var Pe=Object.create;var ne=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Ie(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Pe(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. -`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s=i?r.index.search(`*${i}*`):[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` ${ce(l.parent,i)}.${d}`);let v=document.createElement("li");v.classList.value=l.classes??"";let f=document.createElement("a");f.href=r.base+l.url,f.innerHTML=u+d,v.append(f),e.appendChild(v)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var Be={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>Be[e])}var C=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",pe="mousemove",B="mouseup",J={x:0,y:0},fe=!1,ee=!1,He=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(He=!0,F="touchstart",pe="touchmove",B="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(pe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{ee=!1});document.addEventListener("click",t=>{fe&&(t.preventDefault(),t.stopImmediatePropagation(),fe=!1)});var X=class extends C{constructor(n){super(n);this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(F,r=>this.onDocumentPointerDown(r)),document.addEventListener(B,r=>this.onDocumentPointerUp(r))}setActive(n){if(this.active==n)return;this.active=n,document.documentElement.classList.toggle("has-"+this.className,n),this.el.classList.toggle("active",n);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(n){D||(this.setActive(!0),n.preventDefault())}onDocumentPointerDown(n){if(this.active){if(n.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(n){if(!D&&this.active&&n.target.closest(".col-sidebar")){let r=n.target.closest("a");if(r){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),r.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ve=document.head.appendChild(document.createElement("style"));ve.dataset.for="filters";var Y=class extends C{constructor(n){super(n);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ve.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } `}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.checked}setLocalStorage(n){Q.setItem(this.key,n.toString()),this.value=n,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),document.querySelectorAll(".tsd-index-section").forEach(n=>{n.style.display="block";let r=Array.from(n.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);n.style.display=r?"none":"block"})}};var Z=class extends C{constructor(n){super(n);this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let r=Q.getItem(this.key);this.el.open=r?r==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let i=this.summary.querySelector("a");i&&i.addEventListener("click",()=>{location.assign(i.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ye(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ye(t.value)})}function ye(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.href===r.href&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); /*! Bundled license information: diff --git a/dhkem-x25519/docs/classes/DhkemX25519HkdfSha256.html b/dhkem-x25519/docs/classes/DhkemX25519HkdfSha256.html index fd91cd2c1..c14a03ccb 100644 --- a/dhkem-x25519/docs/classes/DhkemX25519HkdfSha256.html +++ b/dhkem-x25519/docs/classes/DhkemX25519HkdfSha256.html @@ -1,67 +1,24 @@ -DhkemX25519HkdfSha256 | @hpke/dhkem-x25519
-
- -
-
-
-
- -

Class DhkemX25519HkdfSha256

-
-

The DHKEM(X25519, HKDF-SHA256) for HPKE KEM implementing KemInterface.

+DhkemX25519HkdfSha256 | @hpke/dhkem-x25519

Class DhkemX25519HkdfSha256

The DHKEM(X25519, HKDF-SHA256) for HPKE KEM implementing KemInterface.

This class is implemented using @noble/curves.

The instance of this class can be specified to the CipherSuiteParams as follows:

-
-
-

Example

Use with @hpke/core (https://deno.land/x/hpke/core/mod.ts).

+

Example

Use with @hpke/core (https://deno.land/x/hpke/core/mod.ts).

import {
Aes128Gcm,
CipherSuite,
HkdfSha256,
} from "https://deno.land/x/hpke/core/mod.ts";
import { DhkemX25519HkdfSha256 } from "https://deno.land/x/hpke/x/dhkem-x25519/mod.ts";

const suite = new CipherSuite({
kem: new DhkemX25519HkdfSha256(),
kdf: new HkdfSha256(),
aead: new Aes128Gcm(),
});

When using hpke-js (https://deno.land/x/hpke/mod.ts), KemId.DhkemX25519HkdfSha256 can be used. You don't need to use this class.

-

Example

import { AeadId, CipherSuite, KdfId, KemId } from "https://deno.land/x/hpke/mod.ts";

const suite = new CipherSuite({
kem: KemId.DhkemX25519HkdfSha256,
kdf: KdfId.HkdfSha256,
aead: AeadId.Aes128Gcm,
});
-
-
-

Hierarchy

-
    -
  • Dhkem -
      -
    • DhkemX25519HkdfSha256
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-

Hierarchy

  • Dhkem
    • DhkemX25519HkdfSha256
-
-

Constructors

-
- -
-
-

Properties

-
- -
_kdf: KdfInterface
-
- -
_prim: DhkemPrimitives
-
- -
encSize: number = 32
-

32

-
-
-
- -
id: KemId = KemId.DhkemX25519HkdfSha256
-

KemId.DhkemX25519HkdfSha256 (0x0020)

-
-
-
- -
privateKeySize: number = 32
-

32

-
-
-
- -
publicKeySize: number = 32
-

32

-
-
-
- -
secretSize: number = 32
-

32

-
-
-
-

Methods

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      params: RecipientContextParams
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      ikm: ArrayBuffer
    -

    Returns Promise<CryptoKeyPair>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      params: SenderContextParams
    -

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

-
- -
    - -
  • -

    Returns Promise<CryptoKeyPair>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      format: "raw" | "jwk"
    • -
    • -
      key: ArrayBuffer | JsonWebKey
    • -
    • -
      isPublic: boolean = true
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
    -

    Returns Promise<ArrayBuffer>

-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

_kdf: KdfInterface
_prim: DhkemPrimitives
encSize: number = 32

32

+
id: KemId = KemId.DhkemX25519HkdfSha256

KemId.DhkemX25519HkdfSha256 (0x0020)

+
privateKeySize: number = 32

32

+
publicKeySize: number = 32

32

+
secretSize: number = 32

32

+

Methods

  • Parameters

    • params: RecipientContextParams

    Returns Promise<ArrayBuffer>

  • Parameters

    • ikm: ArrayBuffer

    Returns Promise<CryptoKeyPair>

  • Parameters

    • key: ArrayBuffer

    Returns Promise<CryptoKey>

  • Parameters

    • key: ArrayBuffer

    Returns Promise<CryptoKey>

  • Parameters

    • params: SenderContextParams

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

  • Returns Promise<CryptoKeyPair>

  • Parameters

    • format: "raw" | "jwk"
    • key: ArrayBuffer | JsonWebKey
    • isPublic: boolean = true

    Returns Promise<CryptoKey>

  • Parameters

    • key: CryptoKey

    Returns Promise<ArrayBuffer>

  • Parameters

    • key: CryptoKey

    Returns Promise<ArrayBuffer>

Generated using TypeDoc

\ No newline at end of file diff --git a/dhkem-x25519/docs/index.html b/dhkem-x25519/docs/index.html index 6034f9961..e44821190 100644 --- a/dhkem-x25519/docs/index.html +++ b/dhkem-x25519/docs/index.html @@ -1,18 +1,4 @@ -@hpke/dhkem-x25519
-
- -
-
-
-
-

@hpke/dhkem-x25519

-

@hpke/dhkem-x25519

+@hpke/dhkem-x25519

@hpke/dhkem-x25519

@hpke/dhkem-x25519

A TypeScript Hybrid Public Key Encryption (HPKE) module extension for DH-KEM with X25519, which is implemented by using @noble/curves
@@ -27,15 +13,15 @@

@hpke/dhkem-x25519

Index

Contributing

We welcome all kind of contributions, filing issues, suggesting new features or sending PRs.

-
-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/dhkem-x25519/docs/modules.html b/dhkem-x25519/docs/modules.html index da14a4cad..ff75d96fc 100644 --- a/dhkem-x25519/docs/modules.html +++ b/dhkem-x25519/docs/modules.html @@ -1,43 +1,2 @@ -@hpke/dhkem-x25519
-
- -
-
-
-
-

@hpke/dhkem-x25519

-
-
-

Index

-
-

Classes

-
-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +@hpke/dhkem-x25519

@hpke/dhkem-x25519

Index

Classes

Generated using TypeDoc

\ No newline at end of file diff --git a/dhkem-x448/docs/assets/main.js b/dhkem-x448/docs/assets/main.js index 01bcad55f..d0aa8d5f9 100644 --- a/dhkem-x448/docs/assets/main.js +++ b/dhkem-x448/docs/assets/main.js @@ -1,6 +1,6 @@ "use strict"; "use strict";(()=>{var Pe=Object.create;var ne=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Ie(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Pe(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. -`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s=i?r.index.search(`*${i}*`):[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` ${ce(l.parent,i)}.${d}`);let v=document.createElement("li");v.classList.value=l.classes??"";let f=document.createElement("a");f.href=r.base+l.url,f.innerHTML=u+d,v.append(f),e.appendChild(v)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var Be={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>Be[e])}var C=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",pe="mousemove",B="mouseup",J={x:0,y:0},fe=!1,ee=!1,He=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(He=!0,F="touchstart",pe="touchmove",B="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(pe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{ee=!1});document.addEventListener("click",t=>{fe&&(t.preventDefault(),t.stopImmediatePropagation(),fe=!1)});var X=class extends C{constructor(n){super(n);this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(F,r=>this.onDocumentPointerDown(r)),document.addEventListener(B,r=>this.onDocumentPointerUp(r))}setActive(n){if(this.active==n)return;this.active=n,document.documentElement.classList.toggle("has-"+this.className,n),this.el.classList.toggle("active",n);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(n){D||(this.setActive(!0),n.preventDefault())}onDocumentPointerDown(n){if(this.active){if(n.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(n){if(!D&&this.active&&n.target.closest(".col-sidebar")){let r=n.target.closest("a");if(r){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),r.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ve=document.head.appendChild(document.createElement("style"));ve.dataset.for="filters";var Y=class extends C{constructor(n){super(n);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ve.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } `}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.checked}setLocalStorage(n){Q.setItem(this.key,n.toString()),this.value=n,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),document.querySelectorAll(".tsd-index-section").forEach(n=>{n.style.display="block";let r=Array.from(n.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);n.style.display=r?"none":"block"})}};var Z=class extends C{constructor(n){super(n);this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let r=Q.getItem(this.key);this.el.open=r?r==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let i=this.summary.querySelector("a");i&&i.addEventListener("click",()=>{location.assign(i.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ye(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ye(t.value)})}function ye(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.href===r.href&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); /*! Bundled license information: diff --git a/dhkem-x448/docs/classes/DhkemX448HkdfSha512.html b/dhkem-x448/docs/classes/DhkemX448HkdfSha512.html index bd3fef359..77d7bb90d 100644 --- a/dhkem-x448/docs/classes/DhkemX448HkdfSha512.html +++ b/dhkem-x448/docs/classes/DhkemX448HkdfSha512.html @@ -1,66 +1,23 @@ -DhkemX448HkdfSha512 | @hpke/dhkem-x448
-
- -
-
-
-
- -

Class DhkemX448HkdfSha512

-
-

The DHKEM(X448, HKDF-SHA512) for HPKE KEM implementing KemInterface.

+DhkemX448HkdfSha512 | @hpke/dhkem-x448

Class DhkemX448HkdfSha512

The DHKEM(X448, HKDF-SHA512) for HPKE KEM implementing KemInterface.

This class is implemented using @noble/curves.

The instance of this class can be specified to the CipherSuiteParams as follows:

-
-
-

Example

Use with hpke-js (https://deno.land/x/hpke/mod.ts).

+

Example

Use with hpke-js (https://deno.land/x/hpke/mod.ts).

import { CipherSuite, AeadId, KdfId } from "https://deno.land/x/hpke/mod.ts";
import { DhkemX448HkdfSha512 } from "https://deno.land/x/hpke/x/dhkem-x448/mod.ts";

const suite = new CipherSuite({
kem: new DhkemX448HkdfSha512(),
kdf: KdfId.HkdfSha512,
aead: AeadId.Aes256Gcm,
});
-

Example

Use with @hpke/core (https://deno.land/x/hpke/core/mod.ts).

import {
Aes256Gcm,
CipherSuite,
HkdfSha512,
} from "https://deno.land/x/hpke/core/mod.ts";
import { DhkemX448HkdfSha512 } from "https://deno.land/x/hpke/x/dhkem-x448/mod.ts";

const suite = new CipherSuite({
kem: new DhkemX448HkdfSha512(),
kdf: new HkdfSha512(),
aead: new Aes256Gcm(),
});
-
-
-

Hierarchy

-
    -
  • Dhkem -
      -
    • DhkemX448HkdfSha512
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-

Hierarchy

  • Dhkem
    • DhkemX448HkdfSha512
-
-

Constructors

-
- -
-
-

Properties

-
- -
_kdf: KdfInterface
-
- -
_prim: DhkemPrimitives
-
- -
encSize: number = 56
-

56

-
-
-
- -
id: KemId = KemId.DhkemX448HkdfSha512
-

KemId.DhkemX448HkdfSha512 (0x0021)

-
-
-
- -
privateKeySize: number = 56
-

56

-
-
-
- -
publicKeySize: number = 56
-

56

-
-
-
- -
secretSize: number = 64
-

64

-
-
-
-

Methods

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      params: RecipientContextParams
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      ikm: ArrayBuffer
    -

    Returns Promise<CryptoKeyPair>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: ArrayBuffer
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      params: SenderContextParams
    -

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

-
- -
    - -
  • -

    Returns Promise<CryptoKeyPair>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      format: "raw" | "jwk"
    • -
    • -
      key: ArrayBuffer | JsonWebKey
    • -
    • -
      isPublic: boolean = true
    -

    Returns Promise<CryptoKey>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
    -

    Returns Promise<ArrayBuffer>

-
- -
    - -
  • -
    -

    Parameters

    -
      -
    • -
      key: CryptoKey
    -

    Returns Promise<ArrayBuffer>

-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

_kdf: KdfInterface
_prim: DhkemPrimitives
encSize: number = 56

56

+
id: KemId = KemId.DhkemX448HkdfSha512

KemId.DhkemX448HkdfSha512 (0x0021)

+
privateKeySize: number = 56

56

+
publicKeySize: number = 56

56

+
secretSize: number = 64

64

+

Methods

  • Parameters

    • params: RecipientContextParams

    Returns Promise<ArrayBuffer>

  • Parameters

    • ikm: ArrayBuffer

    Returns Promise<CryptoKeyPair>

  • Parameters

    • key: ArrayBuffer

    Returns Promise<CryptoKey>

  • Parameters

    • key: ArrayBuffer

    Returns Promise<CryptoKey>

  • Parameters

    • params: SenderContextParams

    Returns Promise<{
        enc: ArrayBuffer;
        sharedSecret: ArrayBuffer;
    }>

  • Returns Promise<CryptoKeyPair>

  • Parameters

    • format: "raw" | "jwk"
    • key: ArrayBuffer | JsonWebKey
    • isPublic: boolean = true

    Returns Promise<CryptoKey>

  • Parameters

    • key: CryptoKey

    Returns Promise<ArrayBuffer>

  • Parameters

    • key: CryptoKey

    Returns Promise<ArrayBuffer>

Generated using TypeDoc

\ No newline at end of file diff --git a/dhkem-x448/docs/index.html b/dhkem-x448/docs/index.html index 5f2cdb102..b5a385bde 100644 --- a/dhkem-x448/docs/index.html +++ b/dhkem-x448/docs/index.html @@ -1,18 +1,4 @@ -@hpke/dhkem-x448
-
- -
-
-
-
-

@hpke/dhkem-x448

-

@hpke/dhkem-x448

+@hpke/dhkem-x448

@hpke/dhkem-x448

@hpke/dhkem-x448

A TypeScript Hybrid Public Key Encryption (HPKE) module extension for DH-KEM with X448, which is implemented by using @noble/curves
@@ -27,15 +13,15 @@

@hpke/dhkem-x448

Index

Contributing

We welcome all kind of contributions, filing issues, suggesting new features or sending PRs.

-
-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Generated using TypeDoc

\ No newline at end of file diff --git a/dhkem-x448/docs/modules.html b/dhkem-x448/docs/modules.html index 81ee590e7..76c9d3a89 100644 --- a/dhkem-x448/docs/modules.html +++ b/dhkem-x448/docs/modules.html @@ -1,43 +1,2 @@ -@hpke/dhkem-x448
-
- -
-
-
-
-

@hpke/dhkem-x448

-
-
-

Index

-
-

Classes

-
-
- -
-
-

Generated using TypeDoc

-
\ No newline at end of file +@hpke/dhkem-x448

@hpke/dhkem-x448

Index

Classes

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/assets/main.js b/docs/assets/main.js index 01bcad55f..d0aa8d5f9 100644 --- a/docs/assets/main.js +++ b/docs/assets/main.js @@ -1,6 +1,6 @@ "use strict"; "use strict";(()=>{var Pe=Object.create;var ne=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Ie(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Pe(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. -`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s=i?r.index.search(`*${i}*`):[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` ${ce(l.parent,i)}.${d}`);let v=document.createElement("li");v.classList.value=l.classes??"";let f=document.createElement("a");f.href=r.base+l.url,f.innerHTML=u+d,v.append(f),e.appendChild(v)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var Be={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>Be[e])}var C=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",pe="mousemove",B="mouseup",J={x:0,y:0},fe=!1,ee=!1,He=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(He=!0,F="touchstart",pe="touchmove",B="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(pe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{ee=!1});document.addEventListener("click",t=>{fe&&(t.preventDefault(),t.stopImmediatePropagation(),fe=!1)});var X=class extends C{constructor(n){super(n);this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(F,r=>this.onDocumentPointerDown(r)),document.addEventListener(B,r=>this.onDocumentPointerUp(r))}setActive(n){if(this.active==n)return;this.active=n,document.documentElement.classList.toggle("has-"+this.className,n),this.el.classList.toggle("active",n);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(n){D||(this.setActive(!0),n.preventDefault())}onDocumentPointerDown(n){if(this.active){if(n.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(n){if(!D&&this.active&&n.target.closest(".col-sidebar")){let r=n.target.closest("a");if(r){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),r.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ve=document.head.appendChild(document.createElement("style"));ve.dataset.for="filters";var Y=class extends C{constructor(n){super(n);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ve.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } `}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.checked}setLocalStorage(n){Q.setItem(this.key,n.toString()),this.value=n,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),document.querySelectorAll(".tsd-index-section").forEach(n=>{n.style.display="block";let r=Array.from(n.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);n.style.display=r?"none":"block"})}};var Z=class extends C{constructor(n){super(n);this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let r=Q.getItem(this.key);this.el.open=r?r==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let i=this.summary.querySelector("a");i&&i.addEventListener("click",()=>{location.assign(i.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ye(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ye(t.value)})}function ye(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.href===r.href&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); /*! Bundled license information: diff --git a/docs/classes/BaseError.html b/docs/classes/BaseError.html index a35b5f864..5a9925cb2 100644 --- a/docs/classes/BaseError.html +++ b/docs/classes/BaseError.html @@ -1,141 +1,7 @@ -BaseError | hpke-js
-
- -
-
-
-
- -

Class BaseError

-
-

The base error class of hpke-js.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +BaseError | hpke-js

Class BaseError

The base error class of hpke-js.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/CipherSuite.html b/docs/classes/CipherSuite.html index 797794110..4f7f66064 100644 --- a/docs/classes/CipherSuite.html +++ b/docs/classes/CipherSuite.html @@ -1,22 +1,4 @@ -CipherSuite | hpke-js
-
- -
-
-
-
- -

Class CipherSuite

-
-

The Hybrid Public Key Encryption (HPKE) ciphersuite, +CipherSuite | hpke-js

Class CipherSuite

The Hybrid Public Key Encryption (HPKE) ciphersuite, which supports all of the ciphersuites defined in RFC9180.

The class consists of the @hpke/core, @@ -41,47 +23,19 @@

Class CipherSuite

The calling of the constructor of this class is the starting point for HPKE operations for both senders and recipients.

-
-
-

Example

Use only ciphersuites supported internally.

+

Example

Use only ciphersuites supported internally.

import { AeadId, CipherSuite, KdfId, KemId } from "http://deno.land/x/hpke/mod.ts";

const suite = new CipherSuite({
kem: KemId.DhkemP256HkdfSha256,
kdf: KdfId.HkdfSha256,
aead: AeadId.Aes128Gcm,
});
-

Example

Use a ciphersuite consisting of an external module.

import { AeadId, CipherSuite, KdfId } from "http://deno.land/x/hpke/mod.ts";
// Use an extension module.
import {
HybridkemX25519Kyber768,
} from "https://deno.land/x/hpke/x/hybridkem-x25519-kyber768/mod.ts";

const suite = new CipherSuite({
kem: new HybridkemX25519Kyber768(),
kdf: KdfId.HkdfSha256,
aead: AeadId.Aes128Gcm,
});
-
-
-

Hierarchy

-
    -
  • CipherSuiteNative -
      -
    • CipherSuite
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-

Hierarchy

  • CipherSuiteNative
    • CipherSuite

Constructors

Properties

-
-

Accessors

-

Accessors

-
-

Methods

-

Methods

-
-

Constructors

-
- -
-
-

Properties

-
- -
_api: SubtleCrypto = undefined
-
- -
-
-

Accessors

-
- -
-
- -
-
- -
-
-

Methods

-
- -
    - -
  • -

    Returns Promise<void>

-
- -
    - -
  • -

    Creates an encryption context for a recipient.

    +

Constructors

Properties

_api: SubtleCrypto = undefined

Accessors

Methods

  • Returns Promise<void>

-
- -
-
- -
  • Derives a key pair for the cipher suite in the manner defined in RFC9180 Section 7.1.3.

    If the error occurred, throws DeriveKeyPairError.

    -
    -
    -

    Parameters

    -
      -
    • -
      ikm: ArrayBuffer
      -

      A byte string of input keying material. The maximum length is 128 bytes.

      -
      -
    -

    Returns Promise<CryptoKeyPair>

    A key pair derived.

    - -
    -

    Deprecated

    Use KemInterface.deriveKeyPair instead.

    - +

    Parameters

    • ikm: ArrayBuffer

      A byte string of input keying material. The maximum length is 128 bytes.

      +

    Returns Promise<CryptoKeyPair>

    A key pair derived.

    +

    Deprecated

    Use KemInterface.deriveKeyPair instead.

    Throws

    DeriveKeyPairError

    -
-
- -
    - -
  • -

    Generates a key pair for the cipher suite.

    +
-
- -
    - -
  • -

    Imports a public or private key and converts to a CryptoKey.

    +
  • Imports a public or private key and converts to a CryptoKey.

    Since key parameters for createSenderContext or createRecipientContext are CryptoKey format, you have to use this function to convert provided keys to CryptoKey.

    Basically, this is a thin wrapper function of SubtleCrypto.importKey.

    If the error occurred, throws DeserializeError.

    -
    -
    -

    Parameters

    -
      -
    • -
      format: "raw" | "jwk"
      -

      For now, 'raw' and 'jwk' are supported.

      -
      -
    • -
    • -
      key: ArrayBuffer | JsonWebKey
      -

      A byte string of a raw key or A JsonWebKey object.

      -
      -
    • -
    • -
      isPublic: boolean = true
      -

      The indicator whether the provided key is a public key or not, which is used only for 'raw' format.

      -
      -
    -

    Returns Promise<CryptoKey>

    A public or private CryptoKey.

    - -
    -

    Deprecated

    Use KemInterface.generateKeyPair instead.

    - +

    Parameters

    • format: "raw" | "jwk"

      For now, 'raw' and 'jwk' are supported.

      +
    • key: ArrayBuffer | JsonWebKey

      A byte string of a raw key or A JsonWebKey object.

      +
    • isPublic: boolean = true

      The indicator whether the provided key is a public key or not, which is used only for 'raw' format.

      +

    Returns Promise<CryptoKey>

    A public or private CryptoKey.

    +

    Deprecated

    Use KemInterface.generateKeyPair instead.

    Throws

    DeserializeError

    -
-
- -
    - -
  • -

    Decrypts a message from a sender.

    +
  • Decrypts a message from a sender.

    If the error occurred, throws DecapError | DeserializeError | OpenError | ValidationError.

    -
    -
    -

    Parameters

    -
      -
    • -
      params: RecipientContextParams
      -

      A set of parameters for building a recipient encryption context.

      -
      -
    • -
    • -
      ct: ArrayBuffer
      -

      An encrypted text as bytes to be decrypted.

      -
      -
    • -
    • -
      aad: ArrayBuffer = EMPTY
      -

      Additional authenticated data as bytes fed by an application.

      -
      -
    -

    Returns Promise<ArrayBuffer>

    A decrypted plain text as bytes.

    - -
-
- -
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Parameters

  • params: SenderContextParams

    A set of parameters for building a sender encryption context.

    +
  • pt: ArrayBuffer

    A plain text as bytes to be encrypted.

    +
  • aad: ArrayBuffer = EMPTY

    Additional authenticated data as bytes fed by an application.

    +

Returns Promise<CipherSuiteSealResponse>

A cipher text and an encapsulated key as bytes.

+

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/DecapError.html b/docs/classes/DecapError.html index 8c0fa8e44..4d3b2e4ab 100644 --- a/docs/classes/DecapError.html +++ b/docs/classes/DecapError.html @@ -1,139 +1,7 @@ -DecapError | hpke-js
-
- -
-
-
-
- -

Class DecapError

-
-

decap() failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +DecapError | hpke-js

Class DecapError

decap() failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/DeriveKeyPairError.html b/docs/classes/DeriveKeyPairError.html index c901ff15e..0690d20e0 100644 --- a/docs/classes/DeriveKeyPairError.html +++ b/docs/classes/DeriveKeyPairError.html @@ -1,139 +1,7 @@ -DeriveKeyPairError | hpke-js
-
- -
-
-
-
- -

Class DeriveKeyPairError

-
-

Key pair derivation failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +DeriveKeyPairError | hpke-js

Class DeriveKeyPairError

Key pair derivation failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/DeserializeError.html b/docs/classes/DeserializeError.html index 9164525c7..66ad641ad 100644 --- a/docs/classes/DeserializeError.html +++ b/docs/classes/DeserializeError.html @@ -1,139 +1,7 @@ -DeserializeError | hpke-js
-
- -
-
-
-
- -

Class DeserializeError

-
-

Public or private key deserialization failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +DeserializeError | hpke-js

Class DeserializeError

Public or private key deserialization failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/EncapError.html b/docs/classes/EncapError.html index 9474b066e..800ae2571 100644 --- a/docs/classes/EncapError.html +++ b/docs/classes/EncapError.html @@ -1,139 +1,7 @@ -EncapError | hpke-js
-
- -
-
-
-
- -

Class EncapError

-
-

encap() failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +EncapError | hpke-js

Class EncapError

encap() failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/ExportError.html b/docs/classes/ExportError.html index de2c887c8..87878e92e 100644 --- a/docs/classes/ExportError.html +++ b/docs/classes/ExportError.html @@ -1,139 +1,7 @@ -ExportError | hpke-js
-
- -
-
-
-
- -

Class ExportError

-
-

Secret export failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +ExportError | hpke-js

Class ExportError

Secret export failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/HpkeError.html b/docs/classes/HpkeError.html index 8012613f3..e4e30d42b 100644 --- a/docs/classes/HpkeError.html +++ b/docs/classes/HpkeError.html @@ -1,152 +1,7 @@ -HpkeError | hpke-js
-
- -
-
-
-
- -

Class HpkeError

-
-

The base error class of hpke-js.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +HpkeError | hpke-js

Class HpkeError

The base error class of hpke-js.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/InvalidParamError.html b/docs/classes/InvalidParamError.html index 8a1dcc237..ea4b5a7ea 100644 --- a/docs/classes/InvalidParamError.html +++ b/docs/classes/InvalidParamError.html @@ -1,139 +1,7 @@ -InvalidParamError | hpke-js
-
- -
-
-
-
- -

Class InvalidParamError

-
-

Invalid parameter.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +InvalidParamError | hpke-js

Class InvalidParamError

Invalid parameter.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/MessageLimitReachedError.html b/docs/classes/MessageLimitReachedError.html index 02cac37e7..3a1895175 100644 --- a/docs/classes/MessageLimitReachedError.html +++ b/docs/classes/MessageLimitReachedError.html @@ -1,139 +1,7 @@ -MessageLimitReachedError | hpke-js
-
- -
-
-
-
- -

Class MessageLimitReachedError

-
-

Sequence number overflow on the encryption context.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +MessageLimitReachedError | hpke-js

Class MessageLimitReachedError

Sequence number overflow on the encryption context.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/NotSupportedError.html b/docs/classes/NotSupportedError.html index b7d7b7198..786a18810 100644 --- a/docs/classes/NotSupportedError.html +++ b/docs/classes/NotSupportedError.html @@ -1,139 +1,7 @@ -NotSupportedError | hpke-js
-
- -
-
-
-
- -

Class NotSupportedError

-
-

Not supported failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +NotSupportedError | hpke-js

Class NotSupportedError

Not supported failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/OpenError.html b/docs/classes/OpenError.html index d9a892dbe..6335a75e1 100644 --- a/docs/classes/OpenError.html +++ b/docs/classes/OpenError.html @@ -1,139 +1,7 @@ -OpenError | hpke-js
-
- -
-
-
-
- -

Class OpenError

-
-

open() failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +OpenError | hpke-js

Class OpenError

open() failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/SealError.html b/docs/classes/SealError.html index 744132331..e3110f31a 100644 --- a/docs/classes/SealError.html +++ b/docs/classes/SealError.html @@ -1,139 +1,7 @@ -SealError | hpke-js
-
- -
-
-
-
- -

Class SealError

-
-

seal() failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +SealError | hpke-js

Class SealError

seal() failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/SerializeError.html b/docs/classes/SerializeError.html index f6a5fece4..2281ce0fa 100644 --- a/docs/classes/SerializeError.html +++ b/docs/classes/SerializeError.html @@ -1,139 +1,7 @@ -SerializeError | hpke-js
-
- -
-
-
-
- -

Class SerializeError

-
-

Public or private key serialization failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +SerializeError | hpke-js

Class SerializeError

Public or private key serialization failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/classes/ValidationError.html b/docs/classes/ValidationError.html index c402faf86..c6ddf0049 100644 --- a/docs/classes/ValidationError.html +++ b/docs/classes/ValidationError.html @@ -1,139 +1,7 @@ -ValidationError | hpke-js
-
- -
-
-
-
- -

Class ValidationError

-
-

KEM input or output validation failure.

-
-
-
-

Hierarchy

-
-
-
-
- -
-
-

Constructors

-
-
-

Properties

-
cause? +ValidationError | hpke-js

Class ValidationError

KEM input or output validation failure.

+

Hierarchy

Constructors

Properties

-
-

Constructors

-
- -
-
-

Properties

-
- -
cause?: unknown
-
- -
message: string
-
- -
name: string
-
- -
stack?: string
-
-
-

Generated using TypeDoc

-
\ No newline at end of file +

Constructors

Properties

cause?: unknown
message: string
name: string
stack?: string

Generated using TypeDoc

\ No newline at end of file diff --git a/docs/index.html b/docs/index.html index 12bb5bf93..419b3c2d5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,18 +1,4 @@ -hpke-js
-
- -
-
-
-
-

hpke-js

-

hpke-js

+hpke-js

hpke-js

hpke-js

@@ -47,28 +33,28 @@

hpke-js

import { AeadId, CipherSuite, KdfId, KemId } from "hpke-js";
// const { AeadId, CipherSuite, KdfId, KemId } = require("hpke-js");
// import {
// Aes128Gcm, CipherSuite, DhkemP256HkdfSha256, HkdfSha256,
// } from "@hpke/core";

async function doHpke() {
const suite = new CipherSuite({
kem: KemId.DhkemP256HkdfSha256,
kdf: KdfId.HkdfSha256,
aead: AeadId.Aes128Gcm,
});
// When using "@hpke/core", specify the cryptographic algorithm instances
// as follows, instead of identities above.
// const suite = new CipherSuite({
// kem: new DhkemP256HkdfSha256(),
// kdf: new HkdfSha256(),
// aead: new Aes128Gcm(),
// });

// A recipient generates a key pair.
const rkp = await suite.kem.generateKeyPair();

// A sender encrypts a message with the recipient public key.
const sender = await suite.createSenderContext({
recipientPublicKey: rkp.publicKey,
});
const ct = await sender.seal(new TextEncoder().encode("Hello world!"));

// The recipient decrypts it.
const recipient = await suite.createRecipientContext({
recipientKey: rkp.privateKey,
enc: sender.enc,
});
const pt = await recipient.open(ct);

// Hello world!
console.log(new TextDecoder().decode(pt));
}

try {
doHpke();
} catch (e) {
console.log("failed:", e.message);
}

Index

    -
  • Packages
  • -
  • Supported Features
  • -
  • Supported Environments
  • -
  • Warnings and Restrictions
  • -
  • Installation
      -
    • Node.js
    • -
    • Deno
    • -
    • Web Browsers
    • -
    • Cloudflare Workers
    • +
    • Packages
    • +
    • Supported Features
    • +
    • Supported Environments
    • +
    • Warnings and Restrictions
    • +
    • Installation
    • -
    • Usage

      Packages

      The hpke-js includes the following packages.

      @@ -355,84 +341,4 @@

      hpke-js

    • RFC9180: Hybrid Public Key Encryption
    • W3C/WICG: Secure Curves in the Web Cryptography API
    • - - -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/interfaces/AeadEncryptionContext.html b/docs/interfaces/AeadEncryptionContext.html index 76a876bad..585f96851 100644 --- a/docs/interfaces/AeadEncryptionContext.html +++ b/docs/interfaces/AeadEncryptionContext.html @@ -1,148 +1,14 @@ -AeadEncryptionContext | hpke-js
      -
      - -
      -
      -
      -
      - -

      Interface AeadEncryptionContext

      -
      -

      The AEAD encryption context interface.

      -
      -
      -
      -

      Hierarchy

      -
        -
      • AeadEncryptionContext
      -
      -
      -
      - -
      -
      -

      Methods

      -
      open +AeadEncryptionContext | hpke-js

      Interface AeadEncryptionContext

      The AEAD encryption context interface.

      +

      Hierarchy

      • AeadEncryptionContext

      Methods

      -
      -

      Methods

      -
      - -
        - -
      • -

        Decrypts data with an initialization vector and additional authenticated data.

        -
        -
        -

        Parameters

        -
          -
        • -
          iv: ArrayBuffer
          -

          An initialization vector.

          -
          -
        • -
        • -
          data: ArrayBuffer
          -

          A plain text as bytes to be encrypted.

          -
          -
        • -
        • -
          aad: ArrayBuffer
          -

          Additional authenticated data as bytes fed by an application.

          -
          -
        -

        Returns Promise<ArrayBuffer>

        A decrypted plain text as bytes.

        - -
      -
      - -
        - -
      • -

        Encrypts data with an initialization vector and additional authenticated data.

        -
        -
        -

        Parameters

        -
          -
        • -
          iv: ArrayBuffer
          -

          An initialization vector.

          -
          -
        • -
        • -
          data: ArrayBuffer
          -

          A plain text as bytes to be encrypted.

          -
          -
        • -
        • -
          aad: ArrayBuffer
          -

          Additional authenticated data as bytes fed by an application.

          -
          -
        -

        Returns Promise<ArrayBuffer>

        A cipher text as bytes.

        - -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +

      Methods

      • Decrypts data with an initialization vector and additional authenticated data.

        +

        Parameters

        • iv: ArrayBuffer

          An initialization vector.

          +
        • data: ArrayBuffer

          A plain text as bytes to be encrypted.

          +
        • aad: ArrayBuffer

          Additional authenticated data as bytes fed by an application.

          +

        Returns Promise<ArrayBuffer>

        A decrypted plain text as bytes.

        +
      • Encrypts data with an initialization vector and additional authenticated data.

        +

        Parameters

        • iv: ArrayBuffer

          An initialization vector.

          +
        • data: ArrayBuffer

          A plain text as bytes to be encrypted.

          +
        • aad: ArrayBuffer

          Additional authenticated data as bytes fed by an application.

          +

        Returns Promise<ArrayBuffer>

        A cipher text as bytes.

        +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/interfaces/AeadInterface.html b/docs/interfaces/AeadInterface.html index 34100cd82..b005a9686 100644 --- a/docs/interfaces/AeadInterface.html +++ b/docs/interfaces/AeadInterface.html @@ -1,151 +1,14 @@ -AeadInterface | hpke-js
      -
      - -
      -
      -
      -
      - -

      Interface AeadInterface

      -
      -

      The AEAD interface.

      -
      -
      -
      -

      Hierarchy

      -
        -
      • AeadInterface
      -
      -
      -
      - -
      -
      -

      Properties

      -
      id +AeadInterface | hpke-js

      Interface AeadInterface

      The AEAD interface.

      +

      Hierarchy

      • AeadInterface
      -
      -

      Properties

      -
      - -
      id: AeadId
      -

      The KDF identifier.

      -
      -
      -
      - -
      keySize: number
      -

      The length in bytes of an AEAD key (Nk).

      -
      -
      -
      - -
      nonceSize: number
      -

      The length in bytes of an AEAD nonce (Nn).

      -
      -
      -
      - -
      tagSize: number
      -

      The length in bytes of an AEAD authentication tag (Nt).

      -
      -
      -
      -

      Methods

      -
      - -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +

      Methods

      Properties

      id: AeadId

      The KDF identifier.

      +
      keySize: number

      The length in bytes of an AEAD key (Nk).

      +
      nonceSize: number

      The length in bytes of an AEAD nonce (Nn).

      +
      tagSize: number

      The length in bytes of an AEAD authentication tag (Nt).

      +

      Methods

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/interfaces/CipherSuiteParams.html b/docs/interfaces/CipherSuiteParams.html index b62a6dd58..a5ec3cea6 100644 --- a/docs/interfaces/CipherSuiteParams.html +++ b/docs/interfaces/CipherSuiteParams.html @@ -1,114 +1,8 @@ -CipherSuiteParams | hpke-js
      -
      - -
      -
      -
      -
      - -

      Interface CipherSuiteParams

      -
      -

      The parameters used to configure the CipherSuite.

      -
      -
      -
      -

      Hierarchy

      -
        -
      • CipherSuiteParams
      -
      -
      -
      - -
      -
      -

      Properties

      -
      aead +CipherSuiteParams | hpke-js

      Interface CipherSuiteParams

      The parameters used to configure the CipherSuite.

      +

      Hierarchy

      • CipherSuiteParams

      Properties

      -
      -

      Properties

      -
      - - -

      The AEAD (Authenticated Encryption with Addtional Data) identifier or the AEAD object.

      -
      -
      -
      - - -

      The KDF (Key Derivation Function) identifier or the KDF object.

      -
      -
      -
      - - -

      The KEM (Key Encapsulation Mechanism) identifier or the KEM object.

      -
      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +

      Properties

      The AEAD (Authenticated Encryption with Addtional Data) identifier or the AEAD object.

      +

      The KDF (Key Derivation Function) identifier or the KDF object.

      +

      The KEM (Key Encapsulation Mechanism) identifier or the KEM object.

      +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/interfaces/CipherSuiteSealResponse.html b/docs/interfaces/CipherSuiteSealResponse.html index d2cf88520..fa213bd18 100644 --- a/docs/interfaces/CipherSuiteSealResponse.html +++ b/docs/interfaces/CipherSuiteSealResponse.html @@ -1,104 +1,6 @@ -CipherSuiteSealResponse | hpke-js
      -
      - -
      -
      -
      -
      - -

      Interface CipherSuiteSealResponse

      -
      -

      The response of the single-shot seal API.

      -
      -
      -
      -

      Hierarchy

      -
        -
      • CipherSuiteSealResponse
      -
      -
      -
      - -
      -
      -

      Properties

      -
      ct +CipherSuiteSealResponse | hpke-js

      Interface CipherSuiteSealResponse

      The response of the single-shot seal API.

      +

      Hierarchy

      • CipherSuiteSealResponse

      Properties

      -
      -

      Properties

      -
      - -
      ct: ArrayBuffer
      -

      The ciphertext as bytes.

      -
      -
      -
      - -
      enc: ArrayBuffer
      -

      The encapsulated key.

      -
      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +

      Properties

      ct: ArrayBuffer

      The ciphertext as bytes.

      +
      enc: ArrayBuffer

      The encapsulated key.

      +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/interfaces/EncryptionContext.html b/docs/interfaces/EncryptionContext.html index 036fb1717..34b661469 100644 --- a/docs/interfaces/EncryptionContext.html +++ b/docs/interfaces/EncryptionContext.html @@ -1,179 +1,23 @@ -EncryptionContext | hpke-js
      -
      - -
      -
      -
      -
      - -

      Interface EncryptionContext

      -
      -

      The encryption context interface for a recipient and a sender.

      -
      -
      -
      -

      Hierarchy

      -
      -
      -
      -
      - -
      -
      -

      Methods

      -
      export +EncryptionContext | hpke-js

      Interface EncryptionContext

      The encryption context interface for a recipient and a sender.

      +

      Hierarchy

      Methods

      -
      -

      Methods

      -
      - -
        - -
      • -

        Exports a secret using a variable-length pseudorandom function.

        +

      Methods

      • Exports a secret using a variable-length pseudorandom function.

        If the error occurred, throws ExportError.

        -
        -
        -

        Parameters

        -
          -
        • -
          exporterContext: ArrayBuffer
          -

          An exporter context string as bytes. The maximum length is 128 bytes.

          -
          -
        • -
        • -
          len: number
          -

          A desired length in bytes of the output secret.

          -
          -
        -

        Returns Promise<ArrayBuffer>

        A secret string as bytes.

        - -
        -

        Throws

        ExportError

        -
      -
      - -
        - -
      • -

        Decrypts data.

        +

        Parameters

        • exporterContext: ArrayBuffer

          An exporter context string as bytes. The maximum length is 128 bytes.

          +
        • len: number

          A desired length in bytes of the output secret.

          +

        Returns Promise<ArrayBuffer>

        A secret string as bytes.

        +

        Throws

        ExportError

        +
      • Decrypts data.

        If the error occurred, throws OpenError.

        -
        -
        -

        Parameters

        -
          -
        • -
          data: ArrayBuffer
          -

          An encrypted text as bytes to be decrypted.

          -
          -
        • -
        • -
          Optional aad: ArrayBuffer
          -

          Additional authenticated data as bytes fed by an application.

          -
          -
        -

        Returns Promise<ArrayBuffer>

        A decrypted plain text as bytes.

        - -
        -

        Throws

        OpenError

        -
      -
      - -
        - -
      • -

        Encrypts data.

        +

        Parameters

        • data: ArrayBuffer

          An encrypted text as bytes to be decrypted.

          +
        • Optional aad: ArrayBuffer

          Additional authenticated data as bytes fed by an application.

          +

        Returns Promise<ArrayBuffer>

        A decrypted plain text as bytes.

        +

        Throws

        OpenError

        +
      • Encrypts data.

        If the error occurred, throws SealError | MessageLimitReachedError.

        -
        -
        -

        Parameters

        -
          -
        • -
          data: ArrayBuffer
          -

          A plain text as bytes to be encrypted.

          -
          -
        • -
        • -
          Optional aad: ArrayBuffer
          -

          Additional authenticated data as bytes fed by an application.

          -
          -
        -

        Returns Promise<ArrayBuffer>

        A cipher text as bytes.

        - -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +

      Parameters

      • data: ArrayBuffer

        A plain text as bytes to be encrypted.

        +
      • Optional aad: ArrayBuffer

        Additional authenticated data as bytes fed by an application.

        +

      Returns Promise<ArrayBuffer>

      A cipher text as bytes.

      +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/interfaces/KdfInterface.html b/docs/interfaces/KdfInterface.html index 88e544188..03ec891a3 100644 --- a/docs/interfaces/KdfInterface.html +++ b/docs/interfaces/KdfInterface.html @@ -1,43 +1,7 @@ -KdfInterface | hpke-js
      -
      - -
      -
      -
      -
      - -

      Interface KdfInterface

      -
      -

      The KDF interface.

      -
      -
      -
      -

      Hierarchy

      -
        -
      • KdfInterface
      -
      -
      -
      - -
      -
      -

      Properties

      -
      hashSize +KdfInterface | hpke-js

      Interface KdfInterface

      The KDF interface.

      +

      Hierarchy

      • KdfInterface

      Properties

      -
      -

      Methods

      -

      Methods

      -
      -

      Properties

      -
      - -
      hashSize: number
      -

      The output size of the extract() function in bytes (Nh).

      -
      -
      -
      - -
      id: KdfId
      -

      The KDF identifier.

      -
      -
      -
      -

      Methods

      -
      - -
        - -
      • -

        Builds a labeled input keying material.

        -
        -
        -

        Parameters

        -
          -
        • -
          label: Uint8Array
          -

          A byte string indicating the cryptographic context/operation.

          -
          -
        • -
        • -
          ikm: Uint8Array
        -

        Returns Uint8Array

        An input keying material as bytes.

        - -
      -
      - -
        - -
      • -

        Builds a labeled info string.

        -
        -
        -

        Parameters

        -
          -
        • -
          label: Uint8Array
          -

          A byte string indicating the cryptographic context/operation.

          -
          -
        • -
        • -
          info: Uint8Array
          -

          An additional byte string.

          -
          -
        • -
        • -
          len: number
          -

          The length of the output byte string.

          -
          -
        -

        Returns Uint8Array

        An info string as bytes.

        - -
      -
      - -
        - -
      • -

        Expands a pseudorandom key prk.

        -
        -
        -

        Parameters

        -
          -
        • -
          prk: ArrayBuffer
          -

          A pseudorandom key.

          -
          -
        • -
        • -
          info: ArrayBuffer
          -

          An additional byte string.

          -
          -
        • -
        • -
          len: number
          -

          The length in bytes of the output keying material.

          -
          -
        -

        Returns Promise<ArrayBuffer>

        An output keying material as bytes.

        - -
      -
      - -
        - -
      • -

        Extracts a pseudorandom key of fixed length (Nh) bytes.

        -
        -
        -

        Parameters

        -
          -
        • -
          salt: ArrayBuffer
          -

          An additional random byte string.

          -
          -
        • -
        • -
          ikm: ArrayBuffer
          -

          An input keying material

          -
          -
        -

        Returns Promise<ArrayBuffer>

        A pseudorandom key as bytes.

        - -
      -
      - -
        - -
      • -

        Extracts a pseudorandom key and expand it to a specified length keying material.

        -
        -
        -

        Parameters

        -
          -
        • -
          salt: ArrayBuffer
          -

          An additional random byte string.

          -
          -
        • -
        • -
          ikm: ArrayBuffer
          -

          An input keying material

          -
          -
        • -
        • -
          info: ArrayBuffer
          -

          An additional byte string.

          -
          -
        • -
        • -
          len: number
          -

          The length in bytes of the output keying material.

          -
          -
        -

        Returns Promise<ArrayBuffer>

        An output keying material as bytes.

        - -
      -
      - -
        - -
      • -

        Initializes the instance by setting a suite_id defined in RFC9180.

        -
        -
        -

        Parameters

        -
          -
        • -
          suiteId: Uint8Array
          -

          A suite_id defined in RFC9180.

          -
          -
        -

        Returns void

        -
      -
      - -
        - -
      • -

        Extracts a pseudorandom key with label.

        -
        -
        -

        Parameters

        -
          -
        • -
          prk: ArrayBuffer
          -

          A pseudorandom key.

          -
          -
        • -
        • -
          label: Uint8Array
          -

          A byte string indicating the cryptographic context/operation.

          -
          -
        • -
        • -
          info: Uint8Array
          -

          An additional byte string.

          -
          -
        • -
        • -
          len: number
          -

          The length in bytes of the output keying material.

          -
          -
        -

        Returns Promise<ArrayBuffer>

        An output keying material as bytes.

        - -
      -
      - -
        - -
      • -

        Extracts a pseudorandom key with label.

        -
        -
        -

        Parameters

        -
          -
        • -
          salt: ArrayBuffer
          -

          An additional random byte string.

          -
          -
        • -
        • -
          label: Uint8Array
          -

          A byte string indicating the cryptographic context/operation.

          -
          -
        • -
        • -
          ikm: Uint8Array
          -

          An input keying material

          -
          -
        -

        Returns Promise<ArrayBuffer>

        A pseudorandom key as bytes.

        - -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +

      Properties

      hashSize: number

      The output size of the extract() function in bytes (Nh).

      +
      id: KdfId

      The KDF identifier.

      +

      Methods

      • Builds a labeled input keying material.

        +

        Parameters

        • label: Uint8Array

          A byte string indicating the cryptographic context/operation.

          +
        • ikm: Uint8Array

        Returns Uint8Array

        An input keying material as bytes.

        +
      • Builds a labeled info string.

        +

        Parameters

        • label: Uint8Array

          A byte string indicating the cryptographic context/operation.

          +
        • info: Uint8Array

          An additional byte string.

          +
        • len: number

          The length of the output byte string.

          +

        Returns Uint8Array

        An info string as bytes.

        +
      • Expands a pseudorandom key prk.

        +

        Parameters

        • prk: ArrayBuffer

          A pseudorandom key.

          +
        • info: ArrayBuffer

          An additional byte string.

          +
        • len: number

          The length in bytes of the output keying material.

          +

        Returns Promise<ArrayBuffer>

        An output keying material as bytes.

        +
      • Extracts a pseudorandom key of fixed length (Nh) bytes.

        +

        Parameters

        • salt: ArrayBuffer

          An additional random byte string.

          +
        • ikm: ArrayBuffer

          An input keying material

          +

        Returns Promise<ArrayBuffer>

        A pseudorandom key as bytes.

        +
      • Extracts a pseudorandom key and expand it to a specified length keying material.

        +

        Parameters

        • salt: ArrayBuffer

          An additional random byte string.

          +
        • ikm: ArrayBuffer

          An input keying material

          +
        • info: ArrayBuffer

          An additional byte string.

          +
        • len: number

          The length in bytes of the output keying material.

          +

        Returns Promise<ArrayBuffer>

        An output keying material as bytes.

        +
      • Initializes the instance by setting a suite_id defined in RFC9180.

        +

        Parameters

        • suiteId: Uint8Array

          A suite_id defined in RFC9180.

          +

        Returns void

      • Extracts a pseudorandom key with label.

        +

        Parameters

        • prk: ArrayBuffer

          A pseudorandom key.

          +
        • label: Uint8Array

          A byte string indicating the cryptographic context/operation.

          +
        • info: Uint8Array

          An additional byte string.

          +
        • len: number

          The length in bytes of the output keying material.

          +

        Returns Promise<ArrayBuffer>

        An output keying material as bytes.

        +
      • Extracts a pseudorandom key with label.

        +

        Parameters

        • salt: ArrayBuffer

          An additional random byte string.

          +
        • label: Uint8Array

          A byte string indicating the cryptographic context/operation.

          +
        • ikm: Uint8Array

          An input keying material

          +

        Returns Promise<ArrayBuffer>

        A pseudorandom key as bytes.

        +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/interfaces/KemInterface.html b/docs/interfaces/KemInterface.html index b0dfaeb1a..e92a69fe7 100644 --- a/docs/interfaces/KemInterface.html +++ b/docs/interfaces/KemInterface.html @@ -1,46 +1,10 @@ -KemInterface | hpke-js
      -
      - -
      -
      -
      -
      - -

      Interface KemInterface

      -
      -

      The KEM interface.

      -
      -
      -
      -

      Hierarchy

      -
        -
      • KemInterface
      -
      -
      -
      - -
      -
      -

      Properties

      -
      encSize +KemInterface | hpke-js

      Interface KemInterface

      The KEM interface.

      +

      Hierarchy

      • KemInterface
      -
      -

      Properties

      -
      - -
      encSize: number
      -

      The length in bytes of an encapsulated key produced by this KEM (Nenc).

      -
      -
      -
      - -
      id: KemId
      -

      The KEM identifier.

      -
      -
      -
      - -
      privateKeySize: number
      -

      The length in bytes of an encoded private key for this KEM (Nsk).

      -
      -
      -
      - -
      publicKeySize: number
      -

      The length in bytes of an encoded public key for this KEM (Npk).

      -
      -
      -
      - -
      secretSize: number
      -

      The length in bytes of a KEM shared secret produced by this KEM (Nsecret).

      -
      -
      -
      -

      Methods

      -
      - -
        - -
      • -

        Recovers the ephemeral symmetric key from its encapsulated representation enc.

        +

      Properties

      encSize: number

      The length in bytes of an encapsulated key produced by this KEM (Nenc).

      +
      id: KemId

      The KEM identifier.

      +
      privateKeySize: number

      The length in bytes of an encoded private key for this KEM (Nsk).

      +
      publicKeySize: number

      The length in bytes of an encoded public key for this KEM (Npk).

      +
      secretSize: number

      The length in bytes of a KEM shared secret produced by this KEM (Nsecret).

      +

      Methods

      • Recovers the ephemeral symmetric key from its encapsulated representation enc.

        If the error occurred, throws DecapError.

        -
        -
        -

        Parameters

        -
        -

        Returns Promise<ArrayBuffer>

        A shared secret as the output of the decapsulation step.

        - -
        -

        Throws

        DecapError

        -
      -
      - -
        - -
      • -

        Derives a key pair from the byte string ikm.

        +

        Parameters

        Returns Promise<ArrayBuffer>

        A shared secret as the output of the decapsulation step.

        +

        Throws

        DecapError

        +
      -
      - -
        - -
      • -

        Deserializes a private key as a byte string of length Nsk to CryptoKey.

        +

        Parameters

        • ikm: ArrayBuffer

          An input keying material.

          +

        Returns Promise<CryptoKeyPair>

        A key pair derived.

        +
      • Deserializes a private key as a byte string of length Nsk to CryptoKey.

        If the error occurred, throws DeserializeError.

        -
        -
        -

        Parameters

        -
          -
        • -
          key: ArrayBuffer
          -

          A key as bytes.

          -
          -
        -

        Returns Promise<CryptoKey>

        A CryptoKey.

        - -
      -
      - -
        - -
      • -

        Deserializes a public key as a byte string of length Npk to CryptoKey.

        +

        Parameters

        • key: ArrayBuffer

          A key as bytes.

          +

        Returns Promise<CryptoKey>

        A CryptoKey.

        +
      • Deserializes a public key as a byte string of length Npk to CryptoKey.

        If the error occurred, throws DeserializeError.

        -
        -
        -

        Parameters

        -
          -
        • -
          key: ArrayBuffer
          -

          A key as bytes.

          -
          -
        -

        Returns Promise<CryptoKey>

        A CryptoKey.

        - -
      -
      - -
        - -
      • -

        Generates an ephemeral, fixed-length symmetric key and +

        Parameters

        • key: ArrayBuffer

          A key as bytes.

          +

        Returns Promise<CryptoKey>

        A CryptoKey.

        +
      • Generates an ephemeral, fixed-length symmetric key and a fixed-length encapsulation of the key that can be decapsulated by the holder of the private key corresponding to pkR.

        If the error occurred, throws EncapError.

        -
        -
        -

        Parameters

        -
        -

        Returns Promise<{
            enc: ArrayBuffer;
            sharedSecret: ArrayBuffer;
        }>

        A shared secret and an encapsulated key as the output of the encapsulation step.

        - -
        -

        Throws

        EncapError

        -
      -
      - -
        - -
      • -

        Generates a key pair.

        +

        Parameters

        Returns Promise<{
            enc: ArrayBuffer;
            sharedSecret: ArrayBuffer;
        }>

        A shared secret and an encapsulated key as the output of the encapsulation step.

        +

        Throws

        EncapError

        +
      -
      - -
      • Imports a public or private key and converts to a CryptoKey.

        Since key parameters for createSenderContext or createRecipientContext are CryptoKey format, you have to use this function to convert provided keys to CryptoKey.

        Basically, this is a thin wrapper function of SubtleCrypto.importKey.

        If the error occurred, throws DeserializeError.

        -
        -
        -

        Parameters

        -
          -
        • -
          format: "raw" | "jwk"
          -

          For now, 'raw' and 'jwk' are supported.

          -
          -
        • -
        • -
          key: ArrayBuffer | JsonWebKey
          -

          A byte string of a raw key or A JsonWebKey object.

          -
          -
        • -
        • -
          Optional isPublic: boolean
          -

          The indicator whether the provided key is a public key or not, which is used only for 'raw' format.

          -
          -
        -

        Returns Promise<CryptoKey>

        A public or private CryptoKey.

        - -
      -
      - -
        - -
      • -

        Serializes a private key as CryptoKey to a byte string of length Nsk.

        +

        Parameters

        • format: "raw" | "jwk"

          For now, 'raw' and 'jwk' are supported.

          +
        • key: ArrayBuffer | JsonWebKey

          A byte string of a raw key or A JsonWebKey object.

          +
        • Optional isPublic: boolean

          The indicator whether the provided key is a public key or not, which is used only for 'raw' format.

          +

        Returns Promise<CryptoKey>

        A public or private CryptoKey.

        +
      • Serializes a private key as CryptoKey to a byte string of length Nsk.

        If the error occurred, throws SerializeError.

        -
        -
        -

        Parameters

        -
          -
        • -
          key: CryptoKey
          -

          A CryptoKey.

          -
          -
        -

        Returns Promise<ArrayBuffer>

        A key as bytes.

        - -
        -

        Throws

        SerializeError

        -
      -
      - -
        - -
      • -

        Serializes a public key as CryptoKey to a byte string of length Npk.

        +

        Parameters

        • key: CryptoKey

          A CryptoKey.

          +

        Returns Promise<ArrayBuffer>

        A key as bytes.

        +
      • Serializes a public key as CryptoKey to a byte string of length Npk.

        If the error occurred, throws SerializeError.

        -
        -
        -

        Parameters

        -
          -
        • -
          key: CryptoKey
          -

          A CryptoKey.

          -
          -
        -

        Returns Promise<ArrayBuffer>

        A key as bytes.

        - -
        -

        Throws

        SerializeError

        -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +

      Parameters

      • key: CryptoKey

        A CryptoKey.

        +

      Returns Promise<ArrayBuffer>

      A key as bytes.

      +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/interfaces/PreSharedKey.html b/docs/interfaces/PreSharedKey.html index e689bd769..7dbbefada 100644 --- a/docs/interfaces/PreSharedKey.html +++ b/docs/interfaces/PreSharedKey.html @@ -1,104 +1,6 @@ -PreSharedKey | hpke-js
      -
      - -
      -
      -
      -
      - -

      Interface PreSharedKey

      -
      -

      The pre-shared key interface.

      -
      -
      -
      -

      Hierarchy

      -
        -
      • PreSharedKey
      -
      -
      -
      - -
      -
      -

      Properties

      -
      id +PreSharedKey | hpke-js

      Interface PreSharedKey

      The pre-shared key interface.

      +

      Hierarchy

      • PreSharedKey

      Properties

      -
      -

      Properties

      -
      - -
      id: ArrayBuffer
      -

      The key identifier.

      -
      -
      -
      - -
      key: ArrayBuffer
      -

      The body of the pre-shared key.

      -
      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +

      Properties

      id: ArrayBuffer

      The key identifier.

      +
      key: ArrayBuffer

      The body of the pre-shared key.

      +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/interfaces/RecipientContextParams.html b/docs/interfaces/RecipientContextParams.html index 77c74cae4..075c7e901 100644 --- a/docs/interfaces/RecipientContextParams.html +++ b/docs/interfaces/RecipientContextParams.html @@ -1,139 +1,13 @@ -RecipientContextParams | hpke-js
      -
      - -
      -
      -
      -
      - -

      Interface RecipientContextParams

      -
      -

      The parameters used to setup the RecipientContext.

      -
      -
      -
      -

      Hierarchy

      -
        -
      • KeyScheduleParams -
          -
        • RecipientContextParams
      -
      -
      -
      - -
      -
      -

      Properties

      -
      enc +RecipientContextParams | hpke-js

      Interface RecipientContextParams

      The parameters used to setup the RecipientContext.

      +

      Hierarchy

      • KeyScheduleParams
        • RecipientContextParams
      -
      -

      Properties

      -
      - -
      enc: ArrayBuffer
      -

      A byte string of the encapsulated key received from a sender.

      -
      -
      -
      - -
      info?: ArrayBuffer
      -

      Application supplied information. The maximum length is 128 bytes.

      -
      -
      -
      - - -

      A pre-shared key (PSK) held by both the sender and recipient. +

      Properties

      enc: ArrayBuffer

      A byte string of the encapsulated key received from a sender.

      +
      info?: ArrayBuffer

      Application supplied information. The maximum length is 128 bytes.

      +

      A pre-shared key (PSK) held by both the sender and recipient. The PSK should have at least 32 bytes :and the maxmum length of the PSK is 128 bytes.

      -
      -
      -
      - -
      recipientKey: CryptoKeyPair | CryptoKey
      -

      A recipient private key or a key pair.

      -
      -
      -
      - -
      senderPublicKey?: CryptoKey
      -

      A sender public key for Auth mode.

      -
      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +
      recipientKey: CryptoKeyPair | CryptoKey

      A recipient private key or a key pair.

      +
      senderPublicKey?: CryptoKey

      A sender public key for Auth mode.

      +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/interfaces/SenderContext.html b/docs/interfaces/SenderContext.html index 43315bc88..f8e7de4f4 100644 --- a/docs/interfaces/SenderContext.html +++ b/docs/interfaces/SenderContext.html @@ -1,194 +1,25 @@ -SenderContext | hpke-js
      -
      - -
      -
      -
      -
      - -

      Interface SenderContext

      -
      -

      The sender encryption context.

      -
      -
      -
      -

      Hierarchy

      -
      -
      -
      -
      - -
      -
      -

      Properties

      -
      enc -
      -
      -

      Methods

      -
      export +SenderContext | hpke-js

      Interface SenderContext

      The sender encryption context.

      +

      Hierarchy

      Properties

      enc +

      Methods

      -
      -

      Properties

      -
      - -
      enc: ArrayBuffer
      -

      The encapsulated key generated by the sender.

      -
      -
      -
      -

      Methods

      -
      - -
        - -
      • -

        Exports a secret using a variable-length pseudorandom function.

        +

      Properties

      enc: ArrayBuffer

      The encapsulated key generated by the sender.

      +

      Methods

      • Exports a secret using a variable-length pseudorandom function.

        If the error occurred, throws ExportError.

        -
        -
        -

        Parameters

        -
          -
        • -
          exporterContext: ArrayBuffer
          -

          An exporter context string as bytes. The maximum length is 128 bytes.

          -
          -
        • -
        • -
          len: number
          -

          A desired length in bytes of the output secret.

          -
          -
        -

        Returns Promise<ArrayBuffer>

        A secret string as bytes.

        - -
        -

        Throws

        ExportError

        -
      -
      - -
        - -
      • -

        Decrypts data.

        +

        Parameters

        • exporterContext: ArrayBuffer

          An exporter context string as bytes. The maximum length is 128 bytes.

          +
        • len: number

          A desired length in bytes of the output secret.

          +

        Returns Promise<ArrayBuffer>

        A secret string as bytes.

        +

        Throws

        ExportError

        +
      • Decrypts data.

        If the error occurred, throws OpenError.

        -
        -
        -

        Parameters

        -
          -
        • -
          data: ArrayBuffer
          -

          An encrypted text as bytes to be decrypted.

          -
          -
        • -
        • -
          Optional aad: ArrayBuffer
          -

          Additional authenticated data as bytes fed by an application.

          -
          -
        -

        Returns Promise<ArrayBuffer>

        A decrypted plain text as bytes.

        - -
        -

        Throws

        OpenError

        -
      -
      - -
        - -
      • -

        Encrypts data.

        +

        Parameters

        • data: ArrayBuffer

          An encrypted text as bytes to be decrypted.

          +
        • Optional aad: ArrayBuffer

          Additional authenticated data as bytes fed by an application.

          +

        Returns Promise<ArrayBuffer>

        A decrypted plain text as bytes.

        +

        Throws

        OpenError

        +
      • Encrypts data.

        If the error occurred, throws SealError | MessageLimitReachedError.

        -
        -
        -

        Parameters

        -
          -
        • -
          data: ArrayBuffer
          -

          A plain text as bytes to be encrypted.

          -
          -
        • -
        • -
          Optional aad: ArrayBuffer
          -

          Additional authenticated data as bytes fed by an application.

          -
          -
        -

        Returns Promise<ArrayBuffer>

        A cipher text as bytes.

        - -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +

      Parameters

      • data: ArrayBuffer

        A plain text as bytes to be encrypted.

        +
      • Optional aad: ArrayBuffer

        Additional authenticated data as bytes fed by an application.

        +

      Returns Promise<ArrayBuffer>

      A cipher text as bytes.

      +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/interfaces/SenderContextParams.html b/docs/interfaces/SenderContextParams.html index c46256b41..da3b800f6 100644 --- a/docs/interfaces/SenderContextParams.html +++ b/docs/interfaces/SenderContextParams.html @@ -1,139 +1,13 @@ -SenderContextParams | hpke-js
      -
      - -
      -
      -
      -
      - -

      Interface SenderContextParams

      -
      -

      The parameters used to setup the SenderContext.

      -
      -
      -
      -

      Hierarchy

      -
        -
      • KeyScheduleParams -
          -
        • SenderContextParams
      -
      -
      -
      - -
      -
      -

      Properties

      -
      ekm? +SenderContextParams | hpke-js

      Interface SenderContextParams

      The parameters used to setup the SenderContext.

      +

      Hierarchy

      • KeyScheduleParams
        • SenderContextParams
      -
      -

      Properties

      -
      - -
      ekm?: ArrayBuffer | CryptoKeyPair
      -

      DO NOT USE. FOR DEBUGGING/TESTING PURPOSES ONLY.

      -
      -
      -
      - -
      info?: ArrayBuffer
      -

      Application supplied information. The maximum length is 128 bytes.

      -
      -
      -
      - - -

      A pre-shared key (PSK) held by both the sender and recipient. +

      Properties

      ekm?: ArrayBuffer | CryptoKeyPair

      DO NOT USE. FOR DEBUGGING/TESTING PURPOSES ONLY.

      +
      info?: ArrayBuffer

      Application supplied information. The maximum length is 128 bytes.

      +

      A pre-shared key (PSK) held by both the sender and recipient. The PSK should have at least 32 bytes :and the maxmum length of the PSK is 128 bytes.

      -
      -
      -
      - -
      recipientPublicKey: CryptoKey
      -

      A recipient public key.

      -
      -
      -
      - -
      senderKey?: CryptoKeyPair | CryptoKey
      -

      A sender private key or a key pair for Auth mode.

      -
      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +
      recipientPublicKey: CryptoKey

      A recipient public key.

      +
      senderKey?: CryptoKeyPair | CryptoKey

      A sender private key or a key pair for Auth mode.

      +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/modules.html b/docs/modules.html index e5134b7ea..aebaa4637 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -1,23 +1,4 @@ -hpke-js
      -
      - -
      -
      -
      -
      -

      hpke-js

      -
      -
      -

      Index

      -
      -

      Classes

      -
      BaseError +hpke-js
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/types/Aead.html b/docs/types/Aead.html index b40846845..c0a9932f0 100644 --- a/docs/types/Aead.html +++ b/docs/types/Aead.html @@ -1,69 +1,3 @@ -Aead | hpke-js
      -
      - -
      -
      -
      -
      - -

      Type alias Aead

      -
      Aead: typeof Aead[keyof typeof Aead]
      -

      The type alias of the supported AEAD identifiers.

      -
      -
      -

      Deprecated

      Use AeadId instead.

      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +Aead | hpke-js

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/types/AeadId.html b/docs/types/AeadId.html index 710b9fcc2..14ce17b42 100644 --- a/docs/types/AeadId.html +++ b/docs/types/AeadId.html @@ -1,67 +1,2 @@ -AeadId | hpke-js
      -
      - -
      -
      -
      -
      - -

      Type alias AeadId

      -
      AeadId: typeof AeadId[keyof typeof AeadId]
      -

      The type alias of the supported AEAD identifiers.

      -
      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +AeadId | hpke-js

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/types/Kdf.html b/docs/types/Kdf.html index b2ffe594b..428cbed5e 100644 --- a/docs/types/Kdf.html +++ b/docs/types/Kdf.html @@ -1,69 +1,3 @@ -Kdf | hpke-js
      -
      - -
      -
      -
      -
      - -

      Type alias Kdf

      -
      Kdf: typeof Kdf[keyof typeof Kdf]
      -

      The type alias of the supported KDF identifiers.

      -
      -
      -

      Deprecated

      Use KdfId instead.

      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +Kdf | hpke-js

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/types/KdfId.html b/docs/types/KdfId.html index 68e02667b..375e6db95 100644 --- a/docs/types/KdfId.html +++ b/docs/types/KdfId.html @@ -1,67 +1,2 @@ -KdfId | hpke-js
      -
      - -
      -
      -
      -
      - -

      Type alias KdfId

      -
      KdfId: typeof KdfId[keyof typeof KdfId]
      -

      The type alias of the supported KDF identifiers.

      -
      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +KdfId | hpke-js

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/types/Kem.html b/docs/types/Kem.html index 1c1a06d18..c97c01a73 100644 --- a/docs/types/Kem.html +++ b/docs/types/Kem.html @@ -1,69 +1,3 @@ -Kem | hpke-js
      -
      - -
      -
      -
      -
      - -

      Type alias Kem

      -
      Kem: typeof Kem[keyof typeof Kem]
      -

      The type alias of the supported KEM identifiers.

      -
      -
      -

      Deprecated

      Use KdfId instead.

      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +Kem | hpke-js

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/types/KemId.html b/docs/types/KemId.html index c4fb8c10a..a7d0606dc 100644 --- a/docs/types/KemId.html +++ b/docs/types/KemId.html @@ -1,67 +1,2 @@ -KemId | hpke-js
      -
      - -
      -
      -
      -
      - -

      Type alias KemId

      -
      KemId: typeof KemId[keyof typeof KemId]
      -

      The type alias of the supported KEM identifiers.

      -
      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +KemId | hpke-js

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/types/RecipientContext.html b/docs/types/RecipientContext.html index 887dd45e2..c4085cdba 100644 --- a/docs/types/RecipientContext.html +++ b/docs/types/RecipientContext.html @@ -1,66 +1,2 @@ -RecipientContext | hpke-js
      -
      - -
      -
      -
      -
      - -

      Type alias RecipientContext

      -
      RecipientContext: EncryptionContext
      -

      The recipient encryption context.

      -
      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +RecipientContext | hpke-js

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/variables/Aead-1.html b/docs/variables/Aead-1.html index c731d71c6..5ff5d1652 100644 --- a/docs/variables/Aead-1.html +++ b/docs/variables/Aead-1.html @@ -1,80 +1,3 @@ -Aead | hpke-js
      -
      - -
      -
      -
      -
      - -

      Variable AeadConst

      -
      Aead: {
          Aes128Gcm: 1;
          Aes256Gcm: 2;
          Chacha20Poly1305: 3;
          ExportOnly: 65535;
      } = ...
      -

      The supported Authenticated Encryption with Associated Data (AEAD) identifiers.

      -
      -
      -

      Type declaration

      -
        -
      • -
        Readonly Aes128Gcm: 1
      • -
      • -
        Readonly Aes256Gcm: 2
      • -
      • -
        Readonly Chacha20Poly1305: 3
      • -
      • -
        Readonly ExportOnly: 65535
      -
      -

      Deprecated

      Use AeadId instead.

      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +Aead | hpke-js

      Variable AeadConst

      Aead: {
          Aes128Gcm: 1;
          Aes256Gcm: 2;
          Chacha20Poly1305: 3;
          ExportOnly: 65535;
      } = ...

      The supported Authenticated Encryption with Associated Data (AEAD) identifiers.

      +

      Type declaration

      • Readonly Aes128Gcm: 1
      • Readonly Aes256Gcm: 2
      • Readonly Chacha20Poly1305: 3
      • Readonly ExportOnly: 65535

      Deprecated

      Use AeadId instead.

      +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/variables/AeadId-1.html b/docs/variables/AeadId-1.html index 44fc11f87..6bb0cfa2e 100644 --- a/docs/variables/AeadId-1.html +++ b/docs/variables/AeadId-1.html @@ -1,78 +1,2 @@ -AeadId | hpke-js
      -
      - -
      -
      -
      -
      - -

      Variable AeadIdConst

      -
      AeadId: {
          Aes128Gcm: 1;
          Aes256Gcm: 2;
          Chacha20Poly1305: 3;
          ExportOnly: 65535;
      } = Aead
      -

      The supported Authenticated Encryption with Associated Data (AEAD) identifiers.

      -
      -
      -

      Type declaration

      -
        -
      • -
        Readonly Aes128Gcm: 1
      • -
      • -
        Readonly Aes256Gcm: 2
      • -
      • -
        Readonly Chacha20Poly1305: 3
      • -
      • -
        Readonly ExportOnly: 65535
      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +AeadId | hpke-js

      Variable AeadIdConst

      AeadId: {
          Aes128Gcm: 1;
          Aes256Gcm: 2;
          Chacha20Poly1305: 3;
          ExportOnly: 65535;
      } = Aead

      The supported Authenticated Encryption with Associated Data (AEAD) identifiers.

      +

      Type declaration

      • Readonly Aes128Gcm: 1
      • Readonly Aes256Gcm: 2
      • Readonly Chacha20Poly1305: 3
      • Readonly ExportOnly: 65535

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/variables/Kdf-1.html b/docs/variables/Kdf-1.html index 674ad620e..dc5dce777 100644 --- a/docs/variables/Kdf-1.html +++ b/docs/variables/Kdf-1.html @@ -1,78 +1,3 @@ -Kdf | hpke-js
      -
      - -
      -
      -
      -
      - -

      Variable KdfConst

      -
      Kdf: {
          HkdfSha256: 1;
          HkdfSha384: 2;
          HkdfSha512: 3;
      } = ...
      -

      The supported Key Derivation Function (KDF) identifiers.

      -
      -
      -

      Type declaration

      -
        -
      • -
        Readonly HkdfSha256: 1
      • -
      • -
        Readonly HkdfSha384: 2
      • -
      • -
        Readonly HkdfSha512: 3
      -
      -

      Deprecated

      Use KdfId instead.

      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +Kdf | hpke-js

      Variable KdfConst

      Kdf: {
          HkdfSha256: 1;
          HkdfSha384: 2;
          HkdfSha512: 3;
      } = ...

      The supported Key Derivation Function (KDF) identifiers.

      +

      Type declaration

      • Readonly HkdfSha256: 1
      • Readonly HkdfSha384: 2
      • Readonly HkdfSha512: 3

      Deprecated

      Use KdfId instead.

      +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/variables/KdfId-1.html b/docs/variables/KdfId-1.html index 5191e84b2..9cbc1cbde 100644 --- a/docs/variables/KdfId-1.html +++ b/docs/variables/KdfId-1.html @@ -1,76 +1,2 @@ -KdfId | hpke-js
      -
      - -
      -
      -
      -
      - -

      Variable KdfIdConst

      -
      KdfId: {
          HkdfSha256: 1;
          HkdfSha384: 2;
          HkdfSha512: 3;
      } = Kdf
      -

      The supported Key Derivation Function (KDF) identifiers.

      -
      -
      -

      Type declaration

      -
        -
      • -
        Readonly HkdfSha256: 1
      • -
      • -
        Readonly HkdfSha384: 2
      • -
      • -
        Readonly HkdfSha512: 3
      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +KdfId | hpke-js

      Variable KdfIdConst

      KdfId: {
          HkdfSha256: 1;
          HkdfSha384: 2;
          HkdfSha512: 3;
      } = Kdf

      The supported Key Derivation Function (KDF) identifiers.

      +

      Type declaration

      • Readonly HkdfSha256: 1
      • Readonly HkdfSha384: 2
      • Readonly HkdfSha512: 3

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/variables/Kem-1.html b/docs/variables/Kem-1.html index a116212d6..4686513b5 100644 --- a/docs/variables/Kem-1.html +++ b/docs/variables/Kem-1.html @@ -1,88 +1,3 @@ -Kem | hpke-js
      -
      - -
      -
      -
      -
      - -

      Variable KemConst

      -
      Kem: {
          DhkemP256HkdfSha256: 16;
          DhkemP384HkdfSha384: 17;
          DhkemP521HkdfSha512: 18;
          DhkemSecp256k1HkdfSha256: 19;
          DhkemX25519HkdfSha256: 32;
          DhkemX448HkdfSha512: 33;
          HybridkemX25519Kyber768: 48;
          NotAssigned: 0;
      } = ...
      -

      The supported Key Encapsulation Mechanism (KEM) identifiers.

      -
      -
      -

      Type declaration

      -
        -
      • -
        Readonly DhkemP256HkdfSha256: 16
      • -
      • -
        Readonly DhkemP384HkdfSha384: 17
      • -
      • -
        Readonly DhkemP521HkdfSha512: 18
      • -
      • -
        Readonly DhkemSecp256k1HkdfSha256: 19
      • -
      • -
        Readonly DhkemX25519HkdfSha256: 32
      • -
      • -
        Readonly DhkemX448HkdfSha512: 33
      • -
      • -
        Readonly HybridkemX25519Kyber768: 48
      • -
      • -
        Readonly NotAssigned: 0
      -
      -

      Deprecated

      Use KdfId instead.

      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +Kem | hpke-js

      Variable KemConst

      Kem: {
          DhkemP256HkdfSha256: 16;
          DhkemP384HkdfSha384: 17;
          DhkemP521HkdfSha512: 18;
          DhkemSecp256k1HkdfSha256: 19;
          DhkemX25519HkdfSha256: 32;
          DhkemX448HkdfSha512: 33;
          HybridkemX25519Kyber768: 48;
          NotAssigned: 0;
      } = ...

      The supported Key Encapsulation Mechanism (KEM) identifiers.

      +

      Type declaration

      • Readonly DhkemP256HkdfSha256: 16
      • Readonly DhkemP384HkdfSha384: 17
      • Readonly DhkemP521HkdfSha512: 18
      • Readonly DhkemSecp256k1HkdfSha256: 19
      • Readonly DhkemX25519HkdfSha256: 32
      • Readonly DhkemX448HkdfSha512: 33
      • Readonly HybridkemX25519Kyber768: 48
      • Readonly NotAssigned: 0

      Deprecated

      Use KdfId instead.

      +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/docs/variables/KemId-1.html b/docs/variables/KemId-1.html index 849f6a6fe..4f3e1ce87 100644 --- a/docs/variables/KemId-1.html +++ b/docs/variables/KemId-1.html @@ -1,86 +1,2 @@ -KemId | hpke-js
      -
      - -
      -
      -
      -
      - -

      Variable KemIdConst

      -
      KemId: {
          DhkemP256HkdfSha256: 16;
          DhkemP384HkdfSha384: 17;
          DhkemP521HkdfSha512: 18;
          DhkemSecp256k1HkdfSha256: 19;
          DhkemX25519HkdfSha256: 32;
          DhkemX448HkdfSha512: 33;
          HybridkemX25519Kyber768: 48;
          NotAssigned: 0;
      } = Kem
      -

      The supported Key Encapsulation Mechanism (KEM) identifiers.

      -
      -
      -

      Type declaration

      -
        -
      • -
        Readonly DhkemP256HkdfSha256: 16
      • -
      • -
        Readonly DhkemP384HkdfSha384: 17
      • -
      • -
        Readonly DhkemP521HkdfSha512: 18
      • -
      • -
        Readonly DhkemSecp256k1HkdfSha256: 19
      • -
      • -
        Readonly DhkemX25519HkdfSha256: 32
      • -
      • -
        Readonly DhkemX448HkdfSha512: 33
      • -
      • -
        Readonly HybridkemX25519Kyber768: 48
      • -
      • -
        Readonly NotAssigned: 0
      -
      -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +KemId | hpke-js

      Variable KemIdConst

      KemId: {
          DhkemP256HkdfSha256: 16;
          DhkemP384HkdfSha384: 17;
          DhkemP521HkdfSha512: 18;
          DhkemSecp256k1HkdfSha256: 19;
          DhkemX25519HkdfSha256: 32;
          DhkemX448HkdfSha512: 33;
          HybridkemX25519Kyber768: 48;
          NotAssigned: 0;
      } = Kem

      The supported Key Encapsulation Mechanism (KEM) identifiers.

      +

      Type declaration

      • Readonly DhkemP256HkdfSha256: 16
      • Readonly DhkemP384HkdfSha384: 17
      • Readonly DhkemP521HkdfSha512: 18
      • Readonly DhkemSecp256k1HkdfSha256: 19
      • Readonly DhkemX25519HkdfSha256: 32
      • Readonly DhkemX448HkdfSha512: 33
      • Readonly HybridkemX25519Kyber768: 48
      • Readonly NotAssigned: 0

      Generated using TypeDoc

      \ No newline at end of file diff --git a/hybridkem-x25519-kyber768/docs/assets/main.js b/hybridkem-x25519-kyber768/docs/assets/main.js index 01bcad55f..d0aa8d5f9 100644 --- a/hybridkem-x25519-kyber768/docs/assets/main.js +++ b/hybridkem-x25519-kyber768/docs/assets/main.js @@ -1,6 +1,6 @@ "use strict"; "use strict";(()=>{var Pe=Object.create;var ne=Object.defineProperty;var Ie=Object.getOwnPropertyDescriptor;var Oe=Object.getOwnPropertyNames;var _e=Object.getPrototypeOf,Re=Object.prototype.hasOwnProperty;var Me=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Fe=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of Oe(e))!Re.call(t,i)&&i!==n&&ne(t,i,{get:()=>e[i],enumerable:!(r=Ie(e,i))||r.enumerable});return t};var De=(t,e,n)=>(n=t!=null?Pe(_e(t)):{},Fe(e||!t||!t.__esModule?ne(n,"default",{value:t,enumerable:!0}):n,t));var ae=Me((se,oe)=>{(function(){var t=function(e){var n=new t.Builder;return n.pipeline.add(t.trimmer,t.stopWordFilter,t.stemmer),n.searchPipeline.add(t.stemmer),e.call(n,n),n.build()};t.version="2.3.9";t.utils={},t.utils.warn=function(e){return function(n){e.console&&console.warn&&console.warn(n)}}(this),t.utils.asString=function(e){return e==null?"":e.toString()},t.utils.clone=function(e){if(e==null)return e;for(var n=Object.create(null),r=Object.keys(e),i=0;i0){var d=t.utils.clone(n)||{};d.position=[a,u],d.index=s.length,s.push(new t.Token(r.slice(a,o),d))}a=o+1}}return s},t.tokenizer.separator=/[\s\-]+/;t.Pipeline=function(){this._stack=[]},t.Pipeline.registeredFunctions=Object.create(null),t.Pipeline.registerFunction=function(e,n){n in this.registeredFunctions&&t.utils.warn("Overwriting existing registered function: "+n),e.label=n,t.Pipeline.registeredFunctions[e.label]=e},t.Pipeline.warnIfFunctionNotRegistered=function(e){var n=e.label&&e.label in this.registeredFunctions;n||t.utils.warn(`Function is not registered with pipeline. This may cause problems when serialising the index. -`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s=i?r.index.search(`*${i}*`):[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` +`,e)},t.Pipeline.load=function(e){var n=new t.Pipeline;return e.forEach(function(r){var i=t.Pipeline.registeredFunctions[r];if(i)n.add(i);else throw new Error("Cannot load unregistered function: "+r)}),n},t.Pipeline.prototype.add=function(){var e=Array.prototype.slice.call(arguments);e.forEach(function(n){t.Pipeline.warnIfFunctionNotRegistered(n),this._stack.push(n)},this)},t.Pipeline.prototype.after=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");r=r+1,this._stack.splice(r,0,n)},t.Pipeline.prototype.before=function(e,n){t.Pipeline.warnIfFunctionNotRegistered(n);var r=this._stack.indexOf(e);if(r==-1)throw new Error("Cannot find existingFn");this._stack.splice(r,0,n)},t.Pipeline.prototype.remove=function(e){var n=this._stack.indexOf(e);n!=-1&&this._stack.splice(n,1)},t.Pipeline.prototype.run=function(e){for(var n=this._stack.length,r=0;r1&&(oe&&(r=s),o!=e);)i=r-n,s=n+Math.floor(i/2),o=this.elements[s*2];if(o==e||o>e)return s*2;if(ol?d+=2:a==l&&(n+=r[u+1]*i[d+1],u+=2,d+=2);return n},t.Vector.prototype.similarity=function(e){return this.dot(e)/this.magnitude()||0},t.Vector.prototype.toArray=function(){for(var e=new Array(this.elements.length/2),n=1,r=0;n0){var o=s.str.charAt(0),a;o in s.node.edges?a=s.node.edges[o]:(a=new t.TokenSet,s.node.edges[o]=a),s.str.length==1&&(a.final=!0),i.push({node:a,editsRemaining:s.editsRemaining,str:s.str.slice(1)})}if(s.editsRemaining!=0){if("*"in s.node.edges)var l=s.node.edges["*"];else{var l=new t.TokenSet;s.node.edges["*"]=l}if(s.str.length==0&&(l.final=!0),i.push({node:l,editsRemaining:s.editsRemaining-1,str:s.str}),s.str.length>1&&i.push({node:s.node,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)}),s.str.length==1&&(s.node.final=!0),s.str.length>=1){if("*"in s.node.edges)var u=s.node.edges["*"];else{var u=new t.TokenSet;s.node.edges["*"]=u}s.str.length==1&&(u.final=!0),i.push({node:u,editsRemaining:s.editsRemaining-1,str:s.str.slice(1)})}if(s.str.length>1){var d=s.str.charAt(0),v=s.str.charAt(1),f;v in s.node.edges?f=s.node.edges[v]:(f=new t.TokenSet,s.node.edges[v]=f),s.str.length==1&&(f.final=!0),i.push({node:f,editsRemaining:s.editsRemaining-1,str:d+s.str.slice(2)})}}}return r},t.TokenSet.fromString=function(e){for(var n=new t.TokenSet,r=n,i=0,s=e.length;i=e;n--){var r=this.uncheckedNodes[n],i=r.child.toString();i in this.minimizedNodes?r.parent.edges[r.char]=this.minimizedNodes[i]:(r.child._str=i,this.minimizedNodes[i]=r.child),this.uncheckedNodes.pop()}};t.Index=function(e){this.invertedIndex=e.invertedIndex,this.fieldVectors=e.fieldVectors,this.tokenSet=e.tokenSet,this.fields=e.fields,this.pipeline=e.pipeline},t.Index.prototype.search=function(e){return this.query(function(n){var r=new t.QueryParser(e,n);r.parse()})},t.Index.prototype.query=function(e){for(var n=new t.Query(this.fields),r=Object.create(null),i=Object.create(null),s=Object.create(null),o=Object.create(null),a=Object.create(null),l=0;l1?this._b=1:this._b=e},t.Builder.prototype.k1=function(e){this._k1=e},t.Builder.prototype.add=function(e,n){var r=e[this._ref],i=Object.keys(this._fields);this._documents[r]=n||{},this.documentCount+=1;for(var s=0;s=this.length)return t.QueryLexer.EOS;var e=this.str.charAt(this.pos);return this.pos+=1,e},t.QueryLexer.prototype.width=function(){return this.pos-this.start},t.QueryLexer.prototype.ignore=function(){this.start==this.pos&&(this.pos+=1),this.start=this.pos},t.QueryLexer.prototype.backup=function(){this.pos-=1},t.QueryLexer.prototype.acceptDigitRun=function(){var e,n;do e=this.next(),n=e.charCodeAt(0);while(n>47&&n<58);e!=t.QueryLexer.EOS&&this.backup()},t.QueryLexer.prototype.more=function(){return this.pos1&&(e.backup(),e.emit(t.QueryLexer.TERM)),e.ignore(),e.more())return t.QueryLexer.lexText},t.QueryLexer.lexEditDistance=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.EDIT_DISTANCE),t.QueryLexer.lexText},t.QueryLexer.lexBoost=function(e){return e.ignore(),e.acceptDigitRun(),e.emit(t.QueryLexer.BOOST),t.QueryLexer.lexText},t.QueryLexer.lexEOS=function(e){e.width()>0&&e.emit(t.QueryLexer.TERM)},t.QueryLexer.termSeparator=t.tokenizer.separator,t.QueryLexer.lexText=function(e){for(;;){var n=e.next();if(n==t.QueryLexer.EOS)return t.QueryLexer.lexEOS;if(n.charCodeAt(0)==92){e.escapeCharacter();continue}if(n==":")return t.QueryLexer.lexField;if(n=="~")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexEditDistance;if(n=="^")return e.backup(),e.width()>0&&e.emit(t.QueryLexer.TERM),t.QueryLexer.lexBoost;if(n=="+"&&e.width()===1||n=="-"&&e.width()===1)return e.emit(t.QueryLexer.PRESENCE),t.QueryLexer.lexText;if(n.match(t.QueryLexer.termSeparator))return t.QueryLexer.lexTerm}},t.QueryParser=function(e,n){this.lexer=new t.QueryLexer(e),this.query=n,this.currentClause={},this.lexemeIdx=0},t.QueryParser.prototype.parse=function(){this.lexer.run(),this.lexemes=this.lexer.lexemes;for(var e=t.QueryParser.parseClause;e;)e=e(this);return this.query},t.QueryParser.prototype.peekLexeme=function(){return this.lexemes[this.lexemeIdx]},t.QueryParser.prototype.consumeLexeme=function(){var e=this.peekLexeme();return this.lexemeIdx+=1,e},t.QueryParser.prototype.nextClause=function(){var e=this.currentClause;this.query.clause(e),this.currentClause={}},t.QueryParser.parseClause=function(e){var n=e.peekLexeme();if(n!=null)switch(n.type){case t.QueryLexer.PRESENCE:return t.QueryParser.parsePresence;case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expected either a field or a term, found "+n.type;throw n.str.length>=1&&(r+=" with value '"+n.str+"'"),new t.QueryParseError(r,n.start,n.end)}},t.QueryParser.parsePresence=function(e){var n=e.consumeLexeme();if(n!=null){switch(n.str){case"-":e.currentClause.presence=t.Query.presence.PROHIBITED;break;case"+":e.currentClause.presence=t.Query.presence.REQUIRED;break;default:var r="unrecognised presence operator'"+n.str+"'";throw new t.QueryParseError(r,n.start,n.end)}var i=e.peekLexeme();if(i==null){var r="expecting term or field, found nothing";throw new t.QueryParseError(r,n.start,n.end)}switch(i.type){case t.QueryLexer.FIELD:return t.QueryParser.parseField;case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var r="expecting term or field, found '"+i.type+"'";throw new t.QueryParseError(r,i.start,i.end)}}},t.QueryParser.parseField=function(e){var n=e.consumeLexeme();if(n!=null){if(e.query.allFields.indexOf(n.str)==-1){var r=e.query.allFields.map(function(o){return"'"+o+"'"}).join(", "),i="unrecognised field '"+n.str+"', possible fields: "+r;throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.fields=[n.str];var s=e.peekLexeme();if(s==null){var i="expecting term, found nothing";throw new t.QueryParseError(i,n.start,n.end)}switch(s.type){case t.QueryLexer.TERM:return t.QueryParser.parseTerm;default:var i="expecting term, found '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseTerm=function(e){var n=e.consumeLexeme();if(n!=null){e.currentClause.term=n.str.toLowerCase(),n.str.indexOf("*")!=-1&&(e.currentClause.usePipeline=!1);var r=e.peekLexeme();if(r==null){e.nextClause();return}switch(r.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+r.type+"'";throw new t.QueryParseError(i,r.start,r.end)}}},t.QueryParser.parseEditDistance=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="edit distance must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.editDistance=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},t.QueryParser.parseBoost=function(e){var n=e.consumeLexeme();if(n!=null){var r=parseInt(n.str,10);if(isNaN(r)){var i="boost must be numeric";throw new t.QueryParseError(i,n.start,n.end)}e.currentClause.boost=r;var s=e.peekLexeme();if(s==null){e.nextClause();return}switch(s.type){case t.QueryLexer.TERM:return e.nextClause(),t.QueryParser.parseTerm;case t.QueryLexer.FIELD:return e.nextClause(),t.QueryParser.parseField;case t.QueryLexer.EDIT_DISTANCE:return t.QueryParser.parseEditDistance;case t.QueryLexer.BOOST:return t.QueryParser.parseBoost;case t.QueryLexer.PRESENCE:return e.nextClause(),t.QueryParser.parsePresence;default:var i="Unexpected lexeme type '"+s.type+"'";throw new t.QueryParseError(i,s.start,s.end)}}},function(e,n){typeof define=="function"&&define.amd?define(n):typeof se=="object"?oe.exports=n():e.lunr=n()}(this,function(){return t})})()});var re=[];function G(t,e){re.push({selector:e,constructor:t})}var U=class{constructor(){this.alwaysVisibleMember=null;this.createComponents(document.body),this.ensureActivePageVisible(),this.ensureFocusedElementVisible(),this.listenForCodeCopies(),window.addEventListener("hashchange",()=>this.ensureFocusedElementVisible())}createComponents(e){re.forEach(n=>{e.querySelectorAll(n.selector).forEach(r=>{r.dataset.hasInstance||(new n.constructor({el:r,app:this}),r.dataset.hasInstance=String(!0))})})}filterChanged(){this.ensureFocusedElementVisible()}ensureActivePageVisible(){let e=document.querySelector(".tsd-navigation .current"),n=e?.parentElement;for(;n&&!n.classList.contains(".tsd-navigation");)n instanceof HTMLDetailsElement&&(n.open=!0),n=n.parentElement;if(e){let r=e.getBoundingClientRect().top-document.documentElement.clientHeight/4;document.querySelector(".site-menu").scrollTop=r}}ensureFocusedElementVisible(){if(this.alwaysVisibleMember&&(this.alwaysVisibleMember.classList.remove("always-visible"),this.alwaysVisibleMember.firstElementChild.remove(),this.alwaysVisibleMember=null),!location.hash)return;let e=document.getElementById(location.hash.substring(1));if(!e)return;let n=e.parentElement;for(;n&&n.tagName!=="SECTION";)n=n.parentElement;if(n&&n.offsetParent==null){this.alwaysVisibleMember=n,n.classList.add("always-visible");let r=document.createElement("p");r.classList.add("warning"),r.textContent="This member is normally hidden due to your filter settings.",n.prepend(r)}}listenForCodeCopies(){document.querySelectorAll("pre > button").forEach(e=>{let n;e.addEventListener("click",()=>{e.previousElementSibling instanceof HTMLElement&&navigator.clipboard.writeText(e.previousElementSibling.innerText.trim()),e.textContent="Copied!",e.classList.add("visible"),clearTimeout(n),n=setTimeout(()=>{e.classList.remove("visible"),n=setTimeout(()=>{e.textContent="Copy"},100)},1e3)})})}};var ie=(t,e=100)=>{let n;return()=>{clearTimeout(n),n=setTimeout(()=>t(),e)}};var de=De(ae());async function le(t,e){if(!window.searchData)return;let n=await fetch(window.searchData),r=new Blob([await n.arrayBuffer()]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();t.data=i,t.index=de.Index.load(i.index),e.classList.remove("loading"),e.classList.add("ready")}function he(){let t=document.getElementById("tsd-search");if(!t)return;let e={base:t.dataset.base+"/"},n=document.getElementById("tsd-search-script");t.classList.add("loading"),n&&(n.addEventListener("error",()=>{t.classList.remove("loading"),t.classList.add("failure")}),n.addEventListener("load",()=>{le(e,t)}),le(e,t));let r=document.querySelector("#tsd-search input"),i=document.querySelector("#tsd-search .results");if(!r||!i)throw new Error("The input field or the result list wrapper was not found");let s=!1;i.addEventListener("mousedown",()=>s=!0),i.addEventListener("mouseup",()=>{s=!1,t.classList.remove("has-focus")}),r.addEventListener("focus",()=>t.classList.add("has-focus")),r.addEventListener("blur",()=>{s||(s=!1,t.classList.remove("has-focus"))}),Ae(t,i,r,e)}function Ae(t,e,n,r){n.addEventListener("input",ie(()=>{Ne(t,e,n,r)},200));let i=!1;n.addEventListener("keydown",s=>{i=!0,s.key=="Enter"?Ve(e,n):s.key=="Escape"?n.blur():s.key=="ArrowUp"?ue(e,-1):s.key==="ArrowDown"?ue(e,1):i=!1}),n.addEventListener("keypress",s=>{i&&s.preventDefault()}),document.body.addEventListener("keydown",s=>{s.altKey||s.ctrlKey||s.metaKey||!n.matches(":focus")&&s.key==="/"&&(n.focus(),s.preventDefault())})}function Ne(t,e,n,r){if(!r.index||!r.data)return;e.textContent="";let i=n.value.trim(),s;if(i){let o=i.split(" ").map(a=>a.length?`*${a}*`:"").join(" ");s=r.index.search(o)}else s=[];for(let o=0;oa.score-o.score);for(let o=0,a=Math.min(10,s.length);o`,d=ce(l.name,i);globalThis.DEBUG_SEARCH_WEIGHTS&&(d+=` (score: ${s[o].score.toFixed(2)})`),l.parent&&(d=` ${ce(l.parent,i)}.${d}`);let v=document.createElement("li");v.classList.value=l.classes??"";let f=document.createElement("a");f.href=r.base+l.url,f.innerHTML=u+d,v.append(f),e.appendChild(v)}}function ue(t,e){let n=t.querySelector(".current");if(!n)n=t.querySelector(e==1?"li:first-child":"li:last-child"),n&&n.classList.add("current");else{let r=n;if(e===1)do r=r.nextElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);else do r=r.previousElementSibling??void 0;while(r instanceof HTMLElement&&r.offsetParent==null);r&&(n.classList.remove("current"),r.classList.add("current"))}}function Ve(t,e){let n=t.querySelector(".current");if(n||(n=t.querySelector("li:first-child")),n){let r=n.querySelector("a");r&&(window.location.href=r.href),e.blur()}}function ce(t,e){if(e==="")return t;let n=t.toLocaleLowerCase(),r=e.toLocaleLowerCase(),i=[],s=0,o=n.indexOf(r);for(;o!=-1;)i.push(K(t.substring(s,o)),`${K(t.substring(o,o+r.length))}`),s=o+r.length,o=n.indexOf(r,s);return i.push(K(t.substring(s))),i.join("")}var Be={"&":"&","<":"<",">":">","'":"'",'"':"""};function K(t){return t.replace(/[&<>"'"]/g,e=>Be[e])}var C=class{constructor(e){this.el=e.el,this.app=e.app}};var F="mousedown",pe="mousemove",B="mouseup",J={x:0,y:0},fe=!1,ee=!1,He=!1,D=!1,me=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);document.documentElement.classList.add(me?"is-mobile":"not-mobile");me&&"ontouchstart"in document.documentElement&&(He=!0,F="touchstart",pe="touchmove",B="touchend");document.addEventListener(F,t=>{ee=!0,D=!1;let e=F=="touchstart"?t.targetTouches[0]:t;J.y=e.pageY||0,J.x=e.pageX||0});document.addEventListener(pe,t=>{if(ee&&!D){let e=F=="touchstart"?t.targetTouches[0]:t,n=J.x-(e.pageX||0),r=J.y-(e.pageY||0);D=Math.sqrt(n*n+r*r)>10}});document.addEventListener(B,()=>{ee=!1});document.addEventListener("click",t=>{fe&&(t.preventDefault(),t.stopImmediatePropagation(),fe=!1)});var X=class extends C{constructor(n){super(n);this.className=this.el.dataset.toggle||"",this.el.addEventListener(B,r=>this.onPointerUp(r)),this.el.addEventListener("click",r=>r.preventDefault()),document.addEventListener(F,r=>this.onDocumentPointerDown(r)),document.addEventListener(B,r=>this.onDocumentPointerUp(r))}setActive(n){if(this.active==n)return;this.active=n,document.documentElement.classList.toggle("has-"+this.className,n),this.el.classList.toggle("active",n);let r=(this.active?"to-has-":"from-has-")+this.className;document.documentElement.classList.add(r),setTimeout(()=>document.documentElement.classList.remove(r),500)}onPointerUp(n){D||(this.setActive(!0),n.preventDefault())}onDocumentPointerDown(n){if(this.active){if(n.target.closest(".col-sidebar, .tsd-filter-group"))return;this.setActive(!1)}}onDocumentPointerUp(n){if(!D&&this.active&&n.target.closest(".col-sidebar")){let r=n.target.closest("a");if(r){let i=window.location.href;i.indexOf("#")!=-1&&(i=i.substring(0,i.indexOf("#"))),r.href.substring(0,i.length)==i&&setTimeout(()=>this.setActive(!1),250)}}}};var te;try{te=localStorage}catch{te={getItem(){return null},setItem(){}}}var Q=te;var ve=document.head.appendChild(document.createElement("style"));ve.dataset.for="filters";var Y=class extends C{constructor(n){super(n);this.key=`filter-${this.el.name}`,this.value=this.el.checked,this.el.addEventListener("change",()=>{this.setLocalStorage(this.el.checked)}),this.setLocalStorage(this.fromLocalStorage()),ve.innerHTML+=`html:not(.${this.key}) .tsd-is-${this.el.name} { display: none; } `}fromLocalStorage(){let n=Q.getItem(this.key);return n?n==="true":this.el.checked}setLocalStorage(n){Q.setItem(this.key,n.toString()),this.value=n,this.handleValueChange()}handleValueChange(){this.el.checked=this.value,document.documentElement.classList.toggle(this.key,this.value),this.app.filterChanged(),document.querySelectorAll(".tsd-index-section").forEach(n=>{n.style.display="block";let r=Array.from(n.querySelectorAll(".tsd-index-link")).every(i=>i.offsetParent==null);n.style.display=r?"none":"block"})}};var Z=class extends C{constructor(n){super(n);this.summary=this.el.querySelector(".tsd-accordion-summary"),this.icon=this.summary.querySelector("svg"),this.key=`tsd-accordion-${this.summary.dataset.key??this.summary.textContent.trim().replace(/\s+/g,"-").toLowerCase()}`;let r=Q.getItem(this.key);this.el.open=r?r==="true":this.el.open,this.el.addEventListener("toggle",()=>this.update());let i=this.summary.querySelector("a");i&&i.addEventListener("click",()=>{location.assign(i.href)}),this.update()}update(){this.icon.style.transform=`rotate(${this.el.open?0:-90}deg)`,Q.setItem(this.key,this.el.open.toString())}};function ge(t){let e=Q.getItem("tsd-theme")||"os";t.value=e,ye(e),t.addEventListener("change",()=>{Q.setItem("tsd-theme",t.value),ye(t.value)})}function ye(t){document.documentElement.dataset.theme=t}var Le;function be(){let t=document.getElementById("tsd-nav-script");t&&(t.addEventListener("load",xe),xe())}async function xe(){let t=document.getElementById("tsd-nav-container");if(!t||!window.navigationData)return;let n=await(await fetch(window.navigationData)).arrayBuffer(),r=new Blob([n]).stream().pipeThrough(new DecompressionStream("gzip")),i=await new Response(r).json();Le=t.dataset.base+"/",t.innerHTML="";for(let s of i)we(s,t,[]);window.app.createComponents(t),window.app.ensureActivePageVisible()}function we(t,e,n){let r=e.appendChild(document.createElement("li"));if(t.children){let i=[...n,t.text],s=r.appendChild(document.createElement("details"));s.className=t.class?`${t.class} tsd-index-accordion`:"tsd-index-accordion",s.dataset.key=i.join("$");let o=s.appendChild(document.createElement("summary"));o.className="tsd-accordion-summary",o.innerHTML='',Ee(t,o);let a=s.appendChild(document.createElement("div"));a.className="tsd-accordion-details";let l=a.appendChild(document.createElement("ul"));l.className="tsd-nested-navigation";for(let u of t.children)we(u,l,i)}else Ee(t,r,t.class)}function Ee(t,e,n){if(t.path){let r=e.appendChild(document.createElement("a"));r.href=Le+t.path,n&&(r.className=n),location.href===r.href&&r.classList.add("current"),t.kind&&(r.innerHTML=``),r.appendChild(document.createElement("span")).textContent=t.text}else e.appendChild(document.createElement("span")).textContent=t.text}G(X,"a[data-toggle]");G(Z,".tsd-index-accordion");G(Y,".tsd-filter-item input[type=checkbox]");var Se=document.getElementById("tsd-theme");Se&&ge(Se);var je=new U;Object.defineProperty(window,"app",{value:je});he();be();})(); /*! Bundled license information: diff --git a/hybridkem-x25519-kyber768/docs/classes/HybridkemX25519Kyber768.html b/hybridkem-x25519-kyber768/docs/classes/HybridkemX25519Kyber768.html index 0ad632d29..36f4d6e8f 100644 --- a/hybridkem-x25519-kyber768/docs/classes/HybridkemX25519Kyber768.html +++ b/hybridkem-x25519-kyber768/docs/classes/HybridkemX25519Kyber768.html @@ -1,51 +1,12 @@ -HybridkemX25519Kyber768 | @hpke/hybridkem-x25519-kyber768
      -
      - -
      -
      -
      - -
      -

      The Hybrid Post-Quantum KEM (X25519, Kyber768).

      +HybridkemX25519Kyber768 | @hpke/hybridkem-x25519-kyber768

      The Hybrid Post-Quantum KEM (X25519, Kyber768).

      This class is implemented using pqc-kyber.

      The instance of this class can be specified to the CipherSuiteParams as follows:

      -
      -
      -

      Example

      import { Aes128Gcm, CipherSuite, HkdfSha256 } from "http://deno.land/x/hpke/core/mod.ts";
      import { HybridkemX25519Kyber768 } from "https://deno.land/x/hpke/x/hybridkem-x25519-kyber768/mod.ts";
      const suite = new CipherSuite({
      kem: new HybridkemX25519Kyber768(),
      kdf: new HkdfSha256(),
      aead: new Aes128Gcm(),
      }); +

      Example

      import { Aes128Gcm, CipherSuite, HkdfSha256 } from "http://deno.land/x/hpke/core/mod.ts";
      import { HybridkemX25519Kyber768 } from "https://deno.land/x/hpke/x/hybridkem-x25519-kyber768/mod.ts";
      const suite = new CipherSuite({
      kem: new HybridkemX25519Kyber768(),
      kdf: new HkdfSha256(),
      aead: new Aes128Gcm(),
      });
      -
      -
      -

      Hierarchy

      -
        -
      • Hybridkem -
          -
        • HybridkemX25519Kyber768
      -
      -
      -
      - -
      -
      -

      Constructors

      -
      -
      -

      Properties

      -
      _a +

      Hierarchy

      • Hybridkem
        • HybridkemX25519Kyber768

      Constructors

      Properties

      _a _b _kdf auth @@ -55,10 +16,7 @@

      Properties

      privateKeySize publicKeySize secretSize -
      -
      -

      Methods

      -

      Methods

      -
      -

      Constructors

      -
      - -
      -
      -

      Properties

      -
      - -
      _a: DhkemInterface
      -
      - -
      _b: KemInterface
      -
      - -
      _kdf: KdfInterface
      -
      - -
      auth: boolean = false
      -
      - -
      encSize: number = 1120
      -
      - -
      id: KemId = KemId.HybridkemX25519Kyber768
      -
      - -
      name: string = "X25519Kyber25519"
      -
      - -
      privateKeySize: number = 2432
      -
      - -
      publicKeySize: number = 1216
      -
      - -
      secretSize: number = 64
      -
      -

      Methods

      -
      - -
        - -
      • -
        -

        Parameters

        -
          -
        • -
          params: RecipientContextParams
        -

        Returns Promise<ArrayBuffer>

      -
      - -
        - -
      • -
        -

        Parameters

        -
          -
        • -
          ikm: ArrayBuffer
        -

        Returns Promise<CryptoKeyPair>

      -
      - -
        - -
      • -
        -

        Parameters

        -
          -
        • -
          key: ArrayBuffer
        -

        Returns Promise<CryptoKey>

      -
      - -
        - -
      • -
        -

        Parameters

        -
          -
        • -
          key: ArrayBuffer
        -

        Returns Promise<CryptoKey>

      -
      - -
        - -
      • -
        -

        Parameters

        -
          -
        • -
          params: SenderContextParams
        -

        Returns Promise<{
            enc: ArrayBuffer;
            sharedSecret: ArrayBuffer;
        }>

      -
      - -
        - -
      • -

        Returns Promise<CryptoKeyPair>

      -
      - -
        - -
      • -
        -

        Parameters

        -
          -
        • -
          format: "raw" | "jwk"
        • -
        • -
          key: ArrayBuffer | JsonWebKey
        • -
        • -
          isPublic: boolean = true
        -

        Returns Promise<CryptoKey>

      -
      - -
        - -
      • -
        -

        Parameters

        -
          -
        • -
          key: CryptoKey
        -

        Returns Promise<ArrayBuffer>

      -
      - -
        - -
      • -
        -

        Parameters

        -
          -
        • -
          key: CryptoKey
        -

        Returns Promise<ArrayBuffer>

      -
      - -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +

      Constructors

      Properties

      _a: DhkemInterface
      _b: KemInterface
      _kdf: KdfInterface
      auth: boolean = false
      encSize: number = 1120
      id: KemId = KemId.HybridkemX25519Kyber768
      name: string = "X25519Kyber25519"
      privateKeySize: number = 2432
      publicKeySize: number = 1216
      secretSize: number = 64

      Methods

      • Parameters

        • params: RecipientContextParams

        Returns Promise<ArrayBuffer>

      • Parameters

        • ikm: ArrayBuffer

        Returns Promise<CryptoKeyPair>

      • Parameters

        • key: ArrayBuffer

        Returns Promise<CryptoKey>

      • Parameters

        • key: ArrayBuffer

        Returns Promise<CryptoKey>

      • Parameters

        • params: SenderContextParams

        Returns Promise<{
            enc: ArrayBuffer;
            sharedSecret: ArrayBuffer;
        }>

      • Returns Promise<CryptoKeyPair>

      • Parameters

        • format: "raw" | "jwk"
        • key: ArrayBuffer | JsonWebKey
        • isPublic: boolean = true

        Returns Promise<CryptoKey>

      • Parameters

        • key: CryptoKey

        Returns Promise<ArrayBuffer>

      • Parameters

        • key: CryptoKey

        Returns Promise<ArrayBuffer>

      Generated using TypeDoc

      \ No newline at end of file diff --git a/hybridkem-x25519-kyber768/docs/index.html b/hybridkem-x25519-kyber768/docs/index.html index 30929df40..13f7a8eb1 100644 --- a/hybridkem-x25519-kyber768/docs/index.html +++ b/hybridkem-x25519-kyber768/docs/index.html @@ -1,18 +1,4 @@ -@hpke/hybridkem-x25519-kyber768
      -
      - -
      -
      -
      -
      -

      @hpke/hybridkem-x25519-kyber768

      -

      @hpke/hybridkem-x25519-kyber768

      +@hpke/hybridkem-x25519-kyber768

      @hpke/hybridkem-x25519-kyber768

      @hpke/hybridkem-x25519-kyber768

      A TypeScript Hybrid Public Key Encryption (HPKE) module extension for the hybrid post-quantum KEM(X25519, Kyber768) compliant with X25519Kyber768Draft00 hybrid post-quantum KEM for HPKE. The kyber implementation included in this module is based on ntontutoveanu/crystals-kyber-javascript published under the MIT license. Note that this module is EXPERIMENTAL and the referred specification has not been standardized yet. @@ -28,15 +14,15 @@

      @hpke/hybridkem-x25519-kyber768

      Index

      Contributing

      We welcome all kind of contributions, filing issues, suggesting new features or sending PRs.

      -
      -
      - -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +

      Generated using TypeDoc

      \ No newline at end of file diff --git a/hybridkem-x25519-kyber768/docs/modules.html b/hybridkem-x25519-kyber768/docs/modules.html index 05ac2f758..a15ba2f62 100644 --- a/hybridkem-x25519-kyber768/docs/modules.html +++ b/hybridkem-x25519-kyber768/docs/modules.html @@ -1,43 +1,2 @@ -@hpke/hybridkem-x25519-kyber768
      -
      - -
      -
      -
      -
      -

      @hpke/hybridkem-x25519-kyber768

      -
      -
      -

      Index

      -
      -

      Classes

      -
      -
      - -
      -
      -

      Generated using TypeDoc

      -
      \ No newline at end of file +@hpke/hybridkem-x25519-kyber768

      @hpke/hybridkem-x25519-kyber768

      Index

      Classes

      Generated using TypeDoc

      \ No newline at end of file diff --git a/src/hpke.js b/src/hpke.js index d476bda10..73bd08747 100644 --- a/src/hpke.js +++ b/src/hpke.js @@ -1,4 +1,4 @@ -var ei={},Mr=ti(globalThis,ei);function ti(r,e){return new Proxy(r,{get(t,n,i){return n in e?e[n]:r[n]},set(t,n,i){return n in e&&delete e[n],r[n]=i,!0},deleteProperty(t,n){let i=!1;return n in e&&(delete e[n],i=!0),n in r&&(delete r[n],i=!0),i},ownKeys(t){let n=Reflect.ownKeys(r),i=Reflect.ownKeys(e),o=new Set(i);return[...n.filter(s=>!o.has(s)),...i]},defineProperty(t,n,i){return n in e&&delete e[n],Reflect.defineProperty(r,n,i),!0},getOwnPropertyDescriptor(t,n){return n in e?Reflect.getOwnPropertyDescriptor(e,n):Reflect.getOwnPropertyDescriptor(r,n)},has(t,n){return n in e||n in r}})}var ir=class extends Error{constructor(e){let t;e instanceof Error?t=e.message:typeof e=="string"?t=e:t="",super(t),this.name=this.constructor.name}},se=class extends ir{},ee=class extends se{},Gr=class extends se{},ae=class extends se{},te=class extends se{},yt=class extends se{},bt=class extends se{},wt=class extends se{},xt=class extends se{},mt=class extends se{},gt=class extends se{},Pe=class extends se{},ce=class extends se{};async function ni(){if(Mr!==void 0&&globalThis.crypto!==void 0)return globalThis.crypto.subtle;try{let{webcrypto:r}=await import("crypto");return r.subtle}catch(r){throw new ce(r)}}var we=class{constructor(){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}async _setup(){this._api===void 0&&(this._api=await ni())}};var _e={Base:0,Psk:1,Auth:2,AuthPsk:3},Fr={NotAssigned:0,DhkemP256HkdfSha256:16,DhkemP384HkdfSha384:17,DhkemP521HkdfSha512:18,DhkemSecp256k1HkdfSha256:19,DhkemX25519HkdfSha256:32,DhkemX448HkdfSha512:33,HybridkemX25519Kyber768:48},F=Fr,$r={HkdfSha256:1,HkdfSha384:2,HkdfSha512:3},Ee=$r,Vr={Aes128Gcm:1,Aes256Gcm:2,Chacha20Poly1305:3,ExportOnly:65535},fe=Vr;var Zr=["encrypt","decrypt"];var or=class extends we{constructor(e){super(),Object.defineProperty(this,"_rawKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._rawKey=e}async seal(e,t,n){await this._setupKey();let i={name:"AES-GCM",iv:e,additionalData:n};return await this._api.encrypt(i,this._key,t)}async open(e,t,n){await this._setupKey();let i={name:"AES-GCM",iv:e,additionalData:n};return await this._api.decrypt(i,this._key,t)}async _setupKey(){if(this._key!==void 0)return;await this._setup();let e=await this._importKey(this._rawKey);new Uint8Array(this._rawKey).fill(0),this._key=e}async _importKey(e){return await this._api.importKey("raw",e,{name:"AES-GCM"},!0,Zr)}},rt=class{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:fe.Aes128Gcm}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:16}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}createEncryptionContext(e){return new or(e)}},_t=class extends rt{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:fe.Aes256Gcm}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}};var Et=class{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:fe.ExportOnly}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:0})}createEncryptionContext(e){throw new ce("Export only")}};var ii=r=>r instanceof Uint8Array;var ve=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),Xr=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),oi=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!oi)throw new Error("Non little-endian hardware is not supported");function vt(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function kt(r){if(typeof r=="string"&&(r=vt(r)),!ii(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}var si=r=>Object.prototype.toString.call(r)==="[object Object]"&&r.constructor===Object;function Wr(r,e){if(e!==void 0&&(typeof e!="object"||!si(e)))throw new Error("options must be object or undefined");return Object.assign(r,e)}function je(r,e){if(!(r instanceof Uint8Array))throw new Error("Uint8Array expected");if(typeof e=="number"&&r.length!==e)throw new Error(`Uint8Array length ${e} expected`)}function Yr(r,e){if(r.length!==e.length)throw new Error("equalBytes: Different size of Uint8Arrays");let t=!0;for(let n=0;n>i&o),a=Number(t&o),c=n?4:0,u=n?0:4;r.setUint32(e+c,s,n),r.setUint32(e+u,a,n)}function ar(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function ai(r){if(typeof r!="boolean")throw new Error(`Expected boolean, not ${r}`)}function Jr(r,...e){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}function ci(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("hash must be wrapped by utils.wrapConstructor");ar(r.outputLen),ar(r.blockLen)}function fi(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function ui(r,e){Jr(r);let t=e.outputLen;if(r.lengthr[e++]&255|(r[e++]&255)<<8,cr=class{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=kt(e),je(e,32);let t=re(e,0),n=re(e,2),i=re(e,4),o=re(e,6),s=re(e,8),a=re(e,10),c=re(e,12),u=re(e,14);this.r[0]=t&8191,this.r[1]=(t>>>13|n<<3)&8191,this.r[2]=(n>>>10|i<<6)&7939,this.r[3]=(i>>>7|o<<9)&8191,this.r[4]=(o>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|a<<2)&8191,this.r[7]=(a>>>11|c<<5)&8065,this.r[8]=(c>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let f=0;f<8;f++)this.pad[f]=re(e,16+2*f)}process(e,t,n=!1){let i=n?0:2048,{h:o,r:s}=this,a=s[0],c=s[1],u=s[2],f=s[3],l=s[4],d=s[5],m=s[6],v=s[7],_=s[8],S=s[9],V=re(e,t+0),W=re(e,t+2),b=re(e,t+4),U=re(e,t+6),E=re(e,t+8),H=re(e,t+10),j=re(e,t+12),I=re(e,t+14),x=o[0]+(V&8191),P=o[1]+((V>>>13|W<<3)&8191),B=o[2]+((W>>>10|b<<6)&8191),A=o[3]+((b>>>7|U<<9)&8191),k=o[4]+((U>>>4|E<<12)&8191),q=o[5]+(E>>>1&8191),C=o[6]+((E>>>14|H<<2)&8191),M=o[7]+((H>>>11|j<<5)&8191),G=o[8]+((j>>>8|I<<8)&8191),p=o[9]+(I>>>5|i),h=0,y=h+x*a+P*(5*S)+B*(5*_)+A*(5*v)+k*(5*m);h=y>>>13,y&=8191,y+=q*(5*d)+C*(5*l)+M*(5*f)+G*(5*u)+p*(5*c),h+=y>>>13,y&=8191;let w=h+x*c+P*a+B*(5*S)+A*(5*_)+k*(5*v);h=w>>>13,w&=8191,w+=q*(5*m)+C*(5*d)+M*(5*l)+G*(5*f)+p*(5*u),h+=w>>>13,w&=8191;let g=h+x*u+P*c+B*a+A*(5*S)+k*(5*_);h=g>>>13,g&=8191,g+=q*(5*v)+C*(5*m)+M*(5*d)+G*(5*l)+p*(5*f),h+=g>>>13,g&=8191;let L=h+x*f+P*u+B*c+A*a+k*(5*S);h=L>>>13,L&=8191,L+=q*(5*_)+C*(5*v)+M*(5*m)+G*(5*d)+p*(5*l),h+=L>>>13,L&=8191;let T=h+x*l+P*f+B*u+A*c+k*a;h=T>>>13,T&=8191,T+=q*(5*S)+C*(5*_)+M*(5*v)+G*(5*m)+p*(5*d),h+=T>>>13,T&=8191;let R=h+x*d+P*l+B*f+A*u+k*c;h=R>>>13,R&=8191,R+=q*a+C*(5*S)+M*(5*_)+G*(5*v)+p*(5*m),h+=R>>>13,R&=8191;let O=h+x*m+P*d+B*l+A*f+k*u;h=O>>>13,O&=8191,O+=q*c+C*a+M*(5*S)+G*(5*_)+p*(5*v),h+=O>>>13,O&=8191;let N=h+x*v+P*m+B*d+A*l+k*f;h=N>>>13,N&=8191,N+=q*u+C*c+M*a+G*(5*S)+p*(5*_),h+=N>>>13,N&=8191;let X=h+x*_+P*v+B*m+A*d+k*l;h=X>>>13,X&=8191,X+=q*f+C*u+M*c+G*a+p*(5*S),h+=X>>>13,X&=8191;let J=h+x*S+P*_+B*v+A*m+k*d;h=J>>>13,J&=8191,J+=q*l+C*f+M*u+G*c+p*a,h+=J>>>13,J&=8191,h=(h<<2)+h|0,h=h+y|0,y=h&8191,h=h>>>13,w+=h,o[0]=y,o[1]=w,o[2]=g,o[3]=L,o[4]=T,o[5]=R,o[6]=O,o[7]=N,o[8]=X,o[9]=J}finalize(){let{h:e,pad:t}=this,n=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=i,i=e[a]>>>13,e[a]&=8191;e[0]+=i*5,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,n[0]=e[0]+5,i=n[0]>>>13,n[0]&=8191;for(let a=1;a<10;a++)n[a]=e[a]+i,i=n[a]>>>13,n[a]&=8191;n[9]-=8192;let o=(i^1)-1;for(let a=0;a<10;a++)n[a]&=o;o=~o;for(let a=0;a<10;a++)e[a]=e[a]&o|n[a];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+t[0];e[0]=s&65535;for(let a=1;a<8;a++)s=(e[a]+t[a]|0)+(s>>>16)|0,e[a]=s&65535}update(e){ie.exists(this);let{buffer:t,blockLen:n}=this;e=kt(e);let i=e.length;for(let o=0;o>>0,e[o++]=n[s]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}};function li(r){let e=(n,i)=>r(i).update(kt(n)).digest(),t=r(new Uint8Array(32));return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=n=>r(n),e}var Qr=li(r=>new cr(r));var di=vt("expand 16-byte k"),pi=vt("expand 32-byte k"),yi=ve(di),bi=ve(pi),St=r=>!(r.byteOffset%4),en=r=>{let{core:e,rounds:t,counterRight:n,counterLen:i,allow128bitKeys:o,extendNonceFn:s,blockLen:a}=Wr({rounds:20,counterRight:!1,counterLen:8,allow128bitKeys:!0,blockLen:64},r);ie.number(i),ie.number(t),ie.number(a),ie.bool(n),ie.bool(o);let c=a/4;if(a%4!==0)throw new Error("Salsa/ChaCha: blockLen must be aligned to 4 bytes");return(u,f,l,d,m=0)=>{if(ie.bytes(u),ie.bytes(f),ie.bytes(l),d||(d=new Uint8Array(l.length)),ie.bytes(d),ie.number(m),m<0||m>=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");if(d.length=2**32-1)throw new Error("Salsa/ChaCha: counter overflow");let B=Math.min(a,I-x);if(B===a&&j&&H){let A=x/4;if(x%4!==0)throw new Error("Salsa/ChaCha: invalid block position");for(let k=0;kr<>>32-e;function wi(r,e,t,n,i,o=20){let s=r[0],a=r[1],c=r[2],u=r[3],f=e[0],l=e[1],d=e[2],m=e[3],v=e[4],_=e[5],S=e[6],V=e[7],W=i,b=t[0],U=t[1],E=t[2],H=s,j=a,I=c,x=u,P=f,B=l,A=d,k=m,q=v,C=_,M=S,G=V,p=W,h=b,y=U,w=E;for(let L=0;L{r.update(e);let t=e.length%16;t&&r.update(mi.subarray(t))},rn=(r,e,t,n,i)=>{let o=r(e,t,new Uint8Array(32)),s=Qr.create(o);i&&tn(s,i),tn(s,n);let a=new Uint8Array(16),c=Xr(a);sr(c,0,BigInt(i?i.length:0),!0),sr(c,8,BigInt(n.length),!0),s.update(a);let u=s.digest();return o.fill(0),u},gi=r=>(e,t,n)=>(je(e,32),je(t),{tagLength:16,encrypt:(o,s)=>{let a=o.length,c=a+16;s?je(s,c):s=new Uint8Array(c),r(e,t,o,s,1);let u=rn(r,e,t,s.subarray(0,-16),n);return s.set(u,a),s},decrypt:(o,s)=>{let a=o.length,c=a-16;if(a<16)throw new Error("encrypted data must be at least 16 bytes");s?je(s,c):s=new Uint8Array(c);let u=o.subarray(0,-16),f=o.subarray(-16),l=rn(r,e,t,u,n);if(!Yr(f,l))throw new Error("invalid tag");return r(e,t,u,s,1),s}}),fr=gi(xi);var ur=class{constructor(e){Object.defineProperty(this,"_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._key=new Uint8Array(e)}async seal(e,t,n){return await this._seal(e,t,n)}async open(e,t,n){return await this._open(e,t,n)}_seal(e,t,n){return new Promise(i=>{let o=fr(this._key,new Uint8Array(e),new Uint8Array(n)).encrypt(new Uint8Array(t));i(o.buffer)})}_open(e,t,n){return new Promise(i=>{let o=fr(this._key,new Uint8Array(e),new Uint8Array(n)).decrypt(new Uint8Array(t));i(o.buffer)})}},At=class{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:fe.Chacha20Poly1305}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}createEncryptionContext(e){return new ur(e)}};function nt(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function it(r,...e){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}function nn(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");nt(r.outputLen),nt(r.blockLen)}function ke(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function Bt(r,e){it(r);let t=e.outputLen;if(r.lengthr instanceof Uint8Array;var sn=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),It=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),pe=(r,e)=>r<<32-e|r>>>e,_i=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!_i)throw new Error("Non little-endian hardware is not supported");function ot(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Le(r){if(typeof r=="string"&&(r=ot(r)),!on(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}function Lt(...r){let e=new Uint8Array(r.reduce((n,i)=>n+i.length,0)),t=0;return r.forEach(n=>{if(!on(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}var Ie=class{clone(){return this._cloneInto()}},Bs={}.toString;function xe(r){let e=n=>r().update(Le(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function an(r){let e=(n,i)=>r(i).update(Le(n)).digest(),t=r({});return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=n=>r(n),e}function Ve(r=32){if(Pt&&typeof Pt.getRandomValues=="function")return Pt.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}var Kt=class extends Ie{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,nn(e);let n=Le(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;snew Kt(r,e).update(t).digest();qe.create=(r,e)=>new Kt(r,e);function Ei(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(t>>i&o),a=Number(t&o),c=n?4:0,u=n?0:4;r.setUint32(e+c,s,n),r.setUint32(e+u,a,n)}var Ze=class extends Ie{constructor(e,t,n,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=It(this.buffer)}update(e){ke(this);let{view:t,buffer:n,blockLen:i}=this;e=Le(e);let o=e.length;for(let s=0;si-s&&(this.process(n,0),s=0);for(let l=s;lf.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;lr&e^~r&t,ki=(r,e,t)=>r&e^r&t^e&t,Si=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Ke=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ue=new Uint32Array(64),hr=class extends Ze{constructor(){super(64,32,8,!1),this.A=Ke[0]|0,this.B=Ke[1]|0,this.C=Ke[2]|0,this.D=Ke[3]|0,this.E=Ke[4]|0,this.F=Ke[5]|0,this.G=Ke[6]|0,this.H=Ke[7]|0}get(){let{A:e,B:t,C:n,D:i,E:o,F:s,G:a,H:c}=this;return[e,t,n,i,o,s,a,c]}set(e,t,n,i,o,s,a,c){this.A=e|0,this.B=t|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=a|0,this.H=c|0}process(e,t){for(let l=0;l<16;l++,t+=4)Ue[l]=e.getUint32(t,!1);for(let l=16;l<64;l++){let d=Ue[l-15],m=Ue[l-2],v=pe(d,7)^pe(d,18)^d>>>3,_=pe(m,17)^pe(m,19)^m>>>10;Ue[l]=_+Ue[l-7]+v+Ue[l-16]|0}let{A:n,B:i,C:o,D:s,E:a,F:c,G:u,H:f}=this;for(let l=0;l<64;l++){let d=pe(a,6)^pe(a,11)^pe(a,25),m=f+d+vi(a,c,u)+Si[l]+Ue[l]|0,_=(pe(n,2)^pe(n,13)^pe(n,22))+ki(n,i,o)|0;f=u,u=c,c=a,a=s+m|0,s=o,o=i,i=n,n=m+_|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,a=a+this.E|0,c=c+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(n,i,o,s,a,c,u,f)}roundClean(){Ue.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var cn=xe(()=>new hr);var $=new Uint8Array(0);var fn=new Uint8Array([72,80,75,69,45,118,49]),st=class extends we{constructor(){super(),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:Ee.HkdfSha256}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:$}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}init(e){this._suiteId=e}buildLabeledIkm(e,t){this._checkInit();let n=new Uint8Array(7+this._suiteId.byteLength+e.byteLength+t.byteLength);return n.set(fn,0),n.set(this._suiteId,7),n.set(e,7+this._suiteId.byteLength),n.set(t,7+this._suiteId.byteLength+e.byteLength),n}buildLabeledInfo(e,t,n){this._checkInit();let i=new Uint8Array(9+this._suiteId.byteLength+e.byteLength+t.byteLength);return i.set(new Uint8Array([0,n]),0),i.set(fn,2),i.set(this._suiteId,9),i.set(e,9+this._suiteId.byteLength),i.set(t,9+this._suiteId.byteLength+e.byteLength),i}async extract(e,t){if(await this._setup(),e.byteLength===0&&(e=new ArrayBuffer(this.hashSize)),e.byteLength!==this.hashSize)throw new ee("The salt length must be the same as the hashSize");let n=await this._api.importKey("raw",e,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",n,t)}async expand(e,t,n){await this._setup();let i=await this._api.importKey("raw",e,this.algHash,!1,["sign"]),o=new ArrayBuffer(n),s=new Uint8Array(o),a=$,c=new Uint8Array(t),u=new Uint8Array(1);if(n>255*this.hashSize)throw new Error("Entropy limit reached");let f=new Uint8Array(this.hashSize+c.length+1);for(let l=1,d=0;d=a.length?(s.set(a,d),d+=a.length):(s.set(a.slice(0,s.length-d),d),d+=s.length-d);return o}async extractAndExpand(e,t,n,i){await this._setup();let o=await this._api.importKey("raw",t,"HKDF",!1,["deriveBits"]);return await this._api.deriveBits({name:"HKDF",hash:this.algHash.hash,salt:e,info:n},o,i*8)}async labeledExtract(e,t,n){return await this.extract(e,this.buildLabeledIkm(t,n))}async labeledExpand(e,t,n,i){return await this.expand(e,this.buildLabeledInfo(t,n,i),i)}_checkInit(){if(this._suiteId===$)throw new Error("Not initialized. Call init()")}},Ut=class extends st{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:Ee.HkdfSha256}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}},Ot=class extends st{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:Ee.HkdfSha384}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:48}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-384",length:384}})}},Ht=class extends st{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:Ee.HkdfSha512}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:64}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-512",length:512}})}};var Oe=class extends Ut{async extract(e,t){if(await this._setup(),e.byteLength===0&&(e=new ArrayBuffer(this.hashSize)),e.byteLength!==this.hashSize)return qe(cn,new Uint8Array(e),new Uint8Array(t));let n=await this._api.importKey("raw",e,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",n,t)}};var Tt=BigInt(4294967295),lr=BigInt(32);function un(r,e=!1){return e?{h:Number(r&Tt),l:Number(r>>lr&Tt)}:{h:Number(r>>lr&Tt)|0,l:Number(r&Tt)|0}}function dr(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let i=0;iBigInt(r>>>0)<>>0),Bi=(r,e,t)=>r>>>t,Pi=(r,e,t)=>r<<32-t|e>>>t,Ii=(r,e,t)=>r>>>t|e<<32-t,Li=(r,e,t)=>r<<32-t|e>>>t,Ki=(r,e,t)=>r<<64-t|e>>>t-32,Ui=(r,e,t)=>r>>>t-32|e<<64-t,Oi=(r,e)=>e,Hi=(r,e)=>r,pr=(r,e,t)=>r<>>32-t,yr=(r,e,t)=>e<>>32-t,br=(r,e,t)=>e<>>64-t,wr=(r,e,t)=>r<>>64-t;function Ti(r,e,t,n){let i=(e>>>0)+(n>>>0);return{h:r+t+(i/2**32|0)|0,l:i|0}}var Ci=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),Ni=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,Ri=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),Di=(r,e,t,n,i)=>e+t+n+i+(r/2**32|0)|0,zi=(r,e,t,n,i)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(i>>>0),ji=(r,e,t,n,i,o)=>e+t+n+i+o+(r/2**32|0)|0;var qi={fromBig:un,split:dr,toBig:Ai,shrSH:Bi,shrSL:Pi,rotrSH:Ii,rotrSL:Li,rotrBH:Ki,rotrBL:Ui,rotr32H:Oi,rotr32L:Hi,rotlSH:pr,rotlSL:yr,rotlBH:br,rotlBL:wr,add:Ti,add3L:Ci,add3H:Ni,add4L:Ri,add4H:Di,add5H:ji,add5L:zi},K=qi;var[Mi,Gi]=(()=>K.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))))(),He=new Uint32Array(80),Te=new Uint32Array(80),Ct=class extends Ze{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:n,Bl:i,Ch:o,Cl:s,Dh:a,Dl:c,Eh:u,El:f,Fh:l,Fl:d,Gh:m,Gl:v,Hh:_,Hl:S}=this;return[e,t,n,i,o,s,a,c,u,f,l,d,m,v,_,S]}set(e,t,n,i,o,s,a,c,u,f,l,d,m,v,_,S){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=a|0,this.Dl=c|0,this.Eh=u|0,this.El=f|0,this.Fh=l|0,this.Fl=d|0,this.Gh=m|0,this.Gl=v|0,this.Hh=_|0,this.Hl=S|0}process(e,t){for(let b=0;b<16;b++,t+=4)He[b]=e.getUint32(t),Te[b]=e.getUint32(t+=4);for(let b=16;b<80;b++){let U=He[b-15]|0,E=Te[b-15]|0,H=K.rotrSH(U,E,1)^K.rotrSH(U,E,8)^K.shrSH(U,E,7),j=K.rotrSL(U,E,1)^K.rotrSL(U,E,8)^K.shrSL(U,E,7),I=He[b-2]|0,x=Te[b-2]|0,P=K.rotrSH(I,x,19)^K.rotrBH(I,x,61)^K.shrSH(I,x,6),B=K.rotrSL(I,x,19)^K.rotrBL(I,x,61)^K.shrSL(I,x,6),A=K.add4L(j,B,Te[b-7],Te[b-16]),k=K.add4H(A,H,P,He[b-7],He[b-16]);He[b]=k|0,Te[b]=A|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:a,Cl:c,Dh:u,Dl:f,Eh:l,El:d,Fh:m,Fl:v,Gh:_,Gl:S,Hh:V,Hl:W}=this;for(let b=0;b<80;b++){let U=K.rotrSH(l,d,14)^K.rotrSH(l,d,18)^K.rotrBH(l,d,41),E=K.rotrSL(l,d,14)^K.rotrSL(l,d,18)^K.rotrBL(l,d,41),H=l&m^~l&_,j=d&v^~d&S,I=K.add5L(W,E,j,Gi[b],Te[b]),x=K.add5H(I,V,U,H,Mi[b],He[b]),P=I|0,B=K.rotrSH(n,i,28)^K.rotrBH(n,i,34)^K.rotrBH(n,i,39),A=K.rotrSL(n,i,28)^K.rotrBL(n,i,34)^K.rotrBL(n,i,39),k=n&o^n&a^o&a,q=i&s^i&c^s&c;V=_|0,W=S|0,_=m|0,S=v|0,m=l|0,v=d|0,{h:l,l:d}=K.add(u|0,f|0,x|0,P|0),u=a|0,f=c|0,a=o|0,c=s|0,o=n|0,s=i|0;let C=K.add3L(P,A,q);n=K.add3H(C,x,B,k),i=C|0}({h:n,l:i}=K.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=K.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:a,l:c}=K.add(this.Ch|0,this.Cl|0,a|0,c|0),{h:u,l:f}=K.add(this.Dh|0,this.Dl|0,u|0,f|0),{h:l,l:d}=K.add(this.Eh|0,this.El|0,l|0,d|0),{h:m,l:v}=K.add(this.Fh|0,this.Fl|0,m|0,v|0),{h:_,l:S}=K.add(this.Gh|0,this.Gl|0,_|0,S|0),{h:V,l:W}=K.add(this.Hh|0,this.Hl|0,V|0,W|0),this.set(n,i,o,s,a,c,u,f,l,d,m,v,_,S,V,W)}roundClean(){He.fill(0),Te.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var xr=class extends Ct{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}},at=xe(()=>new Ct);var hn=xe(()=>new xr);var Xe=class extends Ot{async extract(e,t){if(await this._setup(),e.byteLength===0&&(e=new ArrayBuffer(this.hashSize)),e.byteLength!==this.hashSize)return qe(hn,new Uint8Array(e),new Uint8Array(t));let n=await this._api.importKey("raw",e,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",n,t)}};var Ce=class extends Ht{async extract(e,t){if(await this._setup(),e.byteLength===0&&(e=new ArrayBuffer(this.hashSize)),e.byteLength!==this.hashSize)return qe(at,new Uint8Array(e),new Uint8Array(t));let n=await this._api.importKey("raw",e,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",n,t)}};var ln=new Uint8Array([75,69,77,0,0]);var We=r=>typeof r=="object"&&r!==null&&typeof r.privateKey=="object"&&typeof r.publicKey=="object";function me(r,e){if(e<=0)throw new Error("i2Osp: too small size");if(r>=256**e)throw new Error("i2Osp: too large integer");let t=new Uint8Array(e);for(let n=0;n>8;return t}function ct(r,e){let t=new Uint8Array(r.length+e.length);return t.set(r,0),t.set(e,r.length),t}function Ne(r){let e=r.replace(/-/g,"+").replace(/_/g,"/"),t=atob(e),n=new Uint8Array(t.length);for(let i=0;i8192)throw new ee("Too long ikm");return await this._prim.deriveKeyPair(e)}async encap(e){let t;e.ekm===void 0?t=await this.generateKeyPair():We(e.ekm)?t=e.ekm:t=await this.deriveKeyPair(e.ekm);let n=await this._prim.serializePublicKey(t.publicKey),i=await this._prim.serializePublicKey(e.recipientPublicKey);try{let o;if(e.senderKey===void 0)o=new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey));else{let c=We(e.senderKey)?e.senderKey.privateKey:e.senderKey,u=new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey)),f=new Uint8Array(await this._prim.dh(c,e.recipientPublicKey));o=ct(u,f)}let s;if(e.senderKey===void 0)s=ct(new Uint8Array(n),new Uint8Array(i));else{let c=We(e.senderKey)?e.senderKey.publicKey:await this._prim.derivePublicKey(e.senderKey),u=await this._prim.serializePublicKey(c);s=Vi(new Uint8Array(n),new Uint8Array(i),new Uint8Array(u))}let a=await this._generateSharedSecret(o,s);return{enc:n,sharedSecret:a}}catch(o){throw new yt(o)}}async decap(e){let t=await this._prim.deserializePublicKey(e.enc),n=We(e.recipientKey)?e.recipientKey.privateKey:e.recipientKey,i=We(e.recipientKey)?e.recipientKey.publicKey:await this._prim.derivePublicKey(e.recipientKey),o=await this._prim.serializePublicKey(i);try{let s;if(e.senderPublicKey===void 0)s=new Uint8Array(await this._prim.dh(n,t));else{let c=new Uint8Array(await this._prim.dh(n,t)),u=new Uint8Array(await this._prim.dh(n,e.senderPublicKey));s=ct(c,u)}let a;if(e.senderPublicKey===void 0)a=ct(new Uint8Array(e.enc),new Uint8Array(o));else{let c=await this._prim.serializePublicKey(e.senderPublicKey);a=new Uint8Array(e.enc.byteLength+o.byteLength+c.byteLength),a.set(new Uint8Array(e.enc),0),a.set(new Uint8Array(o),e.enc.byteLength),a.set(new Uint8Array(c),e.enc.byteLength+o.byteLength)}return await this._generateSharedSecret(s,a)}catch(s){throw new bt(s)}}async _generateSharedSecret(e,t){let n=this._kdf.buildLabeledIkm(Fi,e),i=this._kdf.buildLabeledInfo($i,t,this.secretSize);return await this._kdf.extractAndExpand($,n,i,this.secretSize)}};var ue=["deriveBits"],Ye=new Uint8Array([100,107,112,95,112,114,107]),Nt=new Uint8Array([115,107]);var Rt=class{constructor(e){Object.defineProperty(this,"_num",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._num=new Uint8Array(e)}val(){return this._num}reset(){this._num.fill(0)}set(e){if(e.length!==this._num.length)throw new Error("Bignum.set: invalid argument");this._num.set(e)}isZero(){for(let e=0;ee[t])return!1}return!1}};var Zi=new Uint8Array([99,97,110,100,105,100,97,116,101]),Xi=new Uint8Array([255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255,188,230,250,173,167,23,158,132,243,185,202,194,252,99,37,81]),Wi=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,199,99,77,129,244,55,45,223,88,26,13,178,72,176,167,122,236,236,25,106,204,197,41,115]),Yi=new Uint8Array([1,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,81,134,135,131,191,47,150,107,127,204,1,72,247,9,165,208,59,181,201,184,137,156,71,174,187,111,183,30,145,56,100,9]),Ji=new Uint8Array([48,65,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,39,48,37,2,1,1,4,32]),Qi=new Uint8Array([48,78,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,55,48,53,2,1,1,4,48]),eo=new Uint8Array([48,96,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,73,48,71,2,1,1,4,66]),Re=class extends we{constructor(e,t){switch(super(),Object.defineProperty(this,"_hkdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_alg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nPk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nSk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nDh",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_bitmask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pkcs8AlgId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hkdf=t,e){case F.DhkemP256HkdfSha256:this._alg={name:"ECDH",namedCurve:"P-256"},this._nPk=65,this._nSk=32,this._nDh=32,this._order=Xi,this._bitmask=255,this._pkcs8AlgId=Ji;break;case F.DhkemP384HkdfSha384:this._alg={name:"ECDH",namedCurve:"P-384"},this._nPk=97,this._nSk=48,this._nDh=48,this._order=Wi,this._bitmask=255,this._pkcs8AlgId=Qi;break;default:this._alg={name:"ECDH",namedCurve:"P-521"},this._nPk=133,this._nSk=66,this._nDh=66,this._order=Yi,this._bitmask=1,this._pkcs8AlgId=eo;break}}async serializePublicKey(e){await this._setup();try{return await this._api.exportKey("raw",e)}catch(t){throw new ae(t)}}async deserializePublicKey(e){await this._setup();try{return await this._importRawKey(e,!0)}catch(t){throw new te(t)}}async serializePrivateKey(e){await this._setup();try{let t=await this._api.exportKey("jwk",e);if(!("d"in t))throw new Error("Not private key");return Ne(t.d)}catch(t){throw new ae(t)}}async deserializePrivateKey(e){await this._setup();try{return await this._importRawKey(e,!1)}catch(t){throw new te(t)}}async importKey(e,t,n){await this._setup();try{if(e==="raw")return await this._importRawKey(t,n);if(t instanceof ArrayBuffer)throw new Error("Invalid jwk key format");return await this._importJWK(t,n)}catch(i){throw new te(i)}}async generateKeyPair(){await this._setup();try{return await this._api.generateKey(this._alg,!0,ue)}catch(e){throw new ce(e)}}async deriveKeyPair(e){await this._setup();try{let t=await this._hkdf.labeledExtract($,Ye,new Uint8Array(e)),n=new Rt(this._nSk);for(let o=0;n.isZero()||!n.lessThan(this._order);o++){if(o>255)throw new Error("Faild to derive a key pair");let s=new Uint8Array(await this._hkdf.labeledExpand(t,Zi,me(o,1),this._nSk));s[0]=s[0]&this._bitmask,n.set(s)}let i=await this._deserializePkcs8Key(n.val());return n.reset(),{privateKey:i,publicKey:await this.derivePublicKey(i)}}catch(t){throw new Pe(t)}}async derivePublicKey(e){await this._setup();try{let t=await this._api.exportKey("jwk",e);return delete t.d,delete t.key_ops,await this._api.importKey("jwk",t,this._alg,!0,[])}catch(t){throw new te(t)}}async dh(e,t){try{return await this._setup(),await this._api.deriveBits({name:"ECDH",public:t},e,this._nDh*8)}catch(n){throw new ae(n)}}async _importRawKey(e,t){if(t&&e.byteLength!==this._nPk)throw new Error("Invalid public key for the ciphersuite");if(!t&&e.byteLength!==this._nSk)throw new Error("Invalid private key for the ciphersuite");return t?await this._api.importKey("raw",e,this._alg,!0,[]):await this._deserializePkcs8Key(new Uint8Array(e))}async _importJWK(e,t){if(typeof e.crv>"u"||e.crv!==this._alg.namedCurve)throw new Error(`Invalid crv: ${e.crv}`);if(t){if(typeof e.d<"u")throw new Error("Invalid key: `d` should not be set");return await this._api.importKey("jwk",e,this._alg,!0,[])}if(typeof e.d>"u")throw new Error("Invalid key: `d` not found");return await this._api.importKey("jwk",e,this._alg,!0,ue)}async _deserializePkcs8Key(e){let t=new Uint8Array(this._pkcs8AlgId.length+e.length);return t.set(this._pkcs8AlgId,0),t.set(e,this._pkcs8AlgId.length),await this._api.importKey("pkcs8",t,this._alg,!0,ue)}};var Dt=class extends de{constructor(){let e=new Oe,t=new Re(F.DhkemP256HkdfSha256,e);super(F.DhkemP256HkdfSha256,t,e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:F.DhkemP256HkdfSha256}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:32})}};var zt=class extends de{constructor(){let e=new Xe,t=new Re(F.DhkemP384HkdfSha384,e);super(F.DhkemP384HkdfSha384,t,e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:F.DhkemP384HkdfSha384}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:48}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:97}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:97}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:48})}};var jt=class extends de{constructor(){let e=new Ce,t=new Re(F.DhkemP521HkdfSha512,e);super(F.DhkemP521HkdfSha512,t,e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:F.DhkemP521HkdfSha512}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:64}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:133}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:133}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:64})}};var Da=BigInt(0),to=BigInt(1),ro=BigInt(2),qt=r=>r instanceof Uint8Array,no=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function Mt(r){if(!qt(r))throw new Error("Uint8Array expected");let e="";for(let t=0;tn+i.length,0)),t=0;return r.forEach(n=>{if(!qt(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}var bn=r=>(ro<typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function De(r,e,t={}){let n=(i,o,s)=>{let a=io[o];if(typeof a!="function")throw new Error(`Invalid validator "${o}", expected function`);let c=r[i];if(!(s&&c===void 0)&&!a(c,r))throw new Error(`Invalid param ${String(i)}=${c} (${typeof c}), expected ${o}`)};for(let[i,o]of Object.entries(e))n(i,o,!1);for(let[i,o]of Object.entries(t))n(i,o,!0);return r}var Q=BigInt(0),Y=BigInt(1),Fe=BigInt(2),so=BigInt(3),_r=BigInt(4),wn=BigInt(5),xn=BigInt(8),ao=BigInt(9),co=BigInt(16);function z(r,e){let t=r%e;return t>=Q?t:e+t}function Er(r,e,t){if(t<=Q||e 0");if(t===Y)return Q;let n=Y;for(;e>Q;)e&Y&&(n=n*r%t),r=r*r%t,e>>=Y;return n}function Z(r,e,t){let n=r;for(;e-- >Q;)n*=n,n%=t;return n}function mn(r,e){if(r===Q||e<=Q)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=z(r,e),n=e,i=Q,o=Y,s=Y,a=Q;for(;t!==Q;){let u=n/t,f=n%t,l=i-s*u,d=o-a*u;n=t,t=f,i=s,o=a,s=l,a=d}if(n!==Y)throw new Error("invert: does not exist");return z(i,e)}function fo(r){let e=(r-Y)/Fe,t,n,i;for(t=r-Y,n=0;t%Fe===Q;t/=Fe,n++);for(i=Fe;i(z(r,e)&Y)===Y,ho=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function gn(r){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=ho.reduce((n,i)=>(n[i]="function",n),e);return De(r,t)}function lo(r,e,t){if(t 0");if(t===Q)return r.ONE;if(t===Y)return e;let n=r.ONE,i=e;for(;t>Q;)t&Y&&(n=r.mul(n,i)),i=r.sqr(i),t>>=Y;return n}function po(r,e){let t=new Array(e.length),n=e.reduce((o,s,a)=>r.is0(s)?o:(t[a]=o,r.mul(o,s)),r.ONE),i=r.inv(n);return e.reduceRight((o,s,a)=>r.is0(s)?o:(t[a]=r.mul(o,t[a]),r.mul(o,s)),i),t}function kr(r,e){let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function Gt(r,e,t=!1,n={}){if(r<=Q)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:i,nByteLength:o}=kr(r,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=uo(r),a=Object.freeze({ORDER:r,BITS:i,BYTES:o,MASK:bn(i),ZERO:Q,ONE:Y,create:c=>z(c,r),isValid:c=>{if(typeof c!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof c}`);return Q<=c&&cc===Q,isOdd:c=>(c&Y)===Y,neg:c=>z(-c,r),eql:(c,u)=>c===u,sqr:c=>z(c*c,r),add:(c,u)=>z(c+u,r),sub:(c,u)=>z(c-u,r),mul:(c,u)=>z(c*u,r),pow:(c,u)=>lo(a,c,u),div:(c,u)=>z(c*mn(u,r),r),sqrN:c=>c*c,addN:(c,u)=>c+u,subN:(c,u)=>c-u,mulN:(c,u)=>c*u,inv:c=>mn(c,r),sqrt:n.sqrt||(c=>s(a,c)),invertBatch:c=>po(a,c),cmov:(c,u,f)=>f?u:c,toBytes:c=>t?Ge(c,o):mr(c,o),fromBytes:c=>{if(c.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${c.length}`);return t?Se(c):yn(c)}});return Object.freeze(a)}function _n(r,e){if(!r.isOdd)throw new Error("Field doesn't have isOdd");let t=r.sqrt(e);return r.isOdd(t)?r.neg(t):t}var yo=BigInt(0),Sr=BigInt(1);function En(r,e){let t=(i,o)=>{let s=o.negate();return i?s:o},n=i=>{let o=Math.ceil(e/i)+1,s=2**(i-1);return{windows:o,windowSize:s}};return{constTimeNegate:t,unsafeLadder(i,o){let s=r.ZERO,a=i;for(;o>yo;)o&Sr&&(s=s.add(a)),a=a.double(),o>>=Sr;return s},precomputeWindow(i,o){let{windows:s,windowSize:a}=n(o),c=[],u=i,f=u;for(let l=0;l>=m,S>c&&(S-=d,s+=Sr);let V=_,W=_+Math.abs(S)-1,b=v%2!==0,U=S<0;S===0?f=f.add(t(b,o[V])):u=u.add(t(U,o[W]))}return{p:u,f}},wNAFCached(i,o,s,a){let c=i._WINDOW_SIZE||1,u=o.get(i);return u||(u=this.precomputeWindow(i,c),c!==1&&o.set(i,a(u))),this.wNAF(c,u,s)}}}function vn(r){return gn(r.Fp),De(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...kr(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var ye=BigInt(0),le=BigInt(1),Ft=BigInt(2),bo=BigInt(8),wo={zip215:!0};function xo(r){let e=vn(r);return De(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function $e(r){let e=xo(r),{Fp:t,n,prehash:i,hash:o,randomBytes:s,nByteLength:a,h:c}=e,u=Ft<{try{return{isValid:!0,value:t.sqrt(p*t.inv(h))}}catch{return{isValid:!1,value:ye}}}),d=e.adjustScalarBytes||(p=>p),m=e.domain||((p,h,y)=>{if(h.length||y)throw new Error("Contexts/pre-hash are not supported");return p}),v=p=>typeof p=="bigint"&&yev(p)&&v(h)&&pp===ye||_(p,u);function V(p,h){if(_(p,h))return p;throw new Error(`Expected valid scalar < ${h}, got ${typeof p} ${p}`)}function W(p){return p===ye?p:V(p,n)}let b=new Map;function U(p){if(!(p instanceof E))throw new Error("ExtendedPoint expected")}class E{constructor(h,y,w,g){if(this.ex=h,this.ey=y,this.ez=w,this.et=g,!S(h))throw new Error("x required");if(!S(y))throw new Error("y required");if(!S(w))throw new Error("z required");if(!S(g))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(h){if(h instanceof E)throw new Error("extended point not allowed");let{x:y,y:w}=h||{};if(!S(y)||!S(w))throw new Error("invalid affine point");return new E(y,w,le,f(y*w))}static normalizeZ(h){let y=t.invertBatch(h.map(w=>w.ez));return h.map((w,g)=>w.toAffine(y[g])).map(E.fromAffine)}_setWindowSize(h){this._WINDOW_SIZE=h,b.delete(this)}assertValidity(){let{a:h,d:y}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:w,ey:g,ez:L,et:T}=this,R=f(w*w),O=f(g*g),N=f(L*L),X=f(N*N),J=f(R*h),be=f(N*f(J+O)),oe=f(X+f(y*f(R*O)));if(be!==oe)throw new Error("bad point: equation left != right (1)");let Be=f(w*g),ge=f(L*T);if(Be!==ge)throw new Error("bad point: equation left != right (2)")}equals(h){U(h);let{ex:y,ey:w,ez:g}=this,{ex:L,ey:T,ez:R}=h,O=f(y*R),N=f(L*g),X=f(w*R),J=f(T*g);return O===N&&X===J}is0(){return this.equals(E.ZERO)}negate(){return new E(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:h}=e,{ex:y,ey:w,ez:g}=this,L=f(y*y),T=f(w*w),R=f(Ft*f(g*g)),O=f(h*L),N=y+w,X=f(f(N*N)-L-T),J=O+T,be=J-R,oe=O-T,Be=f(X*be),ge=f(J*oe),dt=f(X*oe),pt=f(be*J);return new E(Be,ge,pt,dt)}add(h){U(h);let{a:y,d:w}=e,{ex:g,ey:L,ez:T,et:R}=this,{ex:O,ey:N,ez:X,et:J}=h;if(y===BigInt(-1)){let Cr=f((L-g)*(N+O)),Nr=f((L+g)*(N-O)),nr=f(Nr-Cr);if(nr===ye)return this.double();let Rr=f(T*Ft*J),Dr=f(R*Ft*X),zr=Dr+Rr,jr=Nr+Cr,qr=Dr-Rr,Wn=f(zr*nr),Yn=f(jr*qr),Jn=f(zr*qr),Qn=f(nr*jr);return new E(Wn,Yn,Qn,Jn)}let be=f(g*O),oe=f(L*N),Be=f(R*w*J),ge=f(T*X),dt=f((g+L)*(O+N)-be-oe),pt=ge-Be,Hr=ge+Be,Tr=f(oe-y*be),$n=f(dt*pt),Vn=f(Hr*Tr),Zn=f(dt*Tr),Xn=f(pt*Hr);return new E($n,Vn,Xn,Zn)}subtract(h){return this.add(h.negate())}wNAF(h){return I.wNAFCached(this,b,h,E.normalizeZ)}multiply(h){let{p:y,f:w}=this.wNAF(V(h,n));return E.normalizeZ([y,w])[0]}multiplyUnsafe(h){let y=W(h);return y===ye?j:this.equals(j)||y===le?this:this.equals(H)?this.wNAF(y).p:I.unsafeLadder(this,y)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return I.unsafeLadder(this,n).is0()}toAffine(h){let{ex:y,ey:w,ez:g}=this,L=this.is0();h==null&&(h=L?bo:t.inv(g));let T=f(y*h),R=f(w*h),O=f(g*h);if(L)return{x:ye,y:le};if(O!==le)throw new Error("invZ was invalid");return{x:T,y:R}}clearCofactor(){let{h}=e;return h===le?this:this.multiplyUnsafe(h)}static fromHex(h,y=!1){let{d:w,a:g}=e,L=t.BYTES;h=he("pointHex",h,L);let T=h.slice(),R=h[L-1];T[L-1]=R&-129;let O=Se(T);O===ye||(y?V(O,u):V(O,t.ORDER));let N=f(O*O),X=f(N-le),J=f(w*N-g),{isValid:be,value:oe}=l(X,J);if(!be)throw new Error("Point.fromHex: invalid y coordinate");let Be=(oe&le)===le,ge=(R&128)!==0;if(!y&&oe===ye&&ge)throw new Error("Point.fromHex: x=0 and x_0=1");return ge!==Be&&(oe=f(-oe)),E.fromAffine({x:oe,y:O})}static fromPrivateKey(h){return B(h).point}toRawBytes(){let{x:h,y}=this.toAffine(),w=Ge(y,t.BYTES);return w[w.length-1]|=h&le?128:0,w}toHex(){return Mt(this.toRawBytes())}}E.BASE=new E(e.Gx,e.Gy,le,f(e.Gx*e.Gy)),E.ZERO=new E(ye,le,le,ye);let{BASE:H,ZERO:j}=E,I=En(E,a*8);function x(p){return z(p,n)}function P(p){return x(Se(p))}function B(p){let h=a;p=he("private key",p,h);let y=he("hashed private key",o(p),2*h),w=d(y.slice(0,h)),g=y.slice(h,2*h),L=P(w),T=H.multiply(L),R=T.toRawBytes();return{head:w,prefix:g,scalar:L,point:T,pointBytes:R}}function A(p){return B(p).pointBytes}function k(p=new Uint8Array,...h){let y=gr(...h);return P(o(m(y,he("context",p),!!i)))}function q(p,h,y={}){p=he("message",p),i&&(p=i(p));let{prefix:w,scalar:g,pointBytes:L}=B(h),T=k(y.context,w,p),R=H.multiply(T).toRawBytes(),O=k(y.context,R,L,p),N=x(T+O*g);W(N);let X=gr(R,Ge(N,t.BYTES));return he("result",X,a*2)}let C=wo;function M(p,h,y,w=C){let{context:g,zip215:L}=w,T=t.BYTES;p=he("signature",p,2*T),h=he("message",h),i&&(h=i(h));let R=Se(p.slice(T,2*T)),O,N,X;try{O=E.fromHex(y,L),N=E.fromHex(p.slice(0,T),L),X=H.multiplyUnsafe(R)}catch{return!1}if(!L&&O.isSmallOrder())return!1;let J=k(g,N.toRawBytes(),O.toRawBytes(),h);return N.add(O.multiplyUnsafe(J)).subtract(X).clearCofactor().equals(E.ZERO)}return H._setWindowSize(8),{CURVE:e,getPublicKey:A,sign:q,verify:M,ExtendedPoint:E,utils:{getExtendedPublicKey:B,randomPrivateKey:()=>s(t.BYTES),precompute(p=8,h=E.BASE){return h._setWindowSize(p),h.multiply(BigInt(3)),h}}}}var ft=BigInt(0),Ar=BigInt(1);function mo(r){return De(r,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...r})}function $t(r){let e=mo(r),{P:t}=e,n=b=>z(b,t),i=e.montgomeryBits,o=Math.ceil(i/8),s=e.nByteLength,a=e.adjustScalarBytes||(b=>b),c=e.powPminus2||(b=>Er(b,t-BigInt(2),t));function u(b,U,E){let H=n(b*(U-E));return U=n(U-H),E=n(E+H),[U,E]}function f(b){if(typeof b=="bigint"&&ft<=b&&b=ft;C--){let M=H>>C&Ar;A^=M,k=u(A,I,P),I=k[0],P=k[1],k=u(A,x,B),x=k[0],B=k[1],A=M;let G=I+x,p=n(G*G),h=I-x,y=n(h*h),w=p-y,g=P+B,L=P-B,T=n(L*G),R=n(g*h),O=T+R,N=T-R;P=n(O*O),B=n(j*n(N*N)),I=n(p*y),x=n(w*(p+n(l*w)))}k=u(A,I,P),I=k[0],P=k[1],k=u(A,x,B),x=k[0],B=k[1];let q=c(x);return n(I*q)}function m(b){return Ge(n(b),o)}function v(b){let U=he("u coordinate",b,o);return s===o&&(U[s-1]&=127),Se(U)}function _(b){let U=he("scalar",b);if(U.length!==o&&U.length!==s)throw new Error(`Expected ${o} or ${s} bytes, got ${U.length}`);return Se(a(U))}function S(b,U){let E=v(U),H=_(b),j=d(E,H);if(j===ft)throw new Error("Invalid private or public key received");return m(j)}let V=m(e.Gu);function W(b){return S(b,V)}return{scalarMult:S,scalarMultBase:W,getSharedSecret:(b,U)=>S(b,U),getPublicKey:b=>W(b),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:V}}var ut=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),kn=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),nc=BigInt(0),go=BigInt(1),Br=BigInt(2),_o=BigInt(5),Sn=BigInt(10),Eo=BigInt(20),vo=BigInt(40),An=BigInt(80);function Bn(r){let e=ut,n=r*r%e*r%e,i=Z(n,Br,e)*n%e,o=Z(i,go,e)*r%e,s=Z(o,_o,e)*o%e,a=Z(s,Sn,e)*s%e,c=Z(a,Eo,e)*a%e,u=Z(c,vo,e)*c%e,f=Z(u,An,e)*u%e,l=Z(f,An,e)*u%e,d=Z(l,Sn,e)*s%e;return{pow_p_5_8:Z(d,Br,e)*r%e,b2:n}}function Pn(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function ko(r,e){let t=ut,n=z(e*e*e,t),i=z(n*n*e,t),o=Bn(r*i).pow_p_5_8,s=z(r*n*o,t),a=z(e*s*s,t),c=s,u=z(s*kn,t),f=a===r,l=a===z(-r,t),d=a===z(-r*kn,t);return f&&(s=c),(l||d)&&(s=u),vr(s,t)&&(s=z(-s,t)),{isValid:f||l,value:s}}var Ae=Gt(ut,void 0,!0),Pr={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Ae,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:at,randomBytes:Ve,adjustScalarBytes:Pn,uvRatio:ko},In=$e(Pr);function Ln(r,e,t){if(e.length>255)throw new Error("Context is too big");return Lt(ot("SigEd25519 no Ed25519 collisions"),new Uint8Array([t?1:0,e.length]),e,r)}var ic=$e({...Pr,domain:Ln}),oc=$e({...Pr,domain:Ln,prehash:at}),Ir=(()=>$t({P:ut,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:r=>{let e=ut,{pow_p_5_8:t,b2:n}=Bn(r);return z(Z(t,BigInt(3),e)*n,e)},adjustScalarBytes:Pn,randomBytes:Ve}))();var So=(Ae.ORDER+BigInt(3))/BigInt(8),sc=Ae.pow(Br,So),ac=Ae.sqrt(Ae.neg(Ae.ONE)),cc=(Ae.ORDER-BigInt(5))/BigInt(8),fc=BigInt(486662);var uc=_n(Ae,Ae.neg(BigInt(486664)));var hc=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),lc=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),dc=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),pc=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");var yc=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var ne=class{constructor(e,t,n,i=[]){Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extractable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"algorithm",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"usages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.key=t,this.type=n,this.algorithm={name:e},this.usages=i,n==="public"&&(this.usages=[])}};var Je="X25519",Vt=class{constructor(e){Object.defineProperty(this,"_hkdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nPk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nSk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hkdf=e,this._nPk=32,this._nSk=32}async serializePublicKey(e){try{return await this._serializePublicKey(e)}catch(t){throw new ae(t)}}async deserializePublicKey(e){try{return await this._importRawKey(e,!0)}catch(t){throw new te(t)}}async serializePrivateKey(e){try{return await this._serializePrivateKey(e)}catch(t){throw new ae(t)}}async deserializePrivateKey(e){try{return await this._importRawKey(e,!1)}catch(t){throw new te(t)}}async importKey(e,t,n){try{if(e==="raw")return await this._importRawKey(t,n);if(t instanceof ArrayBuffer)throw new Error("Invalid jwk key format");return await this._importJWK(t,n)}catch(i){throw new te(i)}}async generateKeyPair(){try{let e=In.utils.randomPrivateKey(),t=new ne(Je,e,"private",ue);return{publicKey:await this.derivePublicKey(t),privateKey:t}}catch(e){throw new ce(e)}}async deriveKeyPair(e){try{let t=await this._hkdf.labeledExtract($,Ye,new Uint8Array(e)),n=await this._hkdf.labeledExpand(t,Nt,$,this._nSk),i=new ne(Je,new Uint8Array(n),"private",ue);return{privateKey:i,publicKey:await this.derivePublicKey(i)}}catch(t){throw new Pe(t)}}async derivePublicKey(e){try{return await this._derivePublicKey(e)}catch(t){throw new te(t)}}async dh(e,t){try{return await this._dh(e,t)}catch(n){throw new ae(n)}}_serializePublicKey(e){return new Promise(t=>{t(e.key.buffer)})}_serializePrivateKey(e){return new Promise(t=>{t(e.key.buffer)})}_importRawKey(e,t){return new Promise((n,i)=>{t&&e.byteLength!==this._nPk&&i(new Error("Invalid length of the key")),!t&&e.byteLength!==this._nSk&&i(new Error("Invalid length of the key")),n(new ne(Je,new Uint8Array(e),t?"public":"private",t?[]:ue))})}_importJWK(e,t){return new Promise((n,i)=>{(typeof e.kty>"u"||e.kty!=="OKP")&&i(new Error(`Invalid kty: ${e.kty}`)),(typeof e.crv>"u"||e.crv!=="X25519")&&i(new Error(`Invalid crv: ${e.crv}`)),t?(typeof e.d<"u"&&i(new Error("Invalid key: `d` should not be set")),typeof e.x>"u"&&i(new Error("Invalid key: `x` not found")),n(new ne(Je,Ne(e.x),"public"))):(typeof e.d!="string"&&i(new Error("Invalid key: `d` not found")),n(new ne(Je,Ne(e.d),"private",ue)))})}_derivePublicKey(e){return new Promise((t,n)=>{try{let i=Ir.getPublicKey(e.key);t(new ne(Je,i,"public"))}catch(i){n(i)}})}_dh(e,t){return new Promise((n,i)=>{try{n(Ir.getSharedSecret(e.key,t.key).buffer)}catch(o){i(o)}})}};var Zt=class extends de{constructor(){let e=new Oe;super(F.DhkemX25519HkdfSha256,new Vt(e),e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:F.DhkemX25519HkdfSha256}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:32})}};var[On,Hn,Tn]=[[],[],[]],Ao=BigInt(0),ht=BigInt(1),Bo=BigInt(2),Po=BigInt(7),Io=BigInt(256),Lo=BigInt(113);for(let r=0,e=ht,t=1,n=0;r<24;r++){[t,n]=[n,(2*t+3*n)%5],On.push(2*(5*n+t)),Hn.push((r+1)*(r+2)/2%64);let i=Ao;for(let o=0;o<7;o++)e=(e<>Po)*Lo)%Io,e&Bo&&(i^=ht<<(ht<t>32?br(r,e,t):pr(r,e,t),Un=(r,e,t)=>t>32?wr(r,e,t):yr(r,e,t);function Oo(r,e=24){let t=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let s=0;s<10;s++)t[s]=r[s]^r[s+10]^r[s+20]^r[s+30]^r[s+40];for(let s=0;s<10;s+=2){let a=(s+8)%10,c=(s+2)%10,u=t[c],f=t[c+1],l=Kn(u,f,1)^t[a],d=Un(u,f,1)^t[a+1];for(let m=0;m<50;m+=10)r[s+m]^=l,r[s+m+1]^=d}let i=r[2],o=r[3];for(let s=0;s<24;s++){let a=Hn[s],c=Kn(i,o,a),u=Un(i,o,a),f=On[s];i=r[f],o=r[f+1],r[f]=c,r[f+1]=u}for(let s=0;s<50;s+=10){for(let a=0;a<10;a++)t[a]=r[s+a];for(let a=0;a<10;a++)r[s+a]^=~t[(a+2)%10]&t[(a+4)%10]}r[0]^=Ko[n],r[1]^=Uo[n]}t.fill(0)}var Xt=class r extends Ie{constructor(e,t,n,i=!1,o=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,nt(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=sn(this.state)}keccak(){Oo(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){ke(this);let{blockLen:t,state:n}=this;e=Le(e);let i=e.length;for(let o=0;o=n&&this.keccak();let s=Math.min(n-this.posOut,o-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return nt(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Bt(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:n,outputLen:i,rounds:o,enableXOF:s}=this;return e||(e=new r(t,n,i,s,o)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=n,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}},ze=(r,e,t)=>xe(()=>new Xt(e,r,t)),Oc=ze(6,144,224/8),Hc=ze(6,136,256/8),Tc=ze(6,104,384/8),Cc=ze(6,72,512/8),Nc=ze(1,144,224/8),Rc=ze(1,136,256/8),Dc=ze(1,104,384/8),zc=ze(1,72,512/8),Cn=(r,e,t)=>an((n={})=>new Xt(e,r,n.dkLen===void 0?t:n.dkLen,!0)),jc=Cn(31,168,128/8),Lr=Cn(31,136,256/8);var Ho=xe(()=>Lr.create({dkLen:114})),To=xe(()=>Lr.create({dkLen:64})),lt=BigInt("726838724295606890549323807888004534353641360687318060281490199180612328166730772686396383698676545930088884461843637361053498018365439"),Co=BigInt(1),Nn=BigInt(2),Rn=BigInt(3),Zc=BigInt(4),No=BigInt(11),Ro=BigInt(22),Dn=BigInt(44),Do=BigInt(88),zo=BigInt(223);function zn(r){let e=lt,t=r*r*r%e,n=t*t*r%e,i=Z(n,Rn,e)*n%e,o=Z(i,Rn,e)*n%e,s=Z(o,Nn,e)*t%e,a=Z(s,No,e)*s%e,c=Z(a,Ro,e)*a%e,u=Z(c,Dn,e)*c%e,f=Z(u,Do,e)*u%e,l=Z(f,Dn,e)*c%e,d=Z(l,Nn,e)*t%e,m=Z(d,Co,e)*r%e;return Z(m,zo,e)*d%e}function jn(r){return r[0]&=252,r[55]|=128,r[56]=0,r}function jo(r,e){let t=lt,n=z(r*r*e,t),i=z(n*r,t),o=z(i*n*e,t),s=zn(o),a=z(i*s,t),c=z(a*a,t);return{isValid:z(c*e,t)===r,value:a}}var qn=Gt(lt,456,!0),Mn={a:BigInt(1),d:BigInt("726838724295606890549323807888004534353641360687318060281490199180612328166730772686396383698676545930088884461843637361053498018326358"),Fp:qn,n:BigInt("181709681073901722637330951972001133588410340171829515070372549795146003961539585716195755291692375963310293709091662304773755859649779"),nBitLength:456,h:BigInt(4),Gx:BigInt("224580040295924300187604334099896036246789641632564134246125461686950415467406032909029192869357953282578032075146446173674602635247710"),Gy:BigInt("298819210078481492676017930443930673437544040154080242095928241372331506189835876003536878655418784733982303233503462500531545062832660"),hash:Ho,randomBytes:Ve,adjustScalarBytes:jn,domain:(r,e,t)=>{if(e.length>255)throw new Error(`Context is too big: ${e.length}`);return Lt(ot("SigEd448"),new Uint8Array([t?1:0,e.length]),e,r)},uvRatio:jo},Gn=$e(Mn),Xc=$e({...Mn,prehash:To}),Kr=(()=>$t({a:BigInt(156326),montgomeryBits:448,nByteLength:57,P:lt,Gu:BigInt(5),powPminus2:r=>{let e=lt,t=zn(r),n=Z(t,BigInt(2),e);return z(n*r,e)},adjustScalarBytes:jn,randomBytes:Ve}))();var Wc=(qn.ORDER-BigInt(3))/BigInt(4),Yc=BigInt(156326);var Jc=BigInt("39082"),Qc=BigInt("78163"),ef=BigInt("98944233647732219769177004876929019128417576295529901074099889598043702116001257856802131563896515373927712232092845883226922417596214"),tf=BigInt("315019913931389607337177038330951043522456072897266928557328499619017160722351061360252776265186336876723201881398623946864393857820716");var rf=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Qe="X448",Wt=class{constructor(e){Object.defineProperty(this,"_hkdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nPk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nSk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hkdf=e,this._nPk=56,this._nSk=56}async serializePublicKey(e){try{return await this._serializePublicKey(e)}catch(t){throw new ae(t)}}async deserializePublicKey(e){try{return await this._importRawKey(e,!0)}catch(t){throw new te(t)}}async serializePrivateKey(e){try{return await this._serializePrivateKey(e)}catch(t){throw new ae(t)}}async deserializePrivateKey(e){try{return await this._importRawKey(e,!1)}catch(t){throw new te(t)}}async importKey(e,t,n){try{if(e==="raw")return await this._importRawKey(t,n);if(t instanceof ArrayBuffer)throw new Error("Invalid jwk key format");return await this._importJWK(t,n)}catch(i){throw new te(i)}}async generateKeyPair(){try{let e=Gn.utils.randomPrivateKey(),t=new ne(Qe,e,"private",ue);return{publicKey:await this.derivePublicKey(t),privateKey:t}}catch(e){throw new ce(e)}}async deriveKeyPair(e){try{let t=await this._hkdf.labeledExtract($,Ye,new Uint8Array(e)),n=await this._hkdf.labeledExpand(t,Nt,$,this._nSk),i=new ne(Qe,new Uint8Array(n),"private",ue);return{privateKey:i,publicKey:await this.derivePublicKey(i)}}catch(t){throw new Pe(t)}}async derivePublicKey(e){try{return await this._derivePublicKey(e)}catch(t){throw new te(t)}}async dh(e,t){try{return await this._dh(e,t)}catch(n){throw new ae(n)}}_serializePublicKey(e){return new Promise(t=>{t(e.key.buffer)})}_serializePrivateKey(e){return new Promise(t=>{t(e.key.buffer)})}_importRawKey(e,t){return new Promise((n,i)=>{t&&e.byteLength!==this._nPk&&i(new Error("Invalid length of the key")),!t&&e.byteLength!==this._nSk&&e.byteLength!==this._nSk+1&&i(new Error("Invalid length of the key")),n(new ne(Qe,new Uint8Array(e),t?"public":"private",t?[]:ue))})}_importJWK(e,t){return new Promise((n,i)=>{e.kty!=="OKP"&&i(new Error(`Invalid kty: ${e.kty}`)),e.crv!=="X448"&&i(new Error(`Invalid crv: ${e.crv}`)),t?(typeof e.d<"u"&&i(new Error("Invalid key: `d` should not be set")),typeof e.x!="string"&&i(new Error("Invalid key: `x` not found")),n(new ne(Qe,Ne(e.x),"public"))):(typeof e.d!="string"&&i(new Error("Invalid key: `d` not found")),n(new ne(Qe,Ne(e.d),"private",ue)))})}_derivePublicKey(e){return new Promise((t,n)=>{try{let i=Kr.getPublicKey(e.key);t(new ne(Qe,i,"public"))}catch(i){n(i)}})}_dh(e,t){return new Promise((n,i)=>{try{n(Kr.getSharedSecret(e.key,t.key).buffer)}catch(o){i(o)}})}};var Yt=class extends de{constructor(){let e=new Ce;super(F.DhkemX448HkdfSha512,new Wt(e),e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:F.DhkemX448HkdfSha512}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:64}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:56}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:56}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:56})}};function Ur(){return new Promise((r,e)=>{e(new ce("Not supported"))})}var qo=new Uint8Array([115,101,99]),et=class{constructor(e,t,n){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exporterSecret",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._api=e,this._kdf=t,this.exporterSecret=n}async seal(e,t){return await Ur()}async open(e,t){return await Ur()}async export(e,t){if(e.byteLength>8192)throw new ee("Too long exporter context");try{return await this._kdf.labeledExpand(this.exporterSecret,qo,new Uint8Array(e),t)}catch(n){throw new wt(n)}}},Jt=class extends et{},Qt=class extends et{constructor(e,t,n,i){super(e,t,n),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enc=i}};function Mo(r,e){if(r.byteLength!==e.byteLength)throw new Error("xor: different length inputs");let t=new Uint8Array(r.byteLength);for(let n=0;nNumber.MAX_SAFE_INTEGER)throw new gt("Message limit reached");e.seq+=1}};var er=class extends tt{async open(e,t=$){let n;try{n=await this._ctx.key.open(this.computeNonce(this._ctx),e,t)}catch(i){throw new mt(i)}return this.incrementSeq(this._ctx),n}};var tr=class extends tt{constructor(e,t,n,i){super(e,t,n),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enc=i}async seal(e,t=$){let n;try{n=await this._ctx.key.seal(this.computeNonce(this._ctx),e,t)}catch(i){throw new xt(i)}return this.incrementSeq(this._ctx),n}};var Go=new Uint8Array([98,97,115,101,95,110,111,110,99,101]),Fo=new Uint8Array([101,120,112]),$o=new Uint8Array([105,110,102,111,95,104,97,115,104]),Vo=new Uint8Array([107,101,121]),Zo=new Uint8Array([112,115,107,95,105,100,95,104,97,115,104]),Xo=new Uint8Array([115,101,99,114,101,116]),Wo=new Uint8Array([72,80,75,69,0,0,0,0,0,0]),rr=class extends we{constructor(e){if(super(),Object.defineProperty(this,"_kem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),typeof e.kem=="number")throw new ee("KemId cannot be used");if(this._kem=e.kem,typeof e.kdf=="number")throw new ee("KdfId cannot be used");if(this._kdf=e.kdf,typeof e.aead=="number")throw new ee("AeadId cannot be used");this._aead=e.aead,this._suiteId=new Uint8Array(Wo),this._suiteId.set(me(this._kem.id,2),4),this._suiteId.set(me(this._kdf.id,2),6),this._suiteId.set(me(this._aead.id,2),8),this._kdf.init(this._suiteId)}get kem(){return this._kem}get kdf(){return this._kdf}get aead(){return this._aead}async createSenderContext(e){this._validateInputLength(e),await this._setup();let t=await this._kem.encap(e),n;return e.psk!==void 0?n=e.senderKey!==void 0?_e.AuthPsk:_e.Psk:n=e.senderKey!==void 0?_e.Auth:_e.Base,await this._keyScheduleS(n,t.sharedSecret,t.enc,e)}async createRecipientContext(e){this._validateInputLength(e),await this._setup();let t=await this._kem.decap(e),n;return e.psk!==void 0?n=e.senderPublicKey!==void 0?_e.AuthPsk:_e.Psk:n=e.senderPublicKey!==void 0?_e.Auth:_e.Base,await this._keyScheduleR(n,t,e)}async seal(e,t,n=$){let i=await this.createSenderContext(e);return{ct:await i.seal(t,n),enc:i.enc}}async open(e,t,n=$){return await(await this.createRecipientContext(e)).open(t,n)}async _keySchedule(e,t,n){let i=n.psk===void 0?$:new Uint8Array(n.psk.id),o=await this._kdf.labeledExtract($,Zo,i),s=n.info===void 0?$:new Uint8Array(n.info),a=await this._kdf.labeledExtract($,$o,s),c=new Uint8Array(1+o.byteLength+a.byteLength);c.set(new Uint8Array([e]),0),c.set(new Uint8Array(o),1),c.set(new Uint8Array(a),1+o.byteLength);let u=n.psk===void 0?$:new Uint8Array(n.psk.key),f=this._kdf.buildLabeledIkm(Xo,u),l=this._kdf.buildLabeledInfo(Fo,c,this._kdf.hashSize),d=await this._kdf.extractAndExpand(t,f,l,this._kdf.hashSize);if(this._aead.id===fe.ExportOnly)return{aead:this._aead,exporterSecret:d};let m=this._kdf.buildLabeledInfo(Vo,c,this._aead.keySize),v=await this._kdf.extractAndExpand(t,f,m,this._aead.keySize),_=this._kdf.buildLabeledInfo(Go,c,this._aead.nonceSize),S=await this._kdf.extractAndExpand(t,f,_,this._aead.nonceSize);return{aead:this._aead,exporterSecret:d,key:v,baseNonce:new Uint8Array(S),seq:0}}async _keyScheduleS(e,t,n,i){let o=await this._keySchedule(e,t,i);return o.key===void 0?new Qt(this._api,this._kdf,o.exporterSecret,n):new tr(this._api,this._kdf,o,n)}async _keyScheduleR(e,t,n){let i=await this._keySchedule(e,t,n);return i.key===void 0?new Jt(this._api,this._kdf,i.exporterSecret):new er(this._api,this._kdf,i)}_validateInputLength(e){if(e.info!==void 0&&e.info.byteLength>8192)throw new ee("Too long info");if(e.psk!==void 0){if(e.psk.key.byteLength<32)throw new ee(`PSK must have at least ${32} bytes`);if(e.psk.key.byteLength>8192)throw new ee("Too long psk.key");if(e.psk.id.byteLength>8192)throw new ee("Too long psk.id")}}};var Or=class extends rr{constructor(e){if(typeof e.kem=="number")switch(e.kem){case F.DhkemP256HkdfSha256:e.kem=new Dt;break;case F.DhkemP384HkdfSha384:e.kem=new zt;break;case F.DhkemP521HkdfSha512:e.kem=new jt;break;case F.DhkemX25519HkdfSha256:e.kem=new Zt;break;case F.DhkemX448HkdfSha512:e.kem=new Yt;break;default:throw new ee(`The KEM (${e.kem}) cannot be specified by KemId. Use submodule for the KEM`)}if(typeof e.kdf=="number")switch(e.kdf){case Ee.HkdfSha256:e.kdf=new Oe;break;case Ee.HkdfSha384:e.kdf=new Xe;break;default:e.kdf=new Ce;break}if(typeof e.aead=="number")switch(e.aead){case fe.Aes128Gcm:e.aead=new rt;break;case fe.Aes256Gcm:e.aead=new _t;break;case fe.Chacha20Poly1305:e.aead=new At;break;default:e.aead=new Et;break}super(e)}async generateKeyPair(){return await this._setup(),await this._kem.generateKeyPair()}async deriveKeyPair(e){return await this._setup(),await this._kem.deriveKeyPair(e)}async importKey(e,t,n=!0){return await this._setup(),await this._kem.importKey(e,t,n)}};export{Vr as Aead,fe as AeadId,ir as BaseError,Or as CipherSuite,bt as DecapError,Pe as DeriveKeyPairError,te as DeserializeError,yt as EncapError,wt as ExportError,se as HpkeError,ee as InvalidParamError,$r as Kdf,Ee as KdfId,Fr as Kem,F as KemId,gt as MessageLimitReachedError,ce as NotSupportedError,mt as OpenError,xt as SealError,ae as SerializeError,Gr as ValidationError}; +var ai={},Zr=fi(globalThis,ai);function fi(r,e){return new Proxy(r,{get(t,n,i){return n in e?e[n]:r[n]},set(t,n,i){return n in e&&delete e[n],r[n]=i,!0},deleteProperty(t,n){let i=!1;return n in e&&(delete e[n],i=!0),n in r&&(delete r[n],i=!0),i},ownKeys(t){let n=Reflect.ownKeys(r),i=Reflect.ownKeys(e),o=new Set(i);return[...n.filter(s=>!o.has(s)),...i]},defineProperty(t,n,i){return n in e&&delete e[n],Reflect.defineProperty(r,n,i),!0},getOwnPropertyDescriptor(t,n){return n in e?Reflect.getOwnPropertyDescriptor(e,n):Reflect.getOwnPropertyDescriptor(r,n)},has(t,n){return n in e||n in r}})}var or=class extends Error{constructor(e){let t;e instanceof Error?t=e.message:typeof e=="string"?t=e:t="",super(t),this.name=this.constructor.name}},oe=class extends or{},ee=class extends oe{},Xr=class extends oe{},se=class extends oe{},te=class extends oe{},yt=class extends oe{},bt=class extends oe{},wt=class extends oe{},xt=class extends oe{},mt=class extends oe{},gt=class extends oe{},Be=class extends oe{},ce=class extends oe{};async function hi(){if(Zr!==void 0&&globalThis.crypto!==void 0)return globalThis.crypto.subtle;try{let{webcrypto:r}=await import("crypto");return r.subtle}catch(r){throw new ce(r)}}var be=class{constructor(){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}async _setup(){this._api===void 0&&(this._api=await hi())}};var ge={Base:0,Psk:1,Auth:2,AuthPsk:3},Wr={NotAssigned:0,DhkemP256HkdfSha256:16,DhkemP384HkdfSha384:17,DhkemP521HkdfSha512:18,DhkemSecp256k1HkdfSha256:19,DhkemX25519HkdfSha256:32,DhkemX448HkdfSha512:33,HybridkemX25519Kyber768:48},V=Wr,Yr={HkdfSha256:1,HkdfSha384:2,HkdfSha512:3},_e=Yr,Jr={Aes128Gcm:1,Aes256Gcm:2,Chacha20Poly1305:3,ExportOnly:65535},ae=Jr;var Qr=["encrypt","decrypt"];var sr=class extends be{constructor(e){super(),Object.defineProperty(this,"_rawKey",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._rawKey=e}async seal(e,t,n){await this._setupKey();let i={name:"AES-GCM",iv:e,additionalData:n};return await this._api.encrypt(i,this._key,t)}async open(e,t,n){await this._setupKey();let i={name:"AES-GCM",iv:e,additionalData:n};return await this._api.decrypt(i,this._key,t)}async _setupKey(){if(this._key!==void 0)return;await this._setup();let e=await this._importKey(this._rawKey);new Uint8Array(this._rawKey).fill(0),this._key=e}async _importKey(e){return await this._api.importKey("raw",e,{name:"AES-GCM"},!0,Qr)}},rt=class{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:ae.Aes128Gcm}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:16}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}createEncryptionContext(e){return new sr(e)}},_t=class extends rt{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:ae.Aes256Gcm}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}};var Et=class{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:ae.ExportOnly}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:0})}createEncryptionContext(e){throw new ce("Export only")}};var li=r=>r instanceof Uint8Array;var Ee=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),en=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),di=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!di)throw new Error("Non little-endian hardware is not supported");function vt(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function kt(r){if(typeof r=="string")r=vt(r);else if(li(r))r=r.slice();else throw new Error(`expected Uint8Array, got ${typeof r}`);return r}var pi=r=>Object.prototype.toString.call(r)==="[object Object]"&&r.constructor===Object;function tn(r,e){if(e!==void 0&&(typeof e!="object"||!pi(e)))throw new Error("options must be object or undefined");return Object.assign(r,e)}function ze(r,e){if(!(r instanceof Uint8Array))throw new Error("Uint8Array expected");if(typeof e=="number"&&r.length!==e)throw new Error(`Uint8Array length ${e} expected`)}function rn(r,e){if(r.length!==e.length)throw new Error("equalBytes: Different size of Uint8Arrays");let t=!0;for(let n=0;n(Object.assign(e,r),e);function ar(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(t>>i&o),c=Number(t&o),a=n?4:0,u=n?0:4;r.setUint32(e+a,s,n),r.setUint32(e+u,c,n)}function St(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function fr(r){if(typeof r!="boolean")throw new Error(`Expected boolean, not ${r}`)}function $e(r,...e){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}function ur(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function nn(r,e){$e(r);let t=e.outputLen;if(r.lengthr[e++]&255|(r[e++]&255)<<8,hr=class{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,e=kt(e),ze(e,32);let t=re(e,0),n=re(e,2),i=re(e,4),o=re(e,6),s=re(e,8),c=re(e,10),a=re(e,12),u=re(e,14);this.r[0]=t&8191,this.r[1]=(t>>>13|n<<3)&8191,this.r[2]=(n>>>10|i<<6)&7939,this.r[3]=(i>>>7|o<<9)&8191,this.r[4]=(o>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|c<<2)&8191,this.r[7]=(c>>>11|a<<5)&8065,this.r[8]=(a>>>8|u<<8)&8191,this.r[9]=u>>>5&127;for(let f=0;f<8;f++)this.pad[f]=re(e,16+2*f)}process(e,t,n=!1){let i=n?0:2048,{h:o,r:s}=this,c=s[0],a=s[1],u=s[2],f=s[3],l=s[4],d=s[5],b=s[6],m=s[7],g=s[8],x=s[9],A=re(e,t+0),I=re(e,t+2),p=re(e,t+4),S=re(e,t+6),k=re(e,t+8),C=re(e,t+10),$=re(e,t+12),H=re(e,t+14),B=o[0]+(A&8191),O=o[1]+((A>>>13|I<<3)&8191),L=o[2]+((I>>>10|p<<6)&8191),T=o[3]+((p>>>7|S<<9)&8191),P=o[4]+((S>>>4|k<<12)&8191),q=o[5]+(k>>>1&8191),D=o[6]+((k>>>14|C<<2)&8191),G=o[7]+((C>>>11|$<<5)&8191),F=o[8]+(($>>>8|H<<8)&8191),y=o[9]+(H>>>5|i),h=0,w=h+B*c+O*(5*x)+L*(5*g)+T*(5*m)+P*(5*b);h=w>>>13,w&=8191,w+=q*(5*d)+D*(5*l)+G*(5*f)+F*(5*u)+y*(5*a),h+=w>>>13,w&=8191;let E=h+B*a+O*c+L*(5*x)+T*(5*g)+P*(5*m);h=E>>>13,E&=8191,E+=q*(5*b)+D*(5*d)+G*(5*l)+F*(5*f)+y*(5*u),h+=E>>>13,E&=8191;let v=h+B*u+O*a+L*c+T*(5*x)+P*(5*g);h=v>>>13,v&=8191,v+=q*(5*m)+D*(5*b)+G*(5*d)+F*(5*l)+y*(5*f),h+=v>>>13,v&=8191;let K=h+B*f+O*u+L*a+T*c+P*(5*x);h=K>>>13,K&=8191,K+=q*(5*g)+D*(5*m)+G*(5*b)+F*(5*d)+y*(5*l),h+=K>>>13,K&=8191;let R=h+B*l+O*f+L*u+T*a+P*c;h=R>>>13,R&=8191,R+=q*(5*x)+D*(5*g)+G*(5*m)+F*(5*b)+y*(5*d),h+=R>>>13,R&=8191;let j=h+B*d+O*l+L*f+T*u+P*a;h=j>>>13,j&=8191,j+=q*c+D*(5*x)+G*(5*g)+F*(5*m)+y*(5*b),h+=j>>>13,j&=8191;let N=h+B*b+O*d+L*l+T*f+P*u;h=N>>>13,N&=8191,N+=q*a+D*c+G*(5*x)+F*(5*g)+y*(5*m),h+=N>>>13,N&=8191;let z=h+B*m+O*b+L*d+T*l+P*f;h=z>>>13,z&=8191,z+=q*u+D*a+G*c+F*(5*x)+y*(5*g),h+=z>>>13,z&=8191;let W=h+B*g+O*m+L*b+T*d+P*l;h=W>>>13,W&=8191,W+=q*f+D*u+G*a+F*c+y*(5*x),h+=W>>>13,W&=8191;let J=h+B*x+O*g+L*m+T*b+P*d;h=J>>>13,J&=8191,J+=q*l+D*f+G*u+F*a+y*c,h+=J>>>13,J&=8191,h=(h<<2)+h|0,h=h+w|0,w=h&8191,h=h>>>13,E+=h,o[0]=w,o[1]=E,o[2]=v,o[3]=K,o[4]=R,o[5]=j,o[6]=N,o[7]=z,o[8]=W,o[9]=J}finalize(){let{h:e,pad:t}=this,n=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let c=2;c<10;c++)e[c]+=i,i=e[c]>>>13,e[c]&=8191;e[0]+=i*5,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,n[0]=e[0]+5,i=n[0]>>>13,n[0]&=8191;for(let c=1;c<10;c++)n[c]=e[c]+i,i=n[c]>>>13,n[c]&=8191;n[9]-=8192;let o=(i^1)-1;for(let c=0;c<10;c++)n[c]&=o;o=~o;for(let c=0;c<10;c++)e[c]=e[c]&o|n[c];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+t[0];e[0]=s&65535;for(let c=1;c<8;c++)s=(e[c]+t[c]|0)+(s>>>16)|0,e[c]=s&65535}update(e){ur(this);let{buffer:t,blockLen:n}=this;e=kt(e);let i=e.length;for(let o=0;o>>0,e[o++]=n[s]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}};function yi(r){let e=(n,i)=>r(i).update(kt(n)).digest(),t=r(new Uint8Array(32));return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=n=>r(n),e}var on=yi(r=>new hr(r));var bi=vt("expand 16-byte k"),wi=vt("expand 32-byte k"),xi=Ee(bi),mi=Ee(wi);function _(r,e){return r<>>32-e}function lr(r){return r.byteOffset%4===0}var At=64,gi=16,cn=2**32-1,sn=new Uint32Array;function _i(r,e,t,n,i,o,s,c){let a=i.length,u=new Uint8Array(At),f=Ee(u),l=lr(i)&&lr(o),d=l?Ee(i):sn,b=l?Ee(o):sn;for(let m=0;m=cn)throw new Error("arx: counter overflow");let g=Math.min(At,a-m);if(l&&g===At){let x=m/4;if(m%4!==0)throw new Error("arx: invalid block position");for(let A=0,I;A{$e(c),$e(a),$e(u);let d=u.length;if(f||(f=new Uint8Array(d)),$e(f),St(l),l<0||l>=cn)throw new Error("arx: counter overflow");if(f.length0;)b.pop().fill(0);return f}}function un(r,e,t,n,i,o=20){let s=r[0],c=r[1],a=r[2],u=r[3],f=e[0],l=e[1],d=e[2],b=e[3],m=e[4],g=e[5],x=e[6],A=e[7],I=i,p=t[0],S=t[1],k=t[2],C=s,$=c,H=a,B=u,O=f,L=l,T=d,P=b,q=m,D=g,G=x,F=A,y=I,h=p,w=S,E=k;for(let K=0;K{r.update(e);let t=e.length%16;t&&r.update(Si.subarray(t))},Ai=new Uint8Array(32);function fn(r,e,t,n,i){let o=r(e,t,Ai),s=on.create(o);i&&an(s,i),an(s,n);let c=new Uint8Array(16),a=en(c);ar(a,0,BigInt(i?i.length:0),!0),ar(a,8,BigInt(n.length),!0),s.update(c);let u=s.digest();return o.fill(0),u}var hn=r=>(e,t,n)=>(ze(e,32),ze(t),{encrypt:(o,s)=>{let c=o.length,a=c+16;s?ze(s,a):s=new Uint8Array(a),r(e,t,o,s,1);let u=fn(r,e,t,s.subarray(0,-16),n);return s.set(u,c),s},decrypt:(o,s)=>{let c=o.length,a=c-16;if(c<16)throw new Error("encrypted data must be at least 16 bytes");s?ze(s,a):s=new Uint8Array(a);let u=o.subarray(0,-16),f=o.subarray(-16),l=fn(r,e,t,u,n);if(!rn(f,l))throw new Error("invalid tag");return r(e,t,u,s,1),s}}),pr=cr({blockSize:64,nonceLength:12,tagLength:16},hn(vi)),As=cr({blockSize:64,nonceLength:24,tagLength:16},hn(ki));var yr=class{constructor(e){Object.defineProperty(this,"_key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._key=new Uint8Array(e)}async seal(e,t,n){return await this._seal(e,t,n)}async open(e,t,n){return await this._open(e,t,n)}_seal(e,t,n){return new Promise(i=>{let o=pr(this._key,new Uint8Array(e),new Uint8Array(n)).encrypt(new Uint8Array(t));i(o.buffer)})}_open(e,t,n){return new Promise(i=>{let o=pr(this._key,new Uint8Array(e),new Uint8Array(n)).decrypt(new Uint8Array(t));i(o.buffer)})}},Bt=class{constructor(){Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:ae.Chacha20Poly1305}),Object.defineProperty(this,"keySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"nonceSize",{enumerable:!0,configurable:!0,writable:!0,value:12}),Object.defineProperty(this,"tagSize",{enumerable:!0,configurable:!0,writable:!0,value:16})}createEncryptionContext(e){return new yr(e)}};function nt(r){if(!Number.isSafeInteger(r)||r<0)throw new Error(`Wrong positive integer: ${r}`)}function it(r,...e){if(!(r instanceof Uint8Array))throw new Error("Expected Uint8Array");if(e.length>0&&!e.includes(r.length))throw new Error(`Expected Uint8Array of length ${e}, not of length=${r.length}`)}function ln(r){if(typeof r!="function"||typeof r.create!="function")throw new Error("Hash should be wrapped by utils.wrapConstructor");nt(r.outputLen),nt(r.blockLen)}function ve(r,e=!0){if(r.destroyed)throw new Error("Hash instance has been destroyed");if(e&&r.finished)throw new Error("Hash#digest() has already been called")}function Pt(r,e){it(r);let t=e.outputLen;if(r.lengthr instanceof Uint8Array;var pn=r=>new Uint32Array(r.buffer,r.byteOffset,Math.floor(r.byteLength/4)),Lt=r=>new DataView(r.buffer,r.byteOffset,r.byteLength),de=(r,e)=>r<<32-e|r>>>e,Bi=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!Bi)throw new Error("Non little-endian hardware is not supported");function ot(r){if(typeof r!="string")throw new Error(`utf8ToBytes expected string, got ${typeof r}`);return new Uint8Array(new TextEncoder().encode(r))}function Ie(r){if(typeof r=="string"&&(r=ot(r)),!dn(r))throw new Error(`expected Uint8Array, got ${typeof r}`);return r}function Kt(...r){let e=new Uint8Array(r.reduce((n,i)=>n+i.length,0)),t=0;return r.forEach(n=>{if(!dn(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}var Pe=class{clone(){return this._cloneInto()}},Hs={}.toString;function we(r){let e=n=>r().update(Ie(n)).digest(),t=r();return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=()=>r(),e}function yn(r){let e=(n,i)=>r(i).update(Ie(n)).digest(),t=r({});return e.outputLen=t.outputLen,e.blockLen=t.blockLen,e.create=n=>r(n),e}function Ve(r=32){if(It&&typeof It.getRandomValues=="function")return It.getRandomValues(new Uint8Array(r));throw new Error("crypto.getRandomValues must be defined")}var Ut=class extends Pe{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,ln(e);let n=Ie(t);if(this.iHash=e.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,o=new Uint8Array(i);o.set(n.length>i?e.create().update(n).digest():n);for(let s=0;snew Ut(r,e).update(t).digest();je.create=(r,e)=>new Ut(r,e);function Pi(r,e,t,n){if(typeof r.setBigUint64=="function")return r.setBigUint64(e,t,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(t>>i&o),c=Number(t&o),a=n?4:0,u=n?0:4;r.setUint32(e+a,s,n),r.setUint32(e+u,c,n)}var Ze=class extends Pe{constructor(e,t,n,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=Lt(this.buffer)}update(e){ve(this);let{view:t,buffer:n,blockLen:i}=this;e=Ie(e);let o=e.length;for(let s=0;si-s&&(this.process(n,0),s=0);for(let l=s;lf.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;lr&e^~r&t,Li=(r,e,t)=>r&e^r&t^e&t,Ki=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),Le=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),Ke=new Uint32Array(64),br=class extends Ze{constructor(){super(64,32,8,!1),this.A=Le[0]|0,this.B=Le[1]|0,this.C=Le[2]|0,this.D=Le[3]|0,this.E=Le[4]|0,this.F=Le[5]|0,this.G=Le[6]|0,this.H=Le[7]|0}get(){let{A:e,B:t,C:n,D:i,E:o,F:s,G:c,H:a}=this;return[e,t,n,i,o,s,c,a]}set(e,t,n,i,o,s,c,a){this.A=e|0,this.B=t|0,this.C=n|0,this.D=i|0,this.E=o|0,this.F=s|0,this.G=c|0,this.H=a|0}process(e,t){for(let l=0;l<16;l++,t+=4)Ke[l]=e.getUint32(t,!1);for(let l=16;l<64;l++){let d=Ke[l-15],b=Ke[l-2],m=de(d,7)^de(d,18)^d>>>3,g=de(b,17)^de(b,19)^b>>>10;Ke[l]=g+Ke[l-7]+m+Ke[l-16]|0}let{A:n,B:i,C:o,D:s,E:c,F:a,G:u,H:f}=this;for(let l=0;l<64;l++){let d=de(c,6)^de(c,11)^de(c,25),b=f+d+Ii(c,a,u)+Ki[l]+Ke[l]|0,g=(de(n,2)^de(n,13)^de(n,22))+Li(n,i,o)|0;f=u,u=a,a=c,c=s+b|0,s=o,o=i,i=n,n=b+g|0}n=n+this.A|0,i=i+this.B|0,o=o+this.C|0,s=s+this.D|0,c=c+this.E|0,a=a+this.F|0,u=u+this.G|0,f=f+this.H|0,this.set(n,i,o,s,c,a,u,f)}roundClean(){Ke.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};var bn=we(()=>new br);var Z=new Uint8Array(0);var wn=new Uint8Array([72,80,75,69,45,118,49]),st=class extends be{constructor(){super(),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:_e.HkdfSha256}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:Z}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}init(e){this._suiteId=e}buildLabeledIkm(e,t){this._checkInit();let n=new Uint8Array(7+this._suiteId.byteLength+e.byteLength+t.byteLength);return n.set(wn,0),n.set(this._suiteId,7),n.set(e,7+this._suiteId.byteLength),n.set(t,7+this._suiteId.byteLength+e.byteLength),n}buildLabeledInfo(e,t,n){this._checkInit();let i=new Uint8Array(9+this._suiteId.byteLength+e.byteLength+t.byteLength);return i.set(new Uint8Array([0,n]),0),i.set(wn,2),i.set(this._suiteId,9),i.set(e,9+this._suiteId.byteLength),i.set(t,9+this._suiteId.byteLength+e.byteLength),i}async extract(e,t){if(await this._setup(),e.byteLength===0&&(e=new ArrayBuffer(this.hashSize)),e.byteLength!==this.hashSize)throw new ee("The salt length must be the same as the hashSize");let n=await this._api.importKey("raw",e,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",n,t)}async expand(e,t,n){await this._setup();let i=await this._api.importKey("raw",e,this.algHash,!1,["sign"]),o=new ArrayBuffer(n),s=new Uint8Array(o),c=Z,a=new Uint8Array(t),u=new Uint8Array(1);if(n>255*this.hashSize)throw new Error("Entropy limit reached");let f=new Uint8Array(this.hashSize+a.length+1);for(let l=1,d=0;d=c.length?(s.set(c,d),d+=c.length):(s.set(c.slice(0,s.length-d),d),d+=s.length-d);return o}async extractAndExpand(e,t,n,i){await this._setup();let o=await this._api.importKey("raw",t,"HKDF",!1,["deriveBits"]);return await this._api.deriveBits({name:"HKDF",hash:this.algHash.hash,salt:e,info:n},o,i*8)}async labeledExtract(e,t,n){return await this.extract(e,this.buildLabeledIkm(t,n))}async labeledExpand(e,t,n,i){return await this.expand(e,this.buildLabeledInfo(t,n,i),i)}_checkInit(){if(this._suiteId===Z)throw new Error("Not initialized. Call init()")}},Ot=class extends st{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:_e.HkdfSha256}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-256",length:256}})}},Ht=class extends st{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:_e.HkdfSha384}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:48}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-384",length:384}})}},Tt=class extends st{constructor(){super(...arguments),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:_e.HkdfSha512}),Object.defineProperty(this,"hashSize",{enumerable:!0,configurable:!0,writable:!0,value:64}),Object.defineProperty(this,"algHash",{enumerable:!0,configurable:!0,writable:!0,value:{name:"HMAC",hash:"SHA-512",length:512}})}};var Ue=class extends Ot{async extract(e,t){if(await this._setup(),e.byteLength===0&&(e=new ArrayBuffer(this.hashSize)),e.byteLength!==this.hashSize)return je(bn,new Uint8Array(e),new Uint8Array(t));let n=await this._api.importKey("raw",e,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",n,t)}};var Nt=BigInt(4294967295),wr=BigInt(32);function xn(r,e=!1){return e?{h:Number(r&Nt),l:Number(r>>wr&Nt)}:{h:Number(r>>wr&Nt)|0,l:Number(r&Nt)|0}}function xr(r,e=!1){let t=new Uint32Array(r.length),n=new Uint32Array(r.length);for(let i=0;iBigInt(r>>>0)<>>0),Oi=(r,e,t)=>r>>>t,Hi=(r,e,t)=>r<<32-t|e>>>t,Ti=(r,e,t)=>r>>>t|e<<32-t,Ni=(r,e,t)=>r<<32-t|e>>>t,Ri=(r,e,t)=>r<<64-t|e>>>t-32,Ci=(r,e,t)=>r>>>t-32|e<<64-t,Di=(r,e)=>e,zi=(r,e)=>r,mr=(r,e,t)=>r<>>32-t,gr=(r,e,t)=>e<>>32-t,_r=(r,e,t)=>e<>>64-t,Er=(r,e,t)=>r<>>64-t;function ji(r,e,t,n){let i=(e>>>0)+(n>>>0);return{h:r+t+(i/2**32|0)|0,l:i|0}}var Mi=(r,e,t)=>(r>>>0)+(e>>>0)+(t>>>0),qi=(r,e,t,n)=>e+t+n+(r/2**32|0)|0,Gi=(r,e,t,n)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0),Fi=(r,e,t,n,i)=>e+t+n+i+(r/2**32|0)|0,$i=(r,e,t,n,i)=>(r>>>0)+(e>>>0)+(t>>>0)+(n>>>0)+(i>>>0),Vi=(r,e,t,n,i,o)=>e+t+n+i+o+(r/2**32|0)|0;var Zi={fromBig:xn,split:xr,toBig:Ui,shrSH:Oi,shrSL:Hi,rotrSH:Ti,rotrSL:Ni,rotrBH:Ri,rotrBL:Ci,rotr32H:Di,rotr32L:zi,rotlSH:mr,rotlSL:gr,rotlBH:_r,rotlBL:Er,add:ji,add3L:Mi,add3H:qi,add4L:Gi,add4H:Fi,add5H:Vi,add5L:$i},U=Zi;var[Xi,Wi]=(()=>U.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(r=>BigInt(r))))(),Oe=new Uint32Array(80),He=new Uint32Array(80),Rt=class extends Ze{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){let{Ah:e,Al:t,Bh:n,Bl:i,Ch:o,Cl:s,Dh:c,Dl:a,Eh:u,El:f,Fh:l,Fl:d,Gh:b,Gl:m,Hh:g,Hl:x}=this;return[e,t,n,i,o,s,c,a,u,f,l,d,b,m,g,x]}set(e,t,n,i,o,s,c,a,u,f,l,d,b,m,g,x){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=i|0,this.Ch=o|0,this.Cl=s|0,this.Dh=c|0,this.Dl=a|0,this.Eh=u|0,this.El=f|0,this.Fh=l|0,this.Fl=d|0,this.Gh=b|0,this.Gl=m|0,this.Hh=g|0,this.Hl=x|0}process(e,t){for(let p=0;p<16;p++,t+=4)Oe[p]=e.getUint32(t),He[p]=e.getUint32(t+=4);for(let p=16;p<80;p++){let S=Oe[p-15]|0,k=He[p-15]|0,C=U.rotrSH(S,k,1)^U.rotrSH(S,k,8)^U.shrSH(S,k,7),$=U.rotrSL(S,k,1)^U.rotrSL(S,k,8)^U.shrSL(S,k,7),H=Oe[p-2]|0,B=He[p-2]|0,O=U.rotrSH(H,B,19)^U.rotrBH(H,B,61)^U.shrSH(H,B,6),L=U.rotrSL(H,B,19)^U.rotrBL(H,B,61)^U.shrSL(H,B,6),T=U.add4L($,L,He[p-7],He[p-16]),P=U.add4H(T,C,O,Oe[p-7],Oe[p-16]);Oe[p]=P|0,He[p]=T|0}let{Ah:n,Al:i,Bh:o,Bl:s,Ch:c,Cl:a,Dh:u,Dl:f,Eh:l,El:d,Fh:b,Fl:m,Gh:g,Gl:x,Hh:A,Hl:I}=this;for(let p=0;p<80;p++){let S=U.rotrSH(l,d,14)^U.rotrSH(l,d,18)^U.rotrBH(l,d,41),k=U.rotrSL(l,d,14)^U.rotrSL(l,d,18)^U.rotrBL(l,d,41),C=l&b^~l&g,$=d&m^~d&x,H=U.add5L(I,k,$,Wi[p],He[p]),B=U.add5H(H,A,S,C,Xi[p],Oe[p]),O=H|0,L=U.rotrSH(n,i,28)^U.rotrBH(n,i,34)^U.rotrBH(n,i,39),T=U.rotrSL(n,i,28)^U.rotrBL(n,i,34)^U.rotrBL(n,i,39),P=n&o^n&c^o&c,q=i&s^i&a^s&a;A=g|0,I=x|0,g=b|0,x=m|0,b=l|0,m=d|0,{h:l,l:d}=U.add(u|0,f|0,B|0,O|0),u=c|0,f=a|0,c=o|0,a=s|0,o=n|0,s=i|0;let D=U.add3L(O,T,q);n=U.add3H(D,B,L,P),i=D|0}({h:n,l:i}=U.add(this.Ah|0,this.Al|0,n|0,i|0)),{h:o,l:s}=U.add(this.Bh|0,this.Bl|0,o|0,s|0),{h:c,l:a}=U.add(this.Ch|0,this.Cl|0,c|0,a|0),{h:u,l:f}=U.add(this.Dh|0,this.Dl|0,u|0,f|0),{h:l,l:d}=U.add(this.Eh|0,this.El|0,l|0,d|0),{h:b,l:m}=U.add(this.Fh|0,this.Fl|0,b|0,m|0),{h:g,l:x}=U.add(this.Gh|0,this.Gl|0,g|0,x|0),{h:A,l:I}=U.add(this.Hh|0,this.Hl|0,A|0,I|0),this.set(n,i,o,s,c,a,u,f,l,d,b,m,g,x,A,I)}roundClean(){Oe.fill(0),He.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};var vr=class extends Rt{constructor(){super(),this.Ah=-876896931,this.Al=-1056596264,this.Bh=1654270250,this.Bl=914150663,this.Ch=-1856437926,this.Cl=812702999,this.Dh=355462360,this.Dl=-150054599,this.Eh=1731405415,this.El=-4191439,this.Fh=-1900787065,this.Fl=1750603025,this.Gh=-619958771,this.Gl=1694076839,this.Hh=1203062813,this.Hl=-1090891868,this.outputLen=48}},ct=we(()=>new Rt);var mn=we(()=>new vr);var Xe=class extends Ht{async extract(e,t){if(await this._setup(),e.byteLength===0&&(e=new ArrayBuffer(this.hashSize)),e.byteLength!==this.hashSize)return je(mn,new Uint8Array(e),new Uint8Array(t));let n=await this._api.importKey("raw",e,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",n,t)}};var Te=class extends Tt{async extract(e,t){if(await this._setup(),e.byteLength===0&&(e=new ArrayBuffer(this.hashSize)),e.byteLength!==this.hashSize)return je(ct,new Uint8Array(e),new Uint8Array(t));let n=await this._api.importKey("raw",e,this.algHash,!1,["sign"]);return await this._api.sign("HMAC",n,t)}};var gn=new Uint8Array([75,69,77,0,0]);var We=r=>typeof r=="object"&&r!==null&&typeof r.privateKey=="object"&&typeof r.publicKey=="object";function xe(r,e){if(e<=0)throw new Error("i2Osp: too small size");if(r>=256**e)throw new Error("i2Osp: too large integer");let t=new Uint8Array(e);for(let n=0;n>8;return t}function at(r,e){let t=new Uint8Array(r.length+e.length);return t.set(r,0),t.set(e,r.length),t}function Ne(r){let e=r.replace(/-/g,"+").replace(/_/g,"/"),t=atob(e),n=new Uint8Array(t.length);for(let i=0;i8192)throw new ee("Too long ikm");return await this._prim.deriveKeyPair(e)}async encap(e){let t;e.ekm===void 0?t=await this.generateKeyPair():We(e.ekm)?t=e.ekm:t=await this.deriveKeyPair(e.ekm);let n=await this._prim.serializePublicKey(t.publicKey),i=await this._prim.serializePublicKey(e.recipientPublicKey);try{let o;if(e.senderKey===void 0)o=new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey));else{let a=We(e.senderKey)?e.senderKey.privateKey:e.senderKey,u=new Uint8Array(await this._prim.dh(t.privateKey,e.recipientPublicKey)),f=new Uint8Array(await this._prim.dh(a,e.recipientPublicKey));o=at(u,f)}let s;if(e.senderKey===void 0)s=at(new Uint8Array(n),new Uint8Array(i));else{let a=We(e.senderKey)?e.senderKey.publicKey:await this._prim.derivePublicKey(e.senderKey),u=await this._prim.serializePublicKey(a);s=Qi(new Uint8Array(n),new Uint8Array(i),new Uint8Array(u))}let c=await this._generateSharedSecret(o,s);return{enc:n,sharedSecret:c}}catch(o){throw new yt(o)}}async decap(e){let t=await this._prim.deserializePublicKey(e.enc),n=We(e.recipientKey)?e.recipientKey.privateKey:e.recipientKey,i=We(e.recipientKey)?e.recipientKey.publicKey:await this._prim.derivePublicKey(e.recipientKey),o=await this._prim.serializePublicKey(i);try{let s;if(e.senderPublicKey===void 0)s=new Uint8Array(await this._prim.dh(n,t));else{let a=new Uint8Array(await this._prim.dh(n,t)),u=new Uint8Array(await this._prim.dh(n,e.senderPublicKey));s=at(a,u)}let c;if(e.senderPublicKey===void 0)c=at(new Uint8Array(e.enc),new Uint8Array(o));else{let a=await this._prim.serializePublicKey(e.senderPublicKey);c=new Uint8Array(e.enc.byteLength+o.byteLength+a.byteLength),c.set(new Uint8Array(e.enc),0),c.set(new Uint8Array(o),e.enc.byteLength),c.set(new Uint8Array(a),e.enc.byteLength+o.byteLength)}return await this._generateSharedSecret(s,c)}catch(s){throw new bt(s)}}async _generateSharedSecret(e,t){let n=this._kdf.buildLabeledIkm(Yi,e),i=this._kdf.buildLabeledInfo(Ji,t,this.secretSize);return await this._kdf.extractAndExpand(Z,n,i,this.secretSize)}};var fe=["deriveBits"],Ye=new Uint8Array([100,107,112,95,112,114,107]),Ct=new Uint8Array([115,107]);var Dt=class{constructor(e){Object.defineProperty(this,"_num",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._num=new Uint8Array(e)}val(){return this._num}reset(){this._num.fill(0)}set(e){if(e.length!==this._num.length)throw new Error("Bignum.set: invalid argument");this._num.set(e)}isZero(){for(let e=0;ee[t])return!1}return!1}};var eo=new Uint8Array([99,97,110,100,105,100,97,116,101]),to=new Uint8Array([255,255,255,255,0,0,0,0,255,255,255,255,255,255,255,255,188,230,250,173,167,23,158,132,243,185,202,194,252,99,37,81]),ro=new Uint8Array([255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,199,99,77,129,244,55,45,223,88,26,13,178,72,176,167,122,236,236,25,106,204,197,41,115]),no=new Uint8Array([1,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,81,134,135,131,191,47,150,107,127,204,1,72,247,9,165,208,59,181,201,184,137,156,71,174,187,111,183,30,145,56,100,9]),io=new Uint8Array([48,65,2,1,0,48,19,6,7,42,134,72,206,61,2,1,6,8,42,134,72,206,61,3,1,7,4,39,48,37,2,1,1,4,32]),oo=new Uint8Array([48,78,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,34,4,55,48,53,2,1,1,4,48]),so=new Uint8Array([48,96,2,1,0,48,16,6,7,42,134,72,206,61,2,1,6,5,43,129,4,0,35,4,73,48,71,2,1,1,4,66]),Re=class extends be{constructor(e,t){switch(super(),Object.defineProperty(this,"_hkdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_alg",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nPk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nSk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nDh",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_order",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_bitmask",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_pkcs8AlgId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hkdf=t,e){case V.DhkemP256HkdfSha256:this._alg={name:"ECDH",namedCurve:"P-256"},this._nPk=65,this._nSk=32,this._nDh=32,this._order=to,this._bitmask=255,this._pkcs8AlgId=io;break;case V.DhkemP384HkdfSha384:this._alg={name:"ECDH",namedCurve:"P-384"},this._nPk=97,this._nSk=48,this._nDh=48,this._order=ro,this._bitmask=255,this._pkcs8AlgId=oo;break;default:this._alg={name:"ECDH",namedCurve:"P-521"},this._nPk=133,this._nSk=66,this._nDh=66,this._order=no,this._bitmask=1,this._pkcs8AlgId=so;break}}async serializePublicKey(e){await this._setup();try{return await this._api.exportKey("raw",e)}catch(t){throw new se(t)}}async deserializePublicKey(e){await this._setup();try{return await this._importRawKey(e,!0)}catch(t){throw new te(t)}}async serializePrivateKey(e){await this._setup();try{let t=await this._api.exportKey("jwk",e);if(!("d"in t))throw new Error("Not private key");return Ne(t.d)}catch(t){throw new se(t)}}async deserializePrivateKey(e){await this._setup();try{return await this._importRawKey(e,!1)}catch(t){throw new te(t)}}async importKey(e,t,n){await this._setup();try{if(e==="raw")return await this._importRawKey(t,n);if(t instanceof ArrayBuffer)throw new Error("Invalid jwk key format");return await this._importJWK(t,n)}catch(i){throw new te(i)}}async generateKeyPair(){await this._setup();try{return await this._api.generateKey(this._alg,!0,fe)}catch(e){throw new ce(e)}}async deriveKeyPair(e){await this._setup();try{let t=await this._hkdf.labeledExtract(Z,Ye,new Uint8Array(e)),n=new Dt(this._nSk);for(let o=0;n.isZero()||!n.lessThan(this._order);o++){if(o>255)throw new Error("Faild to derive a key pair");let s=new Uint8Array(await this._hkdf.labeledExpand(t,eo,xe(o,1),this._nSk));s[0]=s[0]&this._bitmask,n.set(s)}let i=await this._deserializePkcs8Key(n.val());return n.reset(),{privateKey:i,publicKey:await this.derivePublicKey(i)}}catch(t){throw new Be(t)}}async derivePublicKey(e){await this._setup();try{let t=await this._api.exportKey("jwk",e);return delete t.d,delete t.key_ops,await this._api.importKey("jwk",t,this._alg,!0,[])}catch(t){throw new te(t)}}async dh(e,t){try{return await this._setup(),await this._api.deriveBits({name:"ECDH",public:t},e,this._nDh*8)}catch(n){throw new se(n)}}async _importRawKey(e,t){if(t&&e.byteLength!==this._nPk)throw new Error("Invalid public key for the ciphersuite");if(!t&&e.byteLength!==this._nSk)throw new Error("Invalid private key for the ciphersuite");return t?await this._api.importKey("raw",e,this._alg,!0,[]):await this._deserializePkcs8Key(new Uint8Array(e))}async _importJWK(e,t){if(typeof e.crv>"u"||e.crv!==this._alg.namedCurve)throw new Error(`Invalid crv: ${e.crv}`);if(t){if(typeof e.d<"u")throw new Error("Invalid key: `d` should not be set");return await this._api.importKey("jwk",e,this._alg,!0,[])}if(typeof e.d>"u")throw new Error("Invalid key: `d` not found");return await this._api.importKey("jwk",e,this._alg,!0,fe)}async _deserializePkcs8Key(e){let t=new Uint8Array(this._pkcs8AlgId.length+e.length);return t.set(this._pkcs8AlgId,0),t.set(e,this._pkcs8AlgId.length),await this._api.importKey("pkcs8",t,this._alg,!0,fe)}};var zt=class extends le{constructor(){let e=new Ue,t=new Re(V.DhkemP256HkdfSha256,e);super(V.DhkemP256HkdfSha256,t,e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:V.DhkemP256HkdfSha256}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:65}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:32})}};var jt=class extends le{constructor(){let e=new Xe,t=new Re(V.DhkemP384HkdfSha384,e);super(V.DhkemP384HkdfSha384,t,e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:V.DhkemP384HkdfSha384}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:48}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:97}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:97}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:48})}};var Mt=class extends le{constructor(){let e=new Te,t=new Re(V.DhkemP521HkdfSha512,e);super(V.DhkemP521HkdfSha512,t,e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:V.DhkemP521HkdfSha512}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:64}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:133}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:133}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:64})}};var $c=BigInt(0),co=BigInt(1),ao=BigInt(2),qt=r=>r instanceof Uint8Array,fo=Array.from({length:256},(r,e)=>e.toString(16).padStart(2,"0"));function Gt(r){if(!qt(r))throw new Error("Uint8Array expected");let e="";for(let t=0;tn+i.length,0)),t=0;return r.forEach(n=>{if(!qt(n))throw new Error("Uint8Array expected");e.set(n,t),t+=n.length}),e}var kn=r=>(ao<typeof r=="bigint",function:r=>typeof r=="function",boolean:r=>typeof r=="boolean",string:r=>typeof r=="string",stringOrUint8Array:r=>typeof r=="string"||r instanceof Uint8Array,isSafeInteger:r=>Number.isSafeInteger(r),array:r=>Array.isArray(r),field:(r,e)=>e.Fp.isValid(r),hash:r=>typeof r=="function"&&Number.isSafeInteger(r.outputLen)};function Ce(r,e,t={}){let n=(i,o,s)=>{let c=uo[o];if(typeof c!="function")throw new Error(`Invalid validator "${o}", expected function`);let a=r[i];if(!(s&&a===void 0)&&!c(a,r))throw new Error(`Invalid param ${String(i)}=${a} (${typeof a}), expected ${o}`)};for(let[i,o]of Object.entries(e))n(i,o,!1);for(let[i,o]of Object.entries(t))n(i,o,!0);return r}var Q=BigInt(0),Y=BigInt(1),Ge=BigInt(2),lo=BigInt(3),Ar=BigInt(4),Sn=BigInt(5),An=BigInt(8),po=BigInt(9),yo=BigInt(16);function M(r,e){let t=r%e;return t>=Q?t:e+t}function Br(r,e,t){if(t<=Q||e 0");if(t===Y)return Q;let n=Y;for(;e>Q;)e&Y&&(n=n*r%t),r=r*r%t,e>>=Y;return n}function X(r,e,t){let n=r;for(;e-- >Q;)n*=n,n%=t;return n}function Bn(r,e){if(r===Q||e<=Q)throw new Error(`invert: expected positive integers, got n=${r} mod=${e}`);let t=M(r,e),n=e,i=Q,o=Y,s=Y,c=Q;for(;t!==Q;){let u=n/t,f=n%t,l=i-s*u,d=o-c*u;n=t,t=f,i=s,o=c,s=l,c=d}if(n!==Y)throw new Error("invert: does not exist");return M(i,e)}function bo(r){let e=(r-Y)/Ge,t,n,i;for(t=r-Y,n=0;t%Ge===Q;t/=Ge,n++);for(i=Ge;i(M(r,e)&Y)===Y,xo=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Pn(r){let e={ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"},t=xo.reduce((n,i)=>(n[i]="function",n),e);return Ce(r,t)}function mo(r,e,t){if(t 0");if(t===Q)return r.ONE;if(t===Y)return e;let n=r.ONE,i=e;for(;t>Q;)t&Y&&(n=r.mul(n,i)),i=r.sqr(i),t>>=Y;return n}function go(r,e){let t=new Array(e.length),n=e.reduce((o,s,c)=>r.is0(s)?o:(t[c]=o,r.mul(o,s)),r.ONE),i=r.inv(n);return e.reduceRight((o,s,c)=>r.is0(s)?o:(t[c]=r.mul(o,t[c]),r.mul(o,s)),i),t}function Ir(r,e){let t=e!==void 0?e:r.toString(2).length,n=Math.ceil(t/8);return{nBitLength:t,nByteLength:n}}function Ft(r,e,t=!1,n={}){if(r<=Q)throw new Error(`Expected Field ORDER > 0, got ${r}`);let{nBitLength:i,nByteLength:o}=Ir(r,e);if(o>2048)throw new Error("Field lengths over 2048 bytes are not supported");let s=wo(r),c=Object.freeze({ORDER:r,BITS:i,BYTES:o,MASK:kn(i),ZERO:Q,ONE:Y,create:a=>M(a,r),isValid:a=>{if(typeof a!="bigint")throw new Error(`Invalid field element: expected bigint, got ${typeof a}`);return Q<=a&&aa===Q,isOdd:a=>(a&Y)===Y,neg:a=>M(-a,r),eql:(a,u)=>a===u,sqr:a=>M(a*a,r),add:(a,u)=>M(a+u,r),sub:(a,u)=>M(a-u,r),mul:(a,u)=>M(a*u,r),pow:(a,u)=>mo(c,a,u),div:(a,u)=>M(a*Bn(u,r),r),sqrN:a=>a*a,addN:(a,u)=>a+u,subN:(a,u)=>a-u,mulN:(a,u)=>a*u,inv:a=>Bn(a,r),sqrt:n.sqrt||(a=>s(c,a)),invertBatch:a=>go(c,a),cmov:(a,u,f)=>f?u:a,toBytes:a=>t?qe(a,o):kr(a,o),fromBytes:a=>{if(a.length!==o)throw new Error(`Fp.fromBytes: expected ${o}, got ${a.length}`);return t?ke(a):vn(a)}});return Object.freeze(c)}function In(r,e){if(!r.isOdd)throw new Error("Field doesn't have isOdd");let t=r.sqrt(e);return r.isOdd(t)?r.neg(t):t}var _o=BigInt(0),Lr=BigInt(1);function Ln(r,e){let t=(i,o)=>{let s=o.negate();return i?s:o},n=i=>{let o=Math.ceil(e/i)+1,s=2**(i-1);return{windows:o,windowSize:s}};return{constTimeNegate:t,unsafeLadder(i,o){let s=r.ZERO,c=i;for(;o>_o;)o&Lr&&(s=s.add(c)),c=c.double(),o>>=Lr;return s},precomputeWindow(i,o){let{windows:s,windowSize:c}=n(o),a=[],u=i,f=u;for(let l=0;l>=b,x>a&&(x-=d,s+=Lr);let A=g,I=g+Math.abs(x)-1,p=m%2!==0,S=x<0;x===0?f=f.add(t(p,o[A])):u=u.add(t(S,o[I]))}return{p:u,f}},wNAFCached(i,o,s,c){let a=i._WINDOW_SIZE||1,u=o.get(i);return u||(u=this.precomputeWindow(i,a),a!==1&&o.set(i,c(u))),this.wNAF(a,u,s)}}}function Kn(r){return Pn(r.Fp),Ce(r,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ir(r.n,r.nBitLength),...r,p:r.Fp.ORDER})}var pe=BigInt(0),he=BigInt(1),$t=BigInt(2),Eo=BigInt(8),vo={zip215:!0};function ko(r){let e=Kn(r);return Ce(r,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}function Fe(r){let e=ko(r),{Fp:t,n,prehash:i,hash:o,randomBytes:s,nByteLength:c,h:a}=e,u=$t<{try{return{isValid:!0,value:t.sqrt(y*t.inv(h))}}catch{return{isValid:!1,value:pe}}}),d=e.adjustScalarBytes||(y=>y),b=e.domain||((y,h,w)=>{if(h.length||w)throw new Error("Contexts/pre-hash are not supported");return y}),m=y=>typeof y=="bigint"&&pem(y)&&m(h)&&yy===pe||g(y,u);function A(y,h){if(g(y,h))return y;throw new Error(`Expected valid scalar < ${h}, got ${typeof y} ${y}`)}function I(y){return y===pe?y:A(y,n)}let p=new Map;function S(y){if(!(y instanceof k))throw new Error("ExtendedPoint expected")}class k{constructor(h,w,E,v){if(this.ex=h,this.ey=w,this.ez=E,this.et=v,!x(h))throw new Error("x required");if(!x(w))throw new Error("y required");if(!x(E))throw new Error("z required");if(!x(v))throw new Error("t required")}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(h){if(h instanceof k)throw new Error("extended point not allowed");let{x:w,y:E}=h||{};if(!x(w)||!x(E))throw new Error("invalid affine point");return new k(w,E,he,f(w*E))}static normalizeZ(h){let w=t.invertBatch(h.map(E=>E.ez));return h.map((E,v)=>E.toAffine(w[v])).map(k.fromAffine)}_setWindowSize(h){this._WINDOW_SIZE=h,p.delete(this)}assertValidity(){let{a:h,d:w}=e;if(this.is0())throw new Error("bad point: ZERO");let{ex:E,ey:v,ez:K,et:R}=this,j=f(E*E),N=f(v*v),z=f(K*K),W=f(z*z),J=f(j*h),ye=f(z*f(J+N)),ie=f(W+f(w*f(j*N)));if(ye!==ie)throw new Error("bad point: equation left != right (1)");let Ae=f(E*v),me=f(K*R);if(Ae!==me)throw new Error("bad point: equation left != right (2)")}equals(h){S(h);let{ex:w,ey:E,ez:v}=this,{ex:K,ey:R,ez:j}=h,N=f(w*j),z=f(K*v),W=f(E*j),J=f(R*v);return N===z&&W===J}is0(){return this.equals(k.ZERO)}negate(){return new k(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:h}=e,{ex:w,ey:E,ez:v}=this,K=f(w*w),R=f(E*E),j=f($t*f(v*v)),N=f(h*K),z=w+E,W=f(f(z*z)-K-R),J=N+R,ye=J-j,ie=N-R,Ae=f(W*ye),me=f(J*ie),dt=f(W*ie),pt=f(ye*J);return new k(Ae,me,pt,dt)}add(h){S(h);let{a:w,d:E}=e,{ex:v,ey:K,ez:R,et:j}=this,{ex:N,ey:z,ez:W,et:J}=h;if(w===BigInt(-1)){let jr=f((K-v)*(z+N)),Mr=f((K+v)*(z-N)),ir=f(Mr-jr);if(ir===pe)return this.double();let qr=f(R*$t*J),Gr=f(j*$t*W),Fr=Gr+qr,$r=Mr+jr,Vr=Gr-qr,ii=f(Fr*ir),oi=f($r*Vr),si=f(Fr*Vr),ci=f(ir*$r);return new k(ii,oi,ci,si)}let ye=f(v*N),ie=f(K*z),Ae=f(j*E*J),me=f(R*W),dt=f((v+K)*(N+z)-ye-ie),pt=me-Ae,Dr=me+Ae,zr=f(ie-w*ye),ei=f(dt*pt),ti=f(Dr*zr),ri=f(dt*zr),ni=f(pt*Dr);return new k(ei,ti,ni,ri)}subtract(h){return this.add(h.negate())}wNAF(h){return H.wNAFCached(this,p,h,k.normalizeZ)}multiply(h){let{p:w,f:E}=this.wNAF(A(h,n));return k.normalizeZ([w,E])[0]}multiplyUnsafe(h){let w=I(h);return w===pe?$:this.equals($)||w===he?this:this.equals(C)?this.wNAF(w).p:H.unsafeLadder(this,w)}isSmallOrder(){return this.multiplyUnsafe(a).is0()}isTorsionFree(){return H.unsafeLadder(this,n).is0()}toAffine(h){let{ex:w,ey:E,ez:v}=this,K=this.is0();h==null&&(h=K?Eo:t.inv(v));let R=f(w*h),j=f(E*h),N=f(v*h);if(K)return{x:pe,y:he};if(N!==he)throw new Error("invZ was invalid");return{x:R,y:j}}clearCofactor(){let{h}=e;return h===he?this:this.multiplyUnsafe(h)}static fromHex(h,w=!1){let{d:E,a:v}=e,K=t.BYTES;h=ue("pointHex",h,K);let R=h.slice(),j=h[K-1];R[K-1]=j&-129;let N=ke(R);N===pe||(w?A(N,u):A(N,t.ORDER));let z=f(N*N),W=f(z-he),J=f(E*z-v),{isValid:ye,value:ie}=l(W,J);if(!ye)throw new Error("Point.fromHex: invalid y coordinate");let Ae=(ie&he)===he,me=(j&128)!==0;if(!w&&ie===pe&&me)throw new Error("Point.fromHex: x=0 and x_0=1");return me!==Ae&&(ie=f(-ie)),k.fromAffine({x:ie,y:N})}static fromPrivateKey(h){return L(h).point}toRawBytes(){let{x:h,y:w}=this.toAffine(),E=qe(w,t.BYTES);return E[E.length-1]|=h&he?128:0,E}toHex(){return Gt(this.toRawBytes())}}k.BASE=new k(e.Gx,e.Gy,he,f(e.Gx*e.Gy)),k.ZERO=new k(pe,he,he,pe);let{BASE:C,ZERO:$}=k,H=Ln(k,c*8);function B(y){return M(y,n)}function O(y){return B(ke(y))}function L(y){let h=c;y=ue("private key",y,h);let w=ue("hashed private key",o(y),2*h),E=d(w.slice(0,h)),v=w.slice(h,2*h),K=O(E),R=C.multiply(K),j=R.toRawBytes();return{head:E,prefix:v,scalar:K,point:R,pointBytes:j}}function T(y){return L(y).pointBytes}function P(y=new Uint8Array,...h){let w=Sr(...h);return O(o(b(w,ue("context",y),!!i)))}function q(y,h,w={}){y=ue("message",y),i&&(y=i(y));let{prefix:E,scalar:v,pointBytes:K}=L(h),R=P(w.context,E,y),j=C.multiply(R).toRawBytes(),N=P(w.context,j,K,y),z=B(R+N*v);I(z);let W=Sr(j,qe(z,t.BYTES));return ue("result",W,c*2)}let D=vo;function G(y,h,w,E=D){let{context:v,zip215:K}=E,R=t.BYTES;y=ue("signature",y,2*R),h=ue("message",h),i&&(h=i(h));let j=ke(y.slice(R,2*R)),N,z,W;try{N=k.fromHex(w,K),z=k.fromHex(y.slice(0,R),K),W=C.multiplyUnsafe(j)}catch{return!1}if(!K&&N.isSmallOrder())return!1;let J=P(v,z.toRawBytes(),N.toRawBytes(),h);return z.add(N.multiplyUnsafe(J)).subtract(W).clearCofactor().equals(k.ZERO)}return C._setWindowSize(8),{CURVE:e,getPublicKey:T,sign:q,verify:G,ExtendedPoint:k,utils:{getExtendedPublicKey:L,randomPrivateKey:()=>s(t.BYTES),precompute(y=8,h=k.BASE){return h._setWindowSize(y),h.multiply(BigInt(3)),h}}}}var ft=BigInt(0),Kr=BigInt(1);function So(r){return Ce(r,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...r})}function Vt(r){let e=So(r),{P:t}=e,n=p=>M(p,t),i=e.montgomeryBits,o=Math.ceil(i/8),s=e.nByteLength,c=e.adjustScalarBytes||(p=>p),a=e.powPminus2||(p=>Br(p,t-BigInt(2),t));function u(p,S,k){let C=n(p*(S-k));return S=n(S-C),k=n(k+C),[S,k]}function f(p){if(typeof p=="bigint"&&ft<=p&&p=ft;D--){let G=C>>D&Kr;T^=G,P=u(T,H,O),H=P[0],O=P[1],P=u(T,B,L),B=P[0],L=P[1],T=G;let F=H+B,y=n(F*F),h=H-B,w=n(h*h),E=y-w,v=O+L,K=O-L,R=n(K*F),j=n(v*h),N=R+j,z=R-j;O=n(N*N),L=n($*n(z*z)),H=n(y*w),B=n(E*(y+n(l*E)))}P=u(T,H,O),H=P[0],O=P[1],P=u(T,B,L),B=P[0],L=P[1];let q=a(B);return n(H*q)}function b(p){return qe(n(p),o)}function m(p){let S=ue("u coordinate",p,o);return s===o&&(S[s-1]&=127),ke(S)}function g(p){let S=ue("scalar",p);if(S.length!==o&&S.length!==s)throw new Error(`Expected ${o} or ${s} bytes, got ${S.length}`);return ke(c(S))}function x(p,S){let k=m(S),C=g(p),$=d(k,C);if($===ft)throw new Error("Invalid private or public key received");return b($)}let A=b(e.Gu);function I(p){return x(p,A)}return{scalarMult:x,scalarMultBase:I,getSharedSecret:(p,S)=>x(p,S),getPublicKey:p=>I(p),utils:{randomPrivateKey:()=>e.randomBytes(e.nByteLength)},GuBytes:A}}var ut=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Un=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),ua=BigInt(0),Ao=BigInt(1),Ur=BigInt(2),Bo=BigInt(5),On=BigInt(10),Po=BigInt(20),Io=BigInt(40),Hn=BigInt(80);function Tn(r){let e=ut,n=r*r%e*r%e,i=X(n,Ur,e)*n%e,o=X(i,Ao,e)*r%e,s=X(o,Bo,e)*o%e,c=X(s,On,e)*s%e,a=X(c,Po,e)*c%e,u=X(a,Io,e)*a%e,f=X(u,Hn,e)*u%e,l=X(f,Hn,e)*u%e,d=X(l,On,e)*s%e;return{pow_p_5_8:X(d,Ur,e)*r%e,b2:n}}function Nn(r){return r[0]&=248,r[31]&=127,r[31]|=64,r}function Lo(r,e){let t=ut,n=M(e*e*e,t),i=M(n*n*e,t),o=Tn(r*i).pow_p_5_8,s=M(r*n*o,t),c=M(e*s*s,t),a=s,u=M(s*Un,t),f=c===r,l=c===M(-r,t),d=c===M(-r*Un,t);return f&&(s=a),(l||d)&&(s=u),Pr(s,t)&&(s=M(-s,t)),{isValid:f||l,value:s}}var Se=Ft(ut,void 0,!0),Or={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:Se,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:BigInt(8),Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:ct,randomBytes:Ve,adjustScalarBytes:Nn,uvRatio:Lo},Rn=Fe(Or);function Cn(r,e,t){if(e.length>255)throw new Error("Context is too big");return Kt(ot("SigEd25519 no Ed25519 collisions"),new Uint8Array([t?1:0,e.length]),e,r)}var ha=Fe({...Or,domain:Cn}),la=Fe({...Or,domain:Cn,prehash:ct}),Hr=(()=>Vt({P:ut,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:r=>{let e=ut,{pow_p_5_8:t,b2:n}=Tn(r);return M(X(t,BigInt(3),e)*n,e)},adjustScalarBytes:Nn,randomBytes:Ve}))();var Ko=(Se.ORDER+BigInt(3))/BigInt(8),da=Se.pow(Ur,Ko),pa=Se.sqrt(Se.neg(Se.ONE)),ya=(Se.ORDER-BigInt(5))/BigInt(8),ba=BigInt(486662);var wa=In(Se,Se.neg(BigInt(486664)));var xa=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),ma=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),ga=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),_a=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952");var Ea=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var ne=class{constructor(e,t,n,i=[]){Object.defineProperty(this,"key",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"type",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"extractable",{enumerable:!0,configurable:!0,writable:!0,value:!0}),Object.defineProperty(this,"algorithm",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"usages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.key=t,this.type=n,this.algorithm={name:e},this.usages=i,n==="public"&&(this.usages=[])}};var Je="X25519",Zt=class{constructor(e){Object.defineProperty(this,"_hkdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nPk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nSk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hkdf=e,this._nPk=32,this._nSk=32}async serializePublicKey(e){try{return await this._serializePublicKey(e)}catch(t){throw new se(t)}}async deserializePublicKey(e){try{return await this._importRawKey(e,!0)}catch(t){throw new te(t)}}async serializePrivateKey(e){try{return await this._serializePrivateKey(e)}catch(t){throw new se(t)}}async deserializePrivateKey(e){try{return await this._importRawKey(e,!1)}catch(t){throw new te(t)}}async importKey(e,t,n){try{if(e==="raw")return await this._importRawKey(t,n);if(t instanceof ArrayBuffer)throw new Error("Invalid jwk key format");return await this._importJWK(t,n)}catch(i){throw new te(i)}}async generateKeyPair(){try{let e=Rn.utils.randomPrivateKey(),t=new ne(Je,e,"private",fe);return{publicKey:await this.derivePublicKey(t),privateKey:t}}catch(e){throw new ce(e)}}async deriveKeyPair(e){try{let t=await this._hkdf.labeledExtract(Z,Ye,new Uint8Array(e)),n=await this._hkdf.labeledExpand(t,Ct,Z,this._nSk),i=new ne(Je,new Uint8Array(n),"private",fe);return{privateKey:i,publicKey:await this.derivePublicKey(i)}}catch(t){throw new Be(t)}}async derivePublicKey(e){try{return await this._derivePublicKey(e)}catch(t){throw new te(t)}}async dh(e,t){try{return await this._dh(e,t)}catch(n){throw new se(n)}}_serializePublicKey(e){return new Promise(t=>{t(e.key.buffer)})}_serializePrivateKey(e){return new Promise(t=>{t(e.key.buffer)})}_importRawKey(e,t){return new Promise((n,i)=>{t&&e.byteLength!==this._nPk&&i(new Error("Invalid length of the key")),!t&&e.byteLength!==this._nSk&&i(new Error("Invalid length of the key")),n(new ne(Je,new Uint8Array(e),t?"public":"private",t?[]:fe))})}_importJWK(e,t){return new Promise((n,i)=>{(typeof e.kty>"u"||e.kty!=="OKP")&&i(new Error(`Invalid kty: ${e.kty}`)),(typeof e.crv>"u"||e.crv!=="X25519")&&i(new Error(`Invalid crv: ${e.crv}`)),t?(typeof e.d<"u"&&i(new Error("Invalid key: `d` should not be set")),typeof e.x>"u"&&i(new Error("Invalid key: `x` not found")),n(new ne(Je,Ne(e.x),"public"))):(typeof e.d!="string"&&i(new Error("Invalid key: `d` not found")),n(new ne(Je,Ne(e.d),"private",fe)))})}_derivePublicKey(e){return new Promise((t,n)=>{try{let i=Hr.getPublicKey(e.key);t(new ne(Je,i,"public"))}catch(i){n(i)}})}_dh(e,t){return new Promise((n,i)=>{try{n(Hr.getSharedSecret(e.key,t.key).buffer)}catch(o){i(o)}})}};var Xt=class extends le{constructor(){let e=new Ue;super(V.DhkemX25519HkdfSha256,new Zt(e),e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:V.DhkemX25519HkdfSha256}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:32}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:32})}};var[jn,Mn,qn]=[[],[],[]],Uo=BigInt(0),ht=BigInt(1),Oo=BigInt(2),Ho=BigInt(7),To=BigInt(256),No=BigInt(113);for(let r=0,e=ht,t=1,n=0;r<24;r++){[t,n]=[n,(2*t+3*n)%5],jn.push(2*(5*n+t)),Mn.push((r+1)*(r+2)/2%64);let i=Uo;for(let o=0;o<7;o++)e=(e<>Ho)*No)%To,e&Oo&&(i^=ht<<(ht<t>32?_r(r,e,t):mr(r,e,t),zn=(r,e,t)=>t>32?Er(r,e,t):gr(r,e,t);function Do(r,e=24){let t=new Uint32Array(10);for(let n=24-e;n<24;n++){for(let s=0;s<10;s++)t[s]=r[s]^r[s+10]^r[s+20]^r[s+30]^r[s+40];for(let s=0;s<10;s+=2){let c=(s+8)%10,a=(s+2)%10,u=t[a],f=t[a+1],l=Dn(u,f,1)^t[c],d=zn(u,f,1)^t[c+1];for(let b=0;b<50;b+=10)r[s+b]^=l,r[s+b+1]^=d}let i=r[2],o=r[3];for(let s=0;s<24;s++){let c=Mn[s],a=Dn(i,o,c),u=zn(i,o,c),f=jn[s];i=r[f],o=r[f+1],r[f]=a,r[f+1]=u}for(let s=0;s<50;s+=10){for(let c=0;c<10;c++)t[c]=r[s+c];for(let c=0;c<10;c++)r[s+c]^=~t[(c+2)%10]&t[(c+4)%10]}r[0]^=Ro[n],r[1]^=Co[n]}t.fill(0)}var Wt=class r extends Pe{constructor(e,t,n,i=!1,o=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=n,this.enableXOF=i,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,nt(n),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=pn(this.state)}keccak(){Do(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){ve(this);let{blockLen:t,state:n}=this;e=Ie(e);let i=e.length;for(let o=0;o=n&&this.keccak();let s=Math.min(n-this.posOut,o-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return nt(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Pt(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:n,outputLen:i,rounds:o,enableXOF:s}=this;return e||(e=new r(t,n,i,s,o)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=o,e.suffix=n,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}},De=(r,e,t)=>we(()=>new Wt(e,r,t)),za=De(6,144,224/8),ja=De(6,136,256/8),Ma=De(6,104,384/8),qa=De(6,72,512/8),Ga=De(1,144,224/8),Fa=De(1,136,256/8),$a=De(1,104,384/8),Va=De(1,72,512/8),Gn=(r,e,t)=>yn((n={})=>new Wt(e,r,n.dkLen===void 0?t:n.dkLen,!0)),Za=Gn(31,168,128/8),Tr=Gn(31,136,256/8);var zo=we(()=>Tr.create({dkLen:114})),jo=we(()=>Tr.create({dkLen:64})),lt=BigInt("726838724295606890549323807888004534353641360687318060281490199180612328166730772686396383698676545930088884461843637361053498018365439"),Mo=BigInt(1),Fn=BigInt(2),$n=BigInt(3),tf=BigInt(4),qo=BigInt(11),Go=BigInt(22),Vn=BigInt(44),Fo=BigInt(88),$o=BigInt(223);function Zn(r){let e=lt,t=r*r*r%e,n=t*t*r%e,i=X(n,$n,e)*n%e,o=X(i,$n,e)*n%e,s=X(o,Fn,e)*t%e,c=X(s,qo,e)*s%e,a=X(c,Go,e)*c%e,u=X(a,Vn,e)*a%e,f=X(u,Fo,e)*u%e,l=X(f,Vn,e)*a%e,d=X(l,Fn,e)*t%e,b=X(d,Mo,e)*r%e;return X(b,$o,e)*d%e}function Xn(r){return r[0]&=252,r[55]|=128,r[56]=0,r}function Vo(r,e){let t=lt,n=M(r*r*e,t),i=M(n*r,t),o=M(i*n*e,t),s=Zn(o),c=M(i*s,t),a=M(c*c,t);return{isValid:M(a*e,t)===r,value:c}}var Wn=Ft(lt,456,!0),Yn={a:BigInt(1),d:BigInt("726838724295606890549323807888004534353641360687318060281490199180612328166730772686396383698676545930088884461843637361053498018326358"),Fp:Wn,n:BigInt("181709681073901722637330951972001133588410340171829515070372549795146003961539585716195755291692375963310293709091662304773755859649779"),nBitLength:456,h:BigInt(4),Gx:BigInt("224580040295924300187604334099896036246789641632564134246125461686950415467406032909029192869357953282578032075146446173674602635247710"),Gy:BigInt("298819210078481492676017930443930673437544040154080242095928241372331506189835876003536878655418784733982303233503462500531545062832660"),hash:zo,randomBytes:Ve,adjustScalarBytes:Xn,domain:(r,e,t)=>{if(e.length>255)throw new Error(`Context is too big: ${e.length}`);return Kt(ot("SigEd448"),new Uint8Array([t?1:0,e.length]),e,r)},uvRatio:Vo},Jn=Fe(Yn),rf=Fe({...Yn,prehash:jo}),Nr=(()=>Vt({a:BigInt(156326),montgomeryBits:448,nByteLength:57,P:lt,Gu:BigInt(5),powPminus2:r=>{let e=lt,t=Zn(r),n=X(t,BigInt(2),e);return M(n*r,e)},adjustScalarBytes:Xn,randomBytes:Ve}))();var nf=(Wn.ORDER-BigInt(3))/BigInt(4),of=BigInt(156326);var sf=BigInt("39082"),cf=BigInt("78163"),af=BigInt("98944233647732219769177004876929019128417576295529901074099889598043702116001257856802131563896515373927712232092845883226922417596214"),ff=BigInt("315019913931389607337177038330951043522456072897266928557328499619017160722351061360252776265186336876723201881398623946864393857820716");var uf=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");var Qe="X448",Yt=class{constructor(e){Object.defineProperty(this,"_hkdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nPk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_nSk",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._hkdf=e,this._nPk=56,this._nSk=56}async serializePublicKey(e){try{return await this._serializePublicKey(e)}catch(t){throw new se(t)}}async deserializePublicKey(e){try{return await this._importRawKey(e,!0)}catch(t){throw new te(t)}}async serializePrivateKey(e){try{return await this._serializePrivateKey(e)}catch(t){throw new se(t)}}async deserializePrivateKey(e){try{return await this._importRawKey(e,!1)}catch(t){throw new te(t)}}async importKey(e,t,n){try{if(e==="raw")return await this._importRawKey(t,n);if(t instanceof ArrayBuffer)throw new Error("Invalid jwk key format");return await this._importJWK(t,n)}catch(i){throw new te(i)}}async generateKeyPair(){try{let e=Jn.utils.randomPrivateKey(),t=new ne(Qe,e,"private",fe);return{publicKey:await this.derivePublicKey(t),privateKey:t}}catch(e){throw new ce(e)}}async deriveKeyPair(e){try{let t=await this._hkdf.labeledExtract(Z,Ye,new Uint8Array(e)),n=await this._hkdf.labeledExpand(t,Ct,Z,this._nSk),i=new ne(Qe,new Uint8Array(n),"private",fe);return{privateKey:i,publicKey:await this.derivePublicKey(i)}}catch(t){throw new Be(t)}}async derivePublicKey(e){try{return await this._derivePublicKey(e)}catch(t){throw new te(t)}}async dh(e,t){try{return await this._dh(e,t)}catch(n){throw new se(n)}}_serializePublicKey(e){return new Promise(t=>{t(e.key.buffer)})}_serializePrivateKey(e){return new Promise(t=>{t(e.key.buffer)})}_importRawKey(e,t){return new Promise((n,i)=>{t&&e.byteLength!==this._nPk&&i(new Error("Invalid length of the key")),!t&&e.byteLength!==this._nSk&&e.byteLength!==this._nSk+1&&i(new Error("Invalid length of the key")),n(new ne(Qe,new Uint8Array(e),t?"public":"private",t?[]:fe))})}_importJWK(e,t){return new Promise((n,i)=>{e.kty!=="OKP"&&i(new Error(`Invalid kty: ${e.kty}`)),e.crv!=="X448"&&i(new Error(`Invalid crv: ${e.crv}`)),t?(typeof e.d<"u"&&i(new Error("Invalid key: `d` should not be set")),typeof e.x!="string"&&i(new Error("Invalid key: `x` not found")),n(new ne(Qe,Ne(e.x),"public"))):(typeof e.d!="string"&&i(new Error("Invalid key: `d` not found")),n(new ne(Qe,Ne(e.d),"private",fe)))})}_derivePublicKey(e){return new Promise((t,n)=>{try{let i=Nr.getPublicKey(e.key);t(new ne(Qe,i,"public"))}catch(i){n(i)}})}_dh(e,t){return new Promise((n,i)=>{try{n(Nr.getSharedSecret(e.key,t.key).buffer)}catch(o){i(o)}})}};var Jt=class extends le{constructor(){let e=new Te;super(V.DhkemX448HkdfSha512,new Yt(e),e),Object.defineProperty(this,"id",{enumerable:!0,configurable:!0,writable:!0,value:V.DhkemX448HkdfSha512}),Object.defineProperty(this,"secretSize",{enumerable:!0,configurable:!0,writable:!0,value:64}),Object.defineProperty(this,"encSize",{enumerable:!0,configurable:!0,writable:!0,value:56}),Object.defineProperty(this,"publicKeySize",{enumerable:!0,configurable:!0,writable:!0,value:56}),Object.defineProperty(this,"privateKeySize",{enumerable:!0,configurable:!0,writable:!0,value:56})}};function Rr(){return new Promise((r,e)=>{e(new ce("Not supported"))})}var Zo=new Uint8Array([115,101,99]),et=class{constructor(e,t,n){Object.defineProperty(this,"_api",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"exporterSecret",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this._api=e,this._kdf=t,this.exporterSecret=n}async seal(e,t){return await Rr()}async open(e,t){return await Rr()}async export(e,t){if(e.byteLength>8192)throw new ee("Too long exporter context");try{return await this._kdf.labeledExpand(this.exporterSecret,Zo,new Uint8Array(e),t)}catch(n){throw new wt(n)}}},Qt=class extends et{},er=class extends et{constructor(e,t,n,i){super(e,t,n),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enc=i}};function Xo(r,e){if(r.byteLength!==e.byteLength)throw new Error("xor: different length inputs");let t=new Uint8Array(r.byteLength);for(let n=0;nNumber.MAX_SAFE_INTEGER)throw new gt("Message limit reached");e.seq+=1}};var tr=class extends tt{async open(e,t=Z){let n;try{n=await this._ctx.key.open(this.computeNonce(this._ctx),e,t)}catch(i){throw new mt(i)}return this.incrementSeq(this._ctx),n}};var rr=class extends tt{constructor(e,t,n,i){super(e,t,n),Object.defineProperty(this,"enc",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.enc=i}async seal(e,t=Z){let n;try{n=await this._ctx.key.seal(this.computeNonce(this._ctx),e,t)}catch(i){throw new xt(i)}return this.incrementSeq(this._ctx),n}};var Wo=new Uint8Array([98,97,115,101,95,110,111,110,99,101]),Yo=new Uint8Array([101,120,112]),Jo=new Uint8Array([105,110,102,111,95,104,97,115,104]),Qo=new Uint8Array([107,101,121]),es=new Uint8Array([112,115,107,95,105,100,95,104,97,115,104]),ts=new Uint8Array([115,101,99,114,101,116]),rs=new Uint8Array([72,80,75,69,0,0,0,0,0,0]),nr=class extends be{constructor(e){if(super(),Object.defineProperty(this,"_kem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_kdf",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_aead",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"_suiteId",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),typeof e.kem=="number")throw new ee("KemId cannot be used");if(this._kem=e.kem,typeof e.kdf=="number")throw new ee("KdfId cannot be used");if(this._kdf=e.kdf,typeof e.aead=="number")throw new ee("AeadId cannot be used");this._aead=e.aead,this._suiteId=new Uint8Array(rs),this._suiteId.set(xe(this._kem.id,2),4),this._suiteId.set(xe(this._kdf.id,2),6),this._suiteId.set(xe(this._aead.id,2),8),this._kdf.init(this._suiteId)}get kem(){return this._kem}get kdf(){return this._kdf}get aead(){return this._aead}async createSenderContext(e){this._validateInputLength(e),await this._setup();let t=await this._kem.encap(e),n;return e.psk!==void 0?n=e.senderKey!==void 0?ge.AuthPsk:ge.Psk:n=e.senderKey!==void 0?ge.Auth:ge.Base,await this._keyScheduleS(n,t.sharedSecret,t.enc,e)}async createRecipientContext(e){this._validateInputLength(e),await this._setup();let t=await this._kem.decap(e),n;return e.psk!==void 0?n=e.senderPublicKey!==void 0?ge.AuthPsk:ge.Psk:n=e.senderPublicKey!==void 0?ge.Auth:ge.Base,await this._keyScheduleR(n,t,e)}async seal(e,t,n=Z){let i=await this.createSenderContext(e);return{ct:await i.seal(t,n),enc:i.enc}}async open(e,t,n=Z){return await(await this.createRecipientContext(e)).open(t,n)}async _keySchedule(e,t,n){let i=n.psk===void 0?Z:new Uint8Array(n.psk.id),o=await this._kdf.labeledExtract(Z,es,i),s=n.info===void 0?Z:new Uint8Array(n.info),c=await this._kdf.labeledExtract(Z,Jo,s),a=new Uint8Array(1+o.byteLength+c.byteLength);a.set(new Uint8Array([e]),0),a.set(new Uint8Array(o),1),a.set(new Uint8Array(c),1+o.byteLength);let u=n.psk===void 0?Z:new Uint8Array(n.psk.key),f=this._kdf.buildLabeledIkm(ts,u),l=this._kdf.buildLabeledInfo(Yo,a,this._kdf.hashSize),d=await this._kdf.extractAndExpand(t,f,l,this._kdf.hashSize);if(this._aead.id===ae.ExportOnly)return{aead:this._aead,exporterSecret:d};let b=this._kdf.buildLabeledInfo(Qo,a,this._aead.keySize),m=await this._kdf.extractAndExpand(t,f,b,this._aead.keySize),g=this._kdf.buildLabeledInfo(Wo,a,this._aead.nonceSize),x=await this._kdf.extractAndExpand(t,f,g,this._aead.nonceSize);return{aead:this._aead,exporterSecret:d,key:m,baseNonce:new Uint8Array(x),seq:0}}async _keyScheduleS(e,t,n,i){let o=await this._keySchedule(e,t,i);return o.key===void 0?new er(this._api,this._kdf,o.exporterSecret,n):new rr(this._api,this._kdf,o,n)}async _keyScheduleR(e,t,n){let i=await this._keySchedule(e,t,n);return i.key===void 0?new Qt(this._api,this._kdf,i.exporterSecret):new tr(this._api,this._kdf,i)}_validateInputLength(e){if(e.info!==void 0&&e.info.byteLength>8192)throw new ee("Too long info");if(e.psk!==void 0){if(e.psk.key.byteLength<32)throw new ee(`PSK must have at least ${32} bytes`);if(e.psk.key.byteLength>8192)throw new ee("Too long psk.key");if(e.psk.id.byteLength>8192)throw new ee("Too long psk.id")}}};var Cr=class extends nr{constructor(e){if(typeof e.kem=="number")switch(e.kem){case V.DhkemP256HkdfSha256:e.kem=new zt;break;case V.DhkemP384HkdfSha384:e.kem=new jt;break;case V.DhkemP521HkdfSha512:e.kem=new Mt;break;case V.DhkemX25519HkdfSha256:e.kem=new Xt;break;case V.DhkemX448HkdfSha512:e.kem=new Jt;break;default:throw new ee(`The KEM (${e.kem}) cannot be specified by KemId. Use submodule for the KEM`)}if(typeof e.kdf=="number")switch(e.kdf){case _e.HkdfSha256:e.kdf=new Ue;break;case _e.HkdfSha384:e.kdf=new Xe;break;default:e.kdf=new Te;break}if(typeof e.aead=="number")switch(e.aead){case ae.Aes128Gcm:e.aead=new rt;break;case ae.Aes256Gcm:e.aead=new _t;break;case ae.Chacha20Poly1305:e.aead=new Bt;break;default:e.aead=new Et;break}super(e)}async generateKeyPair(){return await this._setup(),await this._kem.generateKeyPair()}async deriveKeyPair(e){return await this._setup(),await this._kem.deriveKeyPair(e)}async importKey(e,t,n=!0){return await this._setup(),await this._kem.importKey(e,t,n)}};export{Jr as Aead,ae as AeadId,or as BaseError,Cr as CipherSuite,bt as DecapError,Be as DeriveKeyPairError,te as DeserializeError,yt as EncapError,wt as ExportError,oe as HpkeError,ee as InvalidParamError,Yr as Kdf,_e as KdfId,Wr as Kem,V as KemId,gt as MessageLimitReachedError,ce as NotSupportedError,mt as OpenError,xt as SealError,se as SerializeError,Xr as ValidationError}; /*! Bundled license information: @noble/ciphers/esm/utils.js: