@seesign/kit 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 ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Sayangenri
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,77 @@
1
- # Temporary Holding Version
1
+ # @seesign/kit
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The TypeScript side of SeeSign Kit: the QCS-1 renderer (byte-identical to
4
+ `ClearSign.sol`), the message the ML-DSA-87 key signs, QoreX signing, call
5
+ encoders, the contract ABIs and the qorechain-diana constants. Browser-safe.
6
+ Testnet only.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install @seesign/kit viem
12
+ ```
13
+
14
+ ES modules with TypeScript types, for Node 20 or later and any modern bundler.
15
+ Source, contracts and docs: <https://github.com/Sayangenri/seesign-kit>.
16
+
17
+ ## The usual flow
18
+
19
+ ```ts
20
+ import { createPublicClient, http } from "viem";
21
+ import { DIANA, dianaChain, prepare, signWithQoreX } from "@seesign/kit";
22
+
23
+ const client = createPublicClient({ chain: dianaChain, transport: http(DIANA.endpoints.evmRpc) });
24
+
25
+ // 1. Build the intent from chain state. prepare() renders the sentence locally,
26
+ // reads the wallet contract's own sentence (preview*), and throws
27
+ // SentenceMismatchError unless the two are byte-identical.
28
+ const p = await prepare(client, wallet, {
29
+ action: "TRANSFER",
30
+ token: DIANA.tokens.fUSD.address,
31
+ payee: alice,
32
+ amount: 5_000_000n, // 5.00 fUSD
33
+ });
34
+
35
+ // 2. QoreX shows the user exactly p.sentence and signs prefix + sentence with ML-DSA-87.
36
+ const signed = await signWithQoreX(p, { expectedSigner: owner });
37
+
38
+ // 3. Calldata for the factory's relay entry point (or p.signedCall for the wallet itself).
39
+ const data = p.relayCall(signed.signature);
40
+ ```
41
+
42
+ If QoreX cannot sign messages (`signArbitrary` missing), `signWithQoreX` throws
43
+ a `QorexError` with code `SIGN_ARBITRARY_UNAVAILABLE` that points to the CLI
44
+ signer ([`cli/`](https://github.com/Sayangenri/seesign-kit/tree/main/cli): `pnpm seesign sign "<sentence>"` in the
45
+ SeeSign Kit repository). It never asks for a recovery phrase.
46
+
47
+ ## API
48
+
49
+ | Export | What it does |
50
+ |---|---|
51
+ | `render(env, intent)` | The QCS-1 sentence as a string; throws `Qcs1Error` with a QCS-1 error code for anything it cannot render |
52
+ | `renderIntent(env, intent)` | The exact sentence bytes (what the contract rebuilds) |
53
+ | `messageToSign(env, intent)` | `qorechain-msg-v1\|qorechain-diana\|` + sentence: what the ML-DSA-87 key signs |
54
+ | `messageForSentence(sentence)` | The same, for a sentence you already have |
55
+ | `prepare(client, wallet, draft)` | Intent from chain state, checked against the contract's sentence; returns the sentence, the message and call builders |
56
+ | `signWithQoreX(input, opts)` | QoreX `signArbitrary` with capability, network and account checks; returns the 4,627-byte ML-DSA-87 signature |
57
+ | `qorexCanSign(provider)`, `findQorex()` | Capability detection (works on builds that do not declare capabilities) |
58
+ | `encodeSignedCall(intent, nonce, expiry, sig)` | Calldata for the wallet's signed entry point (`transfer`, `addPayee`, `removePayeeSigned`, `cancelAddSigned`, `setLimit`, `upgrade`) |
59
+ | `encodeRelay`, `encodeCreateWallet`, `encodeFinalizeAdd` | Factory relay, wallet creation, ending a timelock |
60
+ | `encodeRemovePayee`, `encodeCancelAdd`, `encodeSetLimitClassical`, `encodePause`, `encodeUnpause` | The classical safety calls (sent by the owner's EVM address) |
61
+ | `readKeyStatus(client, account)` | The background key check: registered, ML-DSA-87, possession proven (`ready`) |
62
+ | `readToken(client, token)` | Symbol and decimals as `ClearSign.tokenInfo` reads them |
63
+ | `verifyMlDsa87`, `verifySentence` | Local FIPS 204 verification (for a relayer's pre-check or the CLI) |
64
+ | `qorToEvm`, `evmToQor`, `sameAccount` | The two encodings of a QoreChain account |
65
+ | `seeSignWalletAbi`, `seeSignFactoryAbi`, `myEscrowAbi` | Generated from the Foundry build (`pnpm abi`; CI checks it is current) |
66
+ | `DIANA`, `dianaChain`, `txUrl` | Endpoints, precompiles, the deployment and the fest tokens (checked against `deployments/diana.json`) |
67
+
68
+ ## Tests
69
+
70
+ ```bash
71
+ pnpm test # 137 tests: every QCS-1 vector, a 5,000-case fuzz, SPEC.md examples,
72
+ # encoders, QoreX signing (with a real ML-DSA-87 stand-in), prepare,
73
+ # and the real QoreX signature from the Phase 0 spike
74
+ pnpm smoke # read-only check against the live deployment on diana
75
+ ```
76
+
77
+ Licence: MIT.