@catena/cli 0.7.0 → 0.9.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 +70 -13
- package/THIRD-PARTY-NOTICES +156 -0
- package/dist/dist-w03V0QPF.mjs +3 -0
- package/dist/hmac-CXnNqvhW.mjs +1 -0
- package/dist/index.mjs +449 -316
- package/dist/mpp-CZl4wkkp.mjs +14 -0
- package/dist/{nodecrypto-CIGSbdQh.mjs → nodecrypto-BSdTIm8T.mjs} +1 -1
- package/dist/purejs-xzcexc4T.mjs +15 -0
- package/dist/rolldown-runtime-B0Z9INg1.mjs +1 -0
- package/dist/{utils-DZmc0RJW.mjs → utils-CrMT-n--.mjs} +1 -1
- package/dist/{webcrypto-CRLL4ptE.mjs → webcrypto-BeKbrVgs.mjs} +1 -1
- package/package.json +8 -5
- package/dist/base64-WTSXTrii.mjs +0 -1
- package/dist/dist-B0qgGwAq.mjs +0 -3
- package/dist/purejs-CZxWHjtN.mjs +0 -15
package/README.md
CHANGED
|
@@ -24,8 +24,31 @@ tools such as `jq`; pass `--json` to print compact single-line JSON instead.
|
|
|
24
24
|
`unlink` revokes only the selected profile's server link and removes that
|
|
25
25
|
profile's local credential.
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
## Hosts without a keychain
|
|
28
|
+
|
|
29
|
+
A container, a CI job, or a serverless runtime has no OS keychain and no
|
|
30
|
+
browser, so `link` cannot store a credential there. Set `CATENA_SECRET_KEY` to
|
|
31
|
+
the agent's P-256 secret key instead:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
CATENA_SECRET_KEY="<64 hex characters>" pnpm dlx @catena/cli whoami
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Create the key in the Catena console: open the agent, select the **Secret keys**
|
|
38
|
+
tab, then **Create secret key**. The console shows it one time. `@catena/sdk`
|
|
39
|
+
reads the same variable, so one key serves either client. Set the value with no
|
|
40
|
+
surrounding whitespace: the CLI trims it, and the SDK does not.
|
|
41
|
+
|
|
42
|
+
While the key is set, `profiles current` reports `source: "secret-key"` with no
|
|
43
|
+
`.profile` field, and `profiles list` adds `shadowedBy` and marks every profile
|
|
44
|
+
`current: false`.
|
|
45
|
+
|
|
46
|
+
On a machine that also holds a linked profile or sets `CATENA_PROFILE`, every
|
|
47
|
+
command prints one stderr line that names the key as the signing credential.
|
|
48
|
+
Stdout keeps only the command result.
|
|
49
|
+
|
|
50
|
+
The key outranks every profile tier, but an explicit `--profile` still wins.
|
|
51
|
+
`unlink` does not apply to it; revoke the key in the console instead.
|
|
29
52
|
|
|
30
53
|
## First-time setup
|
|
31
54
|
|
|
@@ -49,11 +72,10 @@ denied or times out, run the command again.
|
|
|
49
72
|
|
|
50
73
|
Useful flags:
|
|
51
74
|
|
|
52
|
-
| Flag
|
|
53
|
-
|
|
|
54
|
-
| `--
|
|
55
|
-
| `--
|
|
56
|
-
| `--profile` | Credential profile name. | configured default or `default` |
|
|
75
|
+
| Flag | Description | Default |
|
|
76
|
+
| ----------- | ------------------------------------------------------- | ------------------------------- |
|
|
77
|
+
| `--name` | Suggested name when creating an agent from the console. | none |
|
|
78
|
+
| `--profile` | Credential profile name. | configured default or `default` |
|
|
57
79
|
|
|
58
80
|
## Commands
|
|
59
81
|
|
|
@@ -147,6 +169,27 @@ manual retry may be needed after an ambiguous timeout, choose and persist a key
|
|
|
147
169
|
on the first attempt, then reuse that exact key with unchanged inputs. Reusing a
|
|
148
170
|
key with different inputs fails.
|
|
149
171
|
|
|
172
|
+
### `mpp`
|
|
173
|
+
|
|
174
|
+
Fetch an MPP-protected HTTP endpoint and pay a supported USDC charge from a
|
|
175
|
+
wallet account:
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
pnpm dlx @catena/cli mpp --url https://api.example.com/paid \
|
|
179
|
+
--account acct_... --max-amount 0.25
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
Initial support covers `evm/charge` and `usdc/charge` for native USDC on Base
|
|
183
|
+
and Base Sepolia. Payments use the agent's normal send capability, counterparty
|
|
184
|
+
allowlist, spend limits, and approval flow. The recipient must already be a
|
|
185
|
+
saved counterparty wallet rail.
|
|
186
|
+
|
|
187
|
+
The command accepts the same request-body, header, output, profile, and JSON
|
|
188
|
+
flags as `x402`; run `mpp --help` for details. If approval is required, approve
|
|
189
|
+
the reported intent and re-run the same command. If payment completed but the
|
|
190
|
+
paid request failed, inspect the reported intent with `intents get <id>` before
|
|
191
|
+
retrying so the resource is not paid twice.
|
|
192
|
+
|
|
150
193
|
### `accounts list`
|
|
151
194
|
|
|
152
195
|
List the accounts available under the agent's policy.
|
|
@@ -241,15 +284,28 @@ Request a USD send to a counterparty rail.
|
|
|
241
284
|
|
|
242
285
|
```bash
|
|
243
286
|
pnpm dlx @catena/cli send \
|
|
244
|
-
--account acct_... \
|
|
245
287
|
--rail cprl_... \
|
|
246
288
|
--amount 125.00 \
|
|
247
289
|
--method ach
|
|
248
290
|
```
|
|
249
291
|
|
|
250
|
-
Required flags: `--
|
|
292
|
+
Required flags: `--rail`, `--amount`, `--method`.
|
|
251
293
|
|
|
252
|
-
Optional flags: `--memo`, `--description`, `--idempotency-key`.
|
|
294
|
+
Optional flags: `--account`, `--memo`, `--description`, `--idempotency-key`.
|
|
295
|
+
|
|
296
|
+
Omit `--account` when the current effective policy allows sends from exactly one
|
|
297
|
+
account. Zero or multiple send accounts produce an error; other readable or
|
|
298
|
+
transfer accounts do not count. An explicit source is never replaced. The
|
|
299
|
+
result's `accountId` identifies the source pinned to the intent, including while
|
|
300
|
+
awaiting approval. `intents get <id>` returns the same source.
|
|
301
|
+
|
|
302
|
+
A same-key retry uses the original intent's source, even if the current policy
|
|
303
|
+
selects another account or no longer has a unique send account. Changed payment
|
|
304
|
+
details or an explicitly different source return HTTP 409. Policy-blocked
|
|
305
|
+
attempts are reevaluated against the current policy with the source still
|
|
306
|
+
pinned. New operations without an explicit source resolve the current policy.
|
|
307
|
+
Use a new key for a new operation, and reconcile an unknown outcome before
|
|
308
|
+
sending again.
|
|
253
309
|
|
|
254
310
|
`--method` must be one of `ach`, `wire`, or `on-chain`.
|
|
255
311
|
|
|
@@ -353,9 +409,10 @@ later completes, requires approval, or fails.
|
|
|
353
409
|
|
|
354
410
|
## Configuration
|
|
355
411
|
|
|
356
|
-
| Variable
|
|
357
|
-
|
|
|
358
|
-
| `
|
|
412
|
+
| Variable | Purpose | Default |
|
|
413
|
+
| ------------------- | ---------------------------------------------------- | ------- |
|
|
414
|
+
| `CATENA_SECRET_KEY` | Agent P-256 secret key (64 hex). Selects no profile. | none |
|
|
415
|
+
| `CATENA_PROFILE` | Credential profile name. | none |
|
|
359
416
|
|
|
360
417
|
## Discovering options
|
|
361
418
|
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
Third-party notices
|
|
2
|
+
===================
|
|
3
|
+
|
|
4
|
+
This distribution incorporates portions of the following third-party
|
|
5
|
+
software into its compiled output. These notices supplement any attribution
|
|
6
|
+
retained directly in the generated files.
|
|
7
|
+
|
|
8
|
+
mppx
|
|
9
|
+
----
|
|
10
|
+
|
|
11
|
+
MIT License
|
|
12
|
+
|
|
13
|
+
Copyright (c) 2026-present weth, LLC
|
|
14
|
+
|
|
15
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
16
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
17
|
+
in the Software without restriction, including without limitation the rights
|
|
18
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
19
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
20
|
+
furnished to do so, subject to the following conditions:
|
|
21
|
+
|
|
22
|
+
The above copyright notice and this permission notice shall be included in all
|
|
23
|
+
copies or substantial portions of the Software.
|
|
24
|
+
|
|
25
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
26
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
27
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
28
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
29
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
30
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
31
|
+
SOFTWARE.
|
|
32
|
+
|
|
33
|
+
viem
|
|
34
|
+
----
|
|
35
|
+
|
|
36
|
+
MIT License
|
|
37
|
+
|
|
38
|
+
Copyright (c) 2023-present weth, LLC
|
|
39
|
+
|
|
40
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
41
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
42
|
+
in the Software without restriction, including without limitation the rights
|
|
43
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
44
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
45
|
+
furnished to do so, subject to the following conditions:
|
|
46
|
+
|
|
47
|
+
The above copyright notice and this permission notice shall be included in all
|
|
48
|
+
copies or substantial portions of the Software.
|
|
49
|
+
|
|
50
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
51
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
52
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
53
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
54
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
55
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
56
|
+
SOFTWARE.
|
|
57
|
+
|
|
58
|
+
ox
|
|
59
|
+
--
|
|
60
|
+
|
|
61
|
+
MIT License
|
|
62
|
+
|
|
63
|
+
Copyright (c) 2023-present wevm
|
|
64
|
+
|
|
65
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
66
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
67
|
+
in the Software without restriction, including without limitation the rights
|
|
68
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
69
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
70
|
+
furnished to do so, subject to the following conditions:
|
|
71
|
+
|
|
72
|
+
The above copyright notice and this permission notice shall be included in all
|
|
73
|
+
copies or substantial portions of the Software.
|
|
74
|
+
|
|
75
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
76
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
77
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
78
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
79
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
80
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
81
|
+
SOFTWARE.
|
|
82
|
+
|
|
83
|
+
Zod
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
MIT License
|
|
87
|
+
|
|
88
|
+
Copyright (c) 2025 Colin McDonnell
|
|
89
|
+
|
|
90
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
91
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
92
|
+
in the Software without restriction, including without limitation the rights
|
|
93
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
94
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
95
|
+
furnished to do so, subject to the following conditions:
|
|
96
|
+
|
|
97
|
+
The above copyright notice and this permission notice shall be included in all
|
|
98
|
+
copies or substantial portions of the Software.
|
|
99
|
+
|
|
100
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
101
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
102
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
103
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
104
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
105
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
106
|
+
SOFTWARE.
|
|
107
|
+
|
|
108
|
+
eventsource-parser
|
|
109
|
+
------------------
|
|
110
|
+
|
|
111
|
+
MIT License
|
|
112
|
+
|
|
113
|
+
Copyright (c) 2026 Espen Hovlandsdal <espen@hovlandsdal.com>
|
|
114
|
+
|
|
115
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
116
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
117
|
+
in the Software without restriction, including without limitation the rights
|
|
118
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
119
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
120
|
+
furnished to do so, subject to the following conditions:
|
|
121
|
+
|
|
122
|
+
The above copyright notice and this permission notice shall be included in all
|
|
123
|
+
copies or substantial portions of the Software.
|
|
124
|
+
|
|
125
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
126
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
127
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
128
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
129
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
130
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
131
|
+
SOFTWARE.
|
|
132
|
+
|
|
133
|
+
@noble/hashes and @noble/curves
|
|
134
|
+
--------------------------------
|
|
135
|
+
|
|
136
|
+
The MIT License (MIT)
|
|
137
|
+
|
|
138
|
+
Copyright (c) 2022 Paul Miller (https://paulmillr.com)
|
|
139
|
+
|
|
140
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
141
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
142
|
+
in the Software without restriction, including without limitation the rights
|
|
143
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
144
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
145
|
+
furnished to do so, subject to the following conditions:
|
|
146
|
+
|
|
147
|
+
The above copyright notice and this permission notice shall be included in
|
|
148
|
+
all copies or substantial portions of the Software.
|
|
149
|
+
|
|
150
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
151
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
152
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
153
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
154
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
155
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
156
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-B0Z9INg1.mjs";import*as t from"node:crypto";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);const l=t&&typeof t==`object`&&`webcrypto`in t?t.webcrypto:t&&typeof t==`object`&&`randomBytes`in t?t:void 0;
|
|
2
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3
|
+
function u(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name===`Uint8Array`}function d(e){if(!Number.isSafeInteger(e)||e<0)throw Error(`positive integer expected, got `+e)}function f(e,...t){if(!u(e))throw Error(`Uint8Array expected`);if(t.length>0&&!t.includes(e.length))throw Error(`Uint8Array expected of length `+t+`, got length=`+e.length)}function p(e){if(typeof e!=`function`||typeof e.create!=`function`)throw Error(`Hash should be wrapped by utils.createHasher`);d(e.outputLen),d(e.blockLen)}function m(e,t=!0){if(e.destroyed)throw Error(`Hash instance has been destroyed`);if(t&&e.finished)throw Error(`Hash#digest() has already been called`)}function h(e,t){f(e);let n=t.outputLen;if(e.length<n)throw Error(`digestInto() expects output buffer of length at least `+n)}function g(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function _(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function v(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function y(e,t){return e<<32-t|e>>>t}const b=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function x(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function S(e){for(let t=0;t<e.length;t++)e[t]=x(e[t]);return e}const C=b?e=>e:S,w=typeof Uint8Array.from([]).toHex==`function`&&typeof Uint8Array.fromHex==`function`,T=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,`0`));function E(e){if(f(e),w)return e.toHex();let t=``;for(let n=0;n<e.length;n++)t+=T[e[n]];return t}const D={_0:48,_9:57,A:65,F:70,a:97,f:102};function O(e){if(e>=D._0&&e<=D._9)return e-D._0;if(e>=D.A&&e<=D.F)return e-(D.A-10);if(e>=D.a&&e<=D.f)return e-(D.a-10)}function ee(e){if(typeof e!=`string`)throw Error(`hex string expected, got `+typeof e);if(w)return Uint8Array.fromHex(e);let t=e.length,n=t/2;if(t%2)throw Error(`hex string expected, got unpadded hex of length `+t);let r=new Uint8Array(n);for(let t=0,i=0;t<n;t++,i+=2){let n=O(e.charCodeAt(i)),a=O(e.charCodeAt(i+1));if(n===void 0||a===void 0){let t=e[i]+e[i+1];throw Error(`hex string expected, got non-hex character "`+t+`" at index `+i)}r[t]=n*16+a}return r}function te(e){if(typeof e!=`string`)throw Error(`string expected`);return new Uint8Array(new TextEncoder().encode(e))}function k(e){return typeof e==`string`&&(e=te(e)),f(e),e}function ne(...e){let t=0;for(let n=0;n<e.length;n++){let r=e[n];f(r),t+=r.length}let n=new Uint8Array(t);for(let t=0,r=0;t<e.length;t++){let i=e[t];n.set(i,r),r+=i.length}return n}var A=class{};function j(e){let t=t=>e().update(k(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}function re(e=32){if(l&&typeof l.getRandomValues==`function`)return l.getRandomValues(new Uint8Array(e));if(l&&typeof l.randomBytes==`function`)return Uint8Array.from(l.randomBytes(e));throw Error(`crypto.getRandomValues must be defined`)}function ie(e,t,n,r){if(typeof e.setBigUint64==`function`)return e.setBigUint64(t,n,r);let i=BigInt(32),a=BigInt(4294967295),o=Number(n>>i&a),s=Number(n&a),c=r?4:0,l=r?0:4;e.setUint32(t+c,o,r),e.setUint32(t+l,s,r)}function ae(e,t,n){return e&t^~e&n}function oe(e,t,n){return e&t^e&n^t&n}var M=class extends A{constructor(e,t,n,r){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=n,this.isLE=r,this.buffer=new Uint8Array(e),this.view=v(this.buffer)}update(e){m(this),e=k(e),f(e);let{view:t,buffer:n,blockLen:r}=this,i=e.length;for(let a=0;a<i;){let o=Math.min(r-this.pos,i-a);if(o===r){let t=v(e);for(;r<=i-a;a+=r)this.process(t,a);continue}n.set(e.subarray(a,a+o),this.pos),this.pos+=o,a+=o,this.pos===r&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){m(this),h(e,this),this.finished=!0;let{buffer:t,view:n,blockLen:r,isLE:i}=this,{pos:a}=this;t[a++]=128,_(this.buffer.subarray(a)),this.padOffset>r-a&&(this.process(n,0),a=0);for(let e=a;e<r;e++)t[e]=0;ie(n,r-8,BigInt(this.length*8),i),this.process(n,0);let o=v(e),s=this.outputLen;if(s%4)throw Error(`_sha2: outputLen should be aligned to 32bit`);let c=s/4,l=this.get();if(c>l.length)throw Error(`_sha2: outputLen bigger than state`);for(let e=0;e<c;e++)o.setUint32(4*e,l[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let n=e.slice(0,t);return this.destroy(),n}_cloneInto(e){e||=new this.constructor,e.set(...this.get());let{blockLen:t,buffer:n,length:r,finished:i,destroyed:a,pos:o}=this;return e.destroyed=a,e.finished=i,e.length=r,e.pos=o,r%t&&e.buffer.set(n),e}clone(){return this._cloneInto()}};const N=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),P=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),F=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),I=BigInt(2**32-1),L=BigInt(32);function se(e,t=!1){return t?{h:Number(e&I),l:Number(e>>L&I)}:{h:Number(e>>L&I)|0,l:Number(e&I)|0}}function R(e,t=!1){let n=e.length,r=new Uint32Array(n),i=new Uint32Array(n);for(let a=0;a<n;a++){let{h:n,l:o}=se(e[a],t);[r[a],i[a]]=[n,o]}return[r,i]}const z=(e,t,n)=>e>>>n,B=(e,t,n)=>e<<32-n|t>>>n,V=(e,t,n)=>e>>>n|t<<32-n,H=(e,t,n)=>e<<32-n|t>>>n,U=(e,t,n)=>e<<64-n|t>>>n-32,W=(e,t,n)=>e>>>n-32|t<<64-n,ce=(e,t,n)=>e<<n|t>>>32-n,le=(e,t,n)=>t<<n|e>>>32-n,ue=(e,t,n)=>t<<n-32|e>>>64-n,G=(e,t,n)=>e<<n-32|t>>>64-n;function K(e,t,n,r){let i=(t>>>0)+(r>>>0);return{h:e+n+(i/2**32|0)|0,l:i|0}}const de=(e,t,n)=>(e>>>0)+(t>>>0)+(n>>>0),fe=(e,t,n,r)=>t+n+r+(e/2**32|0)|0,pe=(e,t,n,r)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0),me=(e,t,n,r,i)=>t+n+r+i+(e/2**32|0)|0,he=(e,t,n,r,i)=>(e>>>0)+(t>>>0)+(n>>>0)+(r>>>0)+(i>>>0),ge=(e,t,n,r,i,a)=>t+n+r+i+a+(e/2**32|0)|0,_e=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),q=new Uint32Array(64);var ve=class extends M{constructor(e=32){super(64,e,8,!1),this.A=N[0]|0,this.B=N[1]|0,this.C=N[2]|0,this.D=N[3]|0,this.E=N[4]|0,this.F=N[5]|0,this.G=N[6]|0,this.H=N[7]|0}get(){let{A:e,B:t,C:n,D:r,E:i,F:a,G:o,H:s}=this;return[e,t,n,r,i,a,o,s]}set(e,t,n,r,i,a,o,s){this.A=e|0,this.B=t|0,this.C=n|0,this.D=r|0,this.E=i|0,this.F=a|0,this.G=o|0,this.H=s|0}process(e,t){for(let n=0;n<16;n++,t+=4)q[n]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=q[e-15],n=q[e-2],r=y(t,7)^y(t,18)^t>>>3,i=y(n,17)^y(n,19)^n>>>10;q[e]=i+q[e-7]+r+q[e-16]|0}let{A:n,B:r,C:i,D:a,E:o,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){let t=y(o,6)^y(o,11)^y(o,25),u=l+t+ae(o,s,c)+_e[e]+q[e]|0,d=(y(n,2)^y(n,13)^y(n,22))+oe(n,r,i)|0;l=c,c=s,s=o,o=a+u|0,a=i,i=r,r=n,n=u+d|0}n=n+this.A|0,r=r+this.B|0,i=i+this.C|0,a=a+this.D|0,o=o+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(n,r,i,a,o,s,c,l)}roundClean(){_(q)}destroy(){this.set(0,0,0,0,0,0,0,0),_(this.buffer)}};const J=R(`0x428a2f98d728ae22.0x7137449123ef65cd.0xb5c0fbcfec4d3b2f.0xe9b5dba58189dbbc.0x3956c25bf348b538.0x59f111f1b605d019.0x923f82a4af194f9b.0xab1c5ed5da6d8118.0xd807aa98a3030242.0x12835b0145706fbe.0x243185be4ee4b28c.0x550c7dc3d5ffb4e2.0x72be5d74f27b896f.0x80deb1fe3b1696b1.0x9bdc06a725c71235.0xc19bf174cf692694.0xe49b69c19ef14ad2.0xefbe4786384f25e3.0x0fc19dc68b8cd5b5.0x240ca1cc77ac9c65.0x2de92c6f592b0275.0x4a7484aa6ea6e483.0x5cb0a9dcbd41fbd4.0x76f988da831153b5.0x983e5152ee66dfab.0xa831c66d2db43210.0xb00327c898fb213f.0xbf597fc7beef0ee4.0xc6e00bf33da88fc2.0xd5a79147930aa725.0x06ca6351e003826f.0x142929670a0e6e70.0x27b70a8546d22ffc.0x2e1b21385c26c926.0x4d2c6dfc5ac42aed.0x53380d139d95b3df.0x650a73548baf63de.0x766a0abb3c77b2a8.0x81c2c92e47edaee6.0x92722c851482353b.0xa2bfe8a14cf10364.0xa81a664bbc423001.0xc24b8b70d0f89791.0xc76c51a30654be30.0xd192e819d6ef5218.0xd69906245565a910.0xf40e35855771202a.0x106aa07032bbd1b8.0x19a4c116b8d2d0c8.0x1e376c085141ab53.0x2748774cdf8eeb99.0x34b0bcb5e19b48a8.0x391c0cb3c5c95a63.0x4ed8aa4ae3418acb.0x5b9cca4f7763e373.0x682e6ff3d6b2b8a3.0x748f82ee5defb2fc.0x78a5636f43172f60.0x84c87814a1f0ab72.0x8cc702081a6439ec.0x90befffa23631e28.0xa4506cebde82bde9.0xbef9a3f7b2c67915.0xc67178f2e372532b.0xca273eceea26619c.0xd186b8c721c0c207.0xeada7dd6cde0eb1e.0xf57d4f7fee6ed178.0x06f067aa72176fba.0x0a637dc5a2c898a6.0x113f9804bef90dae.0x1b710b35131c471b.0x28db77f523047d84.0x32caab7b40c72493.0x3c9ebe0a15c9bebc.0x431d67c49c100d4c.0x4cc5d4becb3e42b6.0x597f299cfc657e2a.0x5fcb6fab3ad6faec.0x6c44198c4a475817`.split(`.`).map(e=>BigInt(e))),ye=J[0],be=J[1],Y=new Uint32Array(80),X=new Uint32Array(80);var Z=class extends M{constructor(e=64){super(128,e,16,!1),this.Ah=F[0]|0,this.Al=F[1]|0,this.Bh=F[2]|0,this.Bl=F[3]|0,this.Ch=F[4]|0,this.Cl=F[5]|0,this.Dh=F[6]|0,this.Dl=F[7]|0,this.Eh=F[8]|0,this.El=F[9]|0,this.Fh=F[10]|0,this.Fl=F[11]|0,this.Gh=F[12]|0,this.Gl=F[13]|0,this.Hh=F[14]|0,this.Hl=F[15]|0}get(){let{Ah:e,Al:t,Bh:n,Bl:r,Ch:i,Cl:a,Dh:o,Dl:s,Eh:c,El:l,Fh:u,Fl:d,Gh:f,Gl:p,Hh:m,Hl:h}=this;return[e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h]}set(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h){this.Ah=e|0,this.Al=t|0,this.Bh=n|0,this.Bl=r|0,this.Ch=i|0,this.Cl=a|0,this.Dh=o|0,this.Dl=s|0,this.Eh=c|0,this.El=l|0,this.Fh=u|0,this.Fl=d|0,this.Gh=f|0,this.Gl=p|0,this.Hh=m|0,this.Hl=h|0}process(e,t){for(let n=0;n<16;n++,t+=4)Y[n]=e.getUint32(t),X[n]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=Y[e-15]|0,n=X[e-15]|0,r=V(t,n,1)^V(t,n,8)^z(t,n,7),i=H(t,n,1)^H(t,n,8)^B(t,n,7),a=Y[e-2]|0,o=X[e-2]|0,s=V(a,o,19)^U(a,o,61)^z(a,o,6),c=H(a,o,19)^W(a,o,61)^B(a,o,6),l=pe(i,c,X[e-7],X[e-16]),u=me(l,r,s,Y[e-7],Y[e-16]);Y[e]=u|0,X[e]=l|0}let{Ah:n,Al:r,Bh:i,Bl:a,Ch:o,Cl:s,Dh:c,Dl:l,Eh:u,El:d,Fh:f,Fl:p,Gh:m,Gl:h,Hh:g,Hl:_}=this;for(let e=0;e<80;e++){let t=V(u,d,14)^V(u,d,18)^U(u,d,41),v=H(u,d,14)^H(u,d,18)^W(u,d,41),y=u&f^~u&m,b=d&p^~d&h,x=he(_,v,b,be[e],X[e]),S=ge(x,g,t,y,ye[e],Y[e]),C=x|0,w=V(n,r,28)^U(n,r,34)^U(n,r,39),T=H(n,r,28)^W(n,r,34)^W(n,r,39),E=n&i^n&o^i&o,D=r&a^r&s^a&s;g=m|0,_=h|0,m=f|0,h=p|0,f=u|0,p=d|0,{h:u,l:d}=K(c|0,l|0,S|0,C|0),c=o|0,l=s|0,o=i|0,s=a|0,i=n|0,a=r|0;let O=de(C,T,D);n=fe(O,S,w,E),r=O|0}({h:n,l:r}=K(this.Ah|0,this.Al|0,n|0,r|0)),{h:i,l:a}=K(this.Bh|0,this.Bl|0,i|0,a|0),{h:o,l:s}=K(this.Ch|0,this.Cl|0,o|0,s|0),{h:c,l}=K(this.Dh|0,this.Dl|0,c|0,l|0),{h:u,l:d}=K(this.Eh|0,this.El|0,u|0,d|0),{h:f,l:p}=K(this.Fh|0,this.Fl|0,f|0,p|0),{h:m,l:h}=K(this.Gh|0,this.Gl|0,m|0,h|0),{h:g,l:_}=K(this.Hh|0,this.Hl|0,g|0,_|0),this.set(n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_)}roundClean(){_(Y,X)}destroy(){_(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}},xe=class extends Z{constructor(){super(48),this.Ah=P[0]|0,this.Al=P[1]|0,this.Bh=P[2]|0,this.Bl=P[3]|0,this.Ch=P[4]|0,this.Cl=P[5]|0,this.Dh=P[6]|0,this.Dl=P[7]|0,this.Eh=P[8]|0,this.El=P[9]|0,this.Fh=P[10]|0,this.Fl=P[11]|0,this.Gh=P[12]|0,this.Gl=P[13]|0,this.Hh=P[14]|0,this.Hl=P[15]|0}};const Q=j(()=>new ve),Se=j(()=>new Z),Ce=j(()=>new xe),$=Q;function we(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 Te=e({default:()=>De});function Ee(e){return $($(e))}var De=we(Ee);function Oe(e){let t=e;for(;t&&!(t.encode&&t.decode&&t.decodeUnsafe)&&t.default;)t=t.default;return t}Oe(Te);export{C,r as D,i as E,n as O,re as S,g as T,_,ue as a,ee as b,le as c,f as d,m as f,E as g,h,Se as i,R as l,d as m,Q as n,G as o,p,Ce as r,ce as s,$ as t,A as u,ne as v,k as w,u as x,j as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{_ as e,d as t,f as n,p as r,u as i,w as a}from"./dist-w03V0QPF.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};
|