{
  "description": "Webhook signature test vectors, generated with the Nice Pay server's signer and JWKS (packages/notify). NP-Signature is t=<unix seconds>,kid=<key id>,sig=<base64 Ed25519 signature of \"<t>.<raw body>\">. Verify against the key named by kid in the JWKS and refuse a t more than tolerance_seconds from the verifier's clock. The keys here are test values.",
  "tolerance_seconds": 300,
  "jwks": {
    "keys": [
      {
        "kty": "OKP",
        "crv": "Ed25519",
        "alg": "EdDSA",
        "use": "sig",
        "kid": "wh_test_vector_2",
        "x": "2inpWwLgD_oVZFd1-x0roiKhlDOV7qBrlOLAV7e-adA"
      },
      {
        "kty": "OKP",
        "crv": "Ed25519",
        "alg": "EdDSA",
        "use": "sig",
        "kid": "wh_test_vector_1",
        "x": "p_z33O1VMdWsOFzHvaGk630A1iSKf4-9jbvd9zoh0qA"
      }
    ]
  },
  "vectors": [
    {
      "name": "valid",
      "note": "Signed by the current key, verified 10 seconds later.",
      "header": "t=1794900000,kid=wh_test_vector_2,sig=0GVww44Fpd8oGcohOAcmuDIxVaoX6oyz9oLB1pgHXH3Ap6F6vRvUaRtcmTswZ0PHsmX8Kl5EUnM2kKKCnbjyCg==",
      "body": "{\"id\":\"evt_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"event\",\"type\":\"payin.succeeded\",\"livemode\":false,\"api_version\":\"2026-12-01\",\"sequence\":48213,\"created_at\":\"2026-11-23T10:00:00.000Z\",\"data\":{\"object\":{\"id\":\"pi_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"payin\",\"status\":\"succeeded\",\"amount\":\"10000.00\",\"amount_received\":\"10000.00\",\"currency\":\"INR\"}}}",
      "now": 1794900010,
      "expected": "valid"
    },
    {
      "name": "valid-previous-key",
      "note": "During a rotation the JWKS holds two keys; an event signed by either verifies.",
      "header": "t=1794900000,kid=wh_test_vector_1,sig=G6RSat6Vtfe6FJD6iONBoyaQHpC+4SgnECsk/OU9V2WEB4fJ11szWGYHTkyFA8lfSQ6ecbqVjMOXLH5JSUAwBQ==",
      "body": "{\"id\":\"evt_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"event\",\"type\":\"payin.succeeded\",\"livemode\":false,\"api_version\":\"2026-12-01\",\"sequence\":48213,\"created_at\":\"2026-11-23T10:00:00.000Z\",\"data\":{\"object\":{\"id\":\"pi_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"payin\",\"status\":\"succeeded\",\"amount\":\"10000.00\",\"amount_received\":\"10000.00\",\"currency\":\"INR\"}}}",
      "now": 1794900010,
      "expected": "valid"
    },
    {
      "name": "valid-unicode-and-spaces",
      "note": "The raw body as received, including non-ASCII and double spaces: never parse and re-serialise before verifying.",
      "header": "t=1794900000,kid=wh_test_vector_2,sig=SfWIpVrmMY0NRkQOqocXFEMrRKcrsmr1beVcEAW5cDyBy8ngY1ibyN0sm/lcfm9/X1GGbCrUM0SITJCoH5s9CQ==",
      "body": "{\"id\":\"evt_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"event\",\"type\":\"payin.succeeded\",\"livemode\":false,\"api_version\":\"2026-12-01\",\"sequence\":48213,\"created_at\":\"2026-11-23T10:00:00.000Z\",\"data\":{\"object\":{\"id\":\"pi_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"payin\",\"status\":\"succeeded\",\"metadata\":{\"player\":\"Ā  ü\"},\"amount\":\"10000.00\",\"amount_received\":\"10000.00\",\"currency\":\"INR\"}}}",
      "now": 1794900000,
      "expected": "valid"
    },
    {
      "name": "valid-fields-reordered",
      "note": "The header's fields may come in any order.",
      "header": "sig=0GVww44Fpd8oGcohOAcmuDIxVaoX6oyz9oLB1pgHXH3Ap6F6vRvUaRtcmTswZ0PHsmX8Kl5EUnM2kKKCnbjyCg==,t=1794900000,kid=wh_test_vector_2",
      "body": "{\"id\":\"evt_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"event\",\"type\":\"payin.succeeded\",\"livemode\":false,\"api_version\":\"2026-12-01\",\"sequence\":48213,\"created_at\":\"2026-11-23T10:00:00.000Z\",\"data\":{\"object\":{\"id\":\"pi_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"payin\",\"status\":\"succeeded\",\"amount\":\"10000.00\",\"amount_received\":\"10000.00\",\"currency\":\"INR\"}}}",
      "now": 1794900299,
      "expected": "valid"
    },
    {
      "name": "tampered-body",
      "note": "One character of the body changed.",
      "header": "t=1794900000,kid=wh_test_vector_2,sig=0GVww44Fpd8oGcohOAcmuDIxVaoX6oyz9oLB1pgHXH3Ap6F6vRvUaRtcmTswZ0PHsmX8Kl5EUnM2kKKCnbjyCg==",
      "body": "{\"id\":\"evt_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"event\",\"type\":\"payin.succeeded\",\"livemode\":false,\"api_version\":\"2026-12-01\",\"sequence\":48213,\"created_at\":\"2026-11-23T10:00:00.000Z\",\"data\":{\"object\":{\"id\":\"pi_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"payin\",\"status\":\"succeeded\",\"amount\":\"90000.00\",\"amount_received\":\"10000.00\",\"currency\":\"INR\"}}}",
      "now": 1794900010,
      "expected": "invalid",
      "reason": "invalid_signature"
    },
    {
      "name": "reserialised-body",
      "note": "The body parsed and serialised again (here: with indentation) no longer matches.",
      "header": "t=1794900000,kid=wh_test_vector_2,sig=0GVww44Fpd8oGcohOAcmuDIxVaoX6oyz9oLB1pgHXH3Ap6F6vRvUaRtcmTswZ0PHsmX8Kl5EUnM2kKKCnbjyCg==",
      "body": "{\n  \"id\": \"evt_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\n  \"object\": \"event\",\n  \"type\": \"payin.succeeded\",\n  \"livemode\": false,\n  \"api_version\": \"2026-12-01\",\n  \"sequence\": 48213,\n  \"created_at\": \"2026-11-23T10:00:00.000Z\",\n  \"data\": {\n    \"object\": {\n      \"id\": \"pi_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\n      \"object\": \"payin\",\n      \"status\": \"succeeded\",\n      \"amount\": \"10000.00\",\n      \"amount_received\": \"10000.00\",\n      \"currency\": \"INR\"\n    }\n  }\n}",
      "now": 1794900010,
      "expected": "invalid",
      "reason": "invalid_signature"
    },
    {
      "name": "timestamp-changed",
      "note": "t in the header changed after signing.",
      "header": "t=1794900005,kid=wh_test_vector_2,sig=0GVww44Fpd8oGcohOAcmuDIxVaoX6oyz9oLB1pgHXH3Ap6F6vRvUaRtcmTswZ0PHsmX8Kl5EUnM2kKKCnbjyCg==",
      "body": "{\"id\":\"evt_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"event\",\"type\":\"payin.succeeded\",\"livemode\":false,\"api_version\":\"2026-12-01\",\"sequence\":48213,\"created_at\":\"2026-11-23T10:00:00.000Z\",\"data\":{\"object\":{\"id\":\"pi_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"payin\",\"status\":\"succeeded\",\"amount\":\"10000.00\",\"amount_received\":\"10000.00\",\"currency\":\"INR\"}}}",
      "now": 1794900010,
      "expected": "invalid",
      "reason": "invalid_signature"
    },
    {
      "name": "too-old",
      "note": "Older than 300 seconds: refuse even though the signature is good.",
      "header": "t=1794900000,kid=wh_test_vector_2,sig=0GVww44Fpd8oGcohOAcmuDIxVaoX6oyz9oLB1pgHXH3Ap6F6vRvUaRtcmTswZ0PHsmX8Kl5EUnM2kKKCnbjyCg==",
      "body": "{\"id\":\"evt_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"event\",\"type\":\"payin.succeeded\",\"livemode\":false,\"api_version\":\"2026-12-01\",\"sequence\":48213,\"created_at\":\"2026-11-23T10:00:00.000Z\",\"data\":{\"object\":{\"id\":\"pi_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"payin\",\"status\":\"succeeded\",\"amount\":\"10000.00\",\"amount_received\":\"10000.00\",\"currency\":\"INR\"}}}",
      "now": 1794900301,
      "expected": "invalid",
      "reason": "timestamp_out_of_range"
    },
    {
      "name": "too-far-in-future",
      "note": "More than 300 seconds ahead of the verifier's clock.",
      "header": "t=1794900000,kid=wh_test_vector_2,sig=0GVww44Fpd8oGcohOAcmuDIxVaoX6oyz9oLB1pgHXH3Ap6F6vRvUaRtcmTswZ0PHsmX8Kl5EUnM2kKKCnbjyCg==",
      "body": "{\"id\":\"evt_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"event\",\"type\":\"payin.succeeded\",\"livemode\":false,\"api_version\":\"2026-12-01\",\"sequence\":48213,\"created_at\":\"2026-11-23T10:00:00.000Z\",\"data\":{\"object\":{\"id\":\"pi_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"payin\",\"status\":\"succeeded\",\"amount\":\"10000.00\",\"amount_received\":\"10000.00\",\"currency\":\"INR\"}}}",
      "now": 1794899699,
      "expected": "invalid",
      "reason": "timestamp_out_of_range"
    },
    {
      "name": "unknown-key",
      "note": "A kid that is not in the JWKS (refetch the JWKS once, then refuse).",
      "header": "t=1794900000,kid=wh_test_vector_9,sig=0GVww44Fpd8oGcohOAcmuDIxVaoX6oyz9oLB1pgHXH3Ap6F6vRvUaRtcmTswZ0PHsmX8Kl5EUnM2kKKCnbjyCg==",
      "body": "{\"id\":\"evt_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"event\",\"type\":\"payin.succeeded\",\"livemode\":false,\"api_version\":\"2026-12-01\",\"sequence\":48213,\"created_at\":\"2026-11-23T10:00:00.000Z\",\"data\":{\"object\":{\"id\":\"pi_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"payin\",\"status\":\"succeeded\",\"amount\":\"10000.00\",\"amount_received\":\"10000.00\",\"currency\":\"INR\"}}}",
      "now": 1794900010,
      "expected": "invalid",
      "reason": "unknown_key"
    },
    {
      "name": "missing-signature",
      "note": "No sig field.",
      "header": "t=1794900000,kid=wh_test_vector_2",
      "body": "{\"id\":\"evt_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"event\",\"type\":\"payin.succeeded\",\"livemode\":false,\"api_version\":\"2026-12-01\",\"sequence\":48213,\"created_at\":\"2026-11-23T10:00:00.000Z\",\"data\":{\"object\":{\"id\":\"pi_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"payin\",\"status\":\"succeeded\",\"amount\":\"10000.00\",\"amount_received\":\"10000.00\",\"currency\":\"INR\"}}}",
      "now": 1794900010,
      "expected": "invalid",
      "reason": "malformed_header"
    },
    {
      "name": "not-a-number",
      "note": "t is not an integer.",
      "header": "t=soon,kid=wh_test_vector_2,sig=0GVww44Fpd8oGcohOAcmuDIxVaoX6oyz9oLB1pgHXH3Ap6F6vRvUaRtcmTswZ0PHsmX8Kl5EUnM2kKKCnbjyCg==",
      "body": "{\"id\":\"evt_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"event\",\"type\":\"payin.succeeded\",\"livemode\":false,\"api_version\":\"2026-12-01\",\"sequence\":48213,\"created_at\":\"2026-11-23T10:00:00.000Z\",\"data\":{\"object\":{\"id\":\"pi_01JD3QH2Y8ZKX4M9T6V0R1B2C3\",\"object\":\"payin\",\"status\":\"succeeded\",\"amount\":\"10000.00\",\"amount_received\":\"10000.00\",\"currency\":\"INR\"}}}",
      "now": 1794900010,
      "expected": "invalid",
      "reason": "malformed_header"
    }
  ]
}
