{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/coincover/main/json-schema/coincover-assign-key-response-schema.json",
  "title": "AssignKeyResponse",
  "x-generated": "2026-10-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/coincover-institutional-openapi-openapi.json#/components/schemas/AssignKeyResponse",
  "type": "object",
  "properties": {
    "key_id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique identifier for the key"
    },
    "public_key": {
      "type": "string",
      "description": "Public key in hex format. For rsa4096 this is the encryption public key; for secp256k1 or ed25519 this is the compressed public key."
    },
    "signature": {
      "type": "string",
      "description": "Signature of the key in base64 format, produced by the generating enclave. Verify against CoinCover's published JWKS before relying on the key. When sign_with is supplied the signature is computed over signed_payload; otherwise it covers the public key."
    },
    "signed_payload": {
      "type": "string",
      "description": "JCS-canonical (RFC 8785) JSON string that was signed — object keys sorted, always including public_key alongside the requested context fields. Returned only when sign_with was supplied. Verify the signature over these exact bytes rather than a re-serialised copy."
    },
    "signed_fields": {
      "type": "array",
      "description": "The sign_with field names that were included, in the order requested (public_key is not listed). Confirm this contains every field you expected before trusting the binding.",
      "items": {
        "type": "string"
      }
    },
    "customer_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "External customer identifier (e.g. organisation customer ID)"
    },
    "package_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "External package identifier (e.g. workspace/package ID)"
    },
    "metadata": {
      "type": "object",
      "description": "Optional metadata describing the associated organisation and package",
      "properties": {
        "customer_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Human-readable name of the customer or organisation"
        },
        "package_name": {
          "type": [
            "string",
            "null"
          ],
          "description": "Human-readable name of the associated package or workspace"
        }
      }
    }
  }
}