@sig-net/midnight 0.11.0 → 0.13.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 +19 -13
- package/dist/abi-serde.d.ts +89 -0
- package/dist/abi-serde.d.ts.map +1 -0
- package/dist/abi-serde.js +400 -0
- package/dist/abi-serde.js.map +1 -0
- package/dist/constants.d.ts +31 -23
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +38 -32
- package/dist/constants.js.map +1 -1
- package/dist/ecdsa-attestation.d.ts +38 -18
- package/dist/ecdsa-attestation.d.ts.map +1 -1
- package/dist/ecdsa-attestation.js +52 -25
- package/dist/ecdsa-attestation.js.map +1 -1
- package/dist/epsilon-derivation.js +1 -1
- package/dist/epsilon-derivation.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/managed/compiler/contract-info.json +180 -122
- package/dist/managed/compiler/contract-manifest.json +8 -8
- package/dist/managed/contract/index.d.ts +38 -28
- package/dist/managed/contract/index.js +302 -149
- package/dist/managed/contract/index.js.map +1 -1
- package/dist/signature-requests-state-reader.d.ts +13 -13
- package/dist/signature-requests-state-reader.js +22 -22
- package/dist/signature-requests-state-reader.js.map +1 -1
- package/dist/signature-response-verification.d.ts +1 -1
- package/dist/signature-response-verification.js +3 -3
- package/dist/signature-response-verification.js.map +1 -1
- package/dist/signet-contract-state-reader.d.ts +33 -36
- package/dist/signet-contract-state-reader.d.ts.map +1 -1
- package/dist/signet-contract-state-reader.js +26 -28
- package/dist/signet-contract-state-reader.js.map +1 -1
- package/dist/signet-evtype2tx-requests.d.ts +21 -21
- package/dist/signet-evtype2tx-requests.js +16 -16
- package/dist/signet-evtype2tx-requests.js.map +1 -1
- package/dist/signet-request-response-reader.d.ts +27 -25
- package/dist/signet-request-response-reader.d.ts.map +1 -1
- package/dist/signet-request-response-reader.js +32 -30
- package/dist/signet-request-response-reader.js.map +1 -1
- package/dist/signet-requests.d.ts +27 -27
- package/dist/signet-requests.d.ts.map +1 -1
- package/dist/signet-requests.js +28 -29
- package/dist/signet-requests.js.map +1 -1
- package/package.json +3 -2
- package/src/Signet.compact +80 -65
- package/src/circuits.compact +45 -2
package/dist/constants.d.ts
CHANGED
|
@@ -2,42 +2,50 @@
|
|
|
2
2
|
export declare const CAIP2_ID_BYTES = 32;
|
|
3
3
|
/** Width of `SignBidirectionalEvent.params` (`Bytes<64>`). */
|
|
4
4
|
export declare const MPC_PARAMS_BYTES = 64;
|
|
5
|
-
/** Width of `EvmCalldata.selector` (`Bytes<4>`)
|
|
5
|
+
/** Width of `EvmCalldata.selector` (`Bytes<4>`): the literal first 4 calldata bytes. */
|
|
6
6
|
export declare const SELECTOR_BYTES = 4;
|
|
7
|
-
/** Width of `RespondBidirectionalEvent.serializedOutput` (`Bytes<128>`). */
|
|
8
|
-
export declare const SERIALIZED_OUTPUT_BYTES = 128;
|
|
9
7
|
/**
|
|
10
|
-
* The
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
*
|
|
17
|
-
* execution: the first byte is 1 — the little-endian encoding of the
|
|
18
|
-
* ABI-decoded success flag, matching the circuits'
|
|
19
|
-
* `serializedOutput as Field == 1` check.
|
|
8
|
+
* The complete serialised output the MPC attests for a FAILED remote
|
|
9
|
+
* execution (reverted or replaced transaction): the 4-byte error marker
|
|
10
|
+
* `0xdeadbeef` followed by one `0x01` byte. Schema-independent by design,
|
|
11
|
+
* mirroring the canonical MPC's Borsh-format failure payload (sig-net/mpc,
|
|
12
|
+
* node/src/respond_bidirectional.rs), so every respond schema shares one
|
|
13
|
+
* fixed 5-byte failure width. Clients recompute their failure candidate from
|
|
14
|
+
* this constant alone: no receipt or schema needed.
|
|
20
15
|
*
|
|
21
|
-
*
|
|
22
|
-
*
|
|
16
|
+
* The exact-equality check ({@link isMpcFailureOutput}) is unambiguous for
|
|
17
|
+
* every respond schema whose packed width differs from 5 bytes. A schema
|
|
18
|
+
* whose packed width is exactly 5 could in principle produce a legitimate
|
|
19
|
+
* output equal to this sentinel, and such clients must route settlement by
|
|
20
|
+
* digest-candidate matching (recompute both the real-output candidate and
|
|
21
|
+
* the failure candidate, and see which digest the MPC attested), never by
|
|
22
|
+
* inspecting output bytes.
|
|
23
23
|
*/
|
|
24
|
-
export declare
|
|
24
|
+
export declare const MPC_FAILURE_OUTPUT: Uint8Array<ArrayBuffer>;
|
|
25
25
|
/**
|
|
26
|
-
* Whether an
|
|
27
|
-
*
|
|
26
|
+
* Whether an attested serialised output IS the MPC's fixed failure payload:
|
|
27
|
+
* exact byte equality with the 5-byte {@link MPC_FAILURE_OUTPUT} (the length
|
|
28
|
+
* must be exactly 5 and every byte must match). A prefix check would be
|
|
29
|
+
* unsafe, as a legitimate packed output can begin with the same bytes.
|
|
30
|
+
*
|
|
31
|
+
* Unambiguous for every respond schema whose packed width differs from 5
|
|
32
|
+
* bytes. A schema whose packed width is exactly 5 could in principle produce
|
|
33
|
+
* a legitimate output equal to the sentinel: such clients must route
|
|
34
|
+
* settlement by digest-candidate matching instead of inspecting output
|
|
35
|
+
* bytes (see {@link MPC_FAILURE_OUTPUT}).
|
|
28
36
|
*
|
|
29
|
-
* @param serializedOutput - The
|
|
30
|
-
* @returns `true` when the MPC
|
|
37
|
+
* @param serializedOutput - The attested serialised output.
|
|
38
|
+
* @returns `true` when the output equals the MPC failure payload exactly.
|
|
31
39
|
*/
|
|
32
|
-
export declare function
|
|
40
|
+
export declare function isMpcFailureOutput(serializedOutput: Uint8Array): boolean;
|
|
33
41
|
/**
|
|
34
42
|
* Default MPC key version (`keyVersion` field value). Version 0 is the
|
|
35
|
-
* unsupported legacy format
|
|
43
|
+
* unsupported legacy format: the canonical MPC (and
|
|
36
44
|
* `constructSignBidirectionalEvent`) requires `keyVersion >= 1`.
|
|
37
45
|
*/
|
|
38
46
|
export declare const SIGNET_DEFAULT_KEY_VERSION = 1n;
|
|
39
47
|
/**
|
|
40
|
-
* Encode text as zero-padded ASCII bytes
|
|
48
|
+
* Encode text as zero-padded ASCII bytes, the Compact `pad(N, "text")`
|
|
41
49
|
* convention every string-ish field of the request structs uses (consumers
|
|
42
50
|
* NUL-trim on decode).
|
|
43
51
|
*
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AASA,+DAA+D;AAC/D,eAAO,MAAM,cAAc,KAAK,CAAC;AAEjC,8DAA8D;AAC9D,eAAO,MAAM,gBAAgB,KAAK,CAAC;AAEnC,wFAAwF;AACxF,eAAO,MAAM,cAAc,IAAI,CAAC;AAEhC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,kBAAkB,yBAAiD,CAAC;AAEjF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,UAAU,GAAG,OAAO,CAKxE;AAED;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAQpE"}
|
package/dist/constants.js
CHANGED
|
@@ -1,56 +1,62 @@
|
|
|
1
1
|
// MPC routing constants + the padded-ASCII codec for the signet request
|
|
2
|
-
// structs. Field widths mirror Signet.compact (the wire format
|
|
3
|
-
//
|
|
2
|
+
// structs. Field widths mirror Signet.compact (the wire format: keep in
|
|
3
|
+
// lockstep), and the string constants are the values the MPC network
|
|
4
4
|
// routes on. Ported from the MVP's contract-cli signet/constants.ts, adapted
|
|
5
|
-
// to the refactor's zero-padded convention (Compact `pad(N, "text")`)
|
|
6
|
-
// MVP's 2-byte length-prefixed codec is gone with the old layout.
|
|
5
|
+
// to the refactor's zero-padded convention (Compact `pad(N, "text")`).
|
|
7
6
|
//
|
|
8
|
-
// The routing constants belong in github.com/sig-net/signet.js
|
|
7
|
+
// The routing constants belong in github.com/sig-net/signet.js, kept here
|
|
9
8
|
// until upstreamed.
|
|
10
9
|
/** Width of `SignBidirectionalEvent.caip2Id` (`Bytes<32>`). */
|
|
11
10
|
export const CAIP2_ID_BYTES = 32;
|
|
12
11
|
/** Width of `SignBidirectionalEvent.params` (`Bytes<64>`). */
|
|
13
12
|
export const MPC_PARAMS_BYTES = 64;
|
|
14
|
-
/** Width of `EvmCalldata.selector` (`Bytes<4>`)
|
|
13
|
+
/** Width of `EvmCalldata.selector` (`Bytes<4>`): the literal first 4 calldata bytes. */
|
|
15
14
|
export const SELECTOR_BYTES = 4;
|
|
16
|
-
/** Width of `RespondBidirectionalEvent.serializedOutput` (`Bytes<128>`). */
|
|
17
|
-
export const SERIALIZED_OUTPUT_BYTES = 128;
|
|
18
15
|
/**
|
|
19
|
-
* The
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
*
|
|
26
|
-
* execution: the first byte is 1 — the little-endian encoding of the
|
|
27
|
-
* ABI-decoded success flag, matching the circuits'
|
|
28
|
-
* `serializedOutput as Field == 1` check.
|
|
16
|
+
* The complete serialised output the MPC attests for a FAILED remote
|
|
17
|
+
* execution (reverted or replaced transaction): the 4-byte error marker
|
|
18
|
+
* `0xdeadbeef` followed by one `0x01` byte. Schema-independent by design,
|
|
19
|
+
* mirroring the canonical MPC's Borsh-format failure payload (sig-net/mpc,
|
|
20
|
+
* node/src/respond_bidirectional.rs), so every respond schema shares one
|
|
21
|
+
* fixed 5-byte failure width. Clients recompute their failure candidate from
|
|
22
|
+
* this constant alone: no receipt or schema needed.
|
|
29
23
|
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
24
|
+
* The exact-equality check ({@link isMpcFailureOutput}) is unambiguous for
|
|
25
|
+
* every respond schema whose packed width differs from 5 bytes. A schema
|
|
26
|
+
* whose packed width is exactly 5 could in principle produce a legitimate
|
|
27
|
+
* output equal to this sentinel, and such clients must route settlement by
|
|
28
|
+
* digest-candidate matching (recompute both the real-output candidate and
|
|
29
|
+
* the failure candidate, and see which digest the MPC attested), never by
|
|
30
|
+
* inspecting output bytes.
|
|
32
31
|
*/
|
|
33
|
-
export
|
|
34
|
-
return serializedOutput[0] === 1;
|
|
35
|
-
}
|
|
32
|
+
export const MPC_FAILURE_OUTPUT = new Uint8Array([0xde, 0xad, 0xbe, 0xef, 0x01]);
|
|
36
33
|
/**
|
|
37
|
-
* Whether an
|
|
38
|
-
*
|
|
34
|
+
* Whether an attested serialised output IS the MPC's fixed failure payload:
|
|
35
|
+
* exact byte equality with the 5-byte {@link MPC_FAILURE_OUTPUT} (the length
|
|
36
|
+
* must be exactly 5 and every byte must match). A prefix check would be
|
|
37
|
+
* unsafe, as a legitimate packed output can begin with the same bytes.
|
|
38
|
+
*
|
|
39
|
+
* Unambiguous for every respond schema whose packed width differs from 5
|
|
40
|
+
* bytes. A schema whose packed width is exactly 5 could in principle produce
|
|
41
|
+
* a legitimate output equal to the sentinel: such clients must route
|
|
42
|
+
* settlement by digest-candidate matching instead of inspecting output
|
|
43
|
+
* bytes (see {@link MPC_FAILURE_OUTPUT}).
|
|
39
44
|
*
|
|
40
|
-
* @param serializedOutput - The
|
|
41
|
-
* @returns `true` when the MPC
|
|
45
|
+
* @param serializedOutput - The attested serialised output.
|
|
46
|
+
* @returns `true` when the output equals the MPC failure payload exactly.
|
|
42
47
|
*/
|
|
43
|
-
export function
|
|
44
|
-
return
|
|
48
|
+
export function isMpcFailureOutput(serializedOutput) {
|
|
49
|
+
return (serializedOutput.length === MPC_FAILURE_OUTPUT.length &&
|
|
50
|
+
MPC_FAILURE_OUTPUT.every((byte, index) => serializedOutput[index] === byte));
|
|
45
51
|
}
|
|
46
52
|
/**
|
|
47
53
|
* Default MPC key version (`keyVersion` field value). Version 0 is the
|
|
48
|
-
* unsupported legacy format
|
|
54
|
+
* unsupported legacy format: the canonical MPC (and
|
|
49
55
|
* `constructSignBidirectionalEvent`) requires `keyVersion >= 1`.
|
|
50
56
|
*/
|
|
51
57
|
export const SIGNET_DEFAULT_KEY_VERSION = 1n;
|
|
52
58
|
/**
|
|
53
|
-
* Encode text as zero-padded ASCII bytes
|
|
59
|
+
* Encode text as zero-padded ASCII bytes, the Compact `pad(N, "text")`
|
|
54
60
|
* convention every string-ish field of the request structs uses (consumers
|
|
55
61
|
* NUL-trim on decode).
|
|
56
62
|
*
|
|
@@ -62,7 +68,7 @@ export const SIGNET_DEFAULT_KEY_VERSION = 1n;
|
|
|
62
68
|
export function asciiPadded(text, length) {
|
|
63
69
|
const encoded = new TextEncoder().encode(text);
|
|
64
70
|
if (encoded.length > length) {
|
|
65
|
-
throw new Error(`"${text}" is ${encoded.length} bytes
|
|
71
|
+
throw new Error(`"${text}" is ${encoded.length} bytes: does not fit the ${length}-byte field`);
|
|
66
72
|
}
|
|
67
73
|
const out = new Uint8Array(length);
|
|
68
74
|
out.set(encoded);
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,wEAAwE;AACxE,wEAAwE;AACxE,qEAAqE;AACrE,6EAA6E;AAC7E,uEAAuE;AACvE,EAAE;AACF,0EAA0E;AAC1E,oBAAoB;AAEpB,+DAA+D;AAC/D,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,CAAC;AAEjC,8DAA8D;AAC9D,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAEnC,wFAAwF;AACxF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC;AAEhC;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,UAAU,CAAC,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC,CAAC;AAEjF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAAC,gBAA4B;IAC7D,OAAO,CACL,gBAAgB,CAAC,MAAM,KAAK,kBAAkB,CAAC,MAAM;QACrD,kBAAkB,CAAC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,gBAAgB,CAAC,KAAK,CAAC,KAAK,IAAI,CAAC,CAC5E,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAE7C;;;;;;;;;GASG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,MAAc;IACtD,MAAM,OAAO,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IAC/C,IAAI,OAAO,CAAC,MAAM,GAAG,MAAM,EAAE,CAAC;QAC5B,MAAM,IAAI,KAAK,CAAC,IAAI,IAAI,QAAQ,OAAO,CAAC,MAAM,4BAA4B,MAAM,aAAa,CAAC,CAAC;IACjG,CAAC;IACD,MAAM,GAAG,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IACnC,GAAG,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;IACjB,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { Secp256k1Point } from "@midnight-ntwrk/compact-runtime";
|
|
2
|
+
import type { RequestId } from "./signet-requests.ts";
|
|
2
3
|
import type { MpcSignature } from "./signet-contract-state-reader.ts";
|
|
3
4
|
export type { Secp256k1Point } from "@midnight-ntwrk/compact-runtime";
|
|
4
5
|
/** secp256k1 curve (group) order n. */
|
|
@@ -17,7 +18,7 @@ export declare function bytesToBigint(bytes: Uint8Array): bigint;
|
|
|
17
18
|
/**
|
|
18
19
|
* Convert a bigint to exactly 32 little-endian bytes. Matches Compact's
|
|
19
20
|
* `Field as Bytes<32>` / `Secp256k1Scalar as Bytes<32>` encoding (the inverse
|
|
20
|
-
* of {@link bytesToBigint})
|
|
21
|
+
* of {@link bytesToBigint}). Negative inputs are interpreted in the BLS
|
|
21
22
|
* scalar field.
|
|
22
23
|
*
|
|
23
24
|
* @param n - The integer to encode.
|
|
@@ -34,7 +35,7 @@ export declare function bigintToBytes32(n: bigint): Uint8Array;
|
|
|
34
35
|
export declare function bytesToBigintBE(bytes: Uint8Array): bigint;
|
|
35
36
|
/**
|
|
36
37
|
* Convert a bigint to exactly 32 BIG-endian bytes (SEC1 scalar/coordinate
|
|
37
|
-
* order, also the ABI word encoding)
|
|
38
|
+
* order, also the ABI word encoding): the big-endian counterpart of
|
|
38
39
|
* {@link bigintToBytes32} and the inverse of {@link bytesToBigintBE}.
|
|
39
40
|
*
|
|
40
41
|
* @param value - The non-negative integer to encode.
|
|
@@ -45,7 +46,7 @@ export declare function bigintToBytes32BE(value: bigint): Uint8Array;
|
|
|
45
46
|
/**
|
|
46
47
|
* An ECDSA signature over the attestation digest, in the MPC's canonical
|
|
47
48
|
* `Signature { big_r, s, recovery_id }` spirit with `r` already reduced to
|
|
48
|
-
* the scalar `big_r.x mod n
|
|
49
|
+
* the scalar `big_r.x mod n`, the form Compact's `Secp256k1EcdsaSignature`
|
|
49
50
|
* takes. Build the stored form for posting in a respond event with
|
|
50
51
|
* {@link ecdsaSignatureToMpcSignature}.
|
|
51
52
|
*/
|
|
@@ -60,11 +61,11 @@ export interface EcdsaSignature {
|
|
|
60
61
|
/**
|
|
61
62
|
* ECDSA-sign a 32-byte digest with a secp256k1 secret key, exactly as the
|
|
62
63
|
* MPC signs the attestation digest: RFC 6979 deterministic, low-s, the digest
|
|
63
|
-
* interpreted big-endian with NO extra hashing (`prehash: false`)
|
|
64
|
+
* interpreted big-endian with NO extra hashing (`prehash: false`), the same
|
|
64
65
|
* convention `secp256k1EcdsaVerify` checks in-circuit.
|
|
65
66
|
*
|
|
66
|
-
* @param digest - The 32-byte digest to sign (e.g. the
|
|
67
|
-
*
|
|
67
|
+
* @param digest - The 32-byte digest to sign (e.g. the
|
|
68
|
+
* {@link calculateSignetAttestationDigest} output).
|
|
68
69
|
* @param secretKey - The 32-byte secp256k1 secret key.
|
|
69
70
|
* @returns The signature with its recovery id.
|
|
70
71
|
*/
|
|
@@ -72,7 +73,7 @@ export declare function signAttestationDigest(digest: Uint8Array, secretKey: Uin
|
|
|
72
73
|
/**
|
|
73
74
|
* Build the stored-form signature both respond events carry from a
|
|
74
75
|
* scalar-form one: R is reconstructed by decompressing the curve point with
|
|
75
|
-
* x = `r` and the parity `recoveryId` names
|
|
76
|
+
* x = `r` and the parity `recoveryId` names, undoing the compression an
|
|
76
77
|
* `r || s || v` signature performs. For MPC-side posters (the fakenet
|
|
77
78
|
* signer, tests). The negligible caveat: an R.x that overflowed the curve
|
|
78
79
|
* order cannot be told apart from its reduced twin, so reconstruction picks
|
|
@@ -85,15 +86,13 @@ export declare function signAttestationDigest(digest: Uint8Array, secretKey: Uin
|
|
|
85
86
|
*/
|
|
86
87
|
export declare function ecdsaSignatureToMpcSignature(signature: EcdsaSignature): MpcSignature;
|
|
87
88
|
/**
|
|
88
|
-
* Read a stored-form signature back into scalar form
|
|
89
|
+
* Read a stored-form signature back into scalar form: the inverse of
|
|
89
90
|
* {@link ecdsaSignatureToMpcSignature}, for off-chain consumers building a
|
|
90
|
-
* transaction from the response.
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
*
|
|
95
|
-
* curve or the recovery id: signature verification is the authority, not
|
|
96
|
-
* this decoder.
|
|
91
|
+
* transaction from the response. `r` comes out as `bigR.x` reduced mod the
|
|
92
|
+
* curve order. Rejects records that do not even hold the shape, since posts
|
|
93
|
+
* are unauthenticated and a malformed record is garbage. `bigR.y` is NOT
|
|
94
|
+
* checked against the curve or the recovery id: signature verification is
|
|
95
|
+
* the authority, not this decoder.
|
|
97
96
|
*
|
|
98
97
|
* @param signature - The stored-form signature as posted.
|
|
99
98
|
* @returns The scalar-form signature.
|
|
@@ -103,7 +102,7 @@ export declare function ecdsaSignatureToMpcSignature(signature: EcdsaSignature):
|
|
|
103
102
|
export declare function mpcSignatureToEcdsaSignature(signature: MpcSignature): EcdsaSignature;
|
|
104
103
|
/**
|
|
105
104
|
* Parse a secp256k1 public key from SEC1 hex (compressed or uncompressed,
|
|
106
|
-
* optional `0x` prefix) into the Compact runtime's `Secp256k1Point` shape
|
|
105
|
+
* optional `0x` prefix) into the Compact runtime's `Secp256k1Point` shape:
|
|
107
106
|
* how deploys receive the MPC response key to pin.
|
|
108
107
|
*
|
|
109
108
|
* @param value - The SEC1 hex public key.
|
|
@@ -113,7 +112,7 @@ export declare function mpcSignatureToEcdsaSignature(signature: MpcSignature): E
|
|
|
113
112
|
export declare function parseSecp256k1PublicKey(value: string): Secp256k1Point;
|
|
114
113
|
/**
|
|
115
114
|
* Format a secp256k1 public key point as uncompressed SEC1 hex (with `0x`
|
|
116
|
-
* prefix)
|
|
115
|
+
* prefix): the round-trip inverse of {@link parseSecp256k1PublicKey}, for
|
|
117
116
|
* handing a response key to deploys via env/config.
|
|
118
117
|
*
|
|
119
118
|
* @param point - The point to format.
|
|
@@ -121,11 +120,32 @@ export declare function parseSecp256k1PublicKey(value: string): Secp256k1Point;
|
|
|
121
120
|
*/
|
|
122
121
|
export declare function formatSecp256k1PublicKey(point: Secp256k1Point): string;
|
|
123
122
|
/**
|
|
124
|
-
* Derive the `Secp256k1Point` of a secret key
|
|
123
|
+
* Derive the `Secp256k1Point` of a secret key: a convenience for tests and
|
|
125
124
|
* signers that hold key material as raw bytes.
|
|
126
125
|
*
|
|
127
126
|
* @param secretKey - The 32-byte secp256k1 secret key.
|
|
128
127
|
* @returns The public key point.
|
|
129
128
|
*/
|
|
130
129
|
export declare function secp256k1PublicKeyOf(secretKey: Uint8Array): Secp256k1Point;
|
|
130
|
+
/**
|
|
131
|
+
* The attestation digest of a respond-bidirectional response:
|
|
132
|
+
* `keccak256(requestId || serializedOutput)`, the 32-byte digest the MPC
|
|
133
|
+
* ECDSA-signs to attest a remote execution.
|
|
134
|
+
*
|
|
135
|
+
* TS twin of the size-generic Compact circuit
|
|
136
|
+
* `calculateSignetAttestationDigest` (which the compiler cannot export
|
|
137
|
+
* compiled, so this is the one sanctioned re-implementation, pinned
|
|
138
|
+
* byte-for-byte against the fixed-width oracle circuits in
|
|
139
|
+
* circuits.compact). The constructions agree because the circuit's keccak
|
|
140
|
+
* preimage of the `[RequestId, Bytes<N>]` pair is the raw concatenated
|
|
141
|
+
* bytes, and it matches the MPC's respond-bidirectional hash
|
|
142
|
+
* (`hash(request_id || serialized_output)`: one flat concatenation, one
|
|
143
|
+
* hash). The output is hashed AS GIVEN, at its exact length: no padding and
|
|
144
|
+
* no length binding.
|
|
145
|
+
*
|
|
146
|
+
* @param requestId - The 32-byte request id the response answers.
|
|
147
|
+
* @param serializedOutput - The serialised execution output, exact unpadded bytes.
|
|
148
|
+
* @returns The 32-byte attestation digest.
|
|
149
|
+
*/
|
|
150
|
+
export declare function calculateSignetAttestationDigest(requestId: RequestId, serializedOutput: Uint8Array): Uint8Array;
|
|
131
151
|
//# sourceMappingURL=ecdsa-attestation.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecdsa-attestation.d.ts","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ecdsa-attestation.d.ts","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEtD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mCA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;;;;;;;;;GAmBG;AACH,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,UAAU,GAC3B,UAAU,CAIZ"}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
// secp256k1 ECDSA helpers: the TS side of the respond-bidirectional
|
|
2
|
-
// attestation flow in Signet.compact
|
|
3
|
-
// scalar, so it cannot be a circuit), key parsing/formatting,
|
|
2
|
+
// attestation flow in Signet.compact: SIGNING (which needs the secret
|
|
3
|
+
// scalar, so it cannot be a circuit), key parsing/formatting, the
|
|
4
4
|
// byte-order conversions between noble's bigints and the little-endian
|
|
5
|
-
// scalar bytes Compact's casts read
|
|
6
|
-
//
|
|
7
|
-
// verification is `
|
|
8
|
-
//
|
|
9
|
-
//
|
|
5
|
+
// scalar bytes Compact's casts read, and the attestation digest's TS twin.
|
|
6
|
+
// Everything provable stays in Compact where possible: in-circuit
|
|
7
|
+
// verification is `verifyRespondBidirectionalEvent`, the deploy-time key pin
|
|
8
|
+
// is `pureCircuits.signetKeyHash`. The digest circuit is size-generic and the
|
|
9
|
+
// compiler cannot export size-generic circuits top-level, so the digest is
|
|
10
|
+
// the ONE sanctioned TS twin here, pinned byte-for-byte against the
|
|
11
|
+
// fixed-width oracle circuits circuits.compact exports (see
|
|
12
|
+
// tests/ecdsa-attestation.test.ts).
|
|
10
13
|
//
|
|
11
|
-
// This belongs in github.com/sig-net/signet.js as its Midnight adapter
|
|
14
|
+
// This belongs in github.com/sig-net/signet.js as its Midnight adapter,
|
|
12
15
|
// kept here until upstreamed.
|
|
16
|
+
import { ethers } from "ethers";
|
|
13
17
|
import { secp256k1 } from "@noble/curves/secp256k1.js";
|
|
14
18
|
/** secp256k1 curve (group) order n. */
|
|
15
19
|
export const SECP256K1_ORDER = secp256k1.Point.Fn.ORDER;
|
|
@@ -26,6 +30,8 @@ export const BLS_ORDER = 5243587517512619047944774050818596583769055250052763782
|
|
|
26
30
|
export function bytesToBigint(bytes) {
|
|
27
31
|
let result = 0n;
|
|
28
32
|
for (let i = bytes.length - 1; i >= 0; i--) {
|
|
33
|
+
// The index is in range by construction: the assertion satisfies
|
|
34
|
+
// consumers compiling with noUncheckedIndexedAccess.
|
|
29
35
|
result = (result << 8n) | BigInt(bytes[i]);
|
|
30
36
|
}
|
|
31
37
|
return result;
|
|
@@ -33,7 +39,7 @@ export function bytesToBigint(bytes) {
|
|
|
33
39
|
/**
|
|
34
40
|
* Convert a bigint to exactly 32 little-endian bytes. Matches Compact's
|
|
35
41
|
* `Field as Bytes<32>` / `Secp256k1Scalar as Bytes<32>` encoding (the inverse
|
|
36
|
-
* of {@link bytesToBigint})
|
|
42
|
+
* of {@link bytesToBigint}). Negative inputs are interpreted in the BLS
|
|
37
43
|
* scalar field.
|
|
38
44
|
*
|
|
39
45
|
* @param n - The integer to encode.
|
|
@@ -64,7 +70,7 @@ export function bytesToBigintBE(bytes) {
|
|
|
64
70
|
}
|
|
65
71
|
/**
|
|
66
72
|
* Convert a bigint to exactly 32 BIG-endian bytes (SEC1 scalar/coordinate
|
|
67
|
-
* order, also the ABI word encoding)
|
|
73
|
+
* order, also the ABI word encoding): the big-endian counterpart of
|
|
68
74
|
* {@link bigintToBytes32} and the inverse of {@link bytesToBigintBE}.
|
|
69
75
|
*
|
|
70
76
|
* @param value - The non-negative integer to encode.
|
|
@@ -86,11 +92,11 @@ export function bigintToBytes32BE(value) {
|
|
|
86
92
|
/**
|
|
87
93
|
* ECDSA-sign a 32-byte digest with a secp256k1 secret key, exactly as the
|
|
88
94
|
* MPC signs the attestation digest: RFC 6979 deterministic, low-s, the digest
|
|
89
|
-
* interpreted big-endian with NO extra hashing (`prehash: false`)
|
|
95
|
+
* interpreted big-endian with NO extra hashing (`prehash: false`), the same
|
|
90
96
|
* convention `secp256k1EcdsaVerify` checks in-circuit.
|
|
91
97
|
*
|
|
92
|
-
* @param digest - The 32-byte digest to sign (e.g. the
|
|
93
|
-
*
|
|
98
|
+
* @param digest - The 32-byte digest to sign (e.g. the
|
|
99
|
+
* {@link calculateSignetAttestationDigest} output).
|
|
94
100
|
* @param secretKey - The 32-byte secp256k1 secret key.
|
|
95
101
|
* @returns The signature with its recovery id.
|
|
96
102
|
*/
|
|
@@ -115,7 +121,7 @@ export function signAttestationDigest(digest, secretKey) {
|
|
|
115
121
|
/**
|
|
116
122
|
* Build the stored-form signature both respond events carry from a
|
|
117
123
|
* scalar-form one: R is reconstructed by decompressing the curve point with
|
|
118
|
-
* x = `r` and the parity `recoveryId` names
|
|
124
|
+
* x = `r` and the parity `recoveryId` names, undoing the compression an
|
|
119
125
|
* `r || s || v` signature performs. For MPC-side posters (the fakenet
|
|
120
126
|
* signer, tests). The negligible caveat: an R.x that overflowed the curve
|
|
121
127
|
* order cannot be told apart from its reduced twin, so reconstruction picks
|
|
@@ -148,15 +154,13 @@ export function ecdsaSignatureToMpcSignature(signature) {
|
|
|
148
154
|
};
|
|
149
155
|
}
|
|
150
156
|
/**
|
|
151
|
-
* Read a stored-form signature back into scalar form
|
|
157
|
+
* Read a stored-form signature back into scalar form: the inverse of
|
|
152
158
|
* {@link ecdsaSignatureToMpcSignature}, for off-chain consumers building a
|
|
153
|
-
* transaction from the response.
|
|
154
|
-
*
|
|
155
|
-
*
|
|
156
|
-
*
|
|
157
|
-
*
|
|
158
|
-
* curve or the recovery id: signature verification is the authority, not
|
|
159
|
-
* this decoder.
|
|
159
|
+
* transaction from the response. `r` comes out as `bigR.x` reduced mod the
|
|
160
|
+
* curve order. Rejects records that do not even hold the shape, since posts
|
|
161
|
+
* are unauthenticated and a malformed record is garbage. `bigR.y` is NOT
|
|
162
|
+
* checked against the curve or the recovery id: signature verification is
|
|
163
|
+
* the authority, not this decoder.
|
|
160
164
|
*
|
|
161
165
|
* @param signature - The stored-form signature as posted.
|
|
162
166
|
* @returns The scalar-form signature.
|
|
@@ -179,7 +183,7 @@ export function mpcSignatureToEcdsaSignature(signature) {
|
|
|
179
183
|
}
|
|
180
184
|
/**
|
|
181
185
|
* Parse a secp256k1 public key from SEC1 hex (compressed or uncompressed,
|
|
182
|
-
* optional `0x` prefix) into the Compact runtime's `Secp256k1Point` shape
|
|
186
|
+
* optional `0x` prefix) into the Compact runtime's `Secp256k1Point` shape:
|
|
183
187
|
* how deploys receive the MPC response key to pin.
|
|
184
188
|
*
|
|
185
189
|
* @param value - The SEC1 hex public key.
|
|
@@ -204,7 +208,7 @@ export function parseSecp256k1PublicKey(value) {
|
|
|
204
208
|
}
|
|
205
209
|
/**
|
|
206
210
|
* Format a secp256k1 public key point as uncompressed SEC1 hex (with `0x`
|
|
207
|
-
* prefix)
|
|
211
|
+
* prefix): the round-trip inverse of {@link parseSecp256k1PublicKey}, for
|
|
208
212
|
* handing a response key to deploys via env/config.
|
|
209
213
|
*
|
|
210
214
|
* @param point - The point to format.
|
|
@@ -215,7 +219,7 @@ export function formatSecp256k1PublicKey(point) {
|
|
|
215
219
|
return `0x04${toBE32(point.x)}${toBE32(point.y)}`;
|
|
216
220
|
}
|
|
217
221
|
/**
|
|
218
|
-
* Derive the `Secp256k1Point` of a secret key
|
|
222
|
+
* Derive the `Secp256k1Point` of a secret key: a convenience for tests and
|
|
219
223
|
* signers that hold key material as raw bytes.
|
|
220
224
|
*
|
|
221
225
|
* @param secretKey - The 32-byte secp256k1 secret key.
|
|
@@ -229,4 +233,27 @@ export function secp256k1PublicKeyOf(secretKey) {
|
|
|
229
233
|
identity: false,
|
|
230
234
|
};
|
|
231
235
|
}
|
|
236
|
+
/**
|
|
237
|
+
* The attestation digest of a respond-bidirectional response:
|
|
238
|
+
* `keccak256(requestId || serializedOutput)`, the 32-byte digest the MPC
|
|
239
|
+
* ECDSA-signs to attest a remote execution.
|
|
240
|
+
*
|
|
241
|
+
* TS twin of the size-generic Compact circuit
|
|
242
|
+
* `calculateSignetAttestationDigest` (which the compiler cannot export
|
|
243
|
+
* compiled, so this is the one sanctioned re-implementation, pinned
|
|
244
|
+
* byte-for-byte against the fixed-width oracle circuits in
|
|
245
|
+
* circuits.compact). The constructions agree because the circuit's keccak
|
|
246
|
+
* preimage of the `[RequestId, Bytes<N>]` pair is the raw concatenated
|
|
247
|
+
* bytes, and it matches the MPC's respond-bidirectional hash
|
|
248
|
+
* (`hash(request_id || serialized_output)`: one flat concatenation, one
|
|
249
|
+
* hash). The output is hashed AS GIVEN, at its exact length: no padding and
|
|
250
|
+
* no length binding.
|
|
251
|
+
*
|
|
252
|
+
* @param requestId - The 32-byte request id the response answers.
|
|
253
|
+
* @param serializedOutput - The serialised execution output, exact unpadded bytes.
|
|
254
|
+
* @returns The 32-byte attestation digest.
|
|
255
|
+
*/
|
|
256
|
+
export function calculateSignetAttestationDigest(requestId, serializedOutput) {
|
|
257
|
+
return ethers.getBytes(ethers.keccak256(ethers.concat([requestId, serializedOutput])));
|
|
258
|
+
}
|
|
232
259
|
//# sourceMappingURL=ecdsa-attestation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ecdsa-attestation.js","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,
|
|
1
|
+
{"version":3,"file":"ecdsa-attestation.js","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAAA,oEAAoE;AACpE,sEAAsE;AACtE,kEAAkE;AAClE,uEAAuE;AACvE,2EAA2E;AAC3E,kEAAkE;AAClE,6EAA6E;AAC7E,8EAA8E;AAC9E,2EAA2E;AAC3E,oEAAoE;AACpE,4DAA4D;AAC5D,oCAAoC;AACpC,EAAE;AACF,wEAAwE;AACxE,8BAA8B;AAE9B,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAUvD,uCAAuC;AACvC,MAAM,CAAC,MAAM,eAAe,GAAG,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC;AAExD,uEAAuE;AACvE,MAAM,CAAC,MAAM,SAAS,GAAG,8EA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AC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// Epsilon key derivation: contract address + path -> derived EVM account.
|
|
2
2
|
//
|
|
3
|
-
// This belongs in github.com/sig-net/signet.js
|
|
3
|
+
// This belongs in github.com/sig-net/signet.js, kept here until upstreamed.
|
|
4
4
|
//
|
|
5
5
|
// v2.0.0 (COLON-separated) is the only scheme the MPC answers. The v1.0.0
|
|
6
6
|
// COMMA-separated form is `key_version 0` in the MPC's KDF and is not served;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"epsilon-derivation.js","sourceRoot":"","sources":["../src/epsilon-derivation.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,
|
|
1
|
+
{"version":3,"file":"epsilon-derivation.js","sourceRoot":"","sources":["../src/epsilon-derivation.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,EAAE;AACF,4EAA4E;AAC5E,EAAE;AACF,0EAA0E;AAC1E,8EAA8E;AAC9E,6EAA6E;AAC7E,yEAAyE;AACzE,kEAAkE;AAElE,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAC;AAE5E,OAAO,EAAE,eAAe,EAAuB,MAAM,wBAAwB,CAAC;AAE9E;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,uCAAuC,CAAC;AAEjF;;;GAGG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,kBAAkB,CAAC;AAE5D;;;;;;;;;;;;;;;GAeG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAG,uBAAuB,CAAC;AAE3E;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,gBAAgB,CAC9B,qBAA6B,EAC7B,eAAuB,EACvB,IAAY,EACZ,UAAkB,yBAAyB;IAE3C,MAAM,YAAY,GAAG,gBAAgB,CAA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AE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC;QAC7B,GAAG,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC;QAC/B,KAAK,KAAK,EAAE,CAAC;IACf,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAEvC;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAIA,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAEvC;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAE,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// Midnight-side sig-net integration: the client-agnostic signet protocol
|
|
2
2
|
// library (wire structs, state readers, request feed/resolver, crypto) plus
|
|
3
3
|
// the compiled pure circuits of the shared Compact module.
|
|
4
|
+
export * from "./abi-serde.js";
|
|
4
5
|
export * from "./signet-requests.js";
|
|
5
6
|
export * from "./signet-evtype2tx-requests.js";
|
|
6
7
|
export * from "./signature-state-reading.js";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,4EAA4E;AAC5E,2DAA2D;AAE3D,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAEvC;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,yEAAyE;AACzE,4EAA4E;AAC5E,2DAA2D;AAE3D,cAAc,gBAAgB,CAAC;AAC/B,cAAc,sBAAsB,CAAC;AACrC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,8BAA8B,CAAC;AAC7C,cAAc,sCAAsC,CAAC;AACrD,cAAc,mCAAmC,CAAC;AAClD,cAAc,sCAAsC,CAAC;AACrD,cAAc,qCAAqC,CAAC;AACpD,cAAc,8BAA8B,CAAC;AAC7C,cAAc,0BAA0B,CAAC;AACzC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,yBAAyB,CAAC;AACxC,cAAc,wBAAwB,CAAC;AAEvC;;;;GAIG;AACH,OAAO,EAAE,YAAY,EAAqB,MAAM,6BAA6B,CAAC"}
|