Custody Service API

MPC-based key management and signing service with 2-of-3 threshold signatures, TEE attestation, and multi-approval governance for secure transaction signing.

Endpoints

MethodEndpointDescription
POST/keysGenerate new cryptographic key
GET/keysList all keys for tenant
GET/keys/:key_idGet key by ID
DELETE/keys/:key_idRevoke key
POST/signSign message (SHA256)
POST/sign-typed-dataSign EIP-712 typed data
POST/sign-transactionSign blockchain transaction
POST/approvalsCreate approval request
GET/approvalsList pending approvals
GET/approvals/:request_idGet approval status
POST/approvals/:request_id/approveAdd approval to request
POST/approvals/:request_id/rejectReject request
GET/attestationGet TEE attestation status

Generate Key

POST /keys
X-Tenant-Id: your-tenant-id
Content-Type: application/json

{
  "name": "Treasury Signing Key",
  "algorithm": "ecdsa-secp256k1",
  "keyType": "mpc"
}

Request Parameters

FieldTypeRequiredDescription
namestringYesKey display name
algorithmstringNoecdsa-secp256k1 or ed25519
keyTypestringNompc or hsm

Response

{
  "data": {
    "id": "key_abc123",
    "name": "Treasury Signing Key",
    "publicKey": "0x04a1b2c3d4e5f6...",
    "algorithm": "ecdsa-secp256k1",
    "keyType": "mpc",
    "createdAt": "2024-01-15T10:30:00Z"
  }
}

Sign Message

POST /sign
X-Tenant-Id: your-tenant-id
Content-Type: application/json

{
  "keyId": "key_abc123",
  "message": "0x48656c6c6f20576f726c64",
  "encoding": "hex"
}

Response

{
  "data": {
    "signature": "0x...",
    "publicKey": "0x04a1b2c3d4e5f6...",
    "algorithm": "ecdsa-secp256k1",
    "messageHash": "0x..."
  }
}

Sign EIP-712 Typed Data

POST /sign-typed-data
X-Tenant-Id: your-tenant-id
Content-Type: application/json

{
  "keyId": "key_abc123",
  "domain": {
    "name": "Tenzro",
    "version": "1",
    "chainId": 8453
  },
  "types": {
    "Transfer": [
      { "name": "to", "type": "address" },
      { "name": "amount", "type": "uint256" }
    ]
  },
  "primaryType": "Transfer",
  "message": {
    "to": "0x742d35Cc6634C0532925a3b844Bc9e7595f3...",
    "amount": "1000000000"
  }
}

Sign Transaction

POST /sign-transaction
X-Tenant-Id: your-tenant-id
Content-Type: application/json

{
  "keyId": "key_abc123",
  "transaction": {
    "to": "0x742d35Cc6634C0532925a3b844Bc9e7595f3...",
    "value": "0",
    "data": "0xa9059cbb...",
    "chainId": 8453,
    "nonce": 42,
    "gasLimit": "100000",
    "maxFeePerGas": "50000000000",
    "maxPriorityFeePerGas": "2000000000"
  }
}

Response

{
  "data": {
    "signedTransaction": "0x02f8...",
    "transactionHash": "0x...",
    "v": 0,
    "r": "0x...",
    "s": "0x..."
  }
}

Create Approval Request

For high-value operations, create an approval request requiring multiple signers:

POST /approvals
X-Tenant-Id: your-tenant-id
Content-Type: application/json

{
  "keyId": "key_abc123",
  "operationType": "sign_transaction",
  "payload": {
    "transaction": { ... }
  },
  "requiredApprovals": 2,
  "expiresAt": "2024-01-15T12:00:00Z"
}

Response

{
  "data": {
    "id": "approval_xyz789",
    "status": "pending",
    "keyId": "key_abc123",
    "operationType": "sign_transaction",
    "requiredApprovals": 2,
    "currentApprovals": 0,
    "approvers": [],
    "expiresAt": "2024-01-15T12:00:00Z",
    "createdAt": "2024-01-15T10:30:00Z"
  }
}

Add Approval

POST /approvals/approval_xyz789/approve
X-Tenant-Id: your-tenant-id
X-User-Id: user_123
Content-Type: application/json

{
  "signature": "0x..."
}

Get TEE Attestation

GET /attestation
X-Tenant-Id: your-tenant-id

Response

{
  "data": {
    "enclave": "intel-tdx",
    "status": "verified",
    "measurements": {
      "mrtd": "a1b2c3d4...",
      "rtmr0": "e5f6g7h8...",
      "rtmr1": "i9j0k1l2..."
    },
    "attestedAt": "2024-01-15T10:00:00Z",
    "validUntil": "2024-01-15T22:00:00Z"
  }
}

MPC Key Architecture

Keys use a 2-of-3 threshold MPC scheme with shares distributed across:

ShareLocationPurpose
TEE ShareCustody ServiceHardware-isolated server share
Client SharePasskey/Device PRFUser-controlled biometric share
HSM ShareCloud HSMRecovery backup share

Approval Status

StatusDescription
pendingAwaiting required approvals
approvedThreshold met, operation executing
executedOperation completed successfully
rejectedRequest was rejected
expiredRequest expired before approval

Supported Algorithms

AlgorithmCurveUse Case
ecdsa-secp256k1secp256k1Ethereum, Bitcoin, EVM chains
ed25519Curve25519Solana, Canton

Error Codes

CodeDescription
KEY_NOT_FOUNDKey does not exist
APPROVAL_REQUIREDOperation requires multi-approval
APPROVAL_EXPIREDApproval request has expired
ALREADY_APPROVEDUser has already approved
TEE_UNAVAILABLETEE enclave not available