Jiko APIs aim to implement RFC 9421 for HTTP Message Signatures. Currently only a subset of the RFC is supported, listed below.
- The sender selects HTTP fields to include (e.g.,
@method,@path,host,date) - A canonical string is built from those fields
- The string is digitally signed using a private key
- The signature and metadata are added to HTTP headers (
Signature-InputandSignature) - The receiver uses the public key to verify the signature
Describes what was signed and how.
Signature-Input: sig1=("@method" "host" "date"); keyid="my-key"; alg="ecdsa-p256-sha256"; created=1680000000Contains the actual signature in base64 format.
Signature: sig1=:Base64(signature bytes):GET /api/v2/pockets/ HTTP/1.1
Host: api.business.jiko.io
Date: Tue, 16 May 2023 14:00:00 GMT
Signature-Input: sig1=("@method" "host" "date"); keyid="key-ecdsa-1"; alg="ecdsa-p256-sha256"
Signature: sig1=:MEUCIQD...fakebase64...qGZQ==:The server validates that:
- The fields haven't changed
- The signature matches using the known public key
RFC 9421 supports a range of algorithms, currently Jiko supports:
- ECDSA (P-256)
- EdDSA (Ed25519)
| Field Type | Example |
|---|---|
| HTTP Method | @method |
| Request Target | @path, @query, @target-uri |
| Headers | host, date, authorization |
Jiko requires the following fields to be signed:
@method@authority@target-uriauthorizationcontent-digest(when request has a body)
When a request includes a request body providing a Content-Digest header is required. Only SHA-256 or SHA-512 digest algorithms are supported. When signing a request that includes a request body, signing the Content-Digest header is mandatory.
POST /api/v2/pockets/ HTTP/1.1
Host: api.business.jiko.io
Date: Tue, 16 May 2023 14:00:00 GMT
Signature-Input: sig1=("@method" "@authority" "@target-uri" "content-digest" "authorization"); keyid="key-ed25519-1"; alg="ecdsa-p256-sha256"
Signature: sig1=:MEUCIQD...fakebase64...qGZQ==:
Content-Digest: sha-512=:RK/0qy18MlBSVnWgjwz6lZ...fakedigest...EWjP/lF5HF9bvEF8FabDg=:
Authorization: ey...faketoken...sJFjajdmJJS3=
{ "pocket_name": "Test pocket" }The protocol requires key identifiers (keyid) to match public keys. You can add your public key in the Settings page of the Jiko authentication portal.