Skip to content

Test Vectors

Reference test vectors for INK v0.1 signing, encryption, replay protection and audit. These vectors use fixed key material and deterministic inputs so that two independent implementations can verify byte-for-byte correctness.

Files

FileDescription
keys.jsonFixed Ed25519 and X25519 key pairs for Alice and Bob (hex-encoded)
signing.jsonSignature generation and verification test cases
encryption.jsonECIES encryption/decryption test cases
jcs.jsonJCS canonicalization test cases
replay.jsonReplay protection acceptance/rejection test cases
receipts-and-audit.jsonReceipt signatures, audit query signatures, hash-chained events and fork detection

Usage

  1. Load key material from keys.json
  2. Run each test case: construct the expected output from the inputs and compare
  3. All base64url values use no-padding encoding (RFC 4648 §5)
  4. All hex values are lowercase

Key Material

The test keys were generated deterministically from fixed seeds. They are NOT suitable for production use.

{
"alice": {
"signing": {
"publicKeyHex": "...",
"privateKeyHex": "..."
},
"encryption": {
"publicKeyHex": "...",
"privateKeyHex": "..."
}
},
"bob": {
"signing": {
"publicKeyHex": "...",
"privateKeyHex": "..."
},
"encryption": {
"publicKeyHex": "...",
"privateKeyHex": "..."
}
}
}

The full test vectors are available in the INK repository.

Signing Test Cases

Each signing test case provides:

  • input: The signature base components (method, path, recipientDid, body, timestamp)
  • expectedSignatureBase: The concatenated string before signing
  • expectedSignature: The base64url-encoded Ed25519 signature

Encryption Test Cases

Each encryption test case provides:

  • input: Plaintext payload, sender/recipient info, deterministic ephemeral key and nonce
  • expectedEnvelope: The complete outer envelope
  • expectedDecrypted: The decrypted plaintext (must match original)

Audit Chain Test Cases

Each audit chain test case provides:

  • events: Ordered list of audit events with their signatures
  • expectedHashes: The previousEventHash value for each event after the first
  • forkDetection: Cases where duplicate sequence numbers indicate a forked chain