@catena/cli 0.10.0 → 0.12.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 +42 -6
- package/dist/dist-C970_f6m.mjs +1 -0
- package/dist/getAddress-BlHiG3c6.mjs +2 -0
- package/dist/hmac-DW0MnYTR.mjs +1 -0
- package/dist/index.mjs +135 -28
- package/dist/movements-BPWh6hg3.mjs +9 -0
- package/dist/mpp-DDG3E9du.mjs +13 -0
- package/dist/{nodecrypto-86590WN-.mjs → nodecrypto-GFkDS5iF.mjs} +1 -1
- package/dist/{purejs-xzcexc4T.mjs → purejs-CRJs90lt.mjs} +1 -1
- package/dist/sha256-CJuuQjmL.mjs +3 -0
- package/dist/{utils-CnOz_tNs.mjs → utils-q3q3KGtm.mjs} +1 -1
- package/dist/{webcrypto-CejAJWkk.mjs → webcrypto-DIO-H-XA.mjs} +1 -1
- package/package.json +2 -2
- package/dist/dist-w03V0QPF.mjs +0 -3
- package/dist/hmac-CXnNqvhW.mjs +0 -1
- package/dist/mpp-C1N0QzFM.mjs +0 -14
package/README.md
CHANGED
|
@@ -181,9 +181,10 @@ npx @catena/cli mpp --url https://api.example.com/paid \
|
|
|
181
181
|
|
|
182
182
|
The CLI recognizes structurally valid EVM `evm/charge` and `usdc/charge`
|
|
183
183
|
challenges and leaves network and canonical USDC support to the connected
|
|
184
|
-
server.
|
|
185
|
-
|
|
186
|
-
The recipient must already be a
|
|
184
|
+
server. Base and Base Sepolia are supported where enabled. Arc support is
|
|
185
|
+
rolling out. Payments use the agent's normal send capability, counterparty
|
|
186
|
+
allowlist, spend limits, and approval flow. The recipient must already be a
|
|
187
|
+
saved counterparty wallet rail.
|
|
187
188
|
|
|
188
189
|
The command accepts the same request-body, header, output, profile, and JSON
|
|
189
190
|
flags as `x402`; run `mpp --help` for details. If approval is required, approve
|
|
@@ -285,14 +286,14 @@ Request a USD send to a counterparty rail.
|
|
|
285
286
|
|
|
286
287
|
```bash
|
|
287
288
|
npx @catena/cli send \
|
|
288
|
-
--rail
|
|
289
|
+
--rail cpr_... \
|
|
289
290
|
--amount 125.00 \
|
|
290
291
|
--method ach
|
|
291
292
|
```
|
|
292
293
|
|
|
293
294
|
Required flags: `--rail`, `--amount`, `--method`.
|
|
294
295
|
|
|
295
|
-
Optional flags: `--account`, `--
|
|
296
|
+
Optional flags: `--account`, `--description`, `--idempotency-key`, and `--memo`.
|
|
296
297
|
|
|
297
298
|
Omit `--account` when the current effective policy allows sends from exactly one
|
|
298
299
|
account. Zero or multiple send accounts produce an error; other readable or
|
|
@@ -308,7 +309,10 @@ pinned. New operations without an explicit source resolve the current policy.
|
|
|
308
309
|
Use a new key for a new operation, and reconcile an unknown outcome before
|
|
309
310
|
sending again.
|
|
310
311
|
|
|
311
|
-
`--method` must be one of `ach`, `wire`, or `on-chain`.
|
|
312
|
+
`--method` must be one of `ach`, `wire`, or `on-chain`. `--memo` is sent with an
|
|
313
|
+
ACH or wire payment. It remains accepted for on-chain sends for compatibility,
|
|
314
|
+
but is deprecated and is not sent to the blockchain. Use `--description` for an
|
|
315
|
+
internal Catena note on any send.
|
|
312
316
|
|
|
313
317
|
To check whether a send completed, run `intents get <id>` with the returned
|
|
314
318
|
intent id. A separate invocation without an explicit key is a new send, even
|
|
@@ -333,6 +337,38 @@ To check whether a transfer completed, run `intents get <id>` with the returned
|
|
|
333
337
|
intent id. A separate invocation without an explicit key is a new transfer, even
|
|
334
338
|
when its inputs match an earlier command.
|
|
335
339
|
|
|
340
|
+
### Sends that cross chains
|
|
341
|
+
|
|
342
|
+
A `send` to a counterparty wallet on the other side of the Base and Arc lane is
|
|
343
|
+
an ordinary `send`. When the account cannot pay it from its balance on the
|
|
344
|
+
rail's network, the send crosses chains under the same intent: the first
|
|
345
|
+
signature burns the amount toward the account's own address on the other chain,
|
|
346
|
+
and `intents continue` signs the send to the counterparty once the funds land.
|
|
347
|
+
One intent covers the whole payment, so policy, spend limits and any approval
|
|
348
|
+
are evaluated once. Gas on both legs is paid by Catena.
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
npx @catena/cli send --rail cpr_... --amount 250.00 --method on-chain
|
|
352
|
+
npx @catena/cli intents get int_...
|
|
353
|
+
npx @catena/cli intents continue int_...
|
|
354
|
+
```
|
|
355
|
+
|
|
356
|
+
The result carries `crossChain` when the send crossed. Its `nextStep` says what
|
|
357
|
+
to do: `wait` and poll `intents get`, `continue` and run `intents continue`,
|
|
358
|
+
`done`, or `blocked` with `failureReason` set. A network the provider does not
|
|
359
|
+
sponsor yet answers `wallet_send_action_not_yet_enabled` rather than charging
|
|
360
|
+
the agent; on `intents continue` the intent stays at `continue`, so try again
|
|
361
|
+
later.
|
|
362
|
+
|
|
363
|
+
### `intents continue`
|
|
364
|
+
|
|
365
|
+
Sign the second leg of a send that crossed chains, once `intents get` shows
|
|
366
|
+
`crossChain.nextStep` as `continue`. Optional: `--idempotency-key`.
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
npx @catena/cli intents continue int_...
|
|
370
|
+
```
|
|
371
|
+
|
|
336
372
|
### `accounts balance`
|
|
337
373
|
|
|
338
374
|
Read an account balance through the policy engine.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-B0Z9INg1.mjs";import{t}from"./sha256-CJuuQjmL.mjs";function n(e){return e.reduce((e,t)=>e+t.toString(16).padStart(2,`0`),``)}const r=(e,t)=>{if(!e||e.length%2!=0||!/^[0-9A-Fa-f]+$/.test(e))throw Error(`cannot create uint8array from invalid hex string: "${e}"`);let n=new Uint8Array(e.match(/../g).map(e=>parseInt(e,16)));if(!t)return n;if(e.length/2>t)throw Error(`hex value cannot fit in a buffer of `+t+` byte(s)`);let r=new Uint8Array(t);return r.set(n,t-n.length),r},i=(e,t)=>{let n=t-e.length;if(n>0){let t=new Uint8Array(n).fill(0);return new Uint8Array([...t,...e])}if(n<0){let r=n*-1,i=0;for(let t=0;t<r&&t<e.length;t++)e[t]===0&&i++;if(i!==r)throw Error(`invalid number of starting zeroes. Expected number of zeroes: ${r}. Found: ${i}.`);return e.slice(r,r+t)}return e};function a(e){if(e.length>=255)throw TypeError(`Alphabet too long`);let t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let n=0;n<e.length;n++){let r=e.charAt(n),i=r.charCodeAt(0);if(t[i]!==255)throw TypeError(r+` is ambiguous`);t[i]=n}let n=e.length,r=e.charAt(0),i=Math.log(n)/Math.log(256),a=Math.log(256)/Math.log(n);function o(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError(`Expected Uint8Array`);if(t.length===0)return``;let i=0,o=0,s=0,c=t.length;for(;s!==c&&t[s]===0;)s++,i++;let l=(c-s)*a+1>>>0,u=new Uint8Array(l);for(;s!==c;){let e=t[s],r=0;for(let t=l-1;(e!==0||r<o)&&t!==-1;t--,r++)e+=256*u[t]>>>0,u[t]=e%n>>>0,e=e/n>>>0;if(e!==0)throw Error(`Non-zero carry`);o=r,s++}let d=l-o;for(;d!==l&&u[d]===0;)d++;let f=r.repeat(i);for(;d<l;++d)f+=e.charAt(u[d]);return f}function s(e){if(typeof e!=`string`)throw TypeError(`Expected String`);if(e.length===0)return new Uint8Array;let a=0,o=0,s=0;for(;e[a]===r;)o++,a++;let c=(e.length-a)*i+1>>>0,l=new Uint8Array(c);for(;a<e.length;){let r=e.charCodeAt(a);if(r>255)return;let i=t[r];if(i===255)return;let o=0;for(let e=c-1;(i!==0||o<s)&&e!==-1;e--,o++)i+=n*l[e]>>>0,l[e]=i%256>>>0,i=i/256>>>0;if(i!==0)throw Error(`Non-zero carry`);s=o,a++}let u=c-s;for(;u!==c&&l[u]===0;)u++;let d=new Uint8Array(o+(c-u)),f=o;for(;u!==c;)d[f++]=l[u++];return d}function c(e){let t=s(e);if(t)return t;throw Error(`Non-base`+n+` character`)}return{encode:o,decodeUnsafe:s,decode:c}}var o=e({default:()=>s}),s=a(`123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz`);function c(e){let t=e;for(;t&&!(t.encode&&t.decode&&t.decodeUnsafe)&&t.default;)t=t.default;return t}c(o);function l(e){function t(t){var n=Uint8Array.from(t),r=e(n),i=n.length+4,a=new Uint8Array(i);return a.set(n,0),a.set(r.subarray(0,4),n.length),s.encode(a)}function n(t){var n=t.slice(0,-4),r=t.slice(-4),i=e(n);if(!(r[0]^i[0]|r[1]^i[1]|r[2]^i[2]|r[3]^i[3]))return n}function r(e){var t=s.decodeUnsafe(e);if(t!=null)return n(t)}function i(e){var t=n(s.decode(e));if(t==null)throw Error(`Invalid checksum`);return t}return{encode:t,decode:i,decodeUnsafe:r}}var u=e({default:()=>f});function d(e){return t(t(e))}var f=l(d);function p(e){let t=e;for(;t&&!(t.encode&&t.decode&&t.decodeUnsafe)&&t.default;)t=t.default;return t}p(u);export{r as n,n as r,i as t};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{C as e,T as t,_ as n,a as r,c as i,d as a,f as o,h as s,l as c,m as l,o as u,s as ee,u as d,w as te,y as f}from"./sha256-CJuuQjmL.mjs";const p=`2.56.3`;let m={getDocsUrl:({docsBaseUrl:e,docsPath:t=``,docsSlug:n})=>t?`${e??`https://viem.sh`}${t}${n?`#${n}`:``}`:void 0,version:`viem@${p}`};var h=class e extends Error{constructor(t,n={}){let r=n.cause instanceof e?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof e&&n.cause.docsPath||n.docsPath,a=m.getDocsUrl?.({...n,docsPath:i}),o=[t||`An error occurred.`,``,...n.metaMessages?[...n.metaMessages,``]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...m.version?[`Version: ${m.version}`]:[]].join(`
|
|
2
|
+
`);super(o,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:`BaseError`}),this.details=r,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=p}walk(e){return g(this,e)}};function g(e,t){return t?.(e)?e:e&&typeof e==`object`&&`cause`in e&&e.cause!==void 0?g(e.cause,t):t?null:e}function _(e,{strict:t=!0}={}){return!e||typeof e!=`string`?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith(`0x`)}function v(e){return _(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}var ne=class extends h{constructor({offset:e,position:t,size:n}){super(`Slice ${t===`start`?`starting`:`ending`} at offset "${e}" is out-of-bounds (size: ${n}).`,{name:`SliceOffsetOutOfBoundsError`})}},y=class extends h{constructor({size:e,targetSize:t,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:`SizeExceedsPaddingSizeError`})}};function b(e,{dir:t,size:n=32}={}){return typeof e==`string`?x(e,{dir:t,size:n}):re(e,{dir:t,size:n})}function x(e,{dir:t,size:n=32}={}){if(n===null)return e;let r=e.replace(`0x`,``);if(r.length>n*2)throw new y({size:Math.ceil(r.length/2),targetSize:n,type:`hex`});return`0x${r[t===`right`?`padEnd`:`padStart`](n*2,`0`)}`}function re(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new y({size:e.length,targetSize:n,type:`bytes`});let r=new Uint8Array(n);for(let i=0;i<n;i++){let a=t===`right`;r[a?i:n-i-1]=e[a?i:e.length-i-1]}return r}var S=class extends h{constructor({max:e,min:t,signed:n,size:r,value:i}){super(`Number "${i}" is not in safe ${r?`${r*8}-bit ${n?`signed`:`unsigned`} `:``}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:`IntegerOutOfRangeError`})}},ie=class extends h{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:`SizeOverflowError`})}};function C(e,{size:t}){if(v(e)>t)throw new ie({givenSize:v(e),maxSize:t})}function ae(e,t={}){let{signed:n}=t;t.size&&C(e,{size:t.size});let r=BigInt(e);if(!n)return r;let i=Math.ceil((e.length-2)/2);return r<=(1n<<BigInt(i)*8n-1n)-1n?r:r-BigInt(`0x${`f`.padStart(i*2,`f`)}`)-1n}function oe(e,t={}){let n=ae(e,t),r=Number(n);if(!Number.isSafeInteger(r))throw new S({max:`${2**53-1}`,min:`${-(2**53-1)}`,signed:t.signed,size:t.size,value:`${n}n`});return r}const se=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function w(e,t={}){return typeof e==`number`||typeof e==`bigint`?D(e,t):typeof e==`string`?k(e,t):typeof e==`boolean`?T(e,t):E(e,t)}function T(e,t={}){let n=`0x${Number(e)}`;return typeof t.size==`number`?(C(n,{size:t.size}),b(n,{size:t.size})):n}function E(e,t={}){let n=``;for(let t=0;t<e.length;t++)n+=se[e[t]];let r=`0x${n}`;return typeof t.size==`number`?(C(r,{size:t.size}),b(r,{dir:`right`,size:t.size})):r}function D(e,t={}){let{signed:n,size:r}=t,i=BigInt(e),a;r?a=n?(1n<<BigInt(r)*8n-1n)-1n:2n**(BigInt(r)*8n)-1n:typeof e==`number`&&(a=BigInt(2**53-1));let o=typeof a==`bigint`&&n?-a-1n:0;if(a&&i>a||i<o){let t=typeof e==`bigint`?`n`:``;throw new S({max:a?`${a}${t}`:void 0,min:`${o}${t}`,signed:n,size:r,value:`${e}${t}`})}let s=`0x${(n&&i<0?(1n<<BigInt(r*8))+BigInt(i):i).toString(16)}`;return r?b(s,{size:r}):s}const O=new TextEncoder;function k(e,t={}){return E(O.encode(e),t)}const ce=new TextEncoder;function A(e,t={}){return typeof e==`number`||typeof e==`bigint`?ue(e,t):typeof e==`boolean`?le(e,t):_(e)?N(e,t):P(e,t)}function le(e,t={}){let n=new Uint8Array(1);return n[0]=Number(e),typeof t.size==`number`?(C(n,{size:t.size}),b(n,{size:t.size})):n}const j={zero:48,nine:57,A:65,F:70,a:97,f:102};function M(e){if(e>=j.zero&&e<=j.nine)return e-j.zero;if(e>=j.A&&e<=j.F)return e-(j.A-10);if(e>=j.a&&e<=j.f)return e-(j.a-10)}function N(e,t={}){let n=e;t.size&&(C(n,{size:t.size}),n=b(n,{dir:`right`,size:t.size}));let r=n.slice(2);r.length%2&&(r=`0${r}`);let i=r.length/2,a=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let n=M(r.charCodeAt(t++)),i=M(r.charCodeAt(t++));if(n===void 0||i===void 0)throw new h(`Invalid byte sequence ("${r[t-2]}${r[t-1]}" in "${r}").`);a[e]=n*16+i}return a}function ue(e,t){return N(D(e,t))}function P(e,t={}){let n=ce.encode(e);return typeof t.size==`number`?(C(n,{size:t.size}),b(n,{dir:`right`,size:t.size})):n}const F=BigInt(0),I=BigInt(1),L=BigInt(2),R=BigInt(7),z=BigInt(256),B=BigInt(113),V=[],H=[],U=[];for(let e=0,t=I,n=1,r=0;e<24;e++){[n,r]=[r,(2*n+3*r)%5],V.push(2*(5*r+n)),H.push((e+1)*(e+2)/2%64);let i=F;for(let e=0;e<7;e++)t=(t<<I^(t>>R)*B)%z,t&L&&(i^=I<<(I<<BigInt(e))-I);U.push(i)}const W=c(U,!0),de=W[0],fe=W[1],G=(e,t,n)=>n>32?r(e,t,n):ee(e,t,n),K=(e,t,n)=>n>32?u(e,t,n):i(e,t,n);function pe(e,t=24){let r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){let n=(t+8)%10,i=(t+2)%10,a=r[i],o=r[i+1],s=G(a,o,1)^r[n],c=K(a,o,1)^r[n+1];for(let n=0;n<50;n+=10)e[t+n]^=s,e[t+n+1]^=c}let t=e[2],i=e[3];for(let n=0;n<24;n++){let r=H[n],a=G(t,i,r),o=K(t,i,r),s=V[n];t=e[s],i=e[s+1],e[s]=a,e[s+1]=o}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=de[n],e[1]^=fe[n]}n(r)}var me=class r extends d{constructor(e,n,r,i=!1,a=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=i,this.rounds=a,l(r),!(0<e&&e<200))throw Error(`only keccak-f1600 function is supported`);this.state=new Uint8Array(200),this.state32=t(this.state)}clone(){return this._cloneInto()}keccak(){e(this.state32),pe(this.state32,this.rounds),e(this.state32),this.posOut=0,this.pos=0}update(e){o(this),e=te(e),a(e);let{blockLen:t,state:n}=this,r=e.length;for(let i=0;i<r;){let a=Math.min(t-this.pos,r-i);for(let t=0;t<a;t++)n[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:n,blockLen:r}=this;e[n]^=t,t&128&&n===r-1&&this.keccak(),e[r-1]^=128,this.keccak()}writeInto(e){o(this,!1),a(e),this.finish();let t=this.state,{blockLen:n}=this;for(let r=0,i=e.length;r<i;){this.posOut>=n&&this.keccak();let a=Math.min(n-this.posOut,i-r);e.set(t.subarray(this.posOut,this.posOut+a),r),this.posOut+=a,r+=a}return e}xofInto(e){if(!this.enableXOF)throw Error(`XOF is not possible for this instance`);return this.writeInto(e)}xof(e){return l(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(s(e,this),this.finished)throw Error(`digest() was already called`);return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,n(this.state)}_cloneInto(e){let{blockLen:t,suffix:n,outputLen:i,rounds:a,enableXOF:o}=this;return e||=new r(t,n,i,o,a),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=a,e.suffix=n,e.outputLen=i,e.enableXOF=o,e.destroyed=this.destroyed,e}};const he=((e,t,n)=>f(()=>new me(t,e,n)))(1,136,32);function q(e,t){let n=t||`hex`,r=he(_(e,{strict:!1})?A(e):e);return n===`bytes`?r:w(r)}var J=class extends h{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:[`- Address must be a hex value of 20 bytes (40 hex characters).`,`- Address must match its checksum counterpart.`],name:`InvalidAddressError`})}},Y=class extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;e!==void 0&&super.delete(e)}return this}};const ge=/^0x[a-fA-F0-9]{40}$/,X=new Y(8192);function Z(e,t){let{strict:n=!0}=t??{},r=`${e}.${n}`;if(X.has(r))return X.get(r);let i=ge.test(e)?e.toLowerCase()===e||!n||$(e)===e:!1;return X.set(r,i),i}const Q=new Y(8192);function $(e,t){if(Q.has(`${e}.${t}`))return Q.get(`${e}.${t}`);let n=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),r=q(P(n),`bytes`),i=(t?n.substring(`${t}0x`.length):n).split(``);for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(r[e>>1]&15)>=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let a=`0x${i.join(``)}`;return Q.set(`${e}.${t}`,a),a}function _e(e,t){if(!Z(e,{strict:!1}))throw new J({address:e});return $(e,t)}export{_,N as a,E as c,w as d,oe as f,v as g,ne as h,q as i,D as l,x as m,Z as n,A as o,S as p,J as r,T as s,_e as t,k as u,h as v};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,d as t,f as n,p as r,u as i,w as a}from"./sha256-CJuuQjmL.mjs";var o=class extends i{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,r(t);let i=a(n);if(this.iHash=t.create(),typeof this.iHash.update!=`function`)throw Error(`Expected instance of class which extends utils.Hash`);this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let o=this.blockLen,s=new Uint8Array(o);s.set(i.length>o?t.create().update(i).digest():i);for(let e=0;e<s.length;e++)s[e]^=54;this.iHash.update(s),this.oHash=t.create();for(let e=0;e<s.length;e++)s[e]^=106;this.oHash.update(s),e(s)}update(e){return n(this),this.iHash.update(e),this}digestInto(e){n(this),t(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||=Object.create(Object.getPrototypeOf(this),{});let{oHash:t,iHash:n,finished:r,destroyed:i,blockLen:a,outputLen:o}=this;return e=e,e.finished=r,e.destroyed=i,e.blockLen=a,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=n._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const s=(e,t,n)=>new o(e,t).update(n).digest();s.create=(e,t)=>new o(e,t);export{s as t};
|