Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,8 @@ Content-Type: application/json
}
```

- `Algorithm`: see [documentation](https://shreeed-app.github.io/multi-party-computation-controller-api/enums/grpc_grpc.types.Algorithm.html) for possible enum values.

**Response:** `202 Accepted`
Comment on lines +112 to 114
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

README still documents the engine's GenerateKey response as { publicKey, publicKeyPackage } in the key-generation Mermaid sequence diagram, but the proto/types in this PR now wrap those fields under result. Please update the diagram (and any other references) to match the new response shape to avoid misleading API consumers.

Copilot uses AI. Check for mistakes.

```json
Expand All @@ -117,8 +119,6 @@ Content-Type: application/json
}
```

---

### `POST /signing`

Enqueues a threshold-signature job. Requires a previously completed key-generation for the given `keyIdentifier`.
Expand Down Expand Up @@ -146,8 +146,6 @@ Content-Type: application/json
}
```

---

### `GET /jobs/:jobId`

Returns the current status of a job. The `:jobId` must be a valid UUID.
Expand Down
6 changes: 6 additions & 0 deletions proto/engine/v1/engine.proto
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ message GenerateKeyRequest {
* state.
*/
message GenerateKeyResponse {
/** Generated public key and public key package. */
KeyGenerationResult result = 1;
Comment on lines +50 to +51
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the wire shape of GenerateKeyResponse from two top-level bytes fields to a nested message (result). That is a breaking protobuf change: older clients will interpret field 1 as raw bytes of the embedded message (not the canonical public key) and will fail in non-obvious ways. If backward compatibility matters, keep the original fields (deprecated) alongside the new result, or introduce a new RPC / service version instead of changing the existing response shape.

Suggested change
/** Generated public key and public key package. */
KeyGenerationResult result = 1;
/**
* Canonical public key bytes.
* Deprecated: prefer result.public_key. Kept for wire compatibility with
* older clients.
*/
bytes public_key = 1 [deprecated = true];
/**
* Opaque protocol-internal serialization of the public key package.
* Deprecated: prefer result.public_key_package. Kept for wire compatibility
* with older clients.
*/
bytes public_key_package = 2 [deprecated = true];
/** Generated public key and public key package. */
KeyGenerationResult result = 3;

Copilot uses AI. Check for mistakes.
}

/** Key generation result containing the public key and public key package. */
message KeyGenerationResult {
/**
* Canonical public key bytes.
* - secp256k1 compressed: 33 bytes
Expand Down
10 changes: 8 additions & 2 deletions src/grpc/grpc.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ interface GenerateKeyRequest {
readonly participants: number;
}

/** Response from the `GenerateKey` RPC. */
interface GenerateKeyResponse {
/** Key generation result containing the public key and public key package. */
interface KeyGenerationResult {
/**
* Canonical public key bytes.
*
Expand All @@ -46,6 +46,11 @@ interface GenerateKeyResponse {
readonly publicKeyPackage: Buffer;
}

/** Response from the `GenerateKey` RPC. */
interface GenerateKeyResponse {
readonly result: KeyGenerationResult;
}

/** Request payload for the `Sign` RPC. */
interface SignRequest {
/** Must match the identifier used during `GenerateKey`. */
Expand Down Expand Up @@ -137,6 +142,7 @@ export {
type EcdsaSignature,
type GenerateKeyRequest,
type GenerateKeyResponse,
type KeyGenerationResult,
type SignatureResult,
type SignRequest,
type SignResponse,
Expand Down
18 changes: 12 additions & 6 deletions src/queue/key-generation.processor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ describe("KeyGenerationProcessor", () => {
// Arrange — mock a successful gRPC response.
grpcService.generateKey.mockReturnValue(
okAsync({
publicKey: PUBLIC_KEY_BYTES,
publicKeyPackage: PUBLIC_KEY_PACKAGE_BYTES,
result: {
publicKey: PUBLIC_KEY_BYTES,
publicKeyPackage: PUBLIC_KEY_PACKAGE_BYTES,
},
}),
);

Expand All @@ -71,8 +73,10 @@ describe("KeyGenerationProcessor", () => {
it("Returns the hex public key and base64 public key package.", async () => {
grpcService.generateKey.mockReturnValue(
okAsync({
publicKey: PUBLIC_KEY_BYTES,
publicKeyPackage: PUBLIC_KEY_PACKAGE_BYTES,
result: {
publicKey: PUBLIC_KEY_BYTES,
publicKeyPackage: PUBLIC_KEY_PACKAGE_BYTES,
},
}),
);

Expand All @@ -91,8 +95,10 @@ describe("KeyGenerationProcessor", () => {
it("Stores key metadata immediately after a successful key generation.", async () => {
grpcService.generateKey.mockReturnValue(
okAsync({
publicKey: PUBLIC_KEY_BYTES,
publicKeyPackage: PUBLIC_KEY_PACKAGE_BYTES,
result: {
publicKey: PUBLIC_KEY_BYTES,
publicKeyPackage: PUBLIC_KEY_PACKAGE_BYTES,
},
}),
);

Expand Down
8 changes: 4 additions & 4 deletions src/queue/key-generation.processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ class KeyGenerationProcessor extends WorkerHost {
throw result.error;
}

const publicKey: string = Buffer.from(result.value.publicKey).toString(
"hex",
);
const publicKey: string = Buffer.from(
result.value.result.publicKey,
).toString("hex");
const publicKeyPackage: string = Buffer.from(
result.value.publicKeyPackage,
result.value.result.publicKeyPackage,
Comment on lines +73 to +77
Copy link

Copilot AI Apr 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GenerateKeyResponse is now expected to contain a nested result message. This PR updates the processor, but existing unit tests/mocks still return the old shape { publicKey, publicKeyPackage } (e.g. src/queue/key-generation.processor.spec.ts), which will make the test suite fail. Update the mocks (and any other call sites) to return { result: { publicKey, publicKeyPackage } } instead.

Copilot uses AI. Check for mistakes.
).toString("base64");

// Persist key metadata immediately so the signing processor can retrieve
Expand Down
Loading