{
  "swagger": "2.0",
  "info": {
    "title": "google/api/http.proto",
    "version": "version not set"
  },
  "tags": [
    {
      "name": "MpcWalletService"
    }
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/v1/dkg/initiate": {
      "post": {
        "summary": "Initiates a new Distributed Key Generation (DKG) session across mock 3-of-5 nodes.",
        "operationId": "MpcWalletService_InitiateDkg",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1InitiateDkgResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/v1InitiateDkgRequest"
            }
          }
        ],
        "tags": [
          "MpcWalletService"
        ]
      }
    },
    "/v1/dkg/shares": {
      "post": {
        "summary": "Executes a round of polynomial commitment / share exchange during DKG.",
        "operationId": "MpcWalletService_ExchangeDkgShares",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1DkgShareExchangeResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/v1DkgShareExchangeRequest"
            }
          }
        ],
        "tags": [
          "MpcWalletService"
        ]
      }
    },
    "/v1/sessions/resume": {
      "post": {
        "summary": "Resumes a previously paused or escalated session using a checkpoint token.",
        "operationId": "MpcWalletService_ResumeSession",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1ResumeSessionResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/v1ResumeSessionRequest"
            }
          }
        ],
        "tags": [
          "MpcWalletService"
        ]
      }
    },
    "/v1/signing/initiate": {
      "post": {
        "summary": "Initiates a threshold signature ceremony for a transaction intent.",
        "operationId": "MpcWalletService_InitiateSigning",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1InitiateSigningResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/v1InitiateSigningRequest"
            }
          }
        ],
        "tags": [
          "MpcWalletService"
        ]
      }
    },
    "/v1/signing/share": {
      "post": {
        "summary": "Submits partial signature shares to reconstruct the final signature.",
        "operationId": "MpcWalletService_SubmitSignatureShare",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/v1SignatureShareResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/v1SignatureShareRequest"
            }
          }
        ],
        "tags": [
          "MpcWalletService"
        ]
      }
    }
  },
  "definitions": {
    "protobufAny": {
      "type": "object",
      "properties": {
        "@type": {
          "type": "string"
        }
      },
      "additionalProperties": {}
    },
    "rpcStatus": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32"
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/protobufAny"
          }
        }
      }
    },
    "v1ApprovalMode": {
      "type": "string",
      "enum": [
        "APPROVAL_MODE_UNSPECIFIED",
        "DIRECT_ALLOWED",
        "HUMAN_REQUIRED"
      ],
      "default": "APPROVAL_MODE_UNSPECIFIED"
    },
    "v1ClientVersionInfo": {
      "type": "object",
      "properties": {
        "client_name": {
          "type": "string"
        },
        "client_version": {
          "type": "string"
        },
        "contract_version": {
          "type": "string"
        }
      }
    },
    "v1DiagnosticReceipt": {
      "type": "object",
      "properties": {
        "receipt_id": {
          "type": "string"
        },
        "state": {
          "$ref": "#/definitions/v1ReceiptState"
        },
        "approval_mode": {
          "$ref": "#/definitions/v1ApprovalMode"
        },
        "reason_code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "correlation_id": {
          "type": "string"
        },
        "session_id": {
          "type": "string"
        },
        "contract_version": {
          "type": "string"
        },
        "client_name": {
          "type": "string"
        },
        "client_version": {
          "type": "string"
        },
        "epoch": {
          "type": "string",
          "format": "int64"
        },
        "checkpoint_id": {
          "type": "string"
        },
        "resumable": {
          "type": "boolean"
        },
        "keystore_type": {
          "$ref": "#/definitions/v1KeystoreType"
        },
        "backend_route": {
          "type": "string"
        }
      }
    },
    "v1DkgShareExchangeRequest": {
      "type": "object",
      "properties": {
        "session_id": {
          "type": "string"
        },
        "sender_node_id": {
          "type": "integer",
          "format": "int32"
        },
        "recipient_node_id": {
          "type": "integer",
          "format": "int32"
        },
        "encrypted_share": {
          "type": "string",
          "format": "byte",
          "description": "In M0 mock mode this can carry the raw mock share bytes."
        },
        "commitments": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "byte"
          },
          "description": "Mock Feldman VSS commitments."
        },
        "context": {
          "$ref": "#/definitions/v1OrchestrationContext"
        }
      }
    },
    "v1DkgShareExchangeResponse": {
      "type": "object",
      "properties": {
        "session_id": {
          "type": "string"
        },
        "verified": {
          "type": "boolean"
        },
        "error_message": {
          "type": "string"
        },
        "receipt": {
          "$ref": "#/definitions/v1DiagnosticReceipt"
        },
        "checkpoint": {
          "$ref": "#/definitions/v1SessionCheckpoint"
        }
      }
    },
    "v1InitiateDkgRequest": {
      "type": "object",
      "properties": {
        "session_id": {
          "type": "string"
        },
        "threshold": {
          "type": "integer",
          "format": "int32"
        },
        "total_nodes": {
          "type": "integer",
          "format": "int32"
        },
        "derivation": {
          "$ref": "#/definitions/v1ThresholdDerivation"
        },
        "context": {
          "$ref": "#/definitions/v1OrchestrationContext"
        }
      }
    },
    "v1InitiateDkgResponse": {
      "type": "object",
      "properties": {
        "session_id": {
          "type": "string"
        },
        "state": {
          "$ref": "#/definitions/v1ReceiptState"
        },
        "epoch": {
          "type": "string",
          "format": "int64"
        },
        "receipt": {
          "$ref": "#/definitions/v1DiagnosticReceipt"
        },
        "checkpoint": {
          "$ref": "#/definitions/v1SessionCheckpoint"
        }
      }
    },
    "v1InitiateSigningRequest": {
      "type": "object",
      "properties": {
        "transaction_intent_id": {
          "type": "string"
        },
        "wallet_id": {
          "type": "string"
        },
        "derivation": {
          "$ref": "#/definitions/v1ThresholdDerivation"
        },
        "message_hash": {
          "type": "string",
          "format": "byte"
        },
        "policy_approval_token": {
          "type": "string",
          "format": "byte",
          "description": "Opaque policy evidence from PolicyKit. M0 does not interpret business semantics from this payload."
        },
        "human_approval_witness": {
          "type": "string",
          "format": "byte"
        },
        "approval_mode": {
          "$ref": "#/definitions/v1ApprovalMode"
        },
        "context": {
          "$ref": "#/definitions/v1OrchestrationContext"
        },
        "keystore_type": {
          "$ref": "#/definitions/v1KeystoreType"
        },
        "mock_directive": {
          "$ref": "#/definitions/v1MockDirective",
          "description": "Explicit M0-only override for deterministic local testing. Must not carry business-policy semantics."
        }
      }
    },
    "v1InitiateSigningResponse": {
      "type": "object",
      "properties": {
        "signing_session_id": {
          "type": "string"
        },
        "state": {
          "$ref": "#/definitions/v1ReceiptState"
        },
        "epoch": {
          "type": "string",
          "format": "int64"
        },
        "receipt": {
          "$ref": "#/definitions/v1DiagnosticReceipt"
        },
        "checkpoint": {
          "$ref": "#/definitions/v1SessionCheckpoint"
        }
      }
    },
    "v1KeystoreType": {
      "type": "string",
      "enum": [
        "KEYSTORE_TYPE_UNSPECIFIED",
        "KEYSTORE_TYPE_MOCK_THRESHOLD",
        "KEYSTORE_TYPE_MULTISIG_EVM_SAFE",
        "KEYSTORE_TYPE_MPC_SEPIOR",
        "KEYSTORE_TYPE_MPC_FROST",
        "KEYSTORE_TYPE_HSM_PKCS11"
      ],
      "default": "KEYSTORE_TYPE_UNSPECIFIED"
    },
    "v1MockDirective": {
      "type": "string",
      "enum": [
        "MOCK_DIRECTIVE_UNSPECIFIED",
        "MOCK_DIRECTIVE_FORCE_DENIED",
        "MOCK_DIRECTIVE_FORCE_REVOKED",
        "MOCK_DIRECTIVE_FORCE_EXPIRED",
        "MOCK_DIRECTIVE_FORCE_BACKEND_FAILED"
      ],
      "default": "MOCK_DIRECTIVE_UNSPECIFIED"
    },
    "v1OrchestrationContext": {
      "type": "object",
      "properties": {
        "payload": {
          "type": "string",
          "format": "byte",
          "description": "Opaque payload from WalletKit/PolicyKit (e.g., serialized policy approval token or intent ID)."
        },
        "traceparent": {
          "type": "string",
          "description": "W3C traceparent header string for WORM audit traceability."
        },
        "correlation_id": {
          "type": "string",
          "description": "Correlation ID across the entire transaction lifecycle."
        },
        "client": {
          "$ref": "#/definitions/v1ClientVersionInfo",
          "description": "Client/runtime identity used for contract version traceability."
        }
      }
    },
    "v1ReceiptState": {
      "type": "string",
      "enum": [
        "RECEIPT_STATE_UNSPECIFIED",
        "RECEIPT_STATE_ACCEPTED",
        "RECEIPT_STATE_DENIED",
        "RECEIPT_STATE_PENDING_HUMAN_APPROVAL",
        "RECEIPT_STATE_RESUMED",
        "RECEIPT_STATE_EXPIRED",
        "RECEIPT_STATE_REPLAY_REJECTED",
        "RECEIPT_STATE_REVOKED",
        "RECEIPT_STATE_BACKEND_COMPLETED",
        "RECEIPT_STATE_BACKEND_FAILED",
        "RECEIPT_STATE_UNSUPPORTED_CLIENT_CONTRACT_VERSION"
      ],
      "default": "RECEIPT_STATE_UNSPECIFIED"
    },
    "v1ResumeSessionRequest": {
      "type": "object",
      "properties": {
        "session_id": {
          "type": "string"
        },
        "resume_token": {
          "type": "string"
        },
        "context": {
          "$ref": "#/definitions/v1OrchestrationContext"
        },
        "human_approval_witness": {
          "type": "string",
          "format": "byte"
        }
      }
    },
    "v1ResumeSessionResponse": {
      "type": "object",
      "properties": {
        "session_id": {
          "type": "string"
        },
        "state": {
          "$ref": "#/definitions/v1ReceiptState"
        },
        "epoch": {
          "type": "string",
          "format": "int64"
        },
        "receipt": {
          "$ref": "#/definitions/v1DiagnosticReceipt"
        },
        "checkpoint": {
          "$ref": "#/definitions/v1SessionCheckpoint"
        }
      }
    },
    "v1SessionCheckpoint": {
      "type": "object",
      "properties": {
        "checkpoint_id": {
          "type": "string"
        },
        "epoch": {
          "type": "string",
          "format": "int64"
        },
        "created_at_epoch_ms": {
          "type": "string",
          "format": "int64"
        },
        "state": {
          "$ref": "#/definitions/v1ReceiptState"
        },
        "resume_token": {
          "type": "string"
        }
      }
    },
    "v1SignatureShareRequest": {
      "type": "object",
      "properties": {
        "signing_session_id": {
          "type": "string"
        },
        "node_id": {
          "type": "integer",
          "format": "int32"
        },
        "partial_signature": {
          "type": "string",
          "format": "byte"
        },
        "ephemeral_public_key": {
          "type": "string",
          "format": "byte"
        },
        "context": {
          "$ref": "#/definitions/v1OrchestrationContext"
        }
      }
    },
    "v1SignatureShareResponse": {
      "type": "object",
      "properties": {
        "signing_session_id": {
          "type": "string"
        },
        "is_complete": {
          "type": "boolean"
        },
        "full_signature": {
          "type": "string",
          "format": "byte"
        },
        "recovery_id": {
          "type": "string",
          "format": "byte"
        },
        "receipt": {
          "$ref": "#/definitions/v1DiagnosticReceipt"
        },
        "checkpoint": {
          "$ref": "#/definitions/v1SessionCheckpoint"
        }
      }
    },
    "v1ThresholdDerivation": {
      "type": "object",
      "properties": {
        "derivation_path": {
          "type": "string",
          "description": "BIP-32/44 derivation path (e.g., \"m/44'/60'/0'/0/0\")."
        },
        "curve": {
          "type": "string",
          "description": "Curve type (\"secp256k1\" or \"ed25519\")."
        },
        "network_id": {
          "type": "string",
          "description": "Optional chain ID or network identifier."
        }
      }
    }
  }
}
