menese-shielded-icp 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/README.md +149 -2
- package/WASM-HASHES.txt +2 -0
- package/dist/account.d.ts +22 -0
- package/dist/account.d.ts.map +1 -0
- package/dist/account.js +57 -0
- package/dist/account.js.map +1 -0
- package/dist/claim-scan.d.ts +18 -0
- package/dist/claim-scan.d.ts.map +1 -0
- package/dist/claim-scan.js +101 -0
- package/dist/claim-scan.js.map +1 -0
- package/dist/claim-scan.worker.d.ts +2 -0
- package/dist/claim-scan.worker.d.ts.map +1 -0
- package/dist/claim-scan.worker.js +28 -0
- package/dist/claim-scan.worker.js.map +1 -0
- package/dist/claims.d.ts +125 -0
- package/dist/claims.d.ts.map +1 -0
- package/dist/claims.js +510 -0
- package/dist/claims.js.map +1 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +46 -0
- package/dist/config.js.map +1 -0
- package/dist/declarations/zk_ledger.did.d.ts +4 -0
- package/dist/declarations/zk_ledger.did.js +679 -0
- package/dist/declarations/zk_ledger_h.did.d.ts +4 -0
- package/dist/declarations/zk_ledger_h.did.js +743 -0
- package/dist/declarations/zk_ledger_h.types.d.ts +636 -0
- package/dist/enabled.d.ts +10 -0
- package/dist/enabled.d.ts.map +1 -0
- package/dist/enabled.js +36 -0
- package/dist/enabled.js.map +1 -0
- package/dist/engine.d.ts +135 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +798 -0
- package/dist/engine.js.map +1 -0
- package/dist/envelope.d.ts +27 -0
- package/dist/envelope.d.ts.map +1 -0
- package/dist/envelope.js +87 -0
- package/dist/envelope.js.map +1 -0
- package/dist/hex.d.ts +7 -0
- package/dist/hex.d.ts.map +1 -0
- package/dist/hex.js +30 -0
- package/dist/hex.js.map +1 -0
- package/dist/ic.d.ts +130 -0
- package/dist/ic.d.ts.map +1 -0
- package/dist/ic.js +135 -0
- package/dist/ic.js.map +1 -0
- package/dist/index.d.ts +11 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -0
- package/dist/keyset-cache.d.ts +27 -0
- package/dist/keyset-cache.d.ts.map +1 -0
- package/dist/keyset-cache.js +101 -0
- package/dist/keyset-cache.js.map +1 -0
- package/dist/keyset.d.ts +29 -0
- package/dist/keyset.d.ts.map +1 -0
- package/dist/keyset.js +228 -0
- package/dist/keyset.js.map +1 -0
- package/dist/mainnet.d.ts +8 -0
- package/dist/mainnet.d.ts.map +1 -0
- package/dist/mainnet.js +17 -0
- package/dist/mainnet.js.map +1 -0
- package/dist/node-worker.d.ts +2 -0
- package/dist/node-worker.d.ts.map +1 -0
- package/dist/node-worker.js +29 -0
- package/dist/node-worker.js.map +1 -0
- package/dist/node.d.ts +22 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +89 -0
- package/dist/node.js.map +1 -0
- package/dist/plan.d.ts +31 -0
- package/dist/plan.d.ts.map +1 -0
- package/dist/plan.js +112 -0
- package/dist/plan.js.map +1 -0
- package/dist/pool-interface.d.ts +30 -0
- package/dist/pool-interface.d.ts.map +1 -0
- package/dist/pool-interface.js +123 -0
- package/dist/pool-interface.js.map +1 -0
- package/dist/proof-work.d.ts +21 -0
- package/dist/proof-work.d.ts.map +1 -0
- package/dist/proof-work.js +194 -0
- package/dist/proof-work.js.map +1 -0
- package/dist/prover-module.d.ts +8 -0
- package/dist/prover-module.d.ts.map +1 -0
- package/dist/prover-module.js +2 -0
- package/dist/prover-module.js.map +1 -0
- package/dist/prover.worker.d.ts +2 -0
- package/dist/prover.worker.d.ts.map +1 -0
- package/dist/prover.worker.js +54 -0
- package/dist/prover.worker.js.map +1 -0
- package/dist/receipt-core.d.ts +100 -0
- package/dist/receipt-core.d.ts.map +1 -0
- package/dist/receipt-core.js +394 -0
- package/dist/receipt-core.js.map +1 -0
- package/dist/receipt.d.ts +11 -0
- package/dist/receipt.d.ts.map +1 -0
- package/dist/receipt.js +34 -0
- package/dist/receipt.js.map +1 -0
- package/dist/types.d.ts +53 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +28 -0
- package/dist/types.js.map +1 -0
- package/dist/wallet.d.ts +296 -0
- package/dist/wallet.d.ts.map +1 -0
- package/dist/wallet.js +1114 -0
- package/dist/wallet.js.map +1 -0
- package/dist/wasm/claim-scan/claim_scan_wasm.d.ts +60 -0
- package/dist/wasm/claim-scan/claim_scan_wasm.js +248 -0
- package/dist/wasm/claim-scan/claim_scan_wasm_bg.wasm +0 -0
- package/dist/wasm/claim-scan/claim_scan_wasm_bg.wasm.d.ts +12 -0
- package/dist/wasm/prover/pool_prover_wasm.d.ts +121 -0
- package/dist/wasm/prover/pool_prover_wasm.js +661 -0
- package/dist/wasm/prover/pool_prover_wasm_bg.wasm +0 -0
- package/dist/wasm/prover/pool_prover_wasm_bg.wasm.d.ts +24 -0
- package/dist/wasm/prover/snippets/pool-prover-wasm-4952962d09f2354a/inline0.js +1 -0
- package/dist/worker-protocol.d.ts +65 -0
- package/dist/worker-protocol.d.ts.map +1 -0
- package/dist/worker-protocol.js +5 -0
- package/dist/worker-protocol.js.map +1 -0
- package/package.json +116 -5
- package/tools/split-zk-keys.mjs +49 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Menese DeFi Team
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,150 @@
|
|
|
1
|
-
#
|
|
1
|
+
# menese-shielded-icp
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Private ICP for Internet Computer wallets. A user moves ICP into a private balance, sends it privately to
|
|
4
|
+
any principal, and moves it back out. Amounts, balances and who paid whom are never written to any ledger.
|
|
5
|
+
|
|
6
|
+
- **Make private**: ICP goes into a private balance on the Menese shielded ledger.
|
|
7
|
+
- **Send privately**: straight into the recipient's private balance, or, if they have never used one, as a
|
|
8
|
+
claimable payment they pick up at their next sign-in. The sender can take an unclaimed payment back.
|
|
9
|
+
- **Move out**: back to the user's own ICP account.
|
|
10
|
+
- **Receipts**: either side of a payment can prove that one payment to a third party, and the check needs
|
|
11
|
+
no keys at all.
|
|
12
|
+
|
|
13
|
+
Proofs are made on the user's device. The account's keys derive from the wallet's own sign-in through
|
|
14
|
+
vetKeys, live only in memory, and derive again on any device the user signs in on.
|
|
15
|
+
|
|
16
|
+
The package is strict TypeScript on `@icp-sdk/core`, built and linted with the same toolchain and
|
|
17
|
+
`@dfinity/eslint-config-oisy-wallet` rules as OISY.
|
|
18
|
+
|
|
19
|
+
## The ledger it talks to
|
|
20
|
+
|
|
21
|
+
| Canister | ID |
|
|
22
|
+
| --------------------- | ----------------------------- |
|
|
23
|
+
| shielded ledger (ICP) | `3pwrb-oiaaa-aaaao-bbqba-cai` |
|
|
24
|
+
| shielded directory | `3gv25-yaaaa-aaaao-bbqaq-cai` |
|
|
25
|
+
| ICP ledger | `ryjl3-tyaaa-aaaaa-aaaba-cai` |
|
|
26
|
+
|
|
27
|
+
Both canisters are controlled by the Menese Privacy SNS (root `cwoow-saaaa-aaaaq-aafiq-cai`); every
|
|
28
|
+
change to them is a DAO proposal. Their source, the reproducible builds and the 25-contributor trusted-setup
|
|
29
|
+
ceremony are public in
|
|
30
|
+
[Menese-Protocol/Shielded-Ledger-Hivemind](https://github.com/Menese-Protocol/Shielded-Ledger-Hivemind) and
|
|
31
|
+
[Menese-Protocol/Menese-Private-Swaps](https://github.com/Menese-Protocol/Menese-Private-Swaps).
|
|
32
|
+
|
|
33
|
+
### Fees
|
|
34
|
+
|
|
35
|
+
The ledger charges the same fees to every app:
|
|
36
|
+
|
|
37
|
+
| Action | Fee |
|
|
38
|
+
| ----------------- | ------------------------------------- |
|
|
39
|
+
| make private | free (only the ICP ledger's own fees) |
|
|
40
|
+
| private send | 0.1 ICP |
|
|
41
|
+
| claimable payment | 0.3 ICP in total, paid by the sender |
|
|
42
|
+
| move out | ICP network fee + 0.3% of the amount |
|
|
43
|
+
|
|
44
|
+
`engine.quote(...)` returns the exact cost of an action before the user confirms it.
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
```sh
|
|
49
|
+
npm install menese-shielded-icp
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Peer dependencies: `@icp-sdk/core` (4 or 5) and `@dfinity/vetkeys` 0.4.0. Dependencies: `tweetnacl` and
|
|
53
|
+
`@noble/hashes`.
|
|
54
|
+
|
|
55
|
+
## Use it (Vite)
|
|
56
|
+
|
|
57
|
+
```ts
|
|
58
|
+
import { PrivateEngine, mainnet } from 'menese-shielded-icp';
|
|
59
|
+
import ProverWorker from 'menese-shielded-icp/workers/prover?worker';
|
|
60
|
+
import ClaimScanWorker from 'menese-shielded-icp/workers/claim-scan?worker';
|
|
61
|
+
import proverWasm from 'menese-shielded-icp/wasm/prover.wasm?url';
|
|
62
|
+
import claimScanWasm from 'menese-shielded-icp/wasm/claim-scan.wasm?url';
|
|
63
|
+
|
|
64
|
+
const engine = new PrivateEngine({
|
|
65
|
+
network: mainnet({ keysBase: '/zk-keys' }),
|
|
66
|
+
identity, // the signed-in user's Identity
|
|
67
|
+
workers: { prover: () => new ProverWorker(), claimScan: () => new ClaimScanWorker() },
|
|
68
|
+
wasm: { prover: proverWasm, claimScan: claimScanWasm }
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
await engine.open(); // derive this account's keys (vetKeys)
|
|
72
|
+
const snapshot = await engine.sync(); // private balance, incoming claimable payments, pending sends
|
|
73
|
+
|
|
74
|
+
await engine.makePrivate({ amountE8s: 100_000_000n, onProgress });
|
|
75
|
+
const quote = await engine.quote({ kind: 'send', amountE8s: 50_000_000n, to: recipient });
|
|
76
|
+
const { reference } = await engine.sendPrivately({
|
|
77
|
+
to: recipient,
|
|
78
|
+
amountE8s: 50_000_000n,
|
|
79
|
+
onProgress
|
|
80
|
+
});
|
|
81
|
+
await engine.claim({ paymentId: snapshot.incoming[0].id, onProgress });
|
|
82
|
+
await engine.moveOut({ amountE8s: 25_000_000n, onProgress });
|
|
83
|
+
engine.close();
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
The engine compiles each wasm module once and hands the compiled module to its workers, so nothing
|
|
87
|
+
depends on resolving a path inside `node_modules` at run time. The workers are ES modules.
|
|
88
|
+
|
|
89
|
+
`onProgress` receives `{ step, fraction }` with `step` one of `keys`, `prepare`, `approve`, `prove`,
|
|
90
|
+
`submit`, `confirm`: the one-time key download, any note preparation, the ICP allowance, the proof, the
|
|
91
|
+
submission and the final sync.
|
|
92
|
+
|
|
93
|
+
`isPrivateEnabled({ network, principal })` answers with one anonymous query whether an account has a
|
|
94
|
+
private balance, without loading the engine.
|
|
95
|
+
|
|
96
|
+
### Content Security Policy
|
|
97
|
+
|
|
98
|
+
The page needs `'wasm-unsafe-eval'` in `script-src`, workers from `'self'`, and `connect-src` to
|
|
99
|
+
`https://icp-api.io` and wherever the proving keys are served.
|
|
100
|
+
|
|
101
|
+
### Serving the proving keys
|
|
102
|
+
|
|
103
|
+
Proofs need the ceremony's proving keys (8.9 MB, downloaded once per device and cached in IndexedDB).
|
|
104
|
+
Prepare them for serving from the ledger repository's `ceremony-launch-p14/final/`:
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
npx shielded-icp-split-keys <ledger repo>/ceremony-launch-p14/final static/zk-keys
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
The tool checks every file against the ceremony manifest and splits the large key into 1 MiB parts. The
|
|
111
|
+
client checks them again before use, against the manifest and against the verifying keys the ledger
|
|
112
|
+
certifies on chain. A changed or substituted key is refused, whoever serves it.
|
|
113
|
+
|
|
114
|
+
## Security model
|
|
115
|
+
|
|
116
|
+
- **Keys.** The spend and note-opening keys derive from a vetKey bound to the user's principal. The
|
|
117
|
+
browser verifies the vetKey against a key it derives itself from the IC's master public key and the
|
|
118
|
+
directory's canister id, so a directory reporting another key is refused. Nothing secret is written
|
|
119
|
+
to storage. The note cache is sealed with a vetKey-derived key.
|
|
120
|
+
- **What leaves the device.** Private transfers are submitted from a fresh one-time identity each time,
|
|
121
|
+
so the user's principal never appears on them. Address lookups and log reads are anonymous and read
|
|
122
|
+
whole pages. Only "make private" and "move out" are signed by the user, because the ICP ledger records
|
|
123
|
+
those transfers anyway.
|
|
124
|
+
- **Proving keys.** They are bound to the ledger's certified verifying-key anchor (see above). The ledger
|
|
125
|
+
refuses to prove against keys that are not frozen.
|
|
126
|
+
- **Interface upgrades.** The client reads the interface the pool publishes (certified metadata) and
|
|
127
|
+
encodes each call for it, and refuses a pool whose interface it does not know.
|
|
128
|
+
|
|
129
|
+
## Verify this package
|
|
130
|
+
|
|
131
|
+
```sh
|
|
132
|
+
npm ci
|
|
133
|
+
npm run check # strict TypeScript
|
|
134
|
+
npm run lint # @dfinity/eslint-config-oisy-wallet
|
|
135
|
+
npm test # unit tests, including values computed by the ledger's own ProofGate.mo
|
|
136
|
+
npm run test:planted # each guarded rule broken on purpose; the named test must fail every time
|
|
137
|
+
npm run build # dist/, with the bindings and wasm checked against their recorded hashes
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
The two wasm modules rebuild byte for byte from source with `tools/build-wasm.sh <ledger repo>` (pinned
|
|
141
|
+
Rust 1.95.0, wasm-pack 0.13.1, wasm-opt 123). Their hashes are in `WASM-HASHES.txt`.
|
|
142
|
+
|
|
143
|
+
`npm run test:acceptance` runs the package, built, against the real ledger and directory modules on
|
|
144
|
+
PocketIC: make private, private send, claimable send and claim, receipts and move out, with exact
|
|
145
|
+
balances and the pool's books after every step, across the pool's interface upgrades. It needs the
|
|
146
|
+
module files and the `MENESE_SDK_REPO` checkout named at the top of `test/pocketic/acceptance.mts`.
|
|
147
|
+
|
|
148
|
+
## License
|
|
149
|
+
|
|
150
|
+
MIT. Built by the Menese DeFi Team.
|
package/WASM-HASHES.txt
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type VetKey } from '@dfinity/vetkeys';
|
|
2
|
+
import type { Principal } from '@icp-sdk/core/principal';
|
|
3
|
+
import type { DirectoryActor } from './ic.js';
|
|
4
|
+
import type { ProverModule } from './prover-module.js';
|
|
5
|
+
export interface ShieldedAccount {
|
|
6
|
+
nk: string;
|
|
7
|
+
pk: string;
|
|
8
|
+
encPk: Uint8Array;
|
|
9
|
+
encSk: Uint8Array;
|
|
10
|
+
cacheKey: Uint8Array;
|
|
11
|
+
birthdayKey: Uint8Array;
|
|
12
|
+
custody: 'ii-vetkey';
|
|
13
|
+
vetKey: VetKey;
|
|
14
|
+
birthday: number | null;
|
|
15
|
+
}
|
|
16
|
+
export type AccountProver = Pick<ProverModule, 'field_from_seed' | 'shielded_address'>;
|
|
17
|
+
export declare const vetkeyShieldedAccountFor: (wasm: AccountProver, actors: {
|
|
18
|
+
principal: Principal;
|
|
19
|
+
directory: DirectoryActor;
|
|
20
|
+
}, birthday?: number | null) => Promise<ShieldedAccount>;
|
|
21
|
+
export declare const encPkHex: (encPk: Uint8Array) => string;
|
|
22
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAMA,OAAO,EAAuC,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACpF,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAGzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAC9C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAEvD,MAAM,WAAW,eAAe;IAE/B,EAAE,EAAE,MAAM,CAAC;IAEX,EAAE,EAAE,MAAM,CAAC;IAEX,KAAK,EAAE,UAAU,CAAC;IAClB,KAAK,EAAE,UAAU,CAAC;IAElB,QAAQ,EAAE,UAAU,CAAC;IAErB,WAAW,EAAE,UAAU,CAAC;IACxB,OAAO,EAAE,WAAW,CAAC;IAErB,MAAM,EAAE,MAAM,CAAC;IAEf,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAGD,MAAM,MAAM,aAAa,GAAG,IAAI,CAAC,YAAY,EAAE,iBAAiB,GAAG,kBAAkB,CAAC,CAAC;AAMvF,eAAO,MAAM,wBAAwB,GACpC,MAAM,aAAa,EACnB,QAAQ;IAAE,SAAS,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,cAAc,CAAA;CAAE,EAC3D,WAAU,MAAM,GAAG,IAAW,KAC5B,OAAO,CAAC,eAAe,CA0CzB,CAAC;AAEF,eAAO,MAAM,QAAQ,GAAI,OAAO,UAAU,KAAG,MACsB,CAAC"}
|
package/dist/account.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// Shielded account keys.
|
|
2
|
+
//
|
|
3
|
+
// The directory asks the IC's vetKey system for a deterministic principal-bound key, encrypted to a
|
|
4
|
+
// fresh one-use browser transport key. The browser verifies it and derives the spend and note-opening
|
|
5
|
+
// keys in memory. The wallet's own sign-in key is never exported, and no shielded secret is persisted.
|
|
6
|
+
// Signing in with the same identity on any device derives the identical keys again.
|
|
7
|
+
import { EncryptedVetKey, TransportSecretKey } from '@dfinity/vetkeys';
|
|
8
|
+
import nacl from 'tweetnacl';
|
|
9
|
+
import { directoryKey } from './envelope.js';
|
|
10
|
+
const asBytes = (value) => new Uint8Array(value);
|
|
11
|
+
/// Recover the same account on any device authenticated as the same principal. The transport
|
|
12
|
+
/// secret and derived seeds are deliberately ephemeral; only public keys are returned on-chain.
|
|
13
|
+
export const vetkeyShieldedAccountFor = async (wasm, actors, birthday = null) => {
|
|
14
|
+
const input = asBytes(actors.principal.toUint8Array());
|
|
15
|
+
const transport = TransportSecretKey.random();
|
|
16
|
+
// The key the vetKey must verify under is derived from the IC master key, not taken on trust.
|
|
17
|
+
const [derivedPublicKey, encryptedResult] = await Promise.all([
|
|
18
|
+
directoryKey(actors.directory),
|
|
19
|
+
actors.directory.derive_shielded_key(transport.publicKeyBytes())
|
|
20
|
+
]);
|
|
21
|
+
if ('err' in encryptedResult) {
|
|
22
|
+
throw new Error(`vetKey derivation failed: ${encryptedResult.err}`);
|
|
23
|
+
}
|
|
24
|
+
const encryptedVetKey = EncryptedVetKey.deserialize(asBytes(encryptedResult.ok));
|
|
25
|
+
const vetKey = encryptedVetKey.decryptAndVerify(transport, derivedPublicKey, input);
|
|
26
|
+
const nkSeed = vetKey.deriveSymmetricKey('picp-shielded-account/nk/v1', 64);
|
|
27
|
+
const encSeed = vetKey.deriveSymmetricKey('picp-shielded-account/x25519/v1', 32);
|
|
28
|
+
// Symmetric key for the encrypted local cache (wallet.saveCache): principal-bound and session-
|
|
29
|
+
// derived, so another principal's cache fails authentication and only this session can read it.
|
|
30
|
+
const cacheKey = vetKey.deriveSymmetricKey('picp-shielded-account/cache/v1', 32);
|
|
31
|
+
// Symmetric key for the DIRECTORY-held sealed birthday record (wallet.recoverBirthday /
|
|
32
|
+
// publishBirthday) — its own info-string, so it is independent of the cache key (a directory
|
|
33
|
+
// record can never be opened with the cache key or vice versa) and reproducible with no local
|
|
34
|
+
// state on any device that authenticates as this principal. Session-lifetime like cacheKey.
|
|
35
|
+
const birthdayKey = vetKey.deriveSymmetricKey('picp-shielded-account/birthday/v1', 32);
|
|
36
|
+
try {
|
|
37
|
+
const nk = wasm.field_from_seed(nkSeed);
|
|
38
|
+
const pair = nacl.box.keyPair.fromSecretKey(encSeed);
|
|
39
|
+
return {
|
|
40
|
+
nk,
|
|
41
|
+
pk: wasm.shielded_address(nk),
|
|
42
|
+
encPk: pair.publicKey,
|
|
43
|
+
encSk: pair.secretKey,
|
|
44
|
+
cacheKey: new Uint8Array(cacheKey),
|
|
45
|
+
birthdayKey: new Uint8Array(birthdayKey),
|
|
46
|
+
custody: 'ii-vetkey',
|
|
47
|
+
vetKey,
|
|
48
|
+
birthday
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
nkSeed.fill(0);
|
|
53
|
+
encSeed.fill(0);
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
export const encPkHex = (encPk) => Array.from(encPk, (b) => b.toString(16).padStart(2, '0')).join('');
|
|
57
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../src/account.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,EAAE;AACF,oGAAoG;AACpG,sGAAsG;AACtG,uGAAuG;AACvG,oFAAoF;AACpF,OAAO,EAAE,eAAe,EAAE,kBAAkB,EAAe,MAAM,kBAAkB,CAAC;AAEpF,OAAO,IAAI,MAAM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AC,gCAAgC,EAAE,EAAE,CAAC,CAAC;IACjF,wFAAwF;IACxF,6FAA6F;IAC7F,8FAA8F;IAC9F,4FAA4F;IAC5F,MAAM,WAAW,GAAG,MAAM,CAAC,kBAAkB,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC;IACvF,IAAI,CAAC;QACJ,MAAM,EAAE,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;QACxC,MAAM,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACrD,OAAO;YACN,EAAE;YACF,EAAE,EAAE,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC7B,KAAK,EAAE,IAAI,CAAC,SAAS;YACrB,KAAK,EAAE,IAAI,CAAC,SAAS;YACrB,QAAQ,EAAE,IAAI,UAAU,CAAC,QAAQ,CAAC;YAClC,WAAW,EAAE,IAAI,UAAU,CAAC,WAAW,CAAC;YACxC,OAAO,EAAE,WAAW;YACpB,MAAM;YACN,QAAQ;SACR,CAAC;IACH,CAAC;YAAS,CAAC;QACV,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QACf,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACjB,CAAC;AACF,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,KAAiB,EAAU,EAAE,CACrD,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { VetKey } from '@dfinity/vetkeys';
|
|
2
|
+
import type { EnvelopeScanner } from './claims.js';
|
|
3
|
+
import type { ClaimScanRequest, ClaimScanResponse, WorkerLike } from './worker-protocol.js';
|
|
4
|
+
export declare const ENVELOPE_LEN = 216;
|
|
5
|
+
export interface ScanPool extends EnvelopeScanner {
|
|
6
|
+
workers: number;
|
|
7
|
+
scan(envelopes: Uint8Array[], options?: {
|
|
8
|
+
onChunk?: ((found: number[], done: number) => void) | null;
|
|
9
|
+
}): Promise<number[]>;
|
|
10
|
+
close(): void;
|
|
11
|
+
}
|
|
12
|
+
export declare const createScanPool: ({ vetKey, wasm, makeWorker, workers }: {
|
|
13
|
+
vetKey: VetKey | Uint8Array;
|
|
14
|
+
wasm: WebAssembly.Module | BufferSource;
|
|
15
|
+
makeWorker: () => WorkerLike<ClaimScanRequest, ClaimScanResponse>;
|
|
16
|
+
workers?: number | null;
|
|
17
|
+
}) => Promise<ScanPool>;
|
|
18
|
+
//# sourceMappingURL=claim-scan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim-scan.d.ts","sourceRoot":"","sources":["../src/claim-scan.ts"],"names":[],"mappings":"AAcA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAE5F,eAAO,MAAM,YAAY,MAAM,CAAC;AAMhC,MAAM,WAAW,QAAS,SAAQ,eAAe;IAChD,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,CACH,SAAS,EAAE,UAAU,EAAE,EACvB,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC,GAAG,IAAI,CAAA;KAAE,GACtE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;IACrB,KAAK,IAAI,IAAI,CAAC;CACd;AAED,eAAO,MAAM,cAAc,GAAU,uCAKlC;IACF,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5B,IAAI,EAAE,WAAW,CAAC,MAAM,GAAG,YAAY,CAAC;IACxC,UAAU,EAAE,MAAM,UAAU,CAAC,gBAAgB,EAAE,iBAAiB,CAAC,CAAC;IAClE,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB,KAAG,OAAO,CAAC,QAAQ,CA6GnB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
export const ENVELOPE_LEN = 216;
|
|
2
|
+
// Envelopes per message: about four messages per worker (so the cores stay balanced), between 8 and
|
|
3
|
+
// 128 (a message costs well under one envelope's work).
|
|
4
|
+
const chunkFor = (n, workers) => Math.max(8, Math.min(128, Math.ceil(n / (workers * 4))));
|
|
5
|
+
export const createScanPool = async ({ vetKey, wasm, makeWorker, workers = null }) => {
|
|
6
|
+
const count = Math.max(1, Math.min(workers ?? (globalThis.navigator?.hardwareConcurrency || 4), 16));
|
|
7
|
+
const key = vetKey instanceof Uint8Array ? vetKey : vetKey.serialize();
|
|
8
|
+
const pending = new Map();
|
|
9
|
+
let nextId = 0;
|
|
10
|
+
const pool = [];
|
|
11
|
+
await Promise.all(Array.from({ length: count }, () => new Promise((resolve, reject) => {
|
|
12
|
+
const worker = makeWorker();
|
|
13
|
+
worker.onmessage = (event) => {
|
|
14
|
+
const m = event.data;
|
|
15
|
+
if (m.type === 'ready') {
|
|
16
|
+
pool.push(worker);
|
|
17
|
+
resolve();
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
const job = pending.get(m.id);
|
|
21
|
+
if (job === undefined) {
|
|
22
|
+
if (m.type === 'error') {
|
|
23
|
+
reject(new Error(m.error));
|
|
24
|
+
}
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
pending.delete(m.id);
|
|
28
|
+
if (m.type === 'error') {
|
|
29
|
+
job.reject(new Error(m.error));
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
job.resolve(m.found);
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
worker.onerror = (e) => reject(e.error instanceof Error ? e.error : new Error(e.message));
|
|
36
|
+
worker.postMessage({ type: 'init', wasm, vetKey: key });
|
|
37
|
+
})));
|
|
38
|
+
const idle = [...pool];
|
|
39
|
+
const waiting = [];
|
|
40
|
+
const acquire = () => {
|
|
41
|
+
const w = idle.pop();
|
|
42
|
+
return w === undefined ? new Promise((r) => waiting.push(r)) : Promise.resolve(w);
|
|
43
|
+
};
|
|
44
|
+
const release = (w) => {
|
|
45
|
+
const next = waiting.shift();
|
|
46
|
+
if (next === undefined) {
|
|
47
|
+
idle.push(w);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
next(w);
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
const scanChunk = async (envelopes, base) => {
|
|
54
|
+
const buf = new Uint8Array(envelopes.length * ENVELOPE_LEN);
|
|
55
|
+
envelopes.forEach((e, i) => {
|
|
56
|
+
if (e.length !== ENVELOPE_LEN) {
|
|
57
|
+
throw new Error(`envelope ${base + i} is ${e.length} bytes`);
|
|
58
|
+
}
|
|
59
|
+
buf.set(e, i * ENVELOPE_LEN);
|
|
60
|
+
});
|
|
61
|
+
const worker = await acquire();
|
|
62
|
+
try {
|
|
63
|
+
const id = nextId++;
|
|
64
|
+
const found = await new Promise((resolve, reject) => {
|
|
65
|
+
pending.set(id, { resolve, reject });
|
|
66
|
+
worker.postMessage({ type: 'scan', id, envelopes: buf.buffer }, [buf.buffer]);
|
|
67
|
+
});
|
|
68
|
+
return found.map((i) => base + i);
|
|
69
|
+
}
|
|
70
|
+
finally {
|
|
71
|
+
release(worker);
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
return {
|
|
75
|
+
workers: count,
|
|
76
|
+
/// Indices (into `envelopes`) of those that open with the vetKey, each fully verified, in
|
|
77
|
+
/// ascending order. `onChunk(found, done)` fires as chunks finish, in completion order.
|
|
78
|
+
scan: async (envelopes, { onChunk = null } = {}) => {
|
|
79
|
+
let done = 0;
|
|
80
|
+
const jobs = [];
|
|
81
|
+
const chunk = chunkFor(envelopes.length, count);
|
|
82
|
+
for (let s = 0; s < envelopes.length; s += chunk) {
|
|
83
|
+
const part = envelopes.slice(s, s + chunk);
|
|
84
|
+
jobs.push(scanChunk(part, s).then((found) => {
|
|
85
|
+
done += part.length;
|
|
86
|
+
if (onChunk !== null) {
|
|
87
|
+
onChunk(found, done);
|
|
88
|
+
}
|
|
89
|
+
return found;
|
|
90
|
+
}));
|
|
91
|
+
}
|
|
92
|
+
return (await Promise.all(jobs)).flat().sort((a, b) => a - b);
|
|
93
|
+
},
|
|
94
|
+
close: () => {
|
|
95
|
+
for (const w of pool) {
|
|
96
|
+
w.terminate();
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=claim-scan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim-scan.js","sourceRoot":"","sources":["../src/claim-scan.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAAC;AAChC,oGAAoG;AACpG,wDAAwD;AACxD,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,OAAe,EAAU,EAAE,CACvD,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAW1D,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,EAAE,EACpC,MAAM,EACN,IAAI,EACJ,UAAU,EACV,OAAO,GAAG,IAAI,EAMd,EAAqB,EAAE;IACvB,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CACrB,CAAC,EACD,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,EAAE,mBAAmB,IAAI,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,CAAC;YACb,MAAM,IAAI,GAAwB,EAAE,CAAC;YACrC,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC;YAChD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,EAAE,CAAC,IAAI,KAAK,EAAE,CAAC;gBAClD,MAAM,IAAI,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC;gBAC3C,IAAI,CAAC,IAAI,CACR,SAAS,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,EAAE;oBACjC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC;oBACpB,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;wBACtB,OAAO,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;oBACtB,CAAC;oBACD,OAAO,KAAK,CAAC;gBACd,CAAC,CAAC,CACF,CAAC;YACH,CAAC;YACD,OAAO,CAAC,MAAM,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QAC/D,CAAC;QACD,KAAK,EAAE,GAAG,EAAE;YACX,KAAK,MAAM,CAAC,IAAI,IAAI,EAAE,CAAC;gBACtB,CAAC,CAAC,SAAS,EAAE,CAAC;YACf,CAAC;QACF,CAAC;KACD,CAAC;AACH,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim-scan.worker.d.ts","sourceRoot":"","sources":["../src/claim-scan.worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
// One claim-scan worker (claim-scan.ts).
|
|
2
|
+
// Holds the recipient's vetKey inside a claim-scan-wasm Scanner and answers scan requests with the
|
|
3
|
+
// indices of envelopes that open, each fully verified (claim-scan-wasm/src/lib.rs).
|
|
4
|
+
import { initSync, Scanner } from './wasm/claim-scan/claim_scan_wasm.js';
|
|
5
|
+
import { errorMessage } from './worker-protocol.js';
|
|
6
|
+
const scope = globalThis;
|
|
7
|
+
let scanner = null;
|
|
8
|
+
scope.onmessage = (event) => {
|
|
9
|
+
const msg = event.data;
|
|
10
|
+
try {
|
|
11
|
+
if (msg.type === 'init') {
|
|
12
|
+
initSync({ module: msg.wasm });
|
|
13
|
+
scanner = new Scanner(new Uint8Array(msg.vetKey));
|
|
14
|
+
scope.postMessage({ type: 'ready' });
|
|
15
|
+
}
|
|
16
|
+
else {
|
|
17
|
+
if (scanner === null) {
|
|
18
|
+
throw new Error('claim scanner not started');
|
|
19
|
+
}
|
|
20
|
+
const found = Array.from(scanner.scan(new Uint8Array(msg.envelopes)));
|
|
21
|
+
scope.postMessage({ type: 'result', id: msg.id, found });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
catch (error) {
|
|
25
|
+
scope.postMessage({ type: 'error', id: 'id' in msg ? msg.id : -1, error: errorMessage(error) });
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=claim-scan.worker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claim-scan.worker.js","sourceRoot":"","sources":["../src/claim-scan.worker.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,mGAAmG;AACnG,oFAAoF;AACpF,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAiD,MAAM,sBAAsB,CAAC;AAMnG,MAAM,KAAK,GAAG,UAAoC,CAAC;AAEnD,IAAI,OAAO,GAAmB,IAAI,CAAC;AAEnC,KAAK,CAAC,SAAS,GAAG,CAAC,KAAK,EAAE,EAAE;IAC3B,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC;IACvB,IAAI,CAAC;QACJ,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;YACzB,QAAQ,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC;YAC/B,OAAO,GAAG,IAAI,OAAO,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC;YAClD,KAAK,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;QACtC,CAAC;aAAM,CAAC;YACP,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACtB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;YAC9C,CAAC;YACD,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;YACtE,KAAK,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1D,CAAC;IACF,CAAC;IAAC,OAAO,KAAc,EAAE,CAAC;QACzB,KAAK,CAAC,WAAW,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,IAAI,IAAI,GAAG,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACjG,CAAC;AACF,CAAC,CAAC"}
|
package/dist/claims.d.ts
ADDED
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { type DerivedPublicKey, type VetKey } from '@dfinity/vetkeys';
|
|
2
|
+
import { Principal } from '@icp-sdk/core/principal';
|
|
3
|
+
import nacl from 'tweetnacl';
|
|
4
|
+
import type { ShieldedAccount } from './account.js';
|
|
5
|
+
import { type DirectoryActor } from './ic.js';
|
|
6
|
+
import type { PoolActor } from './pool-interface.js';
|
|
7
|
+
import type { ProverModule } from './prover-module.js';
|
|
8
|
+
import { type OrderId, type OwnedNote, type PayFields, type ProvedTransfer, type SpendKeys } from './wallet.js';
|
|
9
|
+
export { CLAIM_ENVELOPE_LEN, CLAIM_PAYLOAD_LEN, claimBinding, decoyEnvelope, decoyFor, sealClaim } from './envelope.js';
|
|
10
|
+
type Wasm = Pick<ProverModule, 'field_from_seed' | 'shielded_address' | 'note_commitment_hex' | 'note_nullifier_hex' | 'random_field'>;
|
|
11
|
+
type MutationResult = Awaited<ReturnType<PoolActor['shield']>>;
|
|
12
|
+
export declare const oneTimeKey: (wasm: Pick<ProverModule, "field_from_seed" | "shielded_address">, senderNkHex: string, firstNfHex: string) => {
|
|
13
|
+
nk: string;
|
|
14
|
+
pk: string;
|
|
15
|
+
};
|
|
16
|
+
export declare const claimRcm: (wasm: Pick<ProverModule, "field_from_seed">, senderNkHex: string, nfHex: string) => string;
|
|
17
|
+
export declare const claimPaySeed: (senderNkHex: string, nfHex: string) => string;
|
|
18
|
+
export declare const claimNoteBox: (otkNkHex: string) => nacl.BoxKeyPair;
|
|
19
|
+
export declare const sweepRcm: (wasm: Pick<ProverModule, "field_from_seed">, otkNkHex: string) => string;
|
|
20
|
+
export interface ClaimPayload {
|
|
21
|
+
part: number;
|
|
22
|
+
parts: number;
|
|
23
|
+
v: bigint;
|
|
24
|
+
rcm: string;
|
|
25
|
+
otkNk: string;
|
|
26
|
+
}
|
|
27
|
+
export declare const encodePayload: ({ part, parts, v, rcm, otkNk }: ClaimPayload) => Uint8Array;
|
|
28
|
+
export declare const decodePayload: (b: Uint8Array) => ClaimPayload | null;
|
|
29
|
+
export declare const openClaim: (vetKey: VetKey, envelope: Uint8Array) => ClaimPayload | null;
|
|
30
|
+
export declare const formatReference: (indices: number[]) => string;
|
|
31
|
+
export declare const parseReference: (text: string) => number[] | null;
|
|
32
|
+
export declare const formatNoteReference: (position: number) => string;
|
|
33
|
+
export type PaymentReference = {
|
|
34
|
+
kind: 'direct';
|
|
35
|
+
position: number;
|
|
36
|
+
} | {
|
|
37
|
+
kind: 'claimable';
|
|
38
|
+
indices: number[];
|
|
39
|
+
};
|
|
40
|
+
export declare const parsePaymentReference: (text: string) => PaymentReference | null;
|
|
41
|
+
type SpendPair = [OwnedNote, OwnedNote];
|
|
42
|
+
export declare const sendClaimable: (actors: {
|
|
43
|
+
ledger: PoolActor;
|
|
44
|
+
directory: DirectoryActor;
|
|
45
|
+
}, wasm: Wasm & Pick<ProverModule, "prove_transfer">, keys: SpendKeys, account: Pick<ShieldedAccount, "nk" | "pk" | "encPk">, { dpk, poolPrincipal, recipient, parts, spends, fee, orderId }: {
|
|
46
|
+
dpk: DerivedPublicKey;
|
|
47
|
+
poolPrincipal: Principal;
|
|
48
|
+
recipient: Principal;
|
|
49
|
+
parts: bigint[];
|
|
50
|
+
spends: (SpendPair | (() => Promise<SpendPair>))[];
|
|
51
|
+
fee: bigint;
|
|
52
|
+
orderId?: OrderId | null;
|
|
53
|
+
}) => Promise<{
|
|
54
|
+
otk: {
|
|
55
|
+
nk: string;
|
|
56
|
+
pk: string;
|
|
57
|
+
};
|
|
58
|
+
results: MutationResult[];
|
|
59
|
+
senders: Principal[];
|
|
60
|
+
reference: string | null;
|
|
61
|
+
}>;
|
|
62
|
+
export interface FoundClaim extends ClaimPayload {
|
|
63
|
+
position: number;
|
|
64
|
+
index?: number;
|
|
65
|
+
time?: bigint;
|
|
66
|
+
note: {
|
|
67
|
+
v: bigint;
|
|
68
|
+
rho: string;
|
|
69
|
+
rcm: string;
|
|
70
|
+
cm: string;
|
|
71
|
+
};
|
|
72
|
+
nk: string;
|
|
73
|
+
nf?: string;
|
|
74
|
+
spent: boolean;
|
|
75
|
+
pay?: PayFields;
|
|
76
|
+
to?: string;
|
|
77
|
+
}
|
|
78
|
+
export interface EnvelopeScanner {
|
|
79
|
+
scan(envelopes: Uint8Array[]): Promise<number[]>;
|
|
80
|
+
}
|
|
81
|
+
export declare const scanClaims: (wasm: Wasm, vetKey: VetKey, { from, pageSize, spent, onProgress, scanner }?: {
|
|
82
|
+
from?: number;
|
|
83
|
+
pageSize?: number;
|
|
84
|
+
spent?: Set<string>;
|
|
85
|
+
onProgress?: ((done: number, total: number) => void) | null;
|
|
86
|
+
scanner?: EnvelopeScanner | null;
|
|
87
|
+
}) => Promise<{
|
|
88
|
+
claims: FoundClaim[];
|
|
89
|
+
cursor: number;
|
|
90
|
+
}>;
|
|
91
|
+
export declare const claimsByReference: (wasm: Wasm, vetKey: VetKey, reference: string, { spent }?: {
|
|
92
|
+
spent?: Set<string>;
|
|
93
|
+
}) => Promise<{
|
|
94
|
+
claims: FoundClaim[];
|
|
95
|
+
} | {
|
|
96
|
+
error: "reference-invalid" | "reference-not-found";
|
|
97
|
+
}>;
|
|
98
|
+
export interface PaymentGroup {
|
|
99
|
+
otkNk: string;
|
|
100
|
+
parts: number;
|
|
101
|
+
notes: FoundClaim[];
|
|
102
|
+
total: bigint;
|
|
103
|
+
complete: boolean;
|
|
104
|
+
reference: string | null;
|
|
105
|
+
pay: PayFields | null;
|
|
106
|
+
}
|
|
107
|
+
export declare const groupPayments: (claims: FoundClaim[]) => PaymentGroup[];
|
|
108
|
+
export declare const sweepOneTime: (actors: {
|
|
109
|
+
ledger: PoolActor;
|
|
110
|
+
directory: DirectoryActor;
|
|
111
|
+
}, wasm: Pick<ProverModule, "field_from_seed" | "random_field" | "prove_transfer">, keys: SpendKeys, to: Pick<ShieldedAccount, "pk" | "encPk">, notes: Pick<FoundClaim, "note" | "nk">[], { fee, envelope, bindingHex }: {
|
|
112
|
+
fee: bigint;
|
|
113
|
+
envelope?: Uint8Array | null;
|
|
114
|
+
bindingHex?: string;
|
|
115
|
+
}) => Promise<{
|
|
116
|
+
res: MutationResult;
|
|
117
|
+
tx: ProvedTransfer;
|
|
118
|
+
sender: Principal;
|
|
119
|
+
}>;
|
|
120
|
+
export interface PendingPayment extends PaymentGroup {
|
|
121
|
+
to: string;
|
|
122
|
+
}
|
|
123
|
+
export declare const pendingFromMemos: (wasm: Wasm, owned: OwnedNote[], spent?: Set<string>, senderNk?: string | null) => Promise<PendingPayment[]>;
|
|
124
|
+
export declare const recipientPrincipal: (text: string) => Principal;
|
|
125
|
+
//# sourceMappingURL=claims.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claims.d.ts","sourceRoot":"","sources":["../src/claims.ts"],"names":[],"mappings":"AAUA,OAAO,EAAiB,KAAK,gBAAgB,EAAE,KAAK,MAAM,EAAE,MAAM,kBAAkB,CAAC;AACrF,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIpD,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,SAAS,CAAC;AAC/D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAUN,KAAK,OAAO,EACZ,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,SAAS,EACd,MAAM,aAAa,CAAC;AAErB,OAAO,EACN,kBAAkB,EAClB,iBAAiB,EACjB,YAAY,EACZ,aAAa,EACb,QAAQ,EACR,SAAS,EACT,MAAM,eAAe,CAAC;AAIvB,KAAK,IAAI,GAAG,IAAI,CACf,YAAY,EACV,iBAAiB,GACjB,kBAAkB,GAClB,qBAAqB,GACrB,oBAAoB,GACpB,cAAc,CAChB,CAAC;AACF,KAAK,cAAc,GAAG,OAAO,CAAC,UAAU,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;AAK/D,eAAO,MAAM,UAAU,GACtB,MAAM,IAAI,CAAC,YAAY,EAAE,iBAAiB,GAAG,kBAAkB,CAAC,EAChE,aAAa,M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