@canton-network/wallet-gateway-remote 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +13 -0
- package/dist/auth/jwt-auth-service.d.ts.map +1 -1
- package/dist/auth/jwt-auth-service.js +2 -3
- package/dist/env.d.ts +5 -0
- package/dist/env.d.ts.map +1 -1
- package/dist/env.js +5 -0
- package/dist/init.d.ts.map +1 -1
- package/dist/init.js +19 -1
- package/dist/ledger/transaction-service.d.ts +13 -0
- package/dist/ledger/transaction-service.d.ts.map +1 -1
- package/dist/ledger/transaction-service.js +116 -0
- package/dist/ledger/wallet-allocation/signing-providers/dfns-wallet-allocator.d.ts +23 -0
- package/dist/ledger/wallet-allocation/signing-providers/dfns-wallet-allocator.d.ts.map +1 -0
- package/dist/ledger/wallet-allocation/signing-providers/dfns-wallet-allocator.js +135 -0
- package/dist/ledger/wallet-allocation/wallet-allocation-service.d.ts +1 -0
- package/dist/ledger/wallet-allocation/wallet-allocation-service.d.ts.map +1 -1
- package/dist/ledger/wallet-allocation/wallet-allocation-service.js +15 -0
- package/dist/user-api/controller.d.ts.map +1 -1
- package/dist/user-api/controller.js +6 -0
- package/dist/web/frontend/404/index.html +2 -2
- package/dist/web/frontend/activities/index.html +3 -3
- package/dist/web/frontend/approve/index.html +5 -5
- package/dist/web/frontend/assets/404-B-o9ppJB.js +5 -0
- package/dist/web/frontend/assets/{activities-4fnnetzm.js → activities-CGjCIjUH.js} +1 -1
- package/dist/web/frontend/assets/{addIdentityProvider-uy13wDEx.js → addIdentityProvider-CR4Wm9Tl.js} +2 -2
- package/dist/web/frontend/assets/{addNetwork-B9yARLXq.js → addNetwork-Dx0-SN4j.js} +3 -3
- package/dist/web/frontend/assets/addParty-COhk_rFn.js +41 -0
- package/dist/web/frontend/assets/{approve-DUxX18Xm.js → approve-B2w66l0J.js} +1 -1
- package/dist/web/frontend/assets/{callback-BGMELOxy.js → callback-BTVon_yQ.js} +1 -1
- package/dist/web/frontend/assets/{identityProviders-ByQNvF7K.js → identityProviders-CK8zSrd3.js} +2 -2
- package/dist/web/frontend/assets/{index-DcZcHMS1.js → index-CF4BKzgl.js} +2 -2
- package/dist/web/frontend/assets/{index-DvQio60y.js → index-DWz_3f3y.js} +1 -1
- package/dist/web/frontend/assets/{index-lfC4c213.js → index-_pMHlJoE.js} +94 -63
- package/dist/web/frontend/assets/{login-BtNyAQqL.js → login-CVoPNVDw.js} +2 -2
- package/dist/web/frontend/assets/{networks-B8bwNVkz.js → networks-D1nPvUzM.js} +2 -2
- package/dist/web/frontend/assets/{reviewIdentityProvider-CWDFtb4t.js → reviewIdentityProvider-CNSf2qQv.js} +4 -4
- package/dist/web/frontend/assets/{reviewNetwork-ZgS_rpXv.js → reviewNetwork-DGLK-Ume.js} +4 -4
- package/dist/web/frontend/assets/{settings-BiWW1vj2.js → settings-B1ga2TK0.js} +2 -2
- package/dist/web/frontend/assets/{state-BpQr_22x.js → state-B2k3ak7d.js} +1 -1
- package/dist/web/frontend/assets/{utils-BNCwV3PT.js → utils-CT9Hzi7v.js} +1 -1
- package/dist/web/frontend/callback/index.html +2 -2
- package/dist/web/frontend/identity-providers/add/index.html +3 -3
- package/dist/web/frontend/identity-providers/index.html +3 -3
- package/dist/web/frontend/identity-providers/review/index.html +3 -3
- package/dist/web/frontend/index.html +1 -1
- package/dist/web/frontend/login/index.html +4 -4
- package/dist/web/frontend/networks/add/index.html +3 -3
- package/dist/web/frontend/networks/index.html +3 -3
- package/dist/web/frontend/networks/review/index.html +3 -3
- package/dist/web/frontend/parties/add/index.html +6 -6
- package/dist/web/frontend/parties/index.html +4 -4
- package/dist/web/frontend/settings/index.html +3 -3
- package/package.json +20 -19
- package/dist/web/frontend/assets/404-BCjBS7OU.js +0 -5
- package/dist/web/frontend/assets/addParty-4qt8FiJv.js +0 -38
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{T as F,c as q,e as G,M as H,g as J,W as K,b as L,f as N,i as Q,t as R}from"./index-_pMHlJoE.js";import{r as V}from"./state-B2k3ak7d.js";var X=Object.create,S=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,T=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),v=t=>{throw TypeError(t)},Z=(t,e,r)=>e in t?S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,P=(t,e)=>S(t,"name",{value:e,configurable:!0}),j=t=>[,,,X(t?.[T("metadata")]??null)],W=["class","method","getter","setter","accessor","field","value","get","set"],w=t=>t!==void 0&&typeof t!="function"?v("Function expected"):t,ee=(t,e,r,o,n)=>({kind:W[t],name:e,metadata:o,addInitializer:a=>r._?v("Already initialized"):n.push(w(a||null))}),te=(t,e)=>Z(e,T("metadata"),t[3]),A=(t,e,r,o)=>{for(var n=0,a=t[e>>1],p=a&&a.length;n<p;n++)e&1?a[n].call(r):o=a[n].call(r,o);return o},B=(t,e,r,o,n,a)=>{var p,d,C,_,k,i=e&7,f=!!(e&8),l=!!(e&16),g=i>3?t.length+1:i?f?1:2:0,U=W[i+5],O=i>3&&(t[g-1]=[]),D=t[g]||(t[g]=[]),c=i&&(!l&&!f&&(n=n.prototype),i<5&&(i>3||!l)&&Y(i<4?n:{get[r](){return x(this,a)},set[r](s){return M(this,a,s)}},r));i?l&&i<4&&P(a,(i>2?"set ":i>1?"get ":"")+r):P(n,r);for(var m=o.length-1;m>=0;m--)_=ee(i,r,C={},t[3],D),i&&(_.static=f,_.private=l,k=_.access={has:l?s=>re(n,s):s=>r in s},i^3&&(k.get=l?s=>(i^1?x:ne)(s,n,i^4?a:c.get):s=>s[r]),i>2&&(k.set=l?(s,y)=>M(s,n,y,i^4?a:c.set):(s,y)=>s[r]=y)),d=(0,o[m])(i?i<4?l?a:c[U]:i>4?void 0:{get:c.get,set:c.set}:n,_),C._=1,i^4||d===void 0?w(d)&&(i>4?O.unshift(d):i?l?a=d:c[U]=d:n=d):typeof d!="object"||d===null?v("Object expected"):(w(p=d.get)&&(c.get=p),w(p=d.set)&&(c.set=p),w(p=d.init)&&O.unshift(p));return i||te(t,n),c&&S(n,r,c),l?i^4?a:c:n},I=(t,e,r)=>e.has(t)||v("Cannot "+r),re=(t,e)=>Object(e)!==e?v('Cannot use the "in" operator on this value'):t.has(e),x=(t,e,r)=>(I(t,e,"read from private field"),r?r.call(t):e.get(t)),ie=(t,e,r)=>e.has(t)?v("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),M=(t,e,r,o)=>(I(t,e,"write to private field"),o?o.call(t,r):e.set(t,r),r),ne=(t,e,r)=>(I(t,e,"access private method"),r),E,b,$,h,z;$=[R("user-ui-add-network")];class u extends(b=N,E=[V()],b){constructor(){super(...arguments),ie(this,z,A(h,8,this,!1)),A(h,11,this)}navigateBack(){window.location.href=F("/networks")}toApiAuth(e){return{method:e.method,audience:e.audience??"",scope:e.scope??"",clientId:e.clientId??"",issuer:e.issuer??"",clientSecret:e.clientSecret??""}}async onSave(e){this.loading=!0;const r=this.toApiAuth(e.network.auth),o=e.network.adminAuth?this.toApiAuth(e.network.adminAuth):{method:"client_credentials",audience:"",scope:"",clientId:"",clientSecret:""};try{await(await q(G.accessToken.get())).request({method:"addNetwork",params:{network:{id:e.network.id,name:e.network.name,description:e.network.description,identityProviderId:e.network.identityProviderId,...e.network.synchronizerId&&{synchronizerId:e.network.synchronizerId},ledgerApi:e.network.ledgerApi.baseUrl,auth:r,adminAuth:o}}}),window.location.href=H("/networks/")}catch(n){this.loading=!1,J(n)}}render(){return L`
|
|
2
2
|
<div class="page-header">
|
|
3
3
|
<h1 class="h4 fw-semibold mb-0">Add a new network</h1>
|
|
4
4
|
<button
|
|
@@ -6,7 +6,7 @@ import{D as T,c as Y,e as q,Y as G,g as H,W as J,b as K,f as D,i as L,t as Q}fro
|
|
|
6
6
|
type="button"
|
|
7
7
|
@click=${this.navigateBack}
|
|
8
8
|
>
|
|
9
|
-
${
|
|
9
|
+
${K}
|
|
10
10
|
<span>Back</span>
|
|
11
11
|
</button>
|
|
12
12
|
</div>
|
|
@@ -17,7 +17,7 @@ import{D as T,c as Y,e as q,Y as G,g as H,W as J,b as K,f as D,i as L,t as Q}fro
|
|
|
17
17
|
@network-edit-save=${this.onSave}
|
|
18
18
|
></network-form>
|
|
19
19
|
</div>
|
|
20
|
-
`}}h=j(b);z=new WeakMap;B(h,4,"loading",E,u,z);u=B(h,0,"UserUiAddNetwork",$,u);u.styles=[
|
|
20
|
+
`}}h=j(b);z=new WeakMap;B(h,4,"loading",E,u,z);u=B(h,0,"UserUiAddNetwork",$,u);u.styles=[N.styles,Q`
|
|
21
21
|
:host {
|
|
22
22
|
display: block;
|
|
23
23
|
max-width: 900px;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import{o as m0,k as dr,m as lr,s as br,p as vr,a as _r,c as G0,e as _0,T as yr,M as pr,g as wr,W as gr,b as Er,f as k0,i as Ar,t as Ur}from"./index-_pMHlJoE.js";import{r as y0}from"./state-B2k3ak7d.js";import{W as p0}from"./index-CF4BKzgl.js";import"./utils-CT9Hzi7v.js";function Br(w){if(Object.prototype.hasOwnProperty.call(w,"__esModule"))return w;var h=w.default;if(typeof h=="function"){var l=function j(){var M=!1;try{M=this instanceof j}catch{}return M?Reflect.construct(h,arguments,this.constructor):h.apply(this,arguments)};l.prototype=h.prototype}else l={};return Object.defineProperty(l,"__esModule",{value:!0}),Object.keys(w).forEach(function(j){var M=Object.getOwnPropertyDescriptor(w,j);Object.defineProperty(l,j,M.get?M:{enumerable:!0,get:function(){return w[j]}})}),l}function Sr(w){throw new Error('Could not dynamically require "'+w+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var w0={exports:{}};const Tr={},Mr=Object.freeze(Object.defineProperty({__proto__:null,default:Tr},Symbol.toStringTag,{value:"Module"})),Cr=Br(Mr);var X0;function jr(){return X0||(X0=1,(function(w){(function(h){var l=function(r){var e,t=new Float64Array(16);if(r)for(e=0;e<r.length;e++)t[e]=r[e];return t},j=function(){throw new Error("no PRNG")},M=new Uint8Array(16),W=new Uint8Array(32);W[0]=9;var tf=l(),af=l([1]),Zf=l([56129,1]),pf=l([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),Pf=l([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),J=l([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),Sf=l([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),uf=l([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Tf(r,e,t,f){r[e]=t>>24&255,r[e+1]=t>>16&255,r[e+2]=t>>8&255,r[e+3]=t&255,r[e+4]=f>>24&255,r[e+5]=f>>16&255,r[e+6]=f>>8&255,r[e+7]=f&255}function Mf(r,e,t,f,x){var n,i=0;for(n=0;n<x;n++)i|=r[e+n]^t[f+n];return(1&i-1>>>8)-1}function Rf(r,e,t,f){return Mf(r,e,t,f,16)}function If(r,e,t,f){return Mf(r,e,t,f,32)}function cf(r,e,t,f){for(var x=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,n=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,i=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,u=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,_=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,S=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,p=e[0]&255|(e[1]&255)<<8|(e[2]&255)<<16|(e[3]&255)<<24,X=e[4]&255|(e[5]&255)<<8|(e[6]&255)<<16|(e[7]&255)<<24,E=e[8]&255|(e[9]&255)<<8|(e[10]&255)<<16|(e[11]&255)<<24,L=e[12]&255|(e[13]&255)<<8|(e[14]&255)<<16|(e[15]&255)<<24,Y=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,z=t[16]&255|(t[17]&255)<<8|(t[18]&255)<<16|(t[19]&255)<<24,I=t[20]&255|(t[21]&255)<<8|(t[22]&255)<<16|(t[23]&255)<<24,O=t[24]&255|(t[25]&255)<<8|(t[26]&255)<<16|(t[27]&255)<<24,R=t[28]&255|(t[29]&255)<<8|(t[30]&255)<<16|(t[31]&255)<<24,P=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,A=x,T=n,g=i,U=u,B=_,y=S,o=p,s=X,b=E,c=L,d=Y,v=z,C=I,N=O,F=R,D=P,a,K=0;K<20;K+=2)a=A+C|0,B^=a<<7|a>>>25,a=B+A|0,b^=a<<9|a>>>23,a=b+B|0,C^=a<<13|a>>>19,a=C+b|0,A^=a<<18|a>>>14,a=y+T|0,c^=a<<7|a>>>25,a=c+y|0,N^=a<<9|a>>>23,a=N+c|0,T^=a<<13|a>>>19,a=T+N|0,y^=a<<18|a>>>14,a=d+o|0,F^=a<<7|a>>>25,a=F+d|0,g^=a<<9|a>>>23,a=g+F|0,o^=a<<13|a>>>19,a=o+g|0,d^=a<<18|a>>>14,a=D+v|0,U^=a<<7|a>>>25,a=U+D|0,s^=a<<9|a>>>23,a=s+U|0,v^=a<<13|a>>>19,a=v+s|0,D^=a<<18|a>>>14,a=A+U|0,T^=a<<7|a>>>25,a=T+A|0,g^=a<<9|a>>>23,a=g+T|0,U^=a<<13|a>>>19,a=U+g|0,A^=a<<18|a>>>14,a=y+B|0,o^=a<<7|a>>>25,a=o+y|0,s^=a<<9|a>>>23,a=s+o|0,B^=a<<13|a>>>19,a=B+s|0,y^=a<<18|a>>>14,a=d+c|0,v^=a<<7|a>>>25,a=v+d|0,b^=a<<9|a>>>23,a=b+v|0,c^=a<<13|a>>>19,a=c+b|0,d^=a<<18|a>>>14,a=D+F|0,C^=a<<7|a>>>25,a=C+D|0,N^=a<<9|a>>>23,a=N+C|0,F^=a<<13|a>>>19,a=F+N|0,D^=a<<18|a>>>14;A=A+x|0,T=T+n|0,g=g+i|0,U=U+u|0,B=B+_|0,y=y+S|0,o=o+p|0,s=s+X|0,b=b+E|0,c=c+L|0,d=d+Y|0,v=v+z|0,C=C+I|0,N=N+O|0,F=F+R|0,D=D+P|0,r[0]=A>>>0&255,r[1]=A>>>8&255,r[2]=A>>>16&255,r[3]=A>>>24&255,r[4]=T>>>0&255,r[5]=T>>>8&255,r[6]=T>>>16&255,r[7]=T>>>24&255,r[8]=g>>>0&255,r[9]=g>>>8&255,r[10]=g>>>16&255,r[11]=g>>>24&255,r[12]=U>>>0&255,r[13]=U>>>8&255,r[14]=U>>>16&255,r[15]=U>>>24&255,r[16]=B>>>0&255,r[17]=B>>>8&255,r[18]=B>>>16&255,r[19]=B>>>24&255,r[20]=y>>>0&255,r[21]=y>>>8&255,r[22]=y>>>16&255,r[23]=y>>>24&255,r[24]=o>>>0&255,r[25]=o>>>8&255,r[26]=o>>>16&255,r[27]=o>>>24&255,r[28]=s>>>0&255,r[29]=s>>>8&255,r[30]=s>>>16&255,r[31]=s>>>24&255,r[32]=b>>>0&255,r[33]=b>>>8&255,r[34]=b>>>16&255,r[35]=b>>>24&255,r[36]=c>>>0&255,r[37]=c>>>8&255,r[38]=c>>>16&255,r[39]=c>>>24&255,r[40]=d>>>0&255,r[41]=d>>>8&255,r[42]=d>>>16&255,r[43]=d>>>24&255,r[44]=v>>>0&255,r[45]=v>>>8&255,r[46]=v>>>16&255,r[47]=v>>>24&255,r[48]=C>>>0&255,r[49]=C>>>8&255,r[50]=C>>>16&255,r[51]=C>>>24&255,r[52]=N>>>0&255,r[53]=N>>>8&255,r[54]=N>>>16&255,r[55]=N>>>24&255,r[56]=F>>>0&255,r[57]=F>>>8&255,r[58]=F>>>16&255,r[59]=F>>>24&255,r[60]=D>>>0&255,r[61]=D>>>8&255,r[62]=D>>>16&255,r[63]=D>>>24&255}function zf(r,e,t,f){for(var x=f[0]&255|(f[1]&255)<<8|(f[2]&255)<<16|(f[3]&255)<<24,n=t[0]&255|(t[1]&255)<<8|(t[2]&255)<<16|(t[3]&255)<<24,i=t[4]&255|(t[5]&255)<<8|(t[6]&255)<<16|(t[7]&255)<<24,u=t[8]&255|(t[9]&255)<<8|(t[10]&255)<<16|(t[11]&255)<<24,_=t[12]&255|(t[13]&255)<<8|(t[14]&255)<<16|(t[15]&255)<<24,S=f[4]&255|(f[5]&255)<<8|(f[6]&255)<<16|(f[7]&255)<<24,p=e[0]&255|(e[1]&255)<<8|(e[2]&255)<<16|(e[3]&255)<<24,X=e[4]&255|(e[5]&255)<<8|(e[6]&255)<<16|(e[7]&255)<<24,E=e[8]&255|(e[9]&255)<<8|(e[10]&255)<<16|(e[11]&255)<<24,L=e[12]&255|(e[13]&255)<<8|(e[14]&255)<<16|(e[15]&255)<<24,Y=f[8]&255|(f[9]&255)<<8|(f[10]&255)<<16|(f[11]&255)<<24,z=t[16]&255|(t[17]&255)<<8|(t[18]&255)<<16|(t[19]&255)<<24,I=t[20]&255|(t[21]&255)<<8|(t[22]&255)<<16|(t[23]&255)<<24,O=t[24]&255|(t[25]&255)<<8|(t[26]&255)<<16|(t[27]&255)<<24,R=t[28]&255|(t[29]&255)<<8|(t[30]&255)<<16|(t[31]&255)<<24,P=f[12]&255|(f[13]&255)<<8|(f[14]&255)<<16|(f[15]&255)<<24,A=x,T=n,g=i,U=u,B=_,y=S,o=p,s=X,b=E,c=L,d=Y,v=z,C=I,N=O,F=R,D=P,a,K=0;K<20;K+=2)a=A+C|0,B^=a<<7|a>>>25,a=B+A|0,b^=a<<9|a>>>23,a=b+B|0,C^=a<<13|a>>>19,a=C+b|0,A^=a<<18|a>>>14,a=y+T|0,c^=a<<7|a>>>25,a=c+y|0,N^=a<<9|a>>>23,a=N+c|0,T^=a<<13|a>>>19,a=T+N|0,y^=a<<18|a>>>14,a=d+o|0,F^=a<<7|a>>>25,a=F+d|0,g^=a<<9|a>>>23,a=g+F|0,o^=a<<13|a>>>19,a=o+g|0,d^=a<<18|a>>>14,a=D+v|0,U^=a<<7|a>>>25,a=U+D|0,s^=a<<9|a>>>23,a=s+U|0,v^=a<<13|a>>>19,a=v+s|0,D^=a<<18|a>>>14,a=A+U|0,T^=a<<7|a>>>25,a=T+A|0,g^=a<<9|a>>>23,a=g+T|0,U^=a<<13|a>>>19,a=U+g|0,A^=a<<18|a>>>14,a=y+B|0,o^=a<<7|a>>>25,a=o+y|0,s^=a<<9|a>>>23,a=s+o|0,B^=a<<13|a>>>19,a=B+s|0,y^=a<<18|a>>>14,a=d+c|0,v^=a<<7|a>>>25,a=v+d|0,b^=a<<9|a>>>23,a=b+v|0,c^=a<<13|a>>>19,a=c+b|0,d^=a<<18|a>>>14,a=D+F|0,C^=a<<7|a>>>25,a=C+D|0,N^=a<<9|a>>>23,a=N+C|0,F^=a<<13|a>>>19,a=F+N|0,D^=a<<18|a>>>14;r[0]=A>>>0&255,r[1]=A>>>8&255,r[2]=A>>>16&255,r[3]=A>>>24&255,r[4]=y>>>0&255,r[5]=y>>>8&255,r[6]=y>>>16&255,r[7]=y>>>24&255,r[8]=d>>>0&255,r[9]=d>>>8&255,r[10]=d>>>16&255,r[11]=d>>>24&255,r[12]=D>>>0&255,r[13]=D>>>8&255,r[14]=D>>>16&255,r[15]=D>>>24&255,r[16]=o>>>0&255,r[17]=o>>>8&255,r[18]=o>>>16&255,r[19]=o>>>24&255,r[20]=s>>>0&255,r[21]=s>>>8&255,r[22]=s>>>16&255,r[23]=s>>>24&255,r[24]=b>>>0&255,r[25]=b>>>8&255,r[26]=b>>>16&255,r[27]=b>>>24&255,r[28]=c>>>0&255,r[29]=c>>>8&255,r[30]=c>>>16&255,r[31]=c>>>24&255}function xf(r,e,t,f){cf(r,e,t,f)}function wf(r,e,t,f){zf(r,e,t,f)}var gf=new Uint8Array([101,120,112,97,110,100,32,51,50,45,98,121,116,101,32,107]);function C0(r,e,t,f,x,n,i){var u=new Uint8Array(16),_=new Uint8Array(64),S,p;for(p=0;p<16;p++)u[p]=0;for(p=0;p<8;p++)u[p]=n[p];for(;x>=64;){for(xf(_,u,i,gf),p=0;p<64;p++)r[e+p]=t[f+p]^_[p];for(S=1,p=8;p<16;p++)S=S+(u[p]&255)|0,u[p]=S&255,S>>>=8;x-=64,e+=64,f+=64}if(x>0)for(xf(_,u,i,gf),p=0;p<x;p++)r[e+p]=t[f+p]^_[p];return 0}function j0(r,e,t,f,x){var n=new Uint8Array(16),i=new Uint8Array(64),u,_;for(_=0;_<16;_++)n[_]=0;for(_=0;_<8;_++)n[_]=f[_];for(;t>=64;){for(xf(i,n,x,gf),_=0;_<64;_++)r[e+_]=i[_];for(u=1,_=8;_<16;_++)u=u+(n[_]&255)|0,n[_]=u&255,u>>>=8;t-=64,e+=64}if(t>0)for(xf(i,n,x,gf),_=0;_<t;_++)r[e+_]=i[_];return 0}function L0(r,e,t,f,x){var n=new Uint8Array(32);wf(n,f,x,gf);for(var i=new Uint8Array(8),u=0;u<8;u++)i[u]=f[u+16];return j0(r,e,t,i,n)}function r0(r,e,t,f,x,n,i){var u=new Uint8Array(32);wf(u,n,i,gf);for(var _=new Uint8Array(8),S=0;S<8;S++)_[S]=n[S+16];return C0(r,e,t,f,x,_,u)}var Wf=function(r){this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.leftover=0,this.fin=0;var e,t,f,x,n,i,u,_;e=r[0]&255|(r[1]&255)<<8,this.r[0]=e&8191,t=r[2]&255|(r[3]&255)<<8,this.r[1]=(e>>>13|t<<3)&8191,f=r[4]&255|(r[5]&255)<<8,this.r[2]=(t>>>10|f<<6)&7939,x=r[6]&255|(r[7]&255)<<8,this.r[3]=(f>>>7|x<<9)&8191,n=r[8]&255|(r[9]&255)<<8,this.r[4]=(x>>>4|n<<12)&255,this.r[5]=n>>>1&8190,i=r[10]&255|(r[11]&255)<<8,this.r[6]=(n>>>14|i<<2)&8191,u=r[12]&255|(r[13]&255)<<8,this.r[7]=(i>>>11|u<<5)&8065,_=r[14]&255|(r[15]&255)<<8,this.r[8]=(u>>>8|_<<8)&8191,this.r[9]=_>>>5&127,this.pad[0]=r[16]&255|(r[17]&255)<<8,this.pad[1]=r[18]&255|(r[19]&255)<<8,this.pad[2]=r[20]&255|(r[21]&255)<<8,this.pad[3]=r[22]&255|(r[23]&255)<<8,this.pad[4]=r[24]&255|(r[25]&255)<<8,this.pad[5]=r[26]&255|(r[27]&255)<<8,this.pad[6]=r[28]&255|(r[29]&255)<<8,this.pad[7]=r[30]&255|(r[31]&255)<<8};Wf.prototype.blocks=function(r,e,t){for(var f=this.fin?0:2048,x,n,i,u,_,S,p,X,E,L,Y,z,I,O,R,P,A,T,g,U=this.h[0],B=this.h[1],y=this.h[2],o=this.h[3],s=this.h[4],b=this.h[5],c=this.h[6],d=this.h[7],v=this.h[8],C=this.h[9],N=this.r[0],F=this.r[1],D=this.r[2],a=this.r[3],K=this.r[4],V=this.r[5],H=this.r[6],$=this.r[7],q=this.r[8],G=this.r[9];t>=16;)x=r[e+0]&255|(r[e+1]&255)<<8,U+=x&8191,n=r[e+2]&255|(r[e+3]&255)<<8,B+=(x>>>13|n<<3)&8191,i=r[e+4]&255|(r[e+5]&255)<<8,y+=(n>>>10|i<<6)&8191,u=r[e+6]&255|(r[e+7]&255)<<8,o+=(i>>>7|u<<9)&8191,_=r[e+8]&255|(r[e+9]&255)<<8,s+=(u>>>4|_<<12)&8191,b+=_>>>1&8191,S=r[e+10]&255|(r[e+11]&255)<<8,c+=(_>>>14|S<<2)&8191,p=r[e+12]&255|(r[e+13]&255)<<8,d+=(S>>>11|p<<5)&8191,X=r[e+14]&255|(r[e+15]&255)<<8,v+=(p>>>8|X<<8)&8191,C+=X>>>5|f,E=0,L=E,L+=U*N,L+=B*(5*G),L+=y*(5*q),L+=o*(5*$),L+=s*(5*H),E=L>>>13,L&=8191,L+=b*(5*V),L+=c*(5*K),L+=d*(5*a),L+=v*(5*D),L+=C*(5*F),E+=L>>>13,L&=8191,Y=E,Y+=U*F,Y+=B*N,Y+=y*(5*G),Y+=o*(5*q),Y+=s*(5*$),E=Y>>>13,Y&=8191,Y+=b*(5*H),Y+=c*(5*V),Y+=d*(5*K),Y+=v*(5*a),Y+=C*(5*D),E+=Y>>>13,Y&=8191,z=E,z+=U*D,z+=B*F,z+=y*N,z+=o*(5*G),z+=s*(5*q),E=z>>>13,z&=8191,z+=b*(5*$),z+=c*(5*H),z+=d*(5*V),z+=v*(5*K),z+=C*(5*a),E+=z>>>13,z&=8191,I=E,I+=U*a,I+=B*D,I+=y*F,I+=o*N,I+=s*(5*G),E=I>>>13,I&=8191,I+=b*(5*q),I+=c*(5*$),I+=d*(5*H),I+=v*(5*V),I+=C*(5*K),E+=I>>>13,I&=8191,O=E,O+=U*K,O+=B*a,O+=y*D,O+=o*F,O+=s*N,E=O>>>13,O&=8191,O+=b*(5*G),O+=c*(5*q),O+=d*(5*$),O+=v*(5*H),O+=C*(5*V),E+=O>>>13,O&=8191,R=E,R+=U*V,R+=B*K,R+=y*a,R+=o*D,R+=s*F,E=R>>>13,R&=8191,R+=b*N,R+=c*(5*G),R+=d*(5*q),R+=v*(5*$),R+=C*(5*H),E+=R>>>13,R&=8191,P=E,P+=U*H,P+=B*V,P+=y*K,P+=o*a,P+=s*D,E=P>>>13,P&=8191,P+=b*F,P+=c*N,P+=d*(5*G),P+=v*(5*q),P+=C*(5*$),E+=P>>>13,P&=8191,A=E,A+=U*$,A+=B*H,A+=y*V,A+=o*K,A+=s*a,E=A>>>13,A&=8191,A+=b*D,A+=c*F,A+=d*N,A+=v*(5*G),A+=C*(5*q),E+=A>>>13,A&=8191,T=E,T+=U*q,T+=B*$,T+=y*H,T+=o*V,T+=s*K,E=T>>>13,T&=8191,T+=b*a,T+=c*D,T+=d*F,T+=v*N,T+=C*(5*G),E+=T>>>13,T&=8191,g=E,g+=U*G,g+=B*q,g+=y*$,g+=o*H,g+=s*V,E=g>>>13,g&=8191,g+=b*K,g+=c*a,g+=d*D,g+=v*F,g+=C*N,E+=g>>>13,g&=8191,E=(E<<2)+E|0,E=E+L|0,L=E&8191,E=E>>>13,Y+=E,U=L,B=Y,y=z,o=I,s=O,b=R,c=P,d=A,v=T,C=g,e+=16,t-=16;this.h[0]=U,this.h[1]=B,this.h[2]=y,this.h[3]=o,this.h[4]=s,this.h[5]=b,this.h[6]=c,this.h[7]=d,this.h[8]=v,this.h[9]=C},Wf.prototype.finish=function(r,e){var t=new Uint16Array(10),f,x,n,i;if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(f=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=f,f=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=f*5,f=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=f,f=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=f,t[0]=this.h[0]+5,f=t[0]>>>13,t[0]&=8191,i=1;i<10;i++)t[i]=this.h[i]+f,f=t[i]>>>13,t[i]&=8191;for(t[9]-=8192,x=(f^1)-1,i=0;i<10;i++)t[i]&=x;for(x=~x,i=0;i<10;i++)this.h[i]=this.h[i]&x|t[i];for(this.h[0]=(this.h[0]|this.h[1]<<13)&65535,this.h[1]=(this.h[1]>>>3|this.h[2]<<10)&65535,this.h[2]=(this.h[2]>>>6|this.h[3]<<7)&65535,this.h[3]=(this.h[3]>>>9|this.h[4]<<4)&65535,this.h[4]=(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14)&65535,this.h[5]=(this.h[6]>>>2|this.h[7]<<11)&65535,this.h[6]=(this.h[7]>>>5|this.h[8]<<8)&65535,this.h[7]=(this.h[8]>>>8|this.h[9]<<5)&65535,n=this.h[0]+this.pad[0],this.h[0]=n&65535,i=1;i<8;i++)n=(this.h[i]+this.pad[i]|0)+(n>>>16)|0,this.h[i]=n&65535;r[e+0]=this.h[0]>>>0&255,r[e+1]=this.h[0]>>>8&255,r[e+2]=this.h[1]>>>0&255,r[e+3]=this.h[1]>>>8&255,r[e+4]=this.h[2]>>>0&255,r[e+5]=this.h[2]>>>8&255,r[e+6]=this.h[3]>>>0&255,r[e+7]=this.h[3]>>>8&255,r[e+8]=this.h[4]>>>0&255,r[e+9]=this.h[4]>>>8&255,r[e+10]=this.h[5]>>>0&255,r[e+11]=this.h[5]>>>8&255,r[e+12]=this.h[6]>>>0&255,r[e+13]=this.h[6]>>>8&255,r[e+14]=this.h[7]>>>0&255,r[e+15]=this.h[7]>>>8&255},Wf.prototype.update=function(r,e,t){var f,x;if(this.leftover){for(x=16-this.leftover,x>t&&(x=t),f=0;f<x;f++)this.buffer[this.leftover+f]=r[e+f];if(t-=x,e+=x,this.leftover+=x,this.leftover<16)return;this.blocks(this.buffer,0,16),this.leftover=0}if(t>=16&&(x=t-t%16,this.blocks(r,e,x),e+=x,t-=x),t){for(f=0;f<t;f++)this.buffer[this.leftover+f]=r[e+f];this.leftover+=t}};function t0(r,e,t,f,x,n){var i=new Wf(n);return i.update(t,f,x),i.finish(r,e),0}function Y0(r,e,t,f,x,n){var i=new Uint8Array(16);return t0(i,0,t,f,x,n),Rf(r,e,i,0)}function e0(r,e,t,f,x){var n;if(t<32)return-1;for(r0(r,0,e,0,t,f,x),t0(r,16,r,32,t-32,r),n=0;n<16;n++)r[n]=0;return 0}function x0(r,e,t,f,x){var n,i=new Uint8Array(32);if(t<32||(L0(i,0,32,f,x),Y0(e,16,e,32,t-32,i)!==0))return-1;for(r0(r,0,e,0,t,f,x),n=0;n<32;n++)r[n]=0;return 0}function _f(r,e){var t;for(t=0;t<16;t++)r[t]=e[t]|0}function a0(r){var e,t,f=1;for(e=0;e<16;e++)t=r[e]+f+65535,f=Math.floor(t/65536),r[e]=t-f*65536;r[0]+=f-1+37*(f-1)}function Cf(r,e,t){for(var f,x=~(t-1),n=0;n<16;n++)f=x&(r[n]^e[n]),r[n]^=f,e[n]^=f}function jf(r,e){var t,f,x,n=l(),i=l();for(t=0;t<16;t++)i[t]=e[t];for(a0(i),a0(i),a0(i),f=0;f<2;f++){for(n[0]=i[0]-65517,t=1;t<15;t++)n[t]=i[t]-65535-(n[t-1]>>16&1),n[t-1]&=65535;n[15]=i[15]-32767-(n[14]>>16&1),x=n[15]>>16&1,n[14]&=65535,Cf(i,n,1-x)}for(t=0;t<16;t++)r[2*t]=i[t]&255,r[2*t+1]=i[t]>>8}function O0(r,e){var t=new Uint8Array(32),f=new Uint8Array(32);return jf(t,r),jf(f,e),If(t,0,f,0)}function P0(r){var e=new Uint8Array(32);return jf(e,r),e[0]&1}function n0(r,e){var t;for(t=0;t<16;t++)r[t]=e[2*t]+(e[2*t+1]<<8);r[15]&=32767}function bf(r,e,t){for(var f=0;f<16;f++)r[f]=e[f]+t[f]}function vf(r,e,t){for(var f=0;f<16;f++)r[f]=e[f]-t[f]}function Z(r,e,t){var f,x,n=0,i=0,u=0,_=0,S=0,p=0,X=0,E=0,L=0,Y=0,z=0,I=0,O=0,R=0,P=0,A=0,T=0,g=0,U=0,B=0,y=0,o=0,s=0,b=0,c=0,d=0,v=0,C=0,N=0,F=0,D=0,a=t[0],K=t[1],V=t[2],H=t[3],$=t[4],q=t[5],G=t[6],rf=t[7],Q=t[8],m=t[9],k=t[10],ff=t[11],ef=t[12],nf=t[13],of=t[14],sf=t[15];f=e[0],n+=f*a,i+=f*K,u+=f*V,_+=f*H,S+=f*$,p+=f*q,X+=f*G,E+=f*rf,L+=f*Q,Y+=f*m,z+=f*k,I+=f*ff,O+=f*ef,R+=f*nf,P+=f*of,A+=f*sf,f=e[1],i+=f*a,u+=f*K,_+=f*V,S+=f*H,p+=f*$,X+=f*q,E+=f*G,L+=f*rf,Y+=f*Q,z+=f*m,I+=f*k,O+=f*ff,R+=f*ef,P+=f*nf,A+=f*of,T+=f*sf,f=e[2],u+=f*a,_+=f*K,S+=f*V,p+=f*H,X+=f*$,E+=f*q,L+=f*G,Y+=f*rf,z+=f*Q,I+=f*m,O+=f*k,R+=f*ff,P+=f*ef,A+=f*nf,T+=f*of,g+=f*sf,f=e[3],_+=f*a,S+=f*K,p+=f*V,X+=f*H,E+=f*$,L+=f*q,Y+=f*G,z+=f*rf,I+=f*Q,O+=f*m,R+=f*k,P+=f*ff,A+=f*ef,T+=f*nf,g+=f*of,U+=f*sf,f=e[4],S+=f*a,p+=f*K,X+=f*V,E+=f*H,L+=f*$,Y+=f*q,z+=f*G,I+=f*rf,O+=f*Q,R+=f*m,P+=f*k,A+=f*ff,T+=f*ef,g+=f*nf,U+=f*of,B+=f*sf,f=e[5],p+=f*a,X+=f*K,E+=f*V,L+=f*H,Y+=f*$,z+=f*q,I+=f*G,O+=f*rf,R+=f*Q,P+=f*m,A+=f*k,T+=f*ff,g+=f*ef,U+=f*nf,B+=f*of,y+=f*sf,f=e[6],X+=f*a,E+=f*K,L+=f*V,Y+=f*H,z+=f*$,I+=f*q,O+=f*G,R+=f*rf,P+=f*Q,A+=f*m,T+=f*k,g+=f*ff,U+=f*ef,B+=f*nf,y+=f*of,o+=f*sf,f=e[7],E+=f*a,L+=f*K,Y+=f*V,z+=f*H,I+=f*$,O+=f*q,R+=f*G,P+=f*rf,A+=f*Q,T+=f*m,g+=f*k,U+=f*ff,B+=f*ef,y+=f*nf,o+=f*of,s+=f*sf,f=e[8],L+=f*a,Y+=f*K,z+=f*V,I+=f*H,O+=f*$,R+=f*q,P+=f*G,A+=f*rf,T+=f*Q,g+=f*m,U+=f*k,B+=f*ff,y+=f*ef,o+=f*nf,s+=f*of,b+=f*sf,f=e[9],Y+=f*a,z+=f*K,I+=f*V,O+=f*H,R+=f*$,P+=f*q,A+=f*G,T+=f*rf,g+=f*Q,U+=f*m,B+=f*k,y+=f*ff,o+=f*ef,s+=f*nf,b+=f*of,c+=f*sf,f=e[10],z+=f*a,I+=f*K,O+=f*V,R+=f*H,P+=f*$,A+=f*q,T+=f*G,g+=f*rf,U+=f*Q,B+=f*m,y+=f*k,o+=f*ff,s+=f*ef,b+=f*nf,c+=f*of,d+=f*sf,f=e[11],I+=f*a,O+=f*K,R+=f*V,P+=f*H,A+=f*$,T+=f*q,g+=f*G,U+=f*rf,B+=f*Q,y+=f*m,o+=f*k,s+=f*ff,b+=f*ef,c+=f*nf,d+=f*of,v+=f*sf,f=e[12],O+=f*a,R+=f*K,P+=f*V,A+=f*H,T+=f*$,g+=f*q,U+=f*G,B+=f*rf,y+=f*Q,o+=f*m,s+=f*k,b+=f*ff,c+=f*ef,d+=f*nf,v+=f*of,C+=f*sf,f=e[13],R+=f*a,P+=f*K,A+=f*V,T+=f*H,g+=f*$,U+=f*q,B+=f*G,y+=f*rf,o+=f*Q,s+=f*m,b+=f*k,c+=f*ff,d+=f*ef,v+=f*nf,C+=f*of,N+=f*sf,f=e[14],P+=f*a,A+=f*K,T+=f*V,g+=f*H,U+=f*$,B+=f*q,y+=f*G,o+=f*rf,s+=f*Q,b+=f*m,c+=f*k,d+=f*ff,v+=f*ef,C+=f*nf,N+=f*of,F+=f*sf,f=e[15],A+=f*a,T+=f*K,g+=f*V,U+=f*H,B+=f*$,y+=f*q,o+=f*G,s+=f*rf,b+=f*Q,c+=f*m,d+=f*k,v+=f*ff,C+=f*ef,N+=f*nf,F+=f*of,D+=f*sf,n+=38*T,i+=38*g,u+=38*U,_+=38*B,S+=38*y,p+=38*o,X+=38*s,E+=38*b,L+=38*c,Y+=38*d,z+=38*v,I+=38*C,O+=38*N,R+=38*F,P+=38*D,x=1,f=n+x+65535,x=Math.floor(f/65536),n=f-x*65536,f=i+x+65535,x=Math.floor(f/65536),i=f-x*65536,f=u+x+65535,x=Math.floor(f/65536),u=f-x*65536,f=_+x+65535,x=Math.floor(f/65536),_=f-x*65536,f=S+x+65535,x=Math.floor(f/65536),S=f-x*65536,f=p+x+65535,x=Math.floor(f/65536),p=f-x*65536,f=X+x+65535,x=Math.floor(f/65536),X=f-x*65536,f=E+x+65535,x=Math.floor(f/65536),E=f-x*65536,f=L+x+65535,x=Math.floor(f/65536),L=f-x*65536,f=Y+x+65535,x=Math.floor(f/65536),Y=f-x*65536,f=z+x+65535,x=Math.floor(f/65536),z=f-x*65536,f=I+x+65535,x=Math.floor(f/65536),I=f-x*65536,f=O+x+65535,x=Math.floor(f/65536),O=f-x*65536,f=R+x+65535,x=Math.floor(f/65536),R=f-x*65536,f=P+x+65535,x=Math.floor(f/65536),P=f-x*65536,f=A+x+65535,x=Math.floor(f/65536),A=f-x*65536,n+=x-1+37*(x-1),x=1,f=n+x+65535,x=Math.floor(f/65536),n=f-x*65536,f=i+x+65535,x=Math.floor(f/65536),i=f-x*65536,f=u+x+65535,x=Math.floor(f/65536),u=f-x*65536,f=_+x+65535,x=Math.floor(f/65536),_=f-x*65536,f=S+x+65535,x=Math.floor(f/65536),S=f-x*65536,f=p+x+65535,x=Math.floor(f/65536),p=f-x*65536,f=X+x+65535,x=Math.floor(f/65536),X=f-x*65536,f=E+x+65535,x=Math.floor(f/65536),E=f-x*65536,f=L+x+65535,x=Math.floor(f/65536),L=f-x*65536,f=Y+x+65535,x=Math.floor(f/65536),Y=f-x*65536,f=z+x+65535,x=Math.floor(f/65536),z=f-x*65536,f=I+x+65535,x=Math.floor(f/65536),I=f-x*65536,f=O+x+65535,x=Math.floor(f/65536),O=f-x*65536,f=R+x+65535,x=Math.floor(f/65536),R=f-x*65536,f=P+x+65535,x=Math.floor(f/65536),P=f-x*65536,f=A+x+65535,x=Math.floor(f/65536),A=f-x*65536,n+=x-1+37*(x-1),r[0]=n,r[1]=i,r[2]=u,r[3]=_,r[4]=S,r[5]=p,r[6]=X,r[7]=E,r[8]=L,r[9]=Y,r[10]=z,r[11]=I,r[12]=O,r[13]=R,r[14]=P,r[15]=A}function df(r,e){Z(r,e,e)}function R0(r,e){var t=l(),f;for(f=0;f<16;f++)t[f]=e[f];for(f=253;f>=0;f--)df(t,t),f!==2&&f!==4&&Z(t,t,e);for(f=0;f<16;f++)r[f]=t[f]}function I0(r,e){var t=l(),f;for(f=0;f<16;f++)t[f]=e[f];for(f=250;f>=0;f--)df(t,t),f!==1&&Z(t,t,e);for(f=0;f<16;f++)r[f]=t[f]}function qf(r,e,t){var f=new Uint8Array(32),x=new Float64Array(80),n,i,u=l(),_=l(),S=l(),p=l(),X=l(),E=l();for(i=0;i<31;i++)f[i]=e[i];for(f[31]=e[31]&127|64,f[0]&=248,n0(x,t),i=0;i<16;i++)_[i]=x[i],p[i]=u[i]=S[i]=0;for(u[0]=p[0]=1,i=254;i>=0;--i)n=f[i>>>3]>>>(i&7)&1,Cf(u,_,n),Cf(S,p,n),bf(X,u,S),vf(u,u,S),bf(S,_,p),vf(_,_,p),df(p,X),df(E,u),Z(u,S,u),Z(S,_,X),bf(X,u,S),vf(u,u,S),df(_,u),vf(S,p,E),Z(u,S,Zf),bf(u,u,p),Z(S,S,u),Z(u,p,E),Z(p,_,x),df(_,X),Cf(u,_,n),Cf(S,p,n);for(i=0;i<16;i++)x[i+16]=u[i],x[i+32]=S[i],x[i+48]=_[i],x[i+64]=p[i];var L=x.subarray(32),Y=x.subarray(16);return R0(L,L),Z(Y,Y,L),jf(r,Y),0}function Gf(r,e){return qf(r,e,W)}function z0(r,e){return j(e,32),Gf(r,e)}function Xf(r,e,t){var f=new Uint8Array(32);return qf(f,t,e),wf(r,M,f,gf)}var N0=e0,nr=x0;function ir(r,e,t,f,x,n){var i=new Uint8Array(32);return Xf(i,x,n),N0(r,e,t,f,i)}function or(r,e,t,f,x,n){var i=new Uint8Array(32);return Xf(i,x,n),nr(r,e,t,f,i)}var D0=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591];function F0(r,e,t,f){for(var x=new Int32Array(16),n=new Int32Array(16),i,u,_,S,p,X,E,L,Y,z,I,O,R,P,A,T,g,U,B,y,o,s,b,c,d,v,C=r[0],N=r[1],F=r[2],D=r[3],a=r[4],K=r[5],V=r[6],H=r[7],$=e[0],q=e[1],G=e[2],rf=e[3],Q=e[4],m=e[5],k=e[6],ff=e[7],ef=0;f>=128;){for(B=0;B<16;B++)y=8*B+ef,x[B]=t[y+0]<<24|t[y+1]<<16|t[y+2]<<8|t[y+3],n[B]=t[y+4]<<24|t[y+5]<<16|t[y+6]<<8|t[y+7];for(B=0;B<80;B++)if(i=C,u=N,_=F,S=D,p=a,X=K,E=V,L=H,Y=$,z=q,I=G,O=rf,R=Q,P=m,A=k,T=ff,o=H,s=ff,b=s&65535,c=s>>>16,d=o&65535,v=o>>>16,o=(a>>>14|Q<<18)^(a>>>18|Q<<14)^(Q>>>9|a<<23),s=(Q>>>14|a<<18)^(Q>>>18|a<<14)^(a>>>9|Q<<23),b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,o=a&K^~a&V,s=Q&m^~Q&k,b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,o=D0[B*2],s=D0[B*2+1],b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,o=x[B%16],s=n[B%16],b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,c+=b>>>16,d+=c>>>16,v+=d>>>16,g=d&65535|v<<16,U=b&65535|c<<16,o=g,s=U,b=s&65535,c=s>>>16,d=o&65535,v=o>>>16,o=(C>>>28|$<<4)^($>>>2|C<<30)^($>>>7|C<<25),s=($>>>28|C<<4)^(C>>>2|$<<30)^(C>>>7|$<<25),b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,o=C&N^C&F^N&F,s=$&q^$&G^q&G,b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,c+=b>>>16,d+=c>>>16,v+=d>>>16,L=d&65535|v<<16,T=b&65535|c<<16,o=S,s=O,b=s&65535,c=s>>>16,d=o&65535,v=o>>>16,o=g,s=U,b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,c+=b>>>16,d+=c>>>16,v+=d>>>16,S=d&65535|v<<16,O=b&65535|c<<16,N=i,F=u,D=_,a=S,K=p,V=X,H=E,C=L,q=Y,G=z,rf=I,Q=O,m=R,k=P,ff=A,$=T,B%16===15)for(y=0;y<16;y++)o=x[y],s=n[y],b=s&65535,c=s>>>16,d=o&65535,v=o>>>16,o=x[(y+9)%16],s=n[(y+9)%16],b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,g=x[(y+1)%16],U=n[(y+1)%16],o=(g>>>1|U<<31)^(g>>>8|U<<24)^g>>>7,s=(U>>>1|g<<31)^(U>>>8|g<<24)^(U>>>7|g<<25),b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,g=x[(y+14)%16],U=n[(y+14)%16],o=(g>>>19|U<<13)^(U>>>29|g<<3)^g>>>6,s=(U>>>19|g<<13)^(g>>>29|U<<3)^(U>>>6|g<<26),b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,c+=b>>>16,d+=c>>>16,v+=d>>>16,x[y]=d&65535|v<<16,n[y]=b&65535|c<<16;o=C,s=$,b=s&65535,c=s>>>16,d=o&65535,v=o>>>16,o=r[0],s=e[0],b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,c+=b>>>16,d+=c>>>16,v+=d>>>16,r[0]=C=d&65535|v<<16,e[0]=$=b&65535|c<<16,o=N,s=q,b=s&65535,c=s>>>16,d=o&65535,v=o>>>16,o=r[1],s=e[1],b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,c+=b>>>16,d+=c>>>16,v+=d>>>16,r[1]=N=d&65535|v<<16,e[1]=q=b&65535|c<<16,o=F,s=G,b=s&65535,c=s>>>16,d=o&65535,v=o>>>16,o=r[2],s=e[2],b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,c+=b>>>16,d+=c>>>16,v+=d>>>16,r[2]=F=d&65535|v<<16,e[2]=G=b&65535|c<<16,o=D,s=rf,b=s&65535,c=s>>>16,d=o&65535,v=o>>>16,o=r[3],s=e[3],b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,c+=b>>>16,d+=c>>>16,v+=d>>>16,r[3]=D=d&65535|v<<16,e[3]=rf=b&65535|c<<16,o=a,s=Q,b=s&65535,c=s>>>16,d=o&65535,v=o>>>16,o=r[4],s=e[4],b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,c+=b>>>16,d+=c>>>16,v+=d>>>16,r[4]=a=d&65535|v<<16,e[4]=Q=b&65535|c<<16,o=K,s=m,b=s&65535,c=s>>>16,d=o&65535,v=o>>>16,o=r[5],s=e[5],b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,c+=b>>>16,d+=c>>>16,v+=d>>>16,r[5]=K=d&65535|v<<16,e[5]=m=b&65535|c<<16,o=V,s=k,b=s&65535,c=s>>>16,d=o&65535,v=o>>>16,o=r[6],s=e[6],b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,c+=b>>>16,d+=c>>>16,v+=d>>>16,r[6]=V=d&65535|v<<16,e[6]=k=b&65535|c<<16,o=H,s=ff,b=s&65535,c=s>>>16,d=o&65535,v=o>>>16,o=r[7],s=e[7],b+=s&65535,c+=s>>>16,d+=o&65535,v+=o>>>16,c+=b>>>16,d+=c>>>16,v+=d>>>16,r[7]=H=d&65535|v<<16,e[7]=ff=b&65535|c<<16,ef+=128,f-=128}return f}function Ef(r,e,t){var f=new Int32Array(8),x=new Int32Array(8),n=new Uint8Array(256),i,u=t;for(f[0]=1779033703,f[1]=3144134277,f[2]=1013904242,f[3]=2773480762,f[4]=1359893119,f[5]=2600822924,f[6]=528734635,f[7]=1541459225,x[0]=4089235720,x[1]=2227873595,x[2]=4271175723,x[3]=1595750129,x[4]=2917565137,x[5]=725511199,x[6]=4215389547,x[7]=327033209,F0(f,x,e,t),t%=128,i=0;i<t;i++)n[i]=e[u-t+i];for(n[t]=128,t=256-128*(t<112?1:0),n[t-9]=0,Tf(n,t-8,u/536870912|0,u<<3),F0(f,x,n,t),i=0;i<8;i++)Tf(r,8*i,f[i],x[i]);return 0}function Vf(r,e){var t=l(),f=l(),x=l(),n=l(),i=l(),u=l(),_=l(),S=l(),p=l();vf(t,r[1],r[0]),vf(p,e[1],e[0]),Z(t,t,p),bf(f,r[0],r[1]),bf(p,e[0],e[1]),Z(f,f,p),Z(x,r[3],e[3]),Z(x,x,Pf),Z(n,r[2],e[2]),bf(n,n,n),vf(i,f,t),vf(u,n,x),bf(_,n,x),bf(S,f,t),Z(r[0],i,u),Z(r[1],S,_),Z(r[2],_,u),Z(r[3],i,S)}function $0(r,e,t){var f;for(f=0;f<4;f++)Cf(r[f],e[f],t)}function i0(r,e){var t=l(),f=l(),x=l();R0(x,e[2]),Z(t,e[0],x),Z(f,e[1],x),jf(r,f),r[31]^=P0(t)<<7}function o0(r,e,t){var f,x;for(_f(r[0],tf),_f(r[1],af),_f(r[2],af),_f(r[3],tf),x=255;x>=0;--x)f=t[x/8|0]>>(x&7)&1,$0(r,e,f),Vf(e,r),Vf(r,r),$0(r,e,f)}function Hf(r,e){var t=[l(),l(),l(),l()];_f(t[0],J),_f(t[1],Sf),_f(t[2],af),Z(t[3],J,Sf),o0(r,t,e)}function s0(r,e,t){var f=new Uint8Array(64),x=[l(),l(),l(),l()],n;for(t||j(e,32),Ef(f,e,32),f[0]&=248,f[31]&=127,f[31]|=64,Hf(x,f),i0(r,x),n=0;n<32;n++)e[n+32]=r[n];return 0}var Jf=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function c0(r,e){var t,f,x,n;for(f=63;f>=32;--f){for(t=0,x=f-32,n=f-12;x<n;++x)e[x]+=t-16*e[f]*Jf[x-(f-32)],t=Math.floor((e[x]+128)/256),e[x]-=t*256;e[x]+=t,e[f]=0}for(t=0,x=0;x<32;x++)e[x]+=t-(e[31]>>4)*Jf[x],t=e[x]>>8,e[x]&=255;for(x=0;x<32;x++)e[x]-=t*Jf[x];for(f=0;f<32;f++)e[f+1]+=e[f]>>8,r[f]=e[f]&255}function h0(r){var e=new Float64Array(64),t;for(t=0;t<64;t++)e[t]=r[t];for(t=0;t<64;t++)r[t]=0;c0(r,e)}function K0(r,e,t,f){var x=new Uint8Array(64),n=new Uint8Array(64),i=new Uint8Array(64),u,_,S=new Float64Array(64),p=[l(),l(),l(),l()];Ef(x,f,32),x[0]&=248,x[31]&=127,x[31]|=64;var X=t+64;for(u=0;u<t;u++)r[64+u]=e[u];for(u=0;u<32;u++)r[32+u]=x[32+u];for(Ef(i,r.subarray(32),t+32),h0(i),Hf(p,i),i0(r,p),u=32;u<64;u++)r[u]=f[u];for(Ef(n,r,t+64),h0(n),u=0;u<64;u++)S[u]=0;for(u=0;u<32;u++)S[u]=i[u];for(u=0;u<32;u++)for(_=0;_<32;_++)S[u+_]+=n[u]*x[_];return c0(r.subarray(32),S),X}function sr(r,e){var t=l(),f=l(),x=l(),n=l(),i=l(),u=l(),_=l();return _f(r[2],af),n0(r[1],e),df(x,r[1]),Z(n,x,pf),vf(x,x,r[2]),bf(n,r[2],n),df(i,n),df(u,i),Z(_,u,i),Z(t,_,x),Z(t,t,n),I0(t,t),Z(t,t,x),Z(t,t,n),Z(t,t,n),Z(r[0],t,n),df(f,r[0]),Z(f,f,n),O0(f,x)&&Z(r[0],r[0],uf),df(f,r[0]),Z(f,f,n),O0(f,x)?-1:(P0(r[0])===e[31]>>7&&vf(r[0],tf,r[0]),Z(r[3],r[0],r[1]),0)}function u0(r,e,t,f){var x,n=new Uint8Array(32),i=new Uint8Array(64),u=[l(),l(),l(),l()],_=[l(),l(),l(),l()];if(t<64||sr(_,f))return-1;for(x=0;x<t;x++)r[x]=e[x];for(x=0;x<32;x++)r[x+32]=f[x];if(Ef(i,r,t),h0(i),o0(u,_,i),Hf(_,e.subarray(32)),Vf(u,_),i0(n,u),t-=64,If(e,0,n,0)){for(x=0;x<t;x++)r[x]=0;return-1}for(x=0;x<t;x++)r[x]=e[x+64];return t}var d0=32,Qf=24,Nf=32,Lf=16,Df=32,mf=32,Ff=32,$f=32,l0=32,Z0=Qf,cr=Nf,hr=Lf,yf=64,Af=32,Yf=64,b0=32,v0=64;h.lowlevel={crypto_core_hsalsa20:wf,crypto_stream_xor:r0,crypto_stream:L0,crypto_stream_salsa20_xor:C0,crypto_stream_salsa20:j0,crypto_onetimeauth:t0,crypto_onetimeauth_verify:Y0,crypto_verify_16:Rf,crypto_verify_32:If,crypto_secretbox:e0,crypto_secretbox_open:x0,crypto_scalarmult:qf,crypto_scalarmult_base:Gf,crypto_box_beforenm:Xf,crypto_box_afternm:N0,crypto_box:ir,crypto_box_open:or,crypto_box_keypair:z0,crypto_hash:Ef,crypto_sign:K0,crypto_sign_keypair:s0,crypto_sign_open:u0,crypto_secretbox_KEYBYTES:d0,crypto_secretbox_NONCEBYTES:Qf,crypto_secretbox_ZEROBYTES:Nf,crypto_secretbox_BOXZEROBYTES:Lf,crypto_scalarmult_BYTES:Df,crypto_scalarmult_SCALARBYTES:mf,crypto_box_PUBLICKEYBYTES:Ff,crypto_box_SECRETKEYBYTES:$f,crypto_box_BEFORENMBYTES:l0,crypto_box_NONCEBYTES:Z0,crypto_box_ZEROBYTES:cr,crypto_box_BOXZEROBYTES:hr,crypto_sign_BYTES:yf,crypto_sign_PUBLICKEYBYTES:Af,crypto_sign_SECRETKEYBYTES:Yf,crypto_sign_SEEDBYTES:b0,crypto_hash_BYTES:v0,gf:l,D:pf,L:Jf,pack25519:jf,unpack25519:n0,M:Z,A:bf,S:df,Z:vf,pow2523:I0,add:Vf,set25519:_f,modL:c0,scalarmult:o0,scalarbase:Hf};function W0(r,e){if(r.length!==d0)throw new Error("bad key size");if(e.length!==Qf)throw new Error("bad nonce size")}function ur(r,e){if(r.length!==Ff)throw new Error("bad public key size");if(e.length!==$f)throw new Error("bad secret key size")}function hf(){for(var r=0;r<arguments.length;r++)if(!(arguments[r]instanceof Uint8Array))throw new TypeError("unexpected type, use Uint8Array")}function q0(r){for(var e=0;e<r.length;e++)r[e]=0}h.randomBytes=function(r){var e=new Uint8Array(r);return j(e,r),e},h.secretbox=function(r,e,t){hf(r,e,t),W0(t,e);for(var f=new Uint8Array(Nf+r.length),x=new Uint8Array(f.length),n=0;n<r.length;n++)f[n+Nf]=r[n];return e0(x,f,f.length,e,t),x.subarray(Lf)},h.secretbox.open=function(r,e,t){hf(r,e,t),W0(t,e);for(var f=new Uint8Array(Lf+r.length),x=new Uint8Array(f.length),n=0;n<r.length;n++)f[n+Lf]=r[n];return f.length<32||x0(x,f,f.length,e,t)!==0?null:x.subarray(Nf)},h.secretbox.keyLength=d0,h.secretbox.nonceLength=Qf,h.secretbox.overheadLength=Lf,h.scalarMult=function(r,e){if(hf(r,e),r.length!==mf)throw new Error("bad n size");if(e.length!==Df)throw new Error("bad p size");var t=new Uint8Array(Df);return qf(t,r,e),t},h.scalarMult.base=function(r){if(hf(r),r.length!==mf)throw new Error("bad n size");var e=new Uint8Array(Df);return Gf(e,r),e},h.scalarMult.scalarLength=mf,h.scalarMult.groupElementLength=Df,h.box=function(r,e,t,f){var x=h.box.before(t,f);return h.secretbox(r,e,x)},h.box.before=function(r,e){hf(r,e),ur(r,e);var t=new Uint8Array(l0);return Xf(t,r,e),t},h.box.after=h.secretbox,h.box.open=function(r,e,t,f){var x=h.box.before(t,f);return h.secretbox.open(r,e,x)},h.box.open.after=h.secretbox.open,h.box.keyPair=function(){var r=new Uint8Array(Ff),e=new Uint8Array($f);return z0(r,e),{publicKey:r,secretKey:e}},h.box.keyPair.fromSecretKey=function(r){if(hf(r),r.length!==$f)throw new Error("bad secret key size");var e=new Uint8Array(Ff);return Gf(e,r),{publicKey:e,secretKey:new Uint8Array(r)}},h.box.publicKeyLength=Ff,h.box.secretKeyLength=$f,h.box.sharedKeyLength=l0,h.box.nonceLength=Z0,h.box.overheadLength=h.secretbox.overheadLength,h.sign=function(r,e){if(hf(r,e),e.length!==Yf)throw new Error("bad secret key size");var t=new Uint8Array(yf+r.length);return K0(t,r,r.length,e),t},h.sign.open=function(r,e){if(hf(r,e),e.length!==Af)throw new Error("bad public key size");var t=new Uint8Array(r.length),f=u0(t,r,r.length,e);if(f<0)return null;for(var x=new Uint8Array(f),n=0;n<x.length;n++)x[n]=t[n];return x},h.sign.detached=function(r,e){for(var t=h.sign(r,e),f=new Uint8Array(yf),x=0;x<f.length;x++)f[x]=t[x];return f},h.sign.detached.verify=function(r,e,t){if(hf(r,e,t),e.length!==yf)throw new Error("bad signature size");if(t.length!==Af)throw new Error("bad public key size");var f=new Uint8Array(yf+r.length),x=new Uint8Array(yf+r.length),n;for(n=0;n<yf;n++)f[n]=e[n];for(n=0;n<r.length;n++)f[n+yf]=r[n];return u0(x,f,f.length,t)>=0},h.sign.keyPair=function(){var r=new Uint8Array(Af),e=new Uint8Array(Yf);return s0(r,e),{publicKey:r,secretKey:e}},h.sign.keyPair.fromSecretKey=function(r){if(hf(r),r.length!==Yf)throw new Error("bad secret key size");for(var e=new Uint8Array(Af),t=0;t<e.length;t++)e[t]=r[32+t];return{publicKey:e,secretKey:new Uint8Array(r)}},h.sign.keyPair.fromSeed=function(r){if(hf(r),r.length!==b0)throw new Error("bad seed size");for(var e=new Uint8Array(Af),t=new Uint8Array(Yf),f=0;f<32;f++)t[f]=r[f];return s0(e,t,!0),{publicKey:e,secretKey:t}},h.sign.publicKeyLength=Af,h.sign.secretKeyLength=Yf,h.sign.seedLength=b0,h.sign.signatureLength=yf,h.hash=function(r){hf(r);var e=new Uint8Array(v0);return Ef(e,r,r.length),e},h.hash.hashLength=v0,h.verify=function(r,e){return hf(r,e),r.length===0||e.length===0||r.length!==e.length?!1:Mf(r,0,e,0,r.length)===0},h.setPRNG=function(r){j=r},(function(){var r=typeof self<"u"?self.crypto||self.msCrypto:null;if(r&&r.getRandomValues){var e=65536;h.setPRNG(function(t,f){var x,n=new Uint8Array(f);for(x=0;x<f;x+=e)r.getRandomValues(n.subarray(x,x+Math.min(f-x,e)));for(x=0;x<f;x++)t[x]=n[x];q0(n)})}else typeof Sr<"u"&&(r=Cr,r&&r.randomBytes&&h.setPRNG(function(t,f){var x,n=r.randomBytes(f);for(x=0;x<f;x++)t[x]=n[x];q0(n)}))})()})(w.exports?w.exports:self.nacl=self.nacl||{})})(w0)),w0.exports}jr();var kf={exports:{}},Lr=kf.exports,V0;function Yr(){return V0||(V0=1,(function(w){(function(h,l){w.exports?w.exports=l():(h.nacl||(h.nacl={}),h.nacl.util=l())})(Lr,function(){var h={};function l(j){if(!/^(?:[A-Za-z0-9+\/]{2}[A-Za-z0-9+\/]{2})*(?:[A-Za-z0-9+\/]{2}==|[A-Za-z0-9+\/]{3}=)?$/.test(j))throw new TypeError("invalid encoding")}return h.decodeUTF8=function(j){if(typeof j!="string")throw new TypeError("expected string");var M,W=unescape(encodeURIComponent(j)),tf=new Uint8Array(W.length);for(M=0;M<W.length;M++)tf[M]=W.charCodeAt(M);return tf},h.encodeUTF8=function(j){var M,W=[];for(M=0;M<j.length;M++)W.push(String.fromCharCode(j[M]));return decodeURIComponent(escape(W.join("")))},typeof atob>"u"?typeof Buffer.from<"u"?(h.encodeBase64=function(j){return Buffer.from(j).toString("base64")},h.decodeBase64=function(j){return l(j),new Uint8Array(Array.prototype.slice.call(Buffer.from(j,"base64"),0))}):(h.encodeBase64=function(j){return new Buffer(j).toString("base64")},h.decodeBase64=function(j){return l(j),new Uint8Array(Array.prototype.slice.call(new Buffer(j,"base64"),0))}):(h.encodeBase64=function(j){var M,W=[],tf=j.length;for(M=0;M<tf;M++)W.push(String.fromCharCode(j[M]));return btoa(W.join(""))},h.decodeBase64=function(j){l(j);var M,W=atob(j),tf=new Uint8Array(W.length);for(M=0;M<W.length;M++)tf[M]=W.charCodeAt(M);return tf}),h})})(kf)),kf.exports}Yr();var A0=(w=>(w.WALLET_KERNEL="wallet-kernel",w.PARTICIPANT="participant",w.FIREBLOCKS="fireblocks",w.BLOCKDAEMON="blockdaemon",w.DFNS="dfns",w))(A0||{}),Or=m0({provider:vr(A0),properties:dr(br(),lr()).optional()});m0({drivers:_r(Or).optional()});var Pr=Object.create,U0=Object.defineProperty,Rr=Object.getOwnPropertyDescriptor,fr=(w,h)=>(h=Symbol[w])?h:Symbol.for("Symbol."+w),Of=w=>{throw TypeError(w)},Ir=(w,h,l)=>h in w?U0(w,h,{enumerable:!0,configurable:!0,writable:!0,value:l}):w[h]=l,H0=(w,h)=>U0(w,"name",{value:h,configurable:!0}),zr=w=>[,,,Pr(w?.[fr("metadata")]??null)],rr=["class","method","getter","setter","accessor","field","value","get","set"],Kf=w=>w!==void 0&&typeof w!="function"?Of("Function expected"):w,Nr=(w,h,l,j,M)=>({kind:rr[w],name:h,metadata:j,addInitializer:W=>l._?Of("Already initialized"):M.push(Kf(W||null))}),Dr=(w,h)=>Ir(h,fr("metadata"),w[3]),Uf=(w,h,l,j)=>{for(var M=0,W=w[h>>1],tf=W&&W.length;M<tf;M++)h&1?W[M].call(l):j=W[M].call(l,j);return j},f0=(w,h,l,j,M,W)=>{var tf,af,Zf,pf,Pf,J=h&7,Sf=!!(h&8),uf=!!(h&16),Tf=J>3?w.length+1:J?Sf?1:2:0,Mf=rr[J+5],Rf=J>3&&(w[Tf-1]=[]),If=w[Tf]||(w[Tf]=[]),cf=J&&(!uf&&!Sf&&(M=M.prototype),J<5&&(J>3||!uf)&&Rr(J<4?M:{get[l](){return J0(this,W)},set[l](xf){return Q0(this,W,xf)}},l));J?uf&&J<4&&H0(W,(J>2?"set ":J>1?"get ":"")+l):H0(M,l);for(var zf=j.length-1;zf>=0;zf--)pf=Nr(J,l,Zf={},w[3],If),J&&(pf.static=Sf,pf.private=uf,Pf=pf.access={has:uf?xf=>Fr(M,xf):xf=>l in xf},J^3&&(Pf.get=uf?xf=>(J^1?J0:$r)(xf,M,J^4?W:cf.get):xf=>xf[l]),J>2&&(Pf.set=uf?(xf,wf)=>Q0(xf,M,wf,J^4?W:cf.set):(xf,wf)=>xf[l]=wf)),af=(0,j[zf])(J?J<4?uf?W:cf[Mf]:J>4?void 0:{get:cf.get,set:cf.set}:M,pf),Zf._=1,J^4||af===void 0?Kf(af)&&(J>4?Rf.unshift(af):J?uf?W=af:cf[Mf]=af:M=af):typeof af!="object"||af===null?Of("Object expected"):(Kf(tf=af.get)&&(cf.get=tf),Kf(tf=af.set)&&(cf.set=tf),Kf(tf=af.init)&&Rf.unshift(tf));return J||Dr(w,M),cf&&U0(M,l,cf),uf?J^4?W:cf:M},B0=(w,h,l)=>h.has(w)||Of("Cannot "+l),Fr=(w,h)=>Object(h)!==h?Of('Cannot use the "in" operator on this value'):w.has(h),J0=(w,h,l)=>(B0(w,h,"read from private field"),l?l.call(w):h.get(w)),g0=(w,h,l)=>h.has(w)?Of("Cannot add the same private member more than once"):h instanceof WeakSet?h.add(w):h.set(w,l),Q0=(w,h,l,j)=>(B0(w,h,"write to private field"),j?j.call(w,l):h.set(w,l),l),$r=(w,h,l)=>(B0(w,h,"access private method"),l),tr,er,xr,E0,ar,lf,S0,T0,M0;ar=[Ur("user-ui-add-party")];class Bf extends(E0=k0,xr=[y0()],er=[y0()],tr=[y0()],E0){constructor(){super(...arguments),g0(this,S0,Uf(lf,8,this,Object.values(A0))),Uf(lf,11,this),g0(this,T0,Uf(lf,12,this,[])),Uf(lf,15,this),g0(this,M0,Uf(lf,16,this,!1)),Uf(lf,19,this)}connectedCallback(){super.connectedCallback(),this.loadContext()}async loadContext(){const M=(await(await G0(_0.accessToken.get())).request({method:"listSessions"}).catch(()=>({sessions:[]})))?.sessions?.[0]?.network?.id||_0.networkId.get();this.networkIds=M?[M]:[]}navigateBack(){window.location.href=yr("/parties")}async onCreateParty(h){this.loading=!0;try{const j=await(await G0(_0.accessToken.get())).request({method:"createWallet",params:{primary:h.primary,partyHint:h.partyHint,signingProviderId:h.signingProviderId}}),W={allocated:p0.WALLET_ALLOCATED,initialized:p0.WALLET_INITIALIZED,removed:p0.WALLET_REMOVED}[j.wallet.status];window.location.href=`${pr("/parties/")}?createPartyStatus=${W}`}catch(l){this.loading=!1,wr(l)}}render(){return Er`
|
|
2
|
+
<div class="page-header">
|
|
3
|
+
<h1 class="h4 fw-semibold mb-0">Create a new party</h1>
|
|
4
|
+
<button
|
|
5
|
+
class="btn btn-link btn-sm text-body text-decoration-none p-0 d-inline-flex align-items-center gap-1"
|
|
6
|
+
type="button"
|
|
7
|
+
@click=${this.navigateBack}
|
|
8
|
+
>
|
|
9
|
+
${gr}
|
|
10
|
+
<span>Back</span>
|
|
11
|
+
</button>
|
|
12
|
+
</div>
|
|
13
|
+
|
|
14
|
+
<div class="form-wrap">
|
|
15
|
+
<wg-wallet-create-form
|
|
16
|
+
.signingProviders=${this.signingProviders}
|
|
17
|
+
.networkIds=${this.networkIds}
|
|
18
|
+
.submitLabel=${"Create party"}
|
|
19
|
+
.loadingLabel=${"Creating party..."}
|
|
20
|
+
.loadingMessage=${"Creating party, please wait..."}
|
|
21
|
+
?loading=${this.loading}
|
|
22
|
+
@wallet-create=${this.onCreateParty}
|
|
23
|
+
></wg-wallet-create-form>
|
|
24
|
+
</div>
|
|
25
|
+
`}}lf=zr(E0);S0=new WeakMap;T0=new WeakMap;M0=new WeakMap;f0(lf,4,"signingProviders",xr,Bf,S0);f0(lf,4,"networkIds",er,Bf,T0);f0(lf,4,"loading",tr,Bf,M0);Bf=f0(lf,0,"UserUiAddParty",ar,Bf);Bf.styles=[k0.styles,Ar`
|
|
26
|
+
:host {
|
|
27
|
+
display: block;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.page-header {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
margin-bottom: var(--wg-space-4);
|
|
35
|
+
gap: var(--wg-space-3);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.form-wrap {
|
|
39
|
+
width: 100%;
|
|
40
|
+
}
|
|
41
|
+
`];Uf(lf,1,Bf);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{o as A,s as m,d as St,l as T,n as Tt,a as tt,
|
|
1
|
+
import{o as A,s as m,d as St,l as T,n as Tt,a as tt,T as et,A as st,c as W,e as $,g as at,b as it,f as Wt,t as $t}from"./index-_pMHlJoE.js";import{r as h}from"./state-B2k3ak7d.js";import{p as Et}from"./index-CiMGhYb1.js";import{s as I}from"./utils-CT9Hzi7v.js";import{a as rt,i as Pt}from"./index-DWz_3f3y.js";var E=(e=>(e.CanActAs="CanActAs",e.CanReadAs="CanReadAs",e.CanExecuteAs="CanExecuteAs",e))(E||{}),Dt=A({baseUrl:m().url()}),Ot=A({id:m(),name:m(),description:m(),synchronizerId:m().includes("::").min(10).optional(),identityProviderId:m(),ledgerApi:Dt,auth:rt,adminAuth:rt.optional()});A({connection:St("type",[A({type:T("memory")}),A({type:T("sqlite"),database:m()}),A({type:T("postgres"),host:m(),port:Tt(),user:m(),password:m(),database:m()})])});A({idps:tt(Pt),networks:tt(Ot)});var Ht=Object.create,D=Object.defineProperty,Rt=Object.getOwnPropertyDescriptor,dt=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),y=e=>{throw TypeError(e)},Ut=(e,t,s)=>t in e?D(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,nt=(e,t)=>D(e,"name",{value:t,configurable:!0}),qt=e=>[,,,Ht(e?.[dt("metadata")]??null)],lt=["class","method","getter","setter","accessor","field","value","get","set"],C=e=>e!==void 0&&typeof e!="function"?y("Function expected"):e,zt=(e,t,s,u,n)=>({kind:lt[e],name:t,metadata:u,addInitializer:c=>s._?y("Already initialized"):n.push(C(c||null))}),jt=(e,t)=>Ut(t,dt("metadata"),e[3]),i=(e,t,s,u)=>{for(var n=0,c=e[t>>1],g=c&&c.length;n<g;n++)t&1?c[n].call(s):u=c[n].call(s,u);return u},l=(e,t,s,u,n,c)=>{var g,d,X,f,b,r=t&7,k=!!(t&8),w=!!(t&16),x=r>3?e.length+1:r?k?1:2:0,Y=lt[r+5],Z=r>3&&(e[x-1]=[]),Mt=e[x]||(e[x]=[]),v=r&&(!w&&!k&&(n=n.prototype),r<5&&(r>3||!w)&&Rt(r<4?n:{get[s](){return ct(this,c)},set[s](_){return ot(this,c,_)}},s));r?w&&r<4&&nt(c,(r>2?"set ":r>1?"get ":"")+s):nt(n,s);for(var M=u.length-1;M>=0;M--)f=zt(r,s,X={},e[3],Mt),r&&(f.static=k,f.private=w,b=f.access={has:w?_=>Gt(n,_):_=>s in _},r^3&&(b.get=w?_=>(r^1?ct:Lt)(_,n,r^4?c:v.get):_=>_[s]),r>2&&(b.set=w?(_,S)=>ot(_,n,S,r^4?c:v.set):(_,S)=>_[s]=S)),d=(0,u[M])(r?r<4?w?c:v[Y]:r>4?void 0:{get:v.get,set:v.set}:n,f),X._=1,r^4||d===void 0?C(d)&&(r>4?Z.unshift(d):r?w?c=d:v[Y]=d:n=d):typeof d!="object"||d===null?y("Object expected"):(C(g=d.get)&&(v.get=g),C(g=d.set)&&(v.set=g),C(g=d.init)&&Z.unshift(g));return r||jt(e,n),v&&D(n,s,v),w?r^4?c:v:n},O=(e,t,s)=>t.has(e)||y("Cannot "+s),Gt=(e,t)=>Object(t)!==t?y('Cannot use the "in" operator on this value'):e.has(t),ct=(e,t,s)=>(O(e,t,"read from private field"),s?s.call(e):t.get(e)),p=(e,t,s)=>t.has(e)?y("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,s),ot=(e,t,s,u)=>(O(e,t,"write to private field"),u?u.call(e,s):t.set(e,s),s),Lt=(e,t,s)=>(O(e,t,"access private method"),s),ht,pt,ut,_t,gt,vt,mt,wt,At,yt,ft,It,Ct,bt,kt,P,xt,a,H,R,U,q,z,j,G,L,B,F,N,V,J,K,Q;xt=[$t("user-ui-approve")];class o extends(P=Wt,kt=[h()],bt=[h()],Ct=[h()],It=[h()],ft=[h()],yt=[h()],At=[h()],wt=[h()],mt=[h()],vt=[h()],gt=[h()],_t=[h()],ut=[h()],pt=[h()],ht=[h()],P){constructor(){super(...arguments),p(this,H,i(a,8,this,!1)),i(a,11,this),p(this,R,i(a,12,this,!1)),i(a,15,this),p(this,U,i(a,16,this,!1)),i(a,19,this),p(this,q,i(a,20,this,"")),i(a,23,this),p(this,z,i(a,24,this,"")),i(a,27,this),p(this,j,i(a,28,this,"")),i(a,31,this),p(this,G,i(a,32,this,"")),i(a,35,this),p(this,L,i(a,36,this,"")),i(a,39,this),p(this,B,i(a,40,this,null)),i(a,43,this),p(this,F,i(a,44,this,"")),i(a,47,this),p(this,N,i(a,48,this,null)),i(a,51,this),p(this,V,i(a,52,this,null)),i(a,55,this),p(this,J,i(a,56,this,null)),i(a,59,this),p(this,K,i(a,60,this,!0)),i(a,63,this),p(this,Q,i(a,64,this,null)),i(a,67,this)}connectedCallback(){super.connectedCallback();const t=new URL(window.location.href);this.transactionId=t.searchParams.get("transactionId")||"",this.updateState()}closeOrGoToList(){this.disabled=!0;const s=new URLSearchParams(window.location.search).has("closeafteraction");setTimeout(()=>{s&&window.opener?window.close():window.location.href=et(st)},2e3)}async updateState(){const t=await W($.accessToken.get()),s=await t.request({method:"getTransaction",params:{transactionId:this.transactionId}});this.transactionId=s.id,this.commandId=s.commandId,this.txHash=s.preparedTransactionHash,this.tx=s.preparedTransaction,this.status=s.status,this.createdAt=s.createdAt||null,this.signedAt=s.signedAt||null,this.origin=s.origin||null;try{this.txParsed=Et(this.tx)}catch(d){console.error("Error parsing prepared transaction:",d),this.txParsed=null}const n=(await t.request({method:"listWallets",params:{}})).find(d=>d.primary===!0);this.partyId=n?.partyId||"";const c=n?.rights,g=!!(c?.includes(E.CanActAs)||c?.includes(E.CanExecuteAs));this.canSubmit=g,this.walletCapabilityMessage=g?null:"The selected wallet is read-only for submission (no CanActAs/CanExecuteAs right)."}async handleReject(){if(confirm(`Reject pending activity "${this.commandId}"?`)){this.isDeleting=!0;try{await(await W($.accessToken.get())).request({method:"deleteTransaction",params:{transactionId:this.transactionId}}),I("","Activity rejected successfully","success"),this.closeOrGoToList()}catch(t){console.error(t),at(t,{message:"Error rejecting activity"})}finally{this.isDeleting=!1}}}async handleApprove(){if(!this.canSubmit){I("Read-only wallet","This wallet can read but cannot submit transactions. Switch to a wallet with CanActAs or CanExecuteAs.","error");return}this.isApproving=!0;try{const t=await W($.accessToken.get()),s=await t.request({method:"sign",params:{transactionId:this.transactionId,partyId:this.partyId}});if(s.status==="pending"){I("Activity pending","Complete signing in your external provider, then click Approve to finish.","info"),await this.updateState();return}if(s.status==="signed"){await t.request({method:"execute",params:{signature:s.signature,signedBy:s.signedBy,transactionId:this.transactionId,partyId:this.partyId}}),I("","Activity executed successfully","success"),this.closeOrGoToList();return}const u=s.status==="rejected"?"Activity was rejected":"Activity failed";I("",u,"error"),await this.updateState()}catch(t){console.error(t),at(t,{message:"Error executing activity"})}finally{this.isApproving=!1}}render(){return it`
|
|
2
2
|
${this.walletCapabilityMessage?it`<div class="alert alert-warning" role="alert">
|
|
3
3
|
${this.walletCapabilityMessage}
|
|
4
4
|
</div>`:""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{h as O,
|
|
1
|
+
import{h as O,T as y,e as h,j as C,r as P,b as x,t as L}from"./index-_pMHlJoE.js";var T=Object.create,v=Object.defineProperty,R=Object.getOwnPropertyDescriptor,w=(e,r)=>(r=Symbol[e])?r:Symbol.for("Symbol."+e),b=e=>{throw TypeError(e)},U=(e,r,a)=>r in e?v(e,r,{enumerable:!0,configurable:!0,writable:!0,value:a}):e[r]=a,j=(e,r)=>v(e,"name",{value:r,configurable:!0}),z=e=>[,,,T(e?.[w("metadata")]??null)],D=["class","method","getter","setter","accessor","field","value","get","set"],m=e=>e!==void 0&&typeof e!="function"?b("Function expected"):e,E=(e,r,a,o,t)=>({kind:D[e],name:r,metadata:o,addInitializer:n=>a._?b("Already initialized"):t.push(m(n||null))}),N=(e,r)=>U(r,w("metadata"),e[3]),A=(e,r,a,o)=>{for(var t=0,n=e[r>>1],s=n&&n.length;t<s;t++)n[t].call(a);return o},F=(e,r,a,o,t,n)=>{var s,l,d,c=r&7,_=!1,i=0,p=e[i]||(e[i]=[]),f=c&&(t=t.prototype,c<5&&(c>3||!_)&&R(t,a));j(t,a);for(var u=o.length-1;u>=0;u--)d=E(c,a,l={},e[3],p),s=(0,o[u])(t,d),l._=1,m(s)&&(t=s);return N(e,t),f&&v(t,a,f),_?c^4?n:f:t},S,k,I;S=[L("login-callback")];class g extends(I=O){connectedCallback(){super.connectedCallback(),this.handleRedirect()}async handleRedirect(){const r=new URL(window.location.href),a=r.searchParams.get("code"),o=r.searchParams.get("state");if(!a&&!o){console.error("missing state and code");return}if(a&&o){const t=JSON.parse(atob(o)),n=sessionStorage.getItem(`oauth-pkce-${t.stateId}`);if(!n){console.error("missing PKCE verifier for OAuth callback state");return}sessionStorage.removeItem(`oauth-pkce-${t.stateId}`);const d=(await(await fetch(t.configUrl)).json()).token_endpoint,c=new URL(y("/callback"),window.location.origin).toString(),i=await(await fetch(d,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:new URLSearchParams({grant_type:"authorization_code",code:a,redirect_uri:c,client_id:t.clientId,audience:t.audience,code_verifier:n})})).json();if(i.access_token){const p=JSON.parse(atob(i.access_token.split(".")[1]));h.expirationDate.set(new Date(p.exp*1e3).toISOString()),h.accessToken.set(i.access_token),C(i.access_token,h.networkId.get()||"").then(()=>{P()})}}}render(){return x`<h2>Logged in!</h2>`}}k=z(I);g=F(k,0,"LoginCallback",S,g);A(k,1,g);
|
package/dist/web/frontend/assets/{identityProviders-ByQNvF7K.js → identityProviders-CK8zSrd3.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{c as
|
|
1
|
+
import{c as Q,e as V,g as X,M as W,b as _,f as F,i as Y,t as Z}from"./index-_pMHlJoE.js";import{r as I}from"./state-B2k3ak7d.js";var j=Object.create,C=Object.defineProperty,ee=Object.getOwnPropertyDescriptor,T=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),u=t=>{throw TypeError(t)},te=(t,e,i)=>e in t?C(t,e,{enumerable:!0,configurable:!0,writable:!0,value:i}):t[e]=i,E=(t,e)=>C(t,"name",{value:e,configurable:!0}),ie=t=>[,,,j(t?.[T("metadata")]??null)],G=["class","method","getter","setter","accessor","field","value","get","set"],f=t=>t!==void 0&&typeof t!="function"?u("Function expected"):t,ae=(t,e,i,n,s)=>({kind:G[t],name:e,metadata:n,addInitializer:r=>i._?u("Already initialized"):s.push(f(r||null))}),se=(t,e)=>te(e,T("metadata"),t[3]),g=(t,e,i,n)=>{for(var s=0,r=t[e>>1],h=r&&r.length;s<h;s++)e&1?r[s].call(i):n=r[s].call(i,n);return n},m=(t,e,i,n,s,r)=>{var h,o,O,w,y,a=e&7,P=!!(e&8),l=!!(e&16),b=a>3?t.length+1:a?P?1:2:0,R=G[a+5],D=a>3&&(t[b-1]=[]),L=t[b]||(t[b]=[]),p=a&&(!l&&!P&&(s=s.prototype),a<5&&(a>3||!l)&&ee(a<4?s:{get[i](){return N(this,r)},set[i](d){return q(this,r,d)}},i));a?l&&a<4&&E(r,(a>2?"set ":a>1?"get ":"")+i):E(s,i);for(var S=n.length-1;S>=0;S--)w=ae(a,i,O={},t[3],L),a&&(w.static=P,w.private=l,y=w.access={has:l?d=>re(s,d):d=>i in d},a^3&&(y.get=l?d=>(a^1?N:ne)(d,s,a^4?r:p.get):d=>d[i]),a>2&&(y.set=l?(d,$)=>q(d,s,$,a^4?r:p.set):(d,$)=>d[i]=$)),o=(0,n[S])(a?a<4?l?r:p[R]:a>4?void 0:{get:p.get,set:p.set}:s,w),O._=1,a^4||o===void 0?f(o)&&(a>4?D.unshift(o):a?l?r=o:p[R]=o:s=o):typeof o!="object"||o===null?u("Object expected"):(f(h=o.get)&&(p.get=h),f(h=o.set)&&(p.set=h),f(h=o.init)&&D.unshift(h));return a||se(t,s),p&&C(s,i,p),l?a^4?r:p:s},A=(t,e,i)=>e.has(t)||u("Cannot "+i),re=(t,e)=>Object(e)!==e?u('Cannot use the "in" operator on this value'):t.has(e),N=(t,e,i)=>(A(t,e,"read from private field"),i?i.call(t):e.get(t)),k=(t,e,i)=>e.has(t)?u("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,i),q=(t,e,i,n)=>(A(t,e,"write to private field"),n?n.call(t,i):e.set(t,i),i),ne=(t,e,i)=>(A(t,e,"access private method"),i),B,H,J,z,K,c,M,x,U;K=[Z("user-ui-identity-providers")];class v extends(z=F,J=[I()],H=[I()],B=[I()],z){constructor(){super(...arguments),k(this,M,g(c,8,this,[])),g(c,11,this),k(this,x,g(c,12,this,!1)),g(c,15,this),k(this,U,g(c,16,this,1)),g(c,19,this),this.pageSize=4}get pagedIdps(){const e=(this.currentPage-1)*this.pageSize;return this.idps.slice(e,e+this.pageSize)}async connectedCallback(){super.connectedCallback(),await this.loadData()}async loadData(){try{const e=await Q(V.accessToken.get()),[i,n]=await Promise.all([e.request({method:"listIdps"}),e.request({method:"getUser"}).catch(()=>({userId:"",isAdmin:!1}))]);this.idps=i.idps,this.isAdmin=n.isAdmin;const s=Math.max(1,Math.ceil(this.idps.length/this.pageSize));this.currentPage>s&&(this.currentPage=s)}catch(e){X(e)}}_onReview(e){window.location.href=`${W("/identity-providers/review/")}?id=${encodeURIComponent(e.idp.id)}`}_onPageChange(e){this.currentPage=e.page}render(){return _`
|
|
2
2
|
<div class="page-header">
|
|
3
3
|
<h1 class="h4 fw-semibold mb-0">Identity Providers</h1>
|
|
4
4
|
|
|
@@ -38,7 +38,7 @@ import{c as L,e as Q,g as V,Y as W,b as _,f as F,i as X,t as Z}from"./index-lfC4
|
|
|
38
38
|
</div>
|
|
39
39
|
`:""}
|
|
40
40
|
`}
|
|
41
|
-
`}}c=ie(z);
|
|
41
|
+
`}}c=ie(z);M=new WeakMap;x=new WeakMap;U=new WeakMap;m(c,4,"idps",J,v,M);m(c,4,"isAdmin",H,v,x);m(c,4,"currentPage",B,v,U);v=m(c,0,"UserUiIdentityProviders",K,v);v.styles=[F.styles,Y`
|
|
42
42
|
:host {
|
|
43
43
|
display: block;
|
|
44
44
|
max-width: 900px;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{b as y,
|
|
1
|
+
import{b as y,M as K,c as P,e as _,g as Q,f as j,i as R,t as X}from"./index-_pMHlJoE.js";import{r as S}from"./state-B2k3ak7d.js";import{s as g}from"./utils-CT9Hzi7v.js";var ee=Object.create,z=Object.defineProperty,te=Object.getOwnPropertyDescriptor,G=(t,e)=>(e=Symbol[t])?e:Symbol.for("Symbol."+t),v=t=>{throw TypeError(t)},ae=(t,e,a)=>e in t?z(t,e,{enumerable:!0,configurable:!0,writable:!0,value:a}):t[e]=a,D=(t,e)=>z(t,"name",{value:e,configurable:!0}),se=t=>[,,,ee(t?.[G("metadata")]??null)],V=["class","method","getter","setter","accessor","field","value","get","set"],m=t=>t!==void 0&&typeof t!="function"?v("Function expected"):t,ie=(t,e,a,l,s)=>({kind:V[t],name:e,metadata:l,addInitializer:r=>a._?v("Already initialized"):s.push(m(r||null))}),re=(t,e)=>ae(e,G("metadata"),t[3]),u=(t,e,a,l)=>{for(var s=0,r=t[e>>1],p=r&&r.length;s<p;s++)e&1?r[s].call(a):l=r[s].call(a,l);return l},b=(t,e,a,l,s,r)=>{var p,c,E,f,W,i=e&7,k=!!(e&8),h=!!(e&16),I=i>3?t.length+1:i?k?1:2:0,O=V[i+5],q=i>3&&(t[I-1]=[]),J=t[I]||(t[I]=[]),d=i&&(!h&&!k&&(s=s.prototype),i<5&&(i>3||!h)&&te(i<4?s:{get[a](){return F(this,r)},set[a](n){return N(this,r,n)}},a));i?h&&i<4&&D(r,(i>2?"set ":i>1?"get ":"")+a):D(s,a);for(var C=l.length-1;C>=0;C--)f=ie(i,a,E={},t[3],J),i&&(f.static=k,f.private=h,W=f.access={has:h?n=>le(s,n):n=>a in n},i^3&&(W.get=h?n=>(i^1?F:ne)(n,s,i^4?r:d.get):n=>n[a]),i>2&&(W.set=h?(n,$)=>N(n,s,$,i^4?r:d.set):(n,$)=>n[a]=$)),c=(0,l[C])(i?i<4?h?r:d[O]:i>4?void 0:{get:d.get,set:d.set}:s,f),E._=1,i^4||c===void 0?m(c)&&(i>4?q.unshift(c):i?h?r=c:d[O]=c:s=c):typeof c!="object"||c===null?v("Object expected"):(m(p=c.get)&&(d.get=p),m(p=c.set)&&(d.set=p),m(p=c.init)&&q.unshift(p));return i||re(t,s),d&&z(s,a,d),h?i^4?r:d:s},L=(t,e,a)=>e.has(t)||v("Cannot "+a),le=(t,e)=>Object(e)!==e?v('Cannot use the "in" operator on this value'):t.has(e),F=(t,e,a)=>(L(t,e,"read from private field"),a?a.call(t):e.get(t)),M=(t,e,a)=>e.has(t)?v("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,a),N=(t,e,a,l)=>(L(t,e,"write to private field"),l?l.call(t,a):e.set(t,a),a),ne=(t,e,a)=>(L(t,e,"access private method"),a),Y,Z,B,x,H,o,T,U,A,ce=(t=>(t.WALLET_ALLOCATED="1",t.WALLET_INITIALIZED="2",t.WALLET_REMOVED="3",t))(ce||{});H=[X("user-ui-parties")];class w extends(x=j,B=[S()],Z=[S()],Y=[S()],x){constructor(){super(...arguments),M(this,T,u(o,8,this)),u(o,11,this),M(this,U,u(o,12,this,!1)),u(o,15,this),M(this,A,u(o,16,this,null)),u(o,19,this)}render(){if(!this.client)return y``;const e={verifiedWallets:[],unverifiedWallets:[]};return this.wallets?.forEach(a=>{a.status==="allocated"?e.verifiedWallets.push(a):e.unverifiedWallets.push(a)}),y`
|
|
2
2
|
<div class="page-header">
|
|
3
3
|
<div class="page-title-wrap">
|
|
4
4
|
<h1 class="h4 fw-semibold mb-0">Parties</h1>
|
|
@@ -47,7 +47,7 @@ import{b as y,Y as K,c as P,e as _,g as Q,f as Y,i as R,t as X}from"./index-lfC4
|
|
|
47
47
|
</div>
|
|
48
48
|
`)}
|
|
49
49
|
</div>
|
|
50
|
-
`}async connectedCallback(){super.connectedCallback(),this.client=await P(_.accessToken.get()),this.showCreationToastIfNeeded(),this.updateWallets()}showCreationToastIfNeeded(){const e=new URL(window.location.href),a=e.searchParams.get("createPartyStatus");if(a==="1")g("Party created","Your new party has been
|
|
50
|
+
`}async connectedCallback(){super.connectedCallback(),this.client=await P(_.accessToken.get()),this.showCreationToastIfNeeded(),this.updateWallets()}showCreationToastIfNeeded(){const e=new URL(window.location.href),a=e.searchParams.get("createPartyStatus");if(a==="1")g("Party created","Your new party has been created successfully.","success");else if(a==="2")g("Party creation pending","Complete the signing in your signing provider, then click Allocate to finish.","info");else if(a==="3")g("Party creation rejected","Party creation failed because the signing transaction was unsuccessful.","error");else return;e.searchParams.delete("createPartyStatus"),window.history.replaceState({},"",e)}async updateWallets(){const e=await P(_.accessToken.get()),s=(await e.request({method:"listSessions"}).catch(()=>({sessions:[]})))?.sessions?.[0]?.network?.id||_.networkId.get(),r=s?{networkIds:[s]}:void 0;e.request({method:"listWallets",params:r?{filter:r}:{}}).then(p=>{this.wallets=p||[]})}async _onSetPrimary(e){await(await P(_.accessToken.get())).request({method:"setPrimaryWallet",params:{partyId:e.wallet.partyId}}),this.updateWallets()}async _onAllocateParty(e){this.loading=!0;const a=e.wallet;try{const s=await(await P(_.accessToken.get())).request({method:"allocatePartyForWallet",params:{partyId:a.partyId}});s?.wallet&&(s.wallet.status==="removed"?g("Party removed","Party was removed because the signing transaction was unsuccessful.","error"):s.wallet.status==="allocated"?g("Party allocated","Party has been successfully allocated.","success"):s.wallet.status==="initialized"&&g("Transaction pending","The signing transaction is still pending. Please approve it in selected signing provider, then try again.","info"))}catch(l){Q(l)}this.loading=!1,this.updateWallets()}}o=se(x);T=new WeakMap;U=new WeakMap;A=new WeakMap;b(o,4,"wallets",B,w,T);b(o,4,"loading",Z,w,U);b(o,4,"client",Y,w,A);w=b(o,0,"UserUiParties",H,w);w.styles=[j.styles,R`
|
|
51
51
|
:host {
|
|
52
52
|
display: block;
|
|
53
53
|
max-width: 900px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{o as p,s as o,l as m,d as D}from"./index-lfC4c213.js";const x=crypto,F=t=>t instanceof CryptoKey,g=new TextEncoder,W=new TextDecoder;function ee(...t){const e=t.reduce((s,{length:i})=>s+i,0),r=new Uint8Array(e);let n=0;for(const s of t)r.set(s,n),n+=s.length;return r}const te=t=>{let e=t;typeof e=="string"&&(e=g.encode(e));const r=32768,n=[];for(let s=0;s<e.length;s+=r)n.push(String.fromCharCode.apply(null,e.subarray(s,s+r)));return btoa(n.join(""))},J=t=>te(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),re=t=>{const e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r},K=t=>{let e=t;e instanceof Uint8Array&&(e=W.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return re(e)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class c extends Error{constructor(e,r){super(e,r),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}c.code="ERR_JOSE_GENERIC";class ne extends c{constructor(e,r,n="unspecified",s="unspecified"){super(e,{cause:{claim:n,reason:s,payload:r}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=n,this.reason=s,this.payload=r}}ne.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class se extends c{constructor(e,r,n="unspecified",s="unspecified"){super(e,{cause:{claim:n,reason:s,payload:r}}),this.code="ERR_JWT_EXPIRED",this.claim=n,this.reason=s,this.payload=r}}se.code="ERR_JWT_EXPIRED";class oe extends c{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}oe.code="ERR_JOSE_ALG_NOT_ALLOWED";class f extends c{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}}f.code="ERR_JOSE_NOT_SUPPORTED";class ie extends c{constructor(e="decryption operation failed",r){super(e,r),this.code="ERR_JWE_DECRYPTION_FAILED"}}ie.code="ERR_JWE_DECRYPTION_FAILED";class ae extends c{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}}ae.code="ERR_JWE_INVALID";class w extends c{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}}w.code="ERR_JWS_INVALID";class h extends c{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}h.code="ERR_JWT_INVALID";class ce extends c{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}}ce.code="ERR_JWK_INVALID";class de extends c{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}}de.code="ERR_JWKS_INVALID";class he extends c{constructor(e="no applicable key found in the JSON Web Key Set",r){super(e,r),this.code="ERR_JWKS_NO_MATCHING_KEY"}}he.code="ERR_JWKS_NO_MATCHING_KEY";class le extends c{constructor(e="multiple matching keys found in the JSON Web Key Set",r){super(e,r),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}le.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class ue extends c{constructor(e="request timed out",r){super(e,r),this.code="ERR_JWKS_TIMEOUT"}}ue.code="ERR_JWKS_TIMEOUT";class fe extends c{constructor(e="signature verification failed",r){super(e,r),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}fe.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";function d(t,e="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`)}function _(t,e){return t.name===e}function P(t){return parseInt(t.name.slice(4),10)}function pe(t){switch(t){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function me(t,e){if(e.length&&!e.some(r=>t.usages.includes(r))){let r="CryptoKey does not support this operation, its usages must include ";if(e.length>2){const n=e.pop();r+=`one of ${e.join(", ")}, or ${n}.`}else e.length===2?r+=`one of ${e[0]} or ${e[1]}.`:r+=`${e[0]}.`;throw new TypeError(r)}}function ye(t,e,...r){switch(e){case"HS256":case"HS384":case"HS512":{if(!_(t.algorithm,"HMAC"))throw d("HMAC");const n=parseInt(e.slice(2),10);if(P(t.algorithm.hash)!==n)throw d(`SHA-${n}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!_(t.algorithm,"RSASSA-PKCS1-v1_5"))throw d("RSASSA-PKCS1-v1_5");const n=parseInt(e.slice(2),10);if(P(t.algorithm.hash)!==n)throw d(`SHA-${n}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!_(t.algorithm,"RSA-PSS"))throw d("RSA-PSS");const n=parseInt(e.slice(2),10);if(P(t.algorithm.hash)!==n)throw d(`SHA-${n}`,"algorithm.hash");break}case"EdDSA":{if(t.algorithm.name!=="Ed25519"&&t.algorithm.name!=="Ed448")throw d("Ed25519 or Ed448");break}case"Ed25519":{if(!_(t.algorithm,"Ed25519"))throw d("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!_(t.algorithm,"ECDSA"))throw d("ECDSA");const n=pe(e);if(t.algorithm.namedCurve!==n)throw d(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}me(t,r)}function k(t,e,...r){if(r=r.filter(Boolean),r.length>2){const n=r.pop();t+=`one of type ${r.join(", ")}, or ${n}.`}else r.length===2?t+=`one of type ${r[0]} or ${r[1]}.`:t+=`of type ${r[0]}.`;return e==null?t+=` Received ${e}`:typeof e=="function"&&e.name?t+=` Received function ${e.name}`:typeof e=="object"&&e!=null&&e.constructor?.name&&(t+=` Received an instance of ${e.constructor.name}`),t}const M=(t,...e)=>k("Key must be ",t,...e);function j(t,e,...r){return k(`Key for the ${t} algorithm must be `,e,...r)}const V=t=>F(t)?!0:t?.[Symbol.toStringTag]==="KeyObject",v=["CryptoKey"],Se=(...t)=>{const e=t.filter(Boolean);if(e.length===0||e.length===1)return!0;let r;for(const n of e){const s=Object.keys(n);if(!r||r.size===0){r=new Set(s);continue}for(const i of s){if(r.has(i))return!1;r.add(i)}}return!0};function we(t){return typeof t=="object"&&t!==null}function N(t){if(!we(t)||Object.prototype.toString.call(t)!=="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}const Ee=(t,e)=>{if(t.startsWith("RS")||t.startsWith("PS")){const{modulusLength:r}=e.algorithm;if(typeof r!="number"||r<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}};function b(t){return N(t)&&typeof t.kty=="string"}function ge(t){return t.kty!=="oct"&&typeof t.d=="string"}function _e(t){return t.kty!=="oct"&&typeof t.d>"u"}function be(t){return b(t)&&t.kty==="oct"&&typeof t.k=="string"}function Te(t){let e,r;switch(t.kty){case"RSA":{switch(t.alg){case"PS256":case"PS384":case"PS512":e={name:"RSA-PSS",hash:`SHA-${t.alg.slice(-3)}`},r=t.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":e={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.alg.slice(-3)}`},r=t.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":e={name:"RSA-OAEP",hash:`SHA-${parseInt(t.alg.slice(-3),10)||1}`},r=t.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new f('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(t.alg){case"ES256":e={name:"ECDSA",namedCurve:"P-256"},r=t.d?["sign"]:["verify"];break;case"ES384":e={name:"ECDSA",namedCurve:"P-384"},r=t.d?["sign"]:["verify"];break;case"ES512":e={name:"ECDSA",namedCurve:"P-521"},r=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:"ECDH",namedCurve:t.crv},r=t.d?["deriveBits"]:[];break;default:throw new f('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(t.alg){case"Ed25519":e={name:"Ed25519"},r=t.d?["sign"]:["verify"];break;case"EdDSA":e={name:t.crv},r=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:t.crv},r=t.d?["deriveBits"]:[];break;default:throw new f('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new f('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:e,keyUsages:r}}const Ae=async t=>{if(!t.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:e,keyUsages:r}=Te(t),n=[e,t.ext??!1,t.key_ops??r],s={...t};return delete s.alg,delete s.use,x.subtle.importKey("jwk",s,...n)},G=t=>K(t);let y,S;const z=t=>t?.[Symbol.toStringTag]==="KeyObject",C=async(t,e,r,n,s=!1)=>{let i=t.get(e);if(i?.[n])return i[n];const a=await Ae({...r,alg:n});return s&&Object.freeze(e),i?i[n]=a:t.set(e,{[n]:a}),a},Ie=(t,e)=>{if(z(t)){let r=t.export({format:"jwk"});return delete r.d,delete r.dp,delete r.dq,delete r.p,delete r.q,delete r.qi,r.k?G(r.k):(S||(S=new WeakMap),C(S,t,r,e))}return b(t)?t.k?K(t.k):(S||(S=new WeakMap),C(S,t,t,e,!0)):t},Re=(t,e)=>{if(z(t)){let r=t.export({format:"jwk"});return r.k?G(r.k):(y||(y=new WeakMap),C(y,t,r,e))}return b(t)?t.k?K(t.k):(y||(y=new WeakMap),C(y,t,t,e,!0)):t},We={normalizePublicKey:Ie,normalizePrivateKey:Re},E=t=>t?.[Symbol.toStringTag],H=(t,e,r)=>{if(e.use!==void 0&&e.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(e.key_ops!==void 0&&e.key_ops.includes?.(r)!==!0)throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${r}`);if(e.alg!==void 0&&e.alg!==t)throw new TypeError(`Invalid key for this operation, when present its alg must be ${t}`);return!0},ve=(t,e,r,n)=>{if(!(e instanceof Uint8Array)){if(n&&b(e)){if(be(e)&&H(t,e,r))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!V(e))throw new TypeError(j(t,e,...v,"Uint8Array",n?"JSON Web Key":null));if(e.type!=="secret")throw new TypeError(`${E(e)} instances for symmetric algorithms must be of type "secret"`)}},Ce=(t,e,r,n)=>{if(n&&b(e))switch(r){case"sign":if(ge(e)&&H(t,e,r))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(_e(e)&&H(t,e,r))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!V(e))throw new TypeError(j(t,e,...v,n?"JSON Web Key":null));if(e.type==="secret")throw new TypeError(`${E(e)} instances for asymmetric algorithms must not be of type "secret"`);if(r==="sign"&&e.type==="public")throw new TypeError(`${E(e)} instances for asymmetric algorithm signing must be of type "private"`);if(r==="decrypt"&&e.type==="public")throw new TypeError(`${E(e)} instances for asymmetric algorithm decryption must be of type "private"`);if(e.algorithm&&r==="verify"&&e.type==="private")throw new TypeError(`${E(e)} instances for asymmetric algorithm verifying must be of type "public"`);if(e.algorithm&&r==="encrypt"&&e.type==="private")throw new TypeError(`${E(e)} instances for asymmetric algorithm encryption must be of type "public"`)};function B(t,e,r,n){e.startsWith("HS")||e==="dir"||e.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(e)?ve(e,r,n,t):Ce(e,r,n,t)}B.bind(void 0,!1);const Ke=B.bind(void 0,!0);function Je(t,e,r,n,s){if(s.crit!==void 0&&n?.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return new Set;if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(a=>typeof a!="string"||a.length===0))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;r!==void 0?i=new Map([...Object.entries(r),...e.entries()]):i=e;for(const a of n.crit){if(!i.has(a))throw new f(`Extension Header Parameter "${a}" is not recognized`);if(s[a]===void 0)throw new t(`Extension Header Parameter "${a}" is missing`);if(i.get(a)&&n[a]===void 0)throw new t(`Extension Header Parameter "${a}" MUST be integrity protected`)}return new Set(n.crit)}function Pe(t,e){const r=`SHA-${t.slice(-3)}`;switch(t){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:t.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:e.namedCurve};case"Ed25519":return{name:"Ed25519"};case"EdDSA":return{name:e.name};default:throw new f(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}async function Oe(t,e,r){if(e=await We.normalizePrivateKey(e,t),F(e))return ye(e,t,r),e;if(e instanceof Uint8Array){if(!t.startsWith("HS"))throw new TypeError(M(e,...v));return x.subtle.importKey("raw",e,{hash:`SHA-${t.slice(-3)}`,name:"HMAC"},!1,[r])}throw new TypeError(M(e,...v,"Uint8Array","JSON Web Key"))}const l=t=>Math.floor(t.getTime()/1e3),q=60,Y=q*60,$=Y*24,He=$*7,De=$*365.25,xe=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,O=t=>{const e=xe.exec(t);if(!e||e[4]&&e[1])throw new TypeError("Invalid time period format");const r=parseFloat(e[2]),n=e[3].toLowerCase();let s;switch(n){case"sec":case"secs":case"second":case"seconds":case"s":s=Math.round(r);break;case"minute":case"minutes":case"min":case"mins":case"m":s=Math.round(r*q);break;case"hour":case"hours":case"hr":case"hrs":case"h":s=Math.round(r*Y);break;case"day":case"days":case"d":s=Math.round(r*$);break;case"week":case"weeks":case"w":s=Math.round(r*He);break;default:s=Math.round(r*De);break}return e[1]==="-"||e[4]==="ago"?-s:s},Ne=async(t,e,r)=>{const n=await Oe(t,e,"sign");Ee(t,n);const s=await x.subtle.sign(Pe(t,n.algorithm),n,r);return new Uint8Array(s)};class $e{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,r){if(!this._protectedHeader&&!this._unprotectedHeader)throw new w("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Se(this._protectedHeader,this._unprotectedHeader))throw new w("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const n={...this._protectedHeader,...this._unprotectedHeader},s=Je(w,new Map([["b64",!0]]),r?.crit,this._protectedHeader,n);let i=!0;if(s.has("b64")&&(i=this._protectedHeader.b64,typeof i!="boolean"))throw new w('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:a}=n;if(typeof a!="string"||!a)throw new w('JWS "alg" (Algorithm) Header Parameter missing or invalid');Ke(a,e,"sign");let T=this._payload;i&&(T=g.encode(J(T)));let A;this._protectedHeader?A=g.encode(J(JSON.stringify(this._protectedHeader))):A=g.encode("");const Z=ee(A,g.encode("."),T),Q=await Ne(a,e,Z),I={signature:J(Q),payload:""};return i&&(I.payload=W.decode(T)),this._unprotectedHeader&&(I.header=this._unprotectedHeader),this._protectedHeader&&(I.protected=W.decode(A)),I}}class Ue{constructor(e){this._flattened=new $e(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,r){const n=await this._flattened.sign(e,r);if(n.payload===void 0)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${n.protected}.${n.payload}.${n.signature}`}}function u(t,e){if(!Number.isFinite(e))throw new TypeError(`Invalid ${t} input`);return e}class Me{constructor(e={}){if(!N(e))throw new TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return typeof e=="number"?this._payload={...this._payload,nbf:u("setNotBefore",e)}:e instanceof Date?this._payload={...this._payload,nbf:u("setNotBefore",l(e))}:this._payload={...this._payload,nbf:l(new Date)+O(e)},this}setExpirationTime(e){return typeof e=="number"?this._payload={...this._payload,exp:u("setExpirationTime",e)}:e instanceof Date?this._payload={...this._payload,exp:u("setExpirationTime",l(e))}:this._payload={...this._payload,exp:l(new Date)+O(e)},this}setIssuedAt(e){return typeof e>"u"?this._payload={...this._payload,iat:l(new Date)}:e instanceof Date?this._payload={...this._payload,iat:u("setIssuedAt",l(e))}:typeof e=="string"?this._payload={...this._payload,iat:u("setIssuedAt",l(new Date)+O(e))}:this._payload={...this._payload,iat:u("setIssuedAt",e)},this}}class Le extends Me{setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,r){const n=new Ue(g.encode(JSON.stringify(this._payload)));if(n.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===!1)throw new h("JWTs MUST NOT use unencoded payload");return n.sign(e,r)}}const Fe=K;function U(t){if(typeof t!="string")throw new h("JWTs must use Compact JWS serialization, JWT must be a string");const{1:e,length:r}=t.split(".");if(r===5)throw new h("Only JWTs using Compact JWS serialization can be decoded");if(r!==3)throw new h("Invalid JWT");if(!e)throw new h("JWTs must contain a payload");let n;try{n=Fe(e)}catch{throw new h("Failed to base64url decode the payload")}let s;try{s=JSON.parse(W.decode(n))}catch{throw new h("Failed to parse the decoded payload as JSON")}if(!N(s))throw new h("Invalid JWT Claims Set");return s}var ke=Object.defineProperty,je=(t,e,r)=>e in t?ke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ve=(t,e,r)=>je(t,e+"",r);function Ge(t){const{sub:e}=U(t);if(!e)throw new Error("token did not contain a subject field");return e}function ze(t){const{email:e}=U(t);if(!(typeof e!="string"||e.length===0))return e}function L(t){try{const e=U(t),r=Math.floor(Date.now()/1e3);return typeof e.exp=="number"&&e.exp<=r}catch{return!0}}var Be=class{constructor(t,e){this.configUrl=t,this.logger=e}async fetchToken(t){try{const e=await this.getOIDCConfig(this.configUrl);this.logger?.debug({oidcConfig:e},"Fetched OIDC config");const n=await(await this.fetchTokenEndpoint(e.token_endpoint,t)).json();if(this.logger?.info({response:n},`Fetched admin token for clientId: ${t.clientId}`),!n.access_token)throw new Error("No access_token in token endpoint response");return n.access_token}catch(e){throw this.logger?.error({err:e},"Failed to fetch admin token"),e}}async fetchTokenEndpoint(t,e){const r=new URLSearchParams({grant_type:"client_credentials",client_id:e.clientId,client_secret:e.clientSecret,scope:e.scope??"",audience:e.audience??""}),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:r.toString()});if(!n.ok)throw this.logger?.error({status:n.status,statusText:n.statusText},"Token endpoint error"),new Error(`Token endpoint error: ${n.status} ${n.statusText}`);return n}async getOIDCConfig(t){const e=await fetch(t);if(!e.ok){const r=await e.text();throw this.logger?.error({status:e.status,statusText:e.statusText,body:r},"Failed to fetch OIDC config"),new Error(`OIDC config error: ${e.status} ${e.statusText}`)}return e.json()}},qe=(t,e)=>({fetchToken:async r=>new Be(t,e).fetchToken(r)}),Ye=class{static async fetchToken(t,e,r,n=3600){const s=new TextEncoder().encode(e.clientSecret),i=Math.floor(Date.now()/1e3),a=await new Le({sub:e.clientId,aud:e.audience||"",scope:e.scope||"",iat:i,exp:i+n,iss:r}).setProtectedHeader({alg:"HS256"}).sign(s);return t.info(`Generated self-signed JWT token: ${a}`),a}},rt=class R{constructor(e,r){this.config=e,this.logger=r,Ve(this,"cachedToken")}static fromToken(e,r){return new R({method:"static",token:e},r)}static fromGatewayConfig(e,r,n){if(r.method==="self_signed")return new R({method:r.method,issuer:r.issuer,credentials:{clientId:r.clientId,clientSecret:r.clientSecret,scope:r.scope,audience:r.audience}},n);if(r.method==="client_credentials"){if(e.type==="oauth")return new R({method:r.method,configUrl:e.configUrl,credentials:{clientId:r.clientId,clientSecret:r.clientSecret,scope:r.scope,audience:r.audience}},n);throw new Error(`IDP type ${e.type} not supported for client_credentials auth`)}throw new Error(`Auth method ${r.method} not supported for programmatic access token`)}async _fetchToken(){switch(this.logger.debug("Fetching user auth token"),this.config.method){case"static":return this.config.token;case"self_signed":return Ye.fetchToken(this.logger,this.config.credentials,this.config.issuer);case"client_credentials":return qe(this.config.configUrl,this.logger).fetchToken(this.config.credentials)}}async getAccessToken(){if(this.cachedToken&&!L(this.cachedToken))return this.cachedToken;{const e=await this._fetchToken();if(L(e))throw new Error("Attempted to refresh a token, but it came back expired.");return this.cachedToken=e,e}}async getAuthContext(){const e=await this.getAccessToken(),r=Ge(e),n=ze(e);return{accessToken:e,userId:r,...n?{email:n}:{}}}},X=p({method:m("authorization_code"),audience:o(),scope:o(),clientId:o()}).meta({description:"Authorization code flow authentication configuration. This is used for browser-based application login."}),Xe=p({method:m("client_credentials"),audience:o(),scope:o(),clientId:o(),clientSecret:o()}),Ze=p({method:m("self_signed"),issuer:o(),audience:o(),scope:o(),clientId:o(),clientSecret:o()}),Qe=p({method:m("client_credentials"),audience:o(),scope:o(),clientId:o(),clientSecretEnv:o()}),et=p({method:m("self_signed"),issuer:o(),audience:o(),scope:o(),clientId:o(),clientSecretEnv:o()}),nt=D("method",[X,Xe,Ze]);D("method",[X,Qe,et]);var st=D("type",[p({id:o(),type:m("self_signed"),issuer:o()}),p({id:o(),type:m("oauth"),issuer:o(),configUrl:o().url()})]);export{rt as A,nt as a,st as i};
|
|
1
|
+
import{o as p,s as o,l as m,d as D}from"./index-_pMHlJoE.js";const x=crypto,F=t=>t instanceof CryptoKey,g=new TextEncoder,W=new TextDecoder;function ee(...t){const e=t.reduce((s,{length:i})=>s+i,0),r=new Uint8Array(e);let n=0;for(const s of t)r.set(s,n),n+=s.length;return r}const te=t=>{let e=t;typeof e=="string"&&(e=g.encode(e));const r=32768,n=[];for(let s=0;s<e.length;s+=r)n.push(String.fromCharCode.apply(null,e.subarray(s,s+r)));return btoa(n.join(""))},J=t=>te(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),re=t=>{const e=atob(t),r=new Uint8Array(e.length);for(let n=0;n<e.length;n++)r[n]=e.charCodeAt(n);return r},K=t=>{let e=t;e instanceof Uint8Array&&(e=W.decode(e)),e=e.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return re(e)}catch{throw new TypeError("The input to be decoded is not correctly encoded.")}};class c extends Error{constructor(e,r){super(e,r),this.code="ERR_JOSE_GENERIC",this.name=this.constructor.name,Error.captureStackTrace?.(this,this.constructor)}}c.code="ERR_JOSE_GENERIC";class ne extends c{constructor(e,r,n="unspecified",s="unspecified"){super(e,{cause:{claim:n,reason:s,payload:r}}),this.code="ERR_JWT_CLAIM_VALIDATION_FAILED",this.claim=n,this.reason=s,this.payload=r}}ne.code="ERR_JWT_CLAIM_VALIDATION_FAILED";class se extends c{constructor(e,r,n="unspecified",s="unspecified"){super(e,{cause:{claim:n,reason:s,payload:r}}),this.code="ERR_JWT_EXPIRED",this.claim=n,this.reason=s,this.payload=r}}se.code="ERR_JWT_EXPIRED";class oe extends c{constructor(){super(...arguments),this.code="ERR_JOSE_ALG_NOT_ALLOWED"}}oe.code="ERR_JOSE_ALG_NOT_ALLOWED";class f extends c{constructor(){super(...arguments),this.code="ERR_JOSE_NOT_SUPPORTED"}}f.code="ERR_JOSE_NOT_SUPPORTED";class ie extends c{constructor(e="decryption operation failed",r){super(e,r),this.code="ERR_JWE_DECRYPTION_FAILED"}}ie.code="ERR_JWE_DECRYPTION_FAILED";class ae extends c{constructor(){super(...arguments),this.code="ERR_JWE_INVALID"}}ae.code="ERR_JWE_INVALID";class w extends c{constructor(){super(...arguments),this.code="ERR_JWS_INVALID"}}w.code="ERR_JWS_INVALID";class h extends c{constructor(){super(...arguments),this.code="ERR_JWT_INVALID"}}h.code="ERR_JWT_INVALID";class ce extends c{constructor(){super(...arguments),this.code="ERR_JWK_INVALID"}}ce.code="ERR_JWK_INVALID";class de extends c{constructor(){super(...arguments),this.code="ERR_JWKS_INVALID"}}de.code="ERR_JWKS_INVALID";class he extends c{constructor(e="no applicable key found in the JSON Web Key Set",r){super(e,r),this.code="ERR_JWKS_NO_MATCHING_KEY"}}he.code="ERR_JWKS_NO_MATCHING_KEY";class le extends c{constructor(e="multiple matching keys found in the JSON Web Key Set",r){super(e,r),this.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS"}}le.code="ERR_JWKS_MULTIPLE_MATCHING_KEYS";class ue extends c{constructor(e="request timed out",r){super(e,r),this.code="ERR_JWKS_TIMEOUT"}}ue.code="ERR_JWKS_TIMEOUT";class fe extends c{constructor(e="signature verification failed",r){super(e,r),this.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED"}}fe.code="ERR_JWS_SIGNATURE_VERIFICATION_FAILED";function d(t,e="algorithm.name"){return new TypeError(`CryptoKey does not support this operation, its ${e} must be ${t}`)}function _(t,e){return t.name===e}function P(t){return parseInt(t.name.slice(4),10)}function pe(t){switch(t){case"ES256":return"P-256";case"ES384":return"P-384";case"ES512":return"P-521";default:throw new Error("unreachable")}}function me(t,e){if(e.length&&!e.some(r=>t.usages.includes(r))){let r="CryptoKey does not support this operation, its usages must include ";if(e.length>2){const n=e.pop();r+=`one of ${e.join(", ")}, or ${n}.`}else e.length===2?r+=`one of ${e[0]} or ${e[1]}.`:r+=`${e[0]}.`;throw new TypeError(r)}}function ye(t,e,...r){switch(e){case"HS256":case"HS384":case"HS512":{if(!_(t.algorithm,"HMAC"))throw d("HMAC");const n=parseInt(e.slice(2),10);if(P(t.algorithm.hash)!==n)throw d(`SHA-${n}`,"algorithm.hash");break}case"RS256":case"RS384":case"RS512":{if(!_(t.algorithm,"RSASSA-PKCS1-v1_5"))throw d("RSASSA-PKCS1-v1_5");const n=parseInt(e.slice(2),10);if(P(t.algorithm.hash)!==n)throw d(`SHA-${n}`,"algorithm.hash");break}case"PS256":case"PS384":case"PS512":{if(!_(t.algorithm,"RSA-PSS"))throw d("RSA-PSS");const n=parseInt(e.slice(2),10);if(P(t.algorithm.hash)!==n)throw d(`SHA-${n}`,"algorithm.hash");break}case"EdDSA":{if(t.algorithm.name!=="Ed25519"&&t.algorithm.name!=="Ed448")throw d("Ed25519 or Ed448");break}case"Ed25519":{if(!_(t.algorithm,"Ed25519"))throw d("Ed25519");break}case"ES256":case"ES384":case"ES512":{if(!_(t.algorithm,"ECDSA"))throw d("ECDSA");const n=pe(e);if(t.algorithm.namedCurve!==n)throw d(n,"algorithm.namedCurve");break}default:throw new TypeError("CryptoKey does not support this operation")}me(t,r)}function k(t,e,...r){if(r=r.filter(Boolean),r.length>2){const n=r.pop();t+=`one of type ${r.join(", ")}, or ${n}.`}else r.length===2?t+=`one of type ${r[0]} or ${r[1]}.`:t+=`of type ${r[0]}.`;return e==null?t+=` Received ${e}`:typeof e=="function"&&e.name?t+=` Received function ${e.name}`:typeof e=="object"&&e!=null&&e.constructor?.name&&(t+=` Received an instance of ${e.constructor.name}`),t}const M=(t,...e)=>k("Key must be ",t,...e);function j(t,e,...r){return k(`Key for the ${t} algorithm must be `,e,...r)}const V=t=>F(t)?!0:t?.[Symbol.toStringTag]==="KeyObject",v=["CryptoKey"],Se=(...t)=>{const e=t.filter(Boolean);if(e.length===0||e.length===1)return!0;let r;for(const n of e){const s=Object.keys(n);if(!r||r.size===0){r=new Set(s);continue}for(const i of s){if(r.has(i))return!1;r.add(i)}}return!0};function we(t){return typeof t=="object"&&t!==null}function N(t){if(!we(t)||Object.prototype.toString.call(t)!=="[object Object]")return!1;if(Object.getPrototypeOf(t)===null)return!0;let e=t;for(;Object.getPrototypeOf(e)!==null;)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}const Ee=(t,e)=>{if(t.startsWith("RS")||t.startsWith("PS")){const{modulusLength:r}=e.algorithm;if(typeof r!="number"||r<2048)throw new TypeError(`${t} requires key modulusLength to be 2048 bits or larger`)}};function b(t){return N(t)&&typeof t.kty=="string"}function ge(t){return t.kty!=="oct"&&typeof t.d=="string"}function _e(t){return t.kty!=="oct"&&typeof t.d>"u"}function be(t){return b(t)&&t.kty==="oct"&&typeof t.k=="string"}function Te(t){let e,r;switch(t.kty){case"RSA":{switch(t.alg){case"PS256":case"PS384":case"PS512":e={name:"RSA-PSS",hash:`SHA-${t.alg.slice(-3)}`},r=t.d?["sign"]:["verify"];break;case"RS256":case"RS384":case"RS512":e={name:"RSASSA-PKCS1-v1_5",hash:`SHA-${t.alg.slice(-3)}`},r=t.d?["sign"]:["verify"];break;case"RSA-OAEP":case"RSA-OAEP-256":case"RSA-OAEP-384":case"RSA-OAEP-512":e={name:"RSA-OAEP",hash:`SHA-${parseInt(t.alg.slice(-3),10)||1}`},r=t.d?["decrypt","unwrapKey"]:["encrypt","wrapKey"];break;default:throw new f('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"EC":{switch(t.alg){case"ES256":e={name:"ECDSA",namedCurve:"P-256"},r=t.d?["sign"]:["verify"];break;case"ES384":e={name:"ECDSA",namedCurve:"P-384"},r=t.d?["sign"]:["verify"];break;case"ES512":e={name:"ECDSA",namedCurve:"P-521"},r=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:"ECDH",namedCurve:t.crv},r=t.d?["deriveBits"]:[];break;default:throw new f('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}case"OKP":{switch(t.alg){case"Ed25519":e={name:"Ed25519"},r=t.d?["sign"]:["verify"];break;case"EdDSA":e={name:t.crv},r=t.d?["sign"]:["verify"];break;case"ECDH-ES":case"ECDH-ES+A128KW":case"ECDH-ES+A192KW":case"ECDH-ES+A256KW":e={name:t.crv},r=t.d?["deriveBits"]:[];break;default:throw new f('Invalid or unsupported JWK "alg" (Algorithm) Parameter value')}break}default:throw new f('Invalid or unsupported JWK "kty" (Key Type) Parameter value')}return{algorithm:e,keyUsages:r}}const Ae=async t=>{if(!t.alg)throw new TypeError('"alg" argument is required when "jwk.alg" is not present');const{algorithm:e,keyUsages:r}=Te(t),n=[e,t.ext??!1,t.key_ops??r],s={...t};return delete s.alg,delete s.use,x.subtle.importKey("jwk",s,...n)},G=t=>K(t);let y,S;const z=t=>t?.[Symbol.toStringTag]==="KeyObject",C=async(t,e,r,n,s=!1)=>{let i=t.get(e);if(i?.[n])return i[n];const a=await Ae({...r,alg:n});return s&&Object.freeze(e),i?i[n]=a:t.set(e,{[n]:a}),a},Ie=(t,e)=>{if(z(t)){let r=t.export({format:"jwk"});return delete r.d,delete r.dp,delete r.dq,delete r.p,delete r.q,delete r.qi,r.k?G(r.k):(S||(S=new WeakMap),C(S,t,r,e))}return b(t)?t.k?K(t.k):(S||(S=new WeakMap),C(S,t,t,e,!0)):t},Re=(t,e)=>{if(z(t)){let r=t.export({format:"jwk"});return r.k?G(r.k):(y||(y=new WeakMap),C(y,t,r,e))}return b(t)?t.k?K(t.k):(y||(y=new WeakMap),C(y,t,t,e,!0)):t},We={normalizePublicKey:Ie,normalizePrivateKey:Re},E=t=>t?.[Symbol.toStringTag],H=(t,e,r)=>{if(e.use!==void 0&&e.use!=="sig")throw new TypeError("Invalid key for this operation, when present its use must be sig");if(e.key_ops!==void 0&&e.key_ops.includes?.(r)!==!0)throw new TypeError(`Invalid key for this operation, when present its key_ops must include ${r}`);if(e.alg!==void 0&&e.alg!==t)throw new TypeError(`Invalid key for this operation, when present its alg must be ${t}`);return!0},ve=(t,e,r,n)=>{if(!(e instanceof Uint8Array)){if(n&&b(e)){if(be(e)&&H(t,e,r))return;throw new TypeError('JSON Web Key for symmetric algorithms must have JWK "kty" (Key Type) equal to "oct" and the JWK "k" (Key Value) present')}if(!V(e))throw new TypeError(j(t,e,...v,"Uint8Array",n?"JSON Web Key":null));if(e.type!=="secret")throw new TypeError(`${E(e)} instances for symmetric algorithms must be of type "secret"`)}},Ce=(t,e,r,n)=>{if(n&&b(e))switch(r){case"sign":if(ge(e)&&H(t,e,r))return;throw new TypeError("JSON Web Key for this operation be a private JWK");case"verify":if(_e(e)&&H(t,e,r))return;throw new TypeError("JSON Web Key for this operation be a public JWK")}if(!V(e))throw new TypeError(j(t,e,...v,n?"JSON Web Key":null));if(e.type==="secret")throw new TypeError(`${E(e)} instances for asymmetric algorithms must not be of type "secret"`);if(r==="sign"&&e.type==="public")throw new TypeError(`${E(e)} instances for asymmetric algorithm signing must be of type "private"`);if(r==="decrypt"&&e.type==="public")throw new TypeError(`${E(e)} instances for asymmetric algorithm decryption must be of type "private"`);if(e.algorithm&&r==="verify"&&e.type==="private")throw new TypeError(`${E(e)} instances for asymmetric algorithm verifying must be of type "public"`);if(e.algorithm&&r==="encrypt"&&e.type==="private")throw new TypeError(`${E(e)} instances for asymmetric algorithm encryption must be of type "public"`)};function B(t,e,r,n){e.startsWith("HS")||e==="dir"||e.startsWith("PBES2")||/^A\d{3}(?:GCM)?KW$/.test(e)?ve(e,r,n,t):Ce(e,r,n,t)}B.bind(void 0,!1);const Ke=B.bind(void 0,!0);function Je(t,e,r,n,s){if(s.crit!==void 0&&n?.crit===void 0)throw new t('"crit" (Critical) Header Parameter MUST be integrity protected');if(!n||n.crit===void 0)return new Set;if(!Array.isArray(n.crit)||n.crit.length===0||n.crit.some(a=>typeof a!="string"||a.length===0))throw new t('"crit" (Critical) Header Parameter MUST be an array of non-empty strings when present');let i;r!==void 0?i=new Map([...Object.entries(r),...e.entries()]):i=e;for(const a of n.crit){if(!i.has(a))throw new f(`Extension Header Parameter "${a}" is not recognized`);if(s[a]===void 0)throw new t(`Extension Header Parameter "${a}" is missing`);if(i.get(a)&&n[a]===void 0)throw new t(`Extension Header Parameter "${a}" MUST be integrity protected`)}return new Set(n.crit)}function Pe(t,e){const r=`SHA-${t.slice(-3)}`;switch(t){case"HS256":case"HS384":case"HS512":return{hash:r,name:"HMAC"};case"PS256":case"PS384":case"PS512":return{hash:r,name:"RSA-PSS",saltLength:t.slice(-3)>>3};case"RS256":case"RS384":case"RS512":return{hash:r,name:"RSASSA-PKCS1-v1_5"};case"ES256":case"ES384":case"ES512":return{hash:r,name:"ECDSA",namedCurve:e.namedCurve};case"Ed25519":return{name:"Ed25519"};case"EdDSA":return{name:e.name};default:throw new f(`alg ${t} is not supported either by JOSE or your javascript runtime`)}}async function Oe(t,e,r){if(e=await We.normalizePrivateKey(e,t),F(e))return ye(e,t,r),e;if(e instanceof Uint8Array){if(!t.startsWith("HS"))throw new TypeError(M(e,...v));return x.subtle.importKey("raw",e,{hash:`SHA-${t.slice(-3)}`,name:"HMAC"},!1,[r])}throw new TypeError(M(e,...v,"Uint8Array","JSON Web Key"))}const l=t=>Math.floor(t.getTime()/1e3),q=60,Y=q*60,$=Y*24,He=$*7,De=$*365.25,xe=/^(\+|\-)? ?(\d+|\d+\.\d+) ?(seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)(?: (ago|from now))?$/i,O=t=>{const e=xe.exec(t);if(!e||e[4]&&e[1])throw new TypeError("Invalid time period format");const r=parseFloat(e[2]),n=e[3].toLowerCase();let s;switch(n){case"sec":case"secs":case"second":case"seconds":case"s":s=Math.round(r);break;case"minute":case"minutes":case"min":case"mins":case"m":s=Math.round(r*q);break;case"hour":case"hours":case"hr":case"hrs":case"h":s=Math.round(r*Y);break;case"day":case"days":case"d":s=Math.round(r*$);break;case"week":case"weeks":case"w":s=Math.round(r*He);break;default:s=Math.round(r*De);break}return e[1]==="-"||e[4]==="ago"?-s:s},Ne=async(t,e,r)=>{const n=await Oe(t,e,"sign");Ee(t,n);const s=await x.subtle.sign(Pe(t,n.algorithm),n,r);return new Uint8Array(s)};class $e{constructor(e){if(!(e instanceof Uint8Array))throw new TypeError("payload must be an instance of Uint8Array");this._payload=e}setProtectedHeader(e){if(this._protectedHeader)throw new TypeError("setProtectedHeader can only be called once");return this._protectedHeader=e,this}setUnprotectedHeader(e){if(this._unprotectedHeader)throw new TypeError("setUnprotectedHeader can only be called once");return this._unprotectedHeader=e,this}async sign(e,r){if(!this._protectedHeader&&!this._unprotectedHeader)throw new w("either setProtectedHeader or setUnprotectedHeader must be called before #sign()");if(!Se(this._protectedHeader,this._unprotectedHeader))throw new w("JWS Protected and JWS Unprotected Header Parameter names must be disjoint");const n={...this._protectedHeader,...this._unprotectedHeader},s=Je(w,new Map([["b64",!0]]),r?.crit,this._protectedHeader,n);let i=!0;if(s.has("b64")&&(i=this._protectedHeader.b64,typeof i!="boolean"))throw new w('The "b64" (base64url-encode payload) Header Parameter must be a boolean');const{alg:a}=n;if(typeof a!="string"||!a)throw new w('JWS "alg" (Algorithm) Header Parameter missing or invalid');Ke(a,e,"sign");let T=this._payload;i&&(T=g.encode(J(T)));let A;this._protectedHeader?A=g.encode(J(JSON.stringify(this._protectedHeader))):A=g.encode("");const Z=ee(A,g.encode("."),T),Q=await Ne(a,e,Z),I={signature:J(Q),payload:""};return i&&(I.payload=W.decode(T)),this._unprotectedHeader&&(I.header=this._unprotectedHeader),this._protectedHeader&&(I.protected=W.decode(A)),I}}class Ue{constructor(e){this._flattened=new $e(e)}setProtectedHeader(e){return this._flattened.setProtectedHeader(e),this}async sign(e,r){const n=await this._flattened.sign(e,r);if(n.payload===void 0)throw new TypeError("use the flattened module for creating JWS with b64: false");return`${n.protected}.${n.payload}.${n.signature}`}}function u(t,e){if(!Number.isFinite(e))throw new TypeError(`Invalid ${t} input`);return e}class Me{constructor(e={}){if(!N(e))throw new TypeError("JWT Claims Set MUST be an object");this._payload=e}setIssuer(e){return this._payload={...this._payload,iss:e},this}setSubject(e){return this._payload={...this._payload,sub:e},this}setAudience(e){return this._payload={...this._payload,aud:e},this}setJti(e){return this._payload={...this._payload,jti:e},this}setNotBefore(e){return typeof e=="number"?this._payload={...this._payload,nbf:u("setNotBefore",e)}:e instanceof Date?this._payload={...this._payload,nbf:u("setNotBefore",l(e))}:this._payload={...this._payload,nbf:l(new Date)+O(e)},this}setExpirationTime(e){return typeof e=="number"?this._payload={...this._payload,exp:u("setExpirationTime",e)}:e instanceof Date?this._payload={...this._payload,exp:u("setExpirationTime",l(e))}:this._payload={...this._payload,exp:l(new Date)+O(e)},this}setIssuedAt(e){return typeof e>"u"?this._payload={...this._payload,iat:l(new Date)}:e instanceof Date?this._payload={...this._payload,iat:u("setIssuedAt",l(e))}:typeof e=="string"?this._payload={...this._payload,iat:u("setIssuedAt",l(new Date)+O(e))}:this._payload={...this._payload,iat:u("setIssuedAt",e)},this}}class Le extends Me{setProtectedHeader(e){return this._protectedHeader=e,this}async sign(e,r){const n=new Ue(g.encode(JSON.stringify(this._payload)));if(n.setProtectedHeader(this._protectedHeader),Array.isArray(this._protectedHeader?.crit)&&this._protectedHeader.crit.includes("b64")&&this._protectedHeader.b64===!1)throw new h("JWTs MUST NOT use unencoded payload");return n.sign(e,r)}}const Fe=K;function U(t){if(typeof t!="string")throw new h("JWTs must use Compact JWS serialization, JWT must be a string");const{1:e,length:r}=t.split(".");if(r===5)throw new h("Only JWTs using Compact JWS serialization can be decoded");if(r!==3)throw new h("Invalid JWT");if(!e)throw new h("JWTs must contain a payload");let n;try{n=Fe(e)}catch{throw new h("Failed to base64url decode the payload")}let s;try{s=JSON.parse(W.decode(n))}catch{throw new h("Failed to parse the decoded payload as JSON")}if(!N(s))throw new h("Invalid JWT Claims Set");return s}var ke=Object.defineProperty,je=(t,e,r)=>e in t?ke(t,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[e]=r,Ve=(t,e,r)=>je(t,e+"",r);function Ge(t){const{sub:e}=U(t);if(!e)throw new Error("token did not contain a subject field");return e}function ze(t){const{email:e}=U(t);if(!(typeof e!="string"||e.length===0))return e}function L(t){try{const e=U(t),r=Math.floor(Date.now()/1e3);return typeof e.exp=="number"&&e.exp<=r}catch{return!0}}var Be=class{constructor(t,e){this.configUrl=t,this.logger=e}async fetchToken(t){try{const e=await this.getOIDCConfig(this.configUrl);this.logger?.debug({oidcConfig:e},"Fetched OIDC config");const n=await(await this.fetchTokenEndpoint(e.token_endpoint,t)).json();if(this.logger?.info({response:n},`Fetched admin token for clientId: ${t.clientId}`),!n.access_token)throw new Error("No access_token in token endpoint response");return n.access_token}catch(e){throw this.logger?.error({err:e},"Failed to fetch admin token"),e}}async fetchTokenEndpoint(t,e){const r=new URLSearchParams({grant_type:"client_credentials",client_id:e.clientId,client_secret:e.clientSecret,scope:e.scope??"",audience:e.audience??""}),n=await fetch(t,{method:"POST",headers:{"Content-Type":"application/x-www-form-urlencoded"},body:r.toString()});if(!n.ok)throw this.logger?.error({status:n.status,statusText:n.statusText},"Token endpoint error"),new Error(`Token endpoint error: ${n.status} ${n.statusText}`);return n}async getOIDCConfig(t){const e=await fetch(t);if(!e.ok){const r=await e.text();throw this.logger?.error({status:e.status,statusText:e.statusText,body:r},"Failed to fetch OIDC config"),new Error(`OIDC config error: ${e.status} ${e.statusText}`)}return e.json()}},qe=(t,e)=>({fetchToken:async r=>new Be(t,e).fetchToken(r)}),Ye=class{static async fetchToken(t,e,r,n=3600){const s=new TextEncoder().encode(e.clientSecret),i=Math.floor(Date.now()/1e3),a=await new Le({sub:e.clientId,aud:e.audience||"",scope:e.scope||"",iat:i,exp:i+n,iss:r}).setProtectedHeader({alg:"HS256"}).sign(s);return t.info(`Generated self-signed JWT token: ${a}`),a}},rt=class R{constructor(e,r){this.config=e,this.logger=r,Ve(this,"cachedToken")}static fromToken(e,r){return new R({method:"static",token:e},r)}static fromGatewayConfig(e,r,n){if(r.method==="self_signed")return new R({method:r.method,issuer:r.issuer,credentials:{clientId:r.clientId,clientSecret:r.clientSecret,scope:r.scope,audience:r.audience}},n);if(r.method==="client_credentials"){if(e.type==="oauth")return new R({method:r.method,configUrl:e.configUrl,credentials:{clientId:r.clientId,clientSecret:r.clientSecret,scope:r.scope,audience:r.audience}},n);throw new Error(`IDP type ${e.type} not supported for client_credentials auth`)}throw new Error(`Auth method ${r.method} not supported for programmatic access token`)}async _fetchToken(){switch(this.logger.debug("Fetching user auth token"),this.config.method){case"static":return this.config.token;case"self_signed":return Ye.fetchToken(this.logger,this.config.credentials,this.config.issuer);case"client_credentials":return qe(this.config.configUrl,this.logger).fetchToken(this.config.credentials)}}async getAccessToken(){if(this.cachedToken&&!L(this.cachedToken))return this.cachedToken;{const e=await this._fetchToken();if(L(e))throw new Error("Attempted to refresh a token, but it came back expired.");return this.cachedToken=e,e}}async getAuthContext(){const e=await this.getAccessToken(),r=Ge(e),n=ze(e);return{accessToken:e,userId:r,...n?{email:n}:{}}}},X=p({method:m("authorization_code"),audience:o(),scope:o(),clientId:o()}).meta({description:"Authorization code flow authentication configuration. This is used for browser-based application login."}),Xe=p({method:m("client_credentials"),audience:o(),scope:o(),clientId:o(),clientSecret:o()}),Ze=p({method:m("self_signed"),issuer:o(),audience:o(),scope:o(),clientId:o(),clientSecret:o()}),Qe=p({method:m("client_credentials"),audience:o(),scope:o(),clientId:o(),clientSecretEnv:o()}),et=p({method:m("self_signed"),issuer:o(),audience:o(),scope:o(),clientId:o(),clientSecretEnv:o()}),nt=D("method",[X,Xe,Ze]);D("method",[X,Qe,et]);var st=D("type",[p({id:o(),type:m("self_signed"),issuer:o()}),p({id:o(),type:m("oauth"),issuer:o(),configUrl:o().url()})]);export{rt as A,nt as a,st as i};
|