@sig-net/midnight 0.21.0-rc.9 → 0.21.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 CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  The [Sig Network](https://sig.network) [Distributed MPC](https://github.com/sig-net/mpc) integration for the [Midnight blockchain](https://midnight.network) lets contracts on Midnight execute arbitrary transactions on foreign blockchains, and respond to the results of those transactions.
4
4
 
5
- `@sig-net/midnight` is the client-agnostic protocol library for that integration. It carries everything a Midnight contract or off-chain client needs to speak the signet protocol (the MPC's [sign bidirectional flow](https://github.com/sig-net/midnight-integration/blob/main/README.md#sign-bidirectional-flow)). It does not bind to any particular contract.
5
+ `@sig-net/midnight` is the client-agnostic protocol library for that integration. It carries everything a Midnight contract or off-chain client needs to speak the signet protocol (the MPC's [sign bidirectional flow](https://github.com/sig-net/midnight-integration/blob/main/README.md#sign-bidirectional-protocol-flow)). It does not bind to any particular contract.
6
6
 
7
7
  > ## 🚧 Under Construction 🚧
8
8
  >
@@ -33,8 +33,9 @@ npm install @sig-net/midnight
33
33
 
34
34
  The protocol and integration documentation lives in the [sig-net/midnight-integration README](https://github.com/sig-net/midnight-integration/blob/main/README.md):
35
35
 
36
- - [Sign Bidirectional Flow](https://github.com/sig-net/midnight-integration/blob/main/README.md#sign-bidirectional-flow): the 5-step protocol this package speaks, with diagram, failure handling and output recovery.
36
+ - [Sign Bidirectional Flow](https://github.com/sig-net/midnight-integration/blob/main/README.md#sign-bidirectional-protocol-flow): the 5-step protocol this package speaks, with diagram, failure handling and output recovery.
37
37
  - [Derived keys](https://github.com/sig-net/midnight-integration/blob/main/README.md#derived-keys): the request signing key and the response key, and how the MPC derives them.
38
+ - [Handling Failure](https://github.com/sig-net/midnight-integration/blob/main/README.md#handling-failure): the fixed 5-byte failure payload the MPC attests for a failed foreign transaction, how a contract tells it apart from a success, and which respond schemas cannot.
38
39
  - [Integrator Guide](https://github.com/sig-net/midnight-integration/blob/main/README.md#integrator-guide): the once-off setup and the per-request runtime steps, built on this package's exports.
39
40
  - [EVM Type 2 transactions and ABI calldata words](https://github.com/sig-net/midnight-integration/blob/main/README.md#evm-type-2-transactions-and-abi-calldata-words): building calldata words in-circuit and deserialising respond payloads.
40
41
 
@@ -66,10 +67,11 @@ What clients import from `@sig-net/midnight`:
66
67
  | Derive the key the MPC signs your requests with | `deriveEvmAddress`: the expected signer address checked in step 2 (see [Derived keys](https://github.com/sig-net/midnight-integration/blob/main/README.md#derived-keys)). |
67
68
  | Derive the response key your deploy pins | `deriveMidnightResponseKey`: the key `initialise` stores (setup step 4), derived from your contract's address. |
68
69
  | Look up published counterparty values | `MidnightNetwork`, `getMpcRootPublicKey` and `getSignetContractAddress`: the fixed per-network values (see the notes in [Runtime](https://github.com/sig-net/midnight-integration/blob/main/README.md#runtime)). |
70
+ | Accept an MPC public key in any published spelling | `parseSecp256k1PublicKey` (to a Compact `Secp256k1Point`) and `normaliseSecp256k1PublicKey` (to the canonical `0x04…` uncompressed SEC1 hex): both take SEC1 hex, compressed or uncompressed with an optional `0x`, and NEAR's `secp256k1:<base58>`. |
69
71
  | Compute a request id off chain | `calculateRequestId`: the TS twin of the on-chain circuit, plus `requestIdHex` and `parseRequestIdHex` for the hex form. |
70
72
  | Compose expected calldata words off chain (UIs, expected-record builders, tests) | The builders `numericAbiWord`, `evmAddressAbiWord` and `boolAbiWord`, and the readers `abiWordToUint128` and `abiWordToBool`: TS twins of the circuits under identical names. |
71
73
  | Convert a foreign execution output into respond bytes | `deserializeEvmOutput` (raw EVM return data to named values) and `serializeRespondOutput` (named values to the packed respond payload the MPC attests): together they rebuild the `serializedOutput` of steps 4 and 5. |
72
- | Recognise a failed remote execution | `MPC_FAILURE_OUTPUT` and `isMpcFailureOutput`: the MPC's fixed 5-byte failure payload for reverted or replaced transactions. |
74
+ | Recognise a failed remote execution | `MPC_FAILURE_OUTPUT` and `isMpcFailureOutput`: the MPC's fixed 5-byte failure payload for reverted or replaced transactions (see [Handling Failure](https://github.com/sig-net/midnight-integration/blob/main/README.md#handling-failure)). |
73
75
  | Verify attestations without the reader | `verifyRespondBidirectionalSignature`: the check the reader runs internally, exposed for custom pipelines. |
74
76
  | Mint attestations in your contract's unit tests | The `@sig-net/midnight/testing` entry point, see [Testing entry point](#testing-entry-point). |
75
77
  | Discover requests MPC-side (responders, background workers) | The discovery primitives: decode the signet contract's emitted notification events with `decodeSignBidirectionalEventNotificationPayload` and `decodeSignBidirectionalNotification`, then resolve each pointer against the named caller's own request map with `lookupSignetRequestAt` (the authenticated read). The polling loop belongs to the responder. |
@@ -93,7 +93,7 @@ export declare function declaredWidths(cell: AlignedValue, what: string): number
93
93
  * width enters the descriptor, so it is fixed per call rather than a constant.
94
94
  *
95
95
  * @param serializedOutputLength - Declared width of the output element, in bytes.
96
- * @returns The triple descriptor for {@link calculateSignetAttestationDigest}.
96
+ * @returns The pair descriptor for {@link calculateSignetAttestationDigest}.
97
97
  */
98
- export declare function attestationPreimageDescriptor(serializedOutputLength: number): CompactType<[Uint8Array, bigint, Uint8Array]>;
98
+ export declare function attestationPreimageDescriptor(serializedOutputLength: number): CompactType<[Uint8Array, Uint8Array]>;
99
99
  //# sourceMappingURL=compact-descriptors.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"compact-descriptors.d.ts","sourceRoot":"","sources":["../src/compact-descriptors.ts"],"names":[],"mappings":"AA4BA,OAAO,EACL,KAAK,YAAY,EACjB,KAAK,WAAW,EAEhB,gBAAgB,EAChB,0BAA0B,EAC3B,MAAM,iCAAiC,CAAC;AAKzC,0CAA0C;AAC1C,eAAO,MAAM,OAAO,kBAA0B,CAAC;AAC/C,2CAA2C;AAC3C,eAAO,MAAM,QAAQ,kBAA2B,CAAC;AACjD,2CAA2C;AAC3C,eAAO,MAAM,QAAQ,kBAA2B,CAAC;AACjD,2CAA2C;AAC3C,eAAO,MAAM,QAAQ,kBAA2B,CAAC;AACjD,yCAAyC;AACzC,eAAO,MAAM,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E,WAAW,CAAC,CAAC,CAAC,GAAG,WAAW,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAKtF;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAC7B,IAAI,EAAE,WAAW,CAAC,CAAC,CAAC,EACpB,KAAK,EAAE,SAAS,UAAU,EAAE,EAC5B,IAAI,EAAE,MAAM,GACX,CAAC,CASH;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAoBzE;AAED;;;;;;;;GAQG;AACH,wBAAgB,6BAA6B,CAC3C,sBAAsB,EAAE,MAAM,GAC7B,WAAW,CAAC,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,CAUvC"}
@@ -146,22 +146,17 @@ export function declaredWidths(cell, what) {
146
146
  * width enters the descriptor, so it is fixed per call rather than a constant.
147
147
  *
148
148
  * @param serializedOutputLength - Declared width of the output element, in bytes.
149
- * @returns The triple descriptor for {@link calculateSignetAttestationDigest}.
149
+ * @returns The pair descriptor for {@link calculateSignetAttestationDigest}.
150
150
  */
151
151
  export function attestationPreimageDescriptor(serializedOutputLength) {
152
152
  const output = new CompactTypeBytes(serializedOutputLength);
153
153
  return {
154
- alignment: () => [...BYTES_32.alignment(), ...UINT_64.alignment(), ...output.alignment()],
155
- toValue: ([requestId, outputLength, serializedOutput]) => [
154
+ alignment: () => [...BYTES_32.alignment(), ...output.alignment()],
155
+ toValue: ([requestId, serializedOutput]) => [
156
156
  ...BYTES_32.toValue(requestId),
157
- ...UINT_64.toValue(outputLength),
158
157
  ...output.toValue(serializedOutput),
159
158
  ],
160
- fromValue: (value) => [
161
- BYTES_32.fromValue(value),
162
- UINT_64.fromValue(value),
163
- output.fromValue(value),
164
- ],
159
+ fromValue: (value) => [BYTES_32.fromValue(value), output.fromValue(value)],
165
160
  };
166
161
  }
167
162
  //# sourceMappingURL=compact-descriptors.js.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QACJ,CAAC;QACD,IAAI,OAAO,CAAC,KAAK,CAAC,GAAG,KAAK,OAAO,EAAE,CAAC;YAClC,MAAM,IAAI,KAAK,CACb,GAAG,IAAI,SAAS,MAAM,CAAC,KAAK,CAAC,gBAAgB,OAAO,CAAC,KAAK,CAAC,GAAG,gCAAgC,CAC/F,CAAC;QACJ,CAAC;QACD,OAAO,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC;IAC9B,CAAC,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,6BAA6B,CAC3C,sBAA8B;IAE9B,MAAM,MAAM,GAAG,IAAI,gBAAgB,CAAC,sBAAsB,CAAC,CAAC;IAC5D,OAAO;QACL,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC,GAAG,QAAQ,CAAC,SAAS,EAAE,EAAE,GAAG,MAAM,CAAC,SAAS,EAAE,CAAC;QACjE,OAAO,EAAE,CAAC,CAAC,SAAS,EAAE,gBAAgB,CAAC,EAAE,EAAE,CAAC;YAC1C,GAAG,QAAQ,CAAC,OAAO,CAAC,SAAS,CAAC;YAC9B,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,CAAC;SACpC;QACD,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,QAAQ,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;KAC3E,CAAC;AACJ,CAAC"}
@@ -63,10 +63,11 @@ export declare enum MidnightNetwork {
63
63
  */
64
64
  export type DeployedNetwork = Exclude<MidnightNetwork, MidnightNetwork.Undeployed>;
65
65
  /**
66
- * The MPC root public key of a deployed Midnight network, as hex: the
67
- * `mpcRootPublicKey` every client key derivation starts from (see
68
- * `deriveEvmAddress`). A local standalone stack has no fixed key: its setup
69
- * generates a fresh `MPC_ROOT_KEY` per stack.
66
+ * The MPC root public key of a deployed Midnight network, as `0x04…`
67
+ * uncompressed SEC1 hex (the canonical spelling of
68
+ * `normaliseSecp256k1PublicKey`): the `mpcRootPublicKey` every client key
69
+ * derivation starts from (see `deriveEvmAddress`). A local standalone stack
70
+ * has no fixed key: its setup generates a fresh `MPC_ROOT_KEY` per stack.
70
71
  *
71
72
  * @param networkId - The deployed network to look up.
72
73
  * @returns The network's MPC root public key.
@@ -1 +1 @@
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;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,yBAAiD,CAAC;AAEjF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,UAAU,GAAG,OAAO,CAKxE;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAUpE;AAED;;;GAGG;AACH,oBAAY,eAAe;IACzB,mFAAmF;IACnF,UAAU,eAAe;IACzB,2CAA2C;IAC3C,QAAQ,aAAa;IACrB,iFAAiF;IACjF,OAAO,YAAY;IACnB,+EAA+E;IAC/E,OAAO,YAAY;IACnB,6CAA6C;IAC7C,OAAO,YAAY;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;AAYnF;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAMtE;AAYD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAM3E"}
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;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,yBAAiD,CAAC;AAEjF;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,gBAAgB,EAAE,UAAU,GAAG,OAAO,CAKxE;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAE7C;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,UAAU,CAUpE;AAED;;;GAGG;AACH,oBAAY,eAAe;IACzB,mFAAmF;IACnF,UAAU,eAAe;IACzB,2CAA2C;IAC3C,QAAQ,aAAa;IACrB,iFAAiF;IACjF,OAAO,YAAY;IACnB,+EAA+E;IAC/E,OAAO,YAAY;IACnB,6CAA6C;IAC7C,OAAO,YAAY;CACpB;AAED;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC;AAgBnF;;;;;;;;;;GAUG;AACH,wBAAgB,mBAAmB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAMtE;AAYD;;;;;;;;;;GAUG;AACH,wBAAgB,wBAAwB,CAAC,SAAS,EAAE,eAAe,GAAG,MAAM,CAM3E"}
package/dist/constants.js CHANGED
@@ -75,20 +75,25 @@ export var MidnightNetwork;
75
75
  /** Production network (live, real value). */
76
76
  MidnightNetwork["Mainnet"] = "mainnet";
77
77
  })(MidnightNetwork || (MidnightNetwork = {}));
78
- // TODO: fill in each network's MPC root public key once it is generated and
79
- // published for that network. An empty string means "not yet published" and
78
+ // Each network's MPC root public key in the canonical `0x04…` uncompressed
79
+ // SEC1 hex (`normaliseSecp256k1PublicKey`), filled in as the MPC operators
80
+ // publish it for that network. An empty string means "not yet published" and
80
81
  // makes getMpcRootPublicKey throw for that network.
81
82
  const mpcRootPublicKeys = {
82
- [MidnightNetwork.Stagenet]: "",
83
+ [MidnightNetwork.Stagenet]:
84
+ // Canonical form of the signet.js TESTNET_DEV root key:
85
+ // secp256k1:54hU5wcCmVUPFWLDALXMh1fFToZsVXrx9BbTbHzSfQq1Kd1rJZi52iPa4QQxo6s5TgjWqgpY8HamYuUDzG6fAaUq
86
+ "0x04cb41bab8bc97121f4902514ca57a284f167b9239ecb8176831d1ef0fede87c61ca3e59da1c194aa90108098a9e5cdc55d3b3297cdefbc085ffafd0f2c34ae61a",
83
87
  [MidnightNetwork.Preview]: "",
84
88
  [MidnightNetwork.Preprod]: "",
85
89
  [MidnightNetwork.Mainnet]: "",
86
90
  };
87
91
  /**
88
- * The MPC root public key of a deployed Midnight network, as hex: the
89
- * `mpcRootPublicKey` every client key derivation starts from (see
90
- * `deriveEvmAddress`). A local standalone stack has no fixed key: its setup
91
- * generates a fresh `MPC_ROOT_KEY` per stack.
92
+ * The MPC root public key of a deployed Midnight network, as `0x04…`
93
+ * uncompressed SEC1 hex (the canonical spelling of
94
+ * `normaliseSecp256k1PublicKey`): the `mpcRootPublicKey` every client key
95
+ * derivation starts from (see `deriveEvmAddress`). A local standalone stack
96
+ * has no fixed key: its setup generates a fresh `MPC_ROOT_KEY` per stack.
92
97
  *
93
98
  * @param networkId - The deployed network to look up.
94
99
  * @returns The network's MPC root public key.
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,2EAA2E;AAC3E,mEAAmE;AACnE,qEAAqE;AACrE,sDAAsD;AACtD,EAAE;AACF,0EAA0E;AAC1E,oBAAoB;AAEpB,+DAA+D;AAC/D,MAAM,CAAC,MAAM,cAAc,GAAG,EAAE,C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O,CAAC,EAAE,EAAE;IAC7B,CAAC,eAAe,CAAC,OAAO,CAAC,EAAE,EAAE;CAC9B,CAAC;AAEF;;;;;;;;;;GAUG;AACH,MAAM,UAAU,wBAAwB,CAAC,SAA0B;IACjE,MAAM,eAAe,GAAG,uBAAuB,CAAC,SAAS,CAAC,CAAC;IAC3D,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,iDAAiD,SAAS,eAAe,CAAC,CAAC;IAC7F,CAAC;IACD,OAAO,eAAe,CAAC;AACzB,CAAC"}
@@ -1,4 +1,5 @@
1
1
  import { type Secp256k1Point } from "@midnight-ntwrk/compact-runtime";
2
+ import { secp256k1 } from "@noble/curves/secp256k1.js";
2
3
  import { Signature } from "ethers";
3
4
  import type { MpcSignature, RespondBidirectionalEvent, SignatureRespondedEvent } from "./signet-contract-events.ts";
4
5
  import type { RequestId } from "./signet-requests.ts";
@@ -74,25 +75,53 @@ export declare function signatureRespondedEventToSignature(response: SignatureRe
74
75
  * @throws {Error} If `r` is not the x coordinate of a secp256k1 point.
75
76
  */
76
77
  export declare function signatureToSignatureRespondedEvent(signature: Pick<Signature, "r" | "s" | "yParity">): SignatureRespondedEvent;
78
+ /** A point in noble's own representation, for curve arithmetic. */
79
+ type NobleSecp256k1Point = ReturnType<typeof secp256k1.Point.fromHex>;
77
80
  /**
78
- * Parse a secp256k1 public key from SEC1 hex (compressed or uncompressed,
79
- * optional `0x` prefix) into the Compact runtime's `Secp256k1Point` shape:
80
- * how deploys receive the MPC response key to pin.
81
+ * Parse a secp256k1 public key in any accepted spelling (see
82
+ * {@link parseSecp256k1PublicKey}) into noble's point, the shape the
83
+ * derivation arithmetic runs on. Package-internal: the public surface hands
84
+ * out the Compact runtime's `Secp256k1Point` instead.
81
85
  *
82
- * @param value - The SEC1 hex public key.
83
- * @returns The parsed point.
86
+ * @param value - The public key, NEAR or SEC1 hex spelling.
87
+ * @returns The point on secp256k1.
84
88
  * @throws {Error} If the value is not a valid secp256k1 public key.
85
89
  */
90
+ export declare function parseSecp256k1PublicKeyToNoblePoint(value: string): NobleSecp256k1Point;
91
+ /**
92
+ * Parse a secp256k1 public key into the Compact runtime's `Secp256k1Point`
93
+ * shape: how deploys receive the MPC response key to pin. Accepts every
94
+ * spelling a key is published in: SEC1 hex, compressed (`02`/`03`) or
95
+ * uncompressed (`04`) with an optional `0x`, and NEAR's `secp256k1:<base58>`
96
+ * (what signet.js and the MPC operators publish). The point is checked to
97
+ * lie on the curve.
98
+ *
99
+ * @param value - The public key in any accepted spelling.
100
+ * @returns The parsed point.
101
+ * @throws {Error} If the value is not a valid secp256k1 public key in any accepted spelling.
102
+ */
86
103
  export declare function parseSecp256k1PublicKey(value: string): Secp256k1Point;
87
104
  /**
88
- * Format a secp256k1 public key point as uncompressed SEC1 hex (with `0x`
89
- * prefix): the round-trip inverse of {@link parseSecp256k1PublicKey}, for
90
- * handing a response key to deploys via env/config.
105
+ * Format a secp256k1 public key point as uncompressed SEC1 hex with a `0x`
106
+ * prefix, the canonical spelling this package publishes and prints keys in:
107
+ * the round-trip inverse of {@link parseSecp256k1PublicKey}, for handing a
108
+ * key to deploys via env/config.
91
109
  *
92
110
  * @param point - The point to format.
93
111
  * @returns The `0x04…` uncompressed SEC1 hex string.
94
112
  */
95
113
  export declare function formatSecp256k1PublicKey(point: Secp256k1Point): string;
114
+ /**
115
+ * Canonicalise a public key given in any accepted spelling (see
116
+ * {@link parseSecp256k1PublicKey}) to the `0x04…` uncompressed SEC1 hex of
117
+ * {@link formatSecp256k1PublicKey}: what to write into configuration and
118
+ * print, so one spelling reaches every derivation.
119
+ *
120
+ * @param value - The public key in any accepted spelling.
121
+ * @returns The same key as `0x04…` uncompressed SEC1 hex, lowercase.
122
+ * @throws {Error} If the value is not a valid secp256k1 public key in any accepted spelling.
123
+ */
124
+ export declare function normaliseSecp256k1PublicKey(value: string): string;
96
125
  /**
97
126
  * Derive the `Secp256k1Point` of a secret key: a convenience for tests and
98
127
  * signers that hold key material as raw bytes.
@@ -103,7 +132,7 @@ export declare function formatSecp256k1PublicKey(point: Secp256k1Point): string;
103
132
  export declare function secp256k1PublicKeyOf(secretKey: Uint8Array): Secp256k1Point;
104
133
  /**
105
134
  * The attestation digest of a respond-bidirectional response:
106
- * `upgradeFromTransient(transientHash([requestId, outputLength, serializedOutput]))`, the
135
+ * `upgradeFromTransient(transientHash([requestId, serializedOutput]))`, the
107
136
  * 32-byte digest the MPC ECDSA-signs to attest a remote execution. TS twin of
108
137
  * the size-generic Compact circuit of the same name.
109
138
  *
@@ -1 +1 @@
1
- {"version":3,"file":"ecdsa-attestation.d.ts","sourceRoot":"","sources":["../src/ecdsa-attestation.ts"],"names":[],"mappings":"AAeA,OAAO,EACL,KAAK,cAAc,EAGpB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,SAAS,EAAW,MAAM,QAAQ,CAAC;AAI5C,OAAO,KAAK,EACV,YAAY,EACZ,yBAAyB,EACzB,uBAAuB,EACxB,MAAM,6BAA6B,CAAC;AACrC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAItD,YAAY,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEtE,uCAAuC;AACvC,eAAO,MAAM,eAAe,QAA2B,CAAC;AAExD;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B,wCAAwC;IACxC,CAAC,EAAE,MAAM,CAAC;IACV,2DAA2D;IAC3D,CAAC,EAAE,MAAM,CAAC;IACV,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,GAAG,cAAc,CAc/F;AAED;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,cAAc,GAAG,YAAY,CAqBpF;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,4BAA4B,CAAC,SAAS,EAAE,Y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AgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEjE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,UAAU,GAAG,cAAc,CAO1E;AAED;;;;;;;;;GASG;AACH,wBAAgB,gCAAgC,CAC9C,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,UAAU,GAC3B,UAAU,CAOZ;AAgBD;;;;;;;;;;;;;GAaG;AACH,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,yBAAyB,GAC/B,yBAAyB,CAQ3B;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,mCAAmC,CACjD,SAAS,EAAE,SAAS,EACpB,gBAAgB,EAAE,UAAU,EAC5B,KAAK,EAAE,yBAAyB,EAChC,cAAc,EAAE,cAAc,GAC7B,OAAO,CAyBT"}
@@ -14,7 +14,7 @@
14
14
  // kept here until upstreamed.
15
15
  import { transientHash, upgradeFromTransient, } from "@midnight-ntwrk/compact-runtime";
16
16
  import { secp256k1 } from "@noble/curves/secp256k1.js";
17
- import { Signature, toBeHex } from "ethers";
17
+ import { decodeBase58, Signature, toBeHex } from "ethers";
18
18
  import { bigintToBytes32BE, bytesToBigintBE, stripHexPrefix } from "./byte-codecs.js";
19
19
  import { attestationPreimageDescriptor } from "./compact-descriptors.js";
20
20
  /** secp256k1 curve (group) order n. */
@@ -139,27 +139,86 @@ export function signatureToSignatureRespondedEvent(signature) {
139
139
  }),
140
140
  };
141
141
  }
142
+ // The NEAR protocol's public-key string form: `secp256k1:` followed by base58
143
+ // of the raw 64-byte X||Y point, with no SEC1 prefix byte and no checksum.
144
+ // It is the spelling signet.js publishes the MPC root keys in so every key entry
145
+ // point here accepts it.
146
+ const NEAR_SECP256K1_PREFIX = "secp256k1:";
147
+ const SECP256K1_POINT_BYTES = 64;
142
148
  /**
143
- * Parse a secp256k1 public key from SEC1 hex (compressed or uncompressed,
144
- * optional `0x` prefix) into the Compact runtime's `Secp256k1Point` shape:
145
- * how deploys receive the MPC response key to pin.
149
+ * The SEC1 hex (no `0x`) of a public key given in any accepted spelling:
150
+ * NEAR's `secp256k1:<base58>` becomes `04` followed by its 64-byte point,
151
+ * and hex loses its optional `0x`. Shape only: the curve check is the
152
+ * parser's.
146
153
  *
147
- * @param value - The SEC1 hex public key.
148
- * @returns The parsed point.
149
- * @throws {Error} If the value is not a valid secp256k1 public key.
154
+ * @param value - The key in NEAR or SEC1 hex spelling.
155
+ * @returns The SEC1 hex without a `0x` prefix.
156
+ * @throws {Error} If the value is blank, its base58 does not decode, or the
157
+ * decoded point is wider than 64 bytes.
150
158
  */
151
- export function parseSecp256k1PublicKey(value) {
152
- const hex = stripHexPrefix(value);
159
+ function publicKeyToSec1Hex(value) {
160
+ const trimmed = value.trim();
161
+ if (trimmed === "") {
162
+ throw new Error("secp256k1 public key is blank");
163
+ }
164
+ if (!trimmed.startsWith(NEAR_SECP256K1_PREFIX)) {
165
+ return stripHexPrefix(trimmed);
166
+ }
167
+ const base58Point = trimmed.slice(NEAR_SECP256K1_PREFIX.length);
153
168
  let point;
154
169
  try {
155
- point = secp256k1.Point.fromHex(hex);
170
+ point = decodeBase58(base58Point);
156
171
  }
157
172
  catch (error) {
158
- throw new Error(`not a secp256k1 public key in SEC1 hex: "${value}" (${String(error)})`, {
173
+ throw new Error(`"${trimmed}" is not base58 after its secp256k1: prefix (${String(error)})`, {
159
174
  cause: error,
160
175
  });
161
176
  }
162
- const uncompressed = point.toBytes(false); // 0x04 || x || y
177
+ // Base58 folds leading zero bytes into leading `1` characters, so the point
178
+ // is rendered back at its fixed width, never at the integer's own width.
179
+ let pointHex;
180
+ try {
181
+ pointHex = toBeHex(point, SECP256K1_POINT_BYTES);
182
+ }
183
+ catch (error) {
184
+ throw new Error(`"${trimmed}" decodes wider than the ${String(SECP256K1_POINT_BYTES)}-byte point a NEAR secp256k1 key carries`, { cause: error });
185
+ }
186
+ return `04${pointHex.slice(2)}`;
187
+ }
188
+ /**
189
+ * Parse a secp256k1 public key in any accepted spelling (see
190
+ * {@link parseSecp256k1PublicKey}) into noble's point, the shape the
191
+ * derivation arithmetic runs on. Package-internal: the public surface hands
192
+ * out the Compact runtime's `Secp256k1Point` instead.
193
+ *
194
+ * @param value - The public key, NEAR or SEC1 hex spelling.
195
+ * @returns The point on secp256k1.
196
+ * @throws {Error} If the value is not a valid secp256k1 public key.
197
+ */
198
+ export function parseSecp256k1PublicKeyToNoblePoint(value) {
199
+ const hex = publicKeyToSec1Hex(value);
200
+ try {
201
+ return secp256k1.Point.fromHex(hex);
202
+ }
203
+ catch (error) {
204
+ throw new Error(`not a secp256k1 public key in SEC1 hex (02/03/04-prefixed, 0x optional) or NEAR ` +
205
+ `secp256k1:<base58> form: "${value}" (${String(error)})`, { cause: error });
206
+ }
207
+ }
208
+ /**
209
+ * Parse a secp256k1 public key into the Compact runtime's `Secp256k1Point`
210
+ * shape: how deploys receive the MPC response key to pin. Accepts every
211
+ * spelling a key is published in: SEC1 hex, compressed (`02`/`03`) or
212
+ * uncompressed (`04`) with an optional `0x`, and NEAR's `secp256k1:<base58>`
213
+ * (what signet.js and the MPC operators publish). The point is checked to
214
+ * lie on the curve.
215
+ *
216
+ * @param value - The public key in any accepted spelling.
217
+ * @returns The parsed point.
218
+ * @throws {Error} If the value is not a valid secp256k1 public key in any accepted spelling.
219
+ */
220
+ export function parseSecp256k1PublicKey(value) {
221
+ const uncompressed = parseSecp256k1PublicKeyToNoblePoint(value).toBytes(false); // 0x04 || x || y
163
222
  return {
164
223
  x: bytesToBigintBE(uncompressed.slice(1, 33)),
165
224
  y: bytesToBigintBE(uncompressed.slice(33, 65)),
@@ -167,9 +226,10 @@ export function parseSecp256k1PublicKey(value) {
167
226
  };
168
227
  }
169
228
  /**
170
- * Format a secp256k1 public key point as uncompressed SEC1 hex (with `0x`
171
- * prefix): the round-trip inverse of {@link parseSecp256k1PublicKey}, for
172
- * handing a response key to deploys via env/config.
229
+ * Format a secp256k1 public key point as uncompressed SEC1 hex with a `0x`
230
+ * prefix, the canonical spelling this package publishes and prints keys in:
231
+ * the round-trip inverse of {@link parseSecp256k1PublicKey}, for handing a
232
+ * key to deploys via env/config.
173
233
  *
174
234
  * @param point - The point to format.
175
235
  * @returns The `0x04…` uncompressed SEC1 hex string.
@@ -178,6 +238,19 @@ export function formatSecp256k1PublicKey(point) {
178
238
  const toBE32 = (v) => v.toString(16).padStart(64, "0");
179
239
  return `0x04${toBE32(point.x)}${toBE32(point.y)}`;
180
240
  }
241
+ /**
242
+ * Canonicalise a public key given in any accepted spelling (see
243
+ * {@link parseSecp256k1PublicKey}) to the `0x04…` uncompressed SEC1 hex of
244
+ * {@link formatSecp256k1PublicKey}: what to write into configuration and
245
+ * print, so one spelling reaches every derivation.
246
+ *
247
+ * @param value - The public key in any accepted spelling.
248
+ * @returns The same key as `0x04…` uncompressed SEC1 hex, lowercase.
249
+ * @throws {Error} If the value is not a valid secp256k1 public key in any accepted spelling.
250
+ */
251
+ export function normaliseSecp256k1PublicKey(value) {
252
+ return formatSecp256k1PublicKey(parseSecp256k1PublicKey(value));
253
+ }
181
254
  /**
182
255
  * Derive the `Secp256k1Point` of a secret key: a convenience for tests and
183
256
  * signers that hold key material as raw bytes.
@@ -195,7 +268,7 @@ export function secp256k1PublicKeyOf(secretKey) {
195
268
  }
196
269
  /**
197
270
  * The attestation digest of a respond-bidirectional response:
198
- * `upgradeFromTransient(transientHash([requestId, outputLength, serializedOutput]))`, the
271
+ * `upgradeFromTransient(transientHash([requestId, serializedOutput]))`, the
199
272
  * 32-byte digest the MPC ECDSA-signs to attest a remote execution. TS twin of
200
273
  * the size-generic Compact circuit of the same name.
201
274
  *
@@ -206,7 +279,6 @@ export function secp256k1PublicKeyOf(secretKey) {
206
279
  export function calculateSignetAttestationDigest(requestId, serializedOutput) {
207
280
  return upgradeFromTransient(transientHash(attestationPreimageDescriptor(serializedOutput.length), [
208
281
  requestId,
209
- BigInt(serializedOutput.length),
210
282
  serializedOutput,
211
283
  ]));
212
284
  }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AAC,GAAG,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACxD,gBAAgB,CAAC,GAAG,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACzD,MAAM,SAAS,GAAG,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC;IACrC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC;IACpB,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACtD,SAAS,CAAC,GAAG,CAAC,iBAAiB,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACvD,IAAI,CAAC;QACH,OAAO,SAAS,CAAC,MAAM,CAAC,gBAAgB,EAAE,MAAM,EAAE,SAAS,EAAE;YAC3D,OAAO,EAAE,KAAK;YACd,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
@@ -1,15 +1,18 @@
1
1
  import { type Secp256k1Point } from "./ecdsa-attestation.ts";
2
2
  /**
3
3
  * Domain prefix of the sig-net v2.0.0 epsilon derivation scheme. The full
4
- * derivation string is `<prefix>:<chainId>:<requester>:<path>` (colon-separated),
5
- * matching `caip2_derivation_path` in the MPC's `crypto/src/kdf.rs`.
4
+ * derivation string is `<prefix>:midnight:mainnet:<requester>:<path>`
5
+ * (colon-separated), matching `caip2_derivation_path` in the MPC's
6
+ * `signet-crypto/src/kdf.rs`.
6
7
  */
7
8
  export declare const EPSILON_DERIVATION_PREFIX = "sig.network v2.0.0 epsilon derivation";
8
9
  /**
9
- * CAIP-2 chain id under which the MPC derives keys for requests originating
10
- * from Midnight contracts.
10
+ * CAIP-2 chain id component of every Midnight derivation string. The MPC
11
+ * renders `Chain::Midnight` as this one literal for every Midnight network
12
+ * (sig-net/mpc signet-primitives/src/chain.rs), so it never varies with the
13
+ * network a contract is deployed on.
11
14
  */
12
- export declare const MIDNIGHT_TESTNET_CHAIN_ID = "midnight:testnet";
15
+ export declare const MIDNIGHT_CAIP2_ID = "midnight:mainnet";
13
16
  /**
14
17
  * The FIXED derivation path of the MPC's respond-bidirectional RESPONSE key
15
18
  * for Midnight client contracts. It enters the derivation string verbatim,
@@ -25,12 +28,13 @@ export declare const MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH = "midnight response ke
25
28
  /**
26
29
  * Derive the EVM address the MPC network signs from for a given Midnight
27
30
  * contract and derivation path, using the sig-net v2.0.0 epsilon scheme:
28
- * `epsilon = keccak256("<prefix>:<chainId>:<requester>:<path>")` and
31
+ * `epsilon = keccak256("<prefix>:midnight:mainnet:<requester>:<path>")` and
29
32
  * `derivedPubKey = mpcRootPubKey + epsilon * G` on secp256k1. The MPC
30
33
  * treats `path` as an opaque string.
31
34
  *
32
- * @param mpcSecp256k1PubkeyHex - The MPC root secp256k1 public key as 0x-hex
33
- * (compressed or uncompressed, normalised internally).
35
+ * @param mpcSecp256k1PublicKey - The MPC root secp256k1 public key, in any
36
+ * spelling `parseSecp256k1PublicKey` accepts (SEC1 hex or NEAR
37
+ * `secp256k1:<base58>`).
34
38
  * @param contractAddress - The Midnight contract address the request
35
39
  * originates from (`0x` prefix optional, case-insensitive: it enters the
36
40
  * derivation string through {@link normaliseRequesterAddress}).
@@ -39,36 +43,36 @@ export declare const MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH = "midnight response ke
39
43
  * `path: Bytes<32>`: the lowercase hex of the FULL 32 bytes, no `0x`
40
44
  * prefix and no trimming ({@link bytesToHex} of the raw bytes), so
41
45
  * `0xab..00` and `0xab..` derive different accounts.
42
- * @param chainId - CAIP-2 chain id component of the derivation string.
43
46
  * @returns The derived EVM address as a 0x-prefixed EIP-55 checksummed string.
44
47
  */
45
- export declare function deriveEvmAddress(mpcSecp256k1PubkeyHex: string, contractAddress: string, path: string, chainId?: string): string;
48
+ export declare function deriveEvmAddress(mpcSecp256k1PublicKey: string, contractAddress: string, path: string): string;
46
49
  /**
47
50
  * The epsilon scalar of the sig-net v2.0.0 derivation scheme:
48
- * `keccak256("<prefix>:<chainId>:<requester>:<path>")` reduced mod the
49
- * secp256k1 curve order. Child keys are `root + epsilon` (secret side) and
51
+ * `keccak256("<prefix>:midnight:mainnet:<requester>:<path>")` reduced mod
52
+ * the secp256k1 curve order, the chain id fixed to
53
+ * {@link MIDNIGHT_CAIP2_ID}. Child keys are `root + epsilon` (secret side) and
50
54
  * `rootPubKey + epsilon * G` (public side).
51
55
  *
52
56
  * @param requester - The requester component of the derivation string,
53
57
  * verbatim (no normalisation: callers must agree on the exact rendering).
54
58
  * @param path - The derivation path string.
55
- * @param chainId - CAIP-2 chain id component of the derivation string.
56
59
  * @returns The epsilon scalar, in `[0, n)`.
57
60
  */
58
- export declare function deriveEpsilon(requester: string, path: string, chainId?: string): bigint;
61
+ export declare function deriveEpsilon(requester: string, path: string): bigint;
59
62
  /**
60
63
  * Derive the MPC's respond-bidirectional RESPONSE key for one client
61
64
  * contract, public side: what the client pins via its `initialise` circuit
62
65
  * and what response verification checks against. See
63
66
  * {@link MIDNIGHT_RESPOND_BIDIRECTIONAL_PATH} for the scheme.
64
67
  *
65
- * @param mpcSecp256k1PubkeyHex - The MPC root secp256k1 public key as 0x-hex
66
- * (compressed or uncompressed).
68
+ * @param mpcSecp256k1PublicKey - The MPC root secp256k1 public key, in any
69
+ * spelling `parseSecp256k1PublicKey` accepts (SEC1 hex or NEAR
70
+ * `secp256k1:<base58>`).
67
71
  * @param clientContractAddress - The client contract's Midnight address
68
72
  * (`0x` prefix optional, case-insensitive).
69
73
  * @returns The response public key as a Compact-runtime `Secp256k1Point`.
70
74
  */
71
- export declare function deriveMidnightResponseKey(mpcSecp256k1PubkeyHex: string, clientContractAddress: string): Secp256k1Point;
75
+ export declare function deriveMidnightResponseKey(mpcSecp256k1PublicKey: string, clientContractAddress: string): Secp256k1Point;
72
76
  /**
73
77
  * Derive the MPC's respond-bidirectional RESPONSE key for one client
74
78
  * contract, secret side: `(rootSecret + epsilon) mod n`. MPC-side only
@@ -1 +1 @@
1
- {"version":3,"file":"epsilon-derivation.d.ts","sourceRoot":"","sources":["../src/epsilon-derivation.ts"],"names":[],"mappings":"AAWA,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAE9E;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,0CAA0C,CAAC;AAEjF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,qBAAqB,CAAC;AAE5D;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mCAAmC,0BAA0B,CAAC;AAe3E;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,gBAAgB,CAC9B,qBAAqB,EAAE,MAAM,EAC7B,eAAe,EAAE,MAAM,EACvB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAkC,GAC1C,MAAM,CAQR;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAC3B,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,OAAO,GAAE,MAAkC,GAC1C,MAAM,CAKR;AAuBD;;;;;;;;;;;GAWG;AACH,wBAAgB,yBAAyB,CACvC,qBAAqB,EAAE,MAAM,EAC7B,qBAAqB,EAAE,MAAM,GAC5B,cAAc,CAQhB;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,+BAA+B,CAC7C,gBAAgB,EAAE,UAAU,EAC5B,qBAAqB,EAAE,MAAM,GAC5B,UAAU,CAeZ"}
1
+ {"version":3,"file":"epsilon-derivation.d.ts","sourceRoot":"","sources":["../src/epsilon-derivation.ts"],"names":[],"mappings":"AAWA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,wBAAwB,CAAC;AAEhC;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,0CAA0C,CAAC;AAEjF;;;;;GAKG;AACH,eAAO,MA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