Skip to content
Almena Network— version v2026-12-beta
Auto
English

Example: payment with a token

This page follows UC-01 from start to finish and shows every message exactly as it is written. It is informative: the rules are in the protocols and in the registries. At the end there are test vectors so that two implementations can check that they compute the same thing.

The messages are shown in plaintext, before being encrypted for the recipient. Signatures and long values are abbreviated with …, except in the test vectors.

Who Identifier in the example
Bank did:keri:EKYLUMmNPZeEs77Zvclf0bSN5IN-mLfLpx2ySb-HDlk4
Merchant (an online shop) did:keri:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg
Person, with the bank did:peer:4zQmPersonWithBankExample (abbreviated)
Person, with the merchant did:peer:4zQmPersonWithMerchantExample (abbreviated)

The person already has a relationship with the bank and an account credential issued by it. They have never dealt with the merchant.

The example, step by step

The shop shows a QR code at checkout, and the same link next to it.

almena://invite?entity=did%3Akeri%3AEcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg&form=EFormHashSubscription…

The format of the link (registries, 7): links have the form almena://<action>?<parameters>, with the parameters URL-encoded. Actions in v2026-12-beta: invite (parameters entity, required, and form, optional: the network hash of the form version) and signin (console sign-in: nonce, key and mailbox). A wallet MUST ignore parameters it does not know.

The wallet resolves the merchant’s did:keri, checks its Almena Trust credential, fetches the form and shows it to the person.

The form asks for the name, an email and a means of payment. The person fills in the first two and approves. Being the first message, it carries the full did:peer:4 (long form) and the mailbox.

{
"id": "0b7e5a52-3c1d-4f0e-8a6b-1d2c3e4f5a60",
"type": "urn:almena:msg:exchange:1.0:request",
"from": "did:peer:4zQmPersonWithMerchantExample…",
"to": ["did:keri:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg"],
"created_time": 1796292000,
"body": {
"form": {
"entity": "did:keri:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg",
"vct": "urn:almena:vct:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg:subscription:1",
"version": 3
},
"fields": {
"given_name": "Ana",
"email": "ana@example.org"
},
"mailbox": "did:peer:2.MediatorExample…"
}
}

The thid is omitted: in the first message of a thread it is the message’s own id.

3. The merchant asks for a means of payment

Section titled “3. The merchant asks for a means of payment”
{
"id": "6a1f0c2d-9e8b-4a7c-b6d5-e4f3a2b1c0d9",
"type": "urn:almena:msg:exchange:1.0:presentation-request",
"from": "did:keri:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg",
"to": ["did:peer:4zQmPersonWithMerchantExample"],
"created_time": 1796292002,
"thid": "0b7e5a52-3c1d-4f0e-8a6b-1d2c3e4f5a60",
"body": {
"form": {
"entity": "did:keri:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg",
"vct": "urn:almena:vct:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg:subscription:1",
"version": 3
},
"nonce": "n-4c8f2a9e1b7d",
"nonce_expires": 1796292302
}
}

The form’s DCQL query asks for a credential of type urn:almena:vct:token:1. The wallet shows the person their bank credentials; the person chooses one and approves the charge permission for this shop.

It goes through the relationship the person already has with the bank, in a new thread.

{
"id": "5e0b9c1e-6a8f-4d9e-9b1a-2c7d4e6f8a01",
"type": "urn:almena:msg:token:1.0:token-request",
"from": "did:peer:4zQmPersonWithBankExample",
"to": ["did:keri:EKYLUMmNPZeEs77Zvclf0bSN5IN-mLfLpx2ySb-HDlk4"],
"created_time": 1796292030,
"body": {
"merchant": "did:keri:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg",
"credential": "iss-2f9a71c0",
"until": "2027-12-31"
}
}

credential is the issuance reference of the account credential the person chose. until is the optional end date of the permission.

{
"id": "c3d4e5f6-0718-4293-a4b5-c6d7e8f90a1b",
"type": "urn:almena:msg:exchange:1.0:issue",
"from": "did:keri:EKYLUMmNPZeEs77Zvclf0bSN5IN-mLfLpx2ySb-HDlk4",
"to": ["did:peer:4zQmPersonWithBankExample"],
"created_time": 1796292031,
"thid": "5e0b9c1e-6a8f-4d9e-9b1a-2c7d4e6f8a01",
"body": {
"credentials": ["eyJhbGciOiJFUzI1NiIsInR5cCI6ImRjK3NkLWp3dCJ9.eyJpc3Mi…~"],
"permission": "perm-91d0b7",
"receipts": [
{
"record": {
"type": "urn:almena:data:record:1",
"entity": "did:keri:EKYLUMmNPZeEs77Zvclf0bSN5IN-mLfLpx2ySb-HDlk4",
"node": "did:keri:ENodeOfTheBankExample…",
"seq": 1287,
"prev": "Ehx3…",
"op": "token.issued",
"time": "2026-12-03T10:00:31Z",
"commitment": "QE1stzU_fryMusvQIOL1UCXKKYPMFX34FiW6s1GEEVs",
"sig": "…"
},
"salt": "o6Ojo6Ojo6Ojo6Ojo6Ojo6Ojo6Ojo6Ojo6Ojo6Ojo6M",
"details": {
"parties": [
"did:keri:EKYLUMmNPZeEs77Zvclf0bSN5IN-mLfLpx2ySb-HDlk4",
"did:peer:4zQmPersonWithBankExample"
],
"ref": "tkp-7f3c9a",
"thid": "5e0b9c1e-6a8f-4d9e-9b1a-2c7d4e6f8a01"
}
}
]
}
}

The token is an SD-JWT VC. Its payload, decoded:

{
"iss": "did:keri:EKYLUMmNPZeEs77Zvclf0bSN5IN-mLfLpx2ySb-HDlk4",
"iat": 1796292031,
"exp": 1798884031,
"vct": "urn:almena:vct:token:1",
"cnf": { "kid": "did:keri:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg" },
"ref": "tkp-7f3c9a",
"status": { "status_list": { "idx": 4113, "uri": "urn:almena:data:status-list:1:EStatusListOfTheBank…" } }
}
  • cnf points to the merchant’s did:keri, not to a specific key: the merchant can rotate keys without the token losing validity.
  • ref is the random reference that only the bank understands; it is different in each token.
  • exp is 30 days after iat (provisional value).
  • There is nothing about the person.

6. The wallet delivers the token to the merchant

Section titled “6. The wallet delivers the token to the merchant”

In the same thread as step 2.

{
"id": "8d9e0f1a-2b3c-4d5e-9f60-718293a4b5c6",
"type": "urn:almena:msg:exchange:1.0:request",
"from": "did:peer:4zQmPersonWithMerchantExample",
"to": ["did:keri:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg"],
"created_time": 1796292035,
"thid": "0b7e5a52-3c1d-4f0e-8a6b-1d2c3e4f5a60",
"body": {
"form": {
"entity": "did:keri:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg",
"vct": "urn:almena:vct:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg:subscription:1",
"version": 3
},
"presentations": ["eyJhbGciOiJFUzI1NiIsInR5cCI6ImRjK3NkLWp3dCJ9.eyJpc3Mi…~"]
}
}

The token travels without a Key Binding JWT: its holder is the merchant, so the wallet cannot sign one, and the nonce does not apply to it. The merchant checks the bank’s signature, that vct is urn:almena:vct:token:1, that cnf is its own did:keri and that it is not revoked. Proof of possession comes later, in step 8, because token-redeem is signed by the merchant’s did:keri. Other credentials in the same request keep their Key Binding JWT with the nonce.

First the ack (only the header with the thid), then the result:

{
"id": "a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d",
"type": "urn:almena:msg:exchange:1.0:result",
"from": "did:keri:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg",
"to": ["did:peer:4zQmPersonWithMerchantExample"],
"created_time": 1796292037,
"thid": "0b7e5a52-3c1d-4f0e-8a6b-1d2c3e4f5a60",
"body": {
"result": "accepted",
"receipts": [
{ "record": { "op": "relationship.created", "…": "…" }, "salt": "…", "details": { "…": "…" } },
{ "record": { "op": "presentation.verified", "…": "…" }, "salt": "…", "details": { "…": "…" } }
]
}
}

Responses carry receipts, a list, because the first response of a relationship carries two: relationship.created and that of the operation.

On the day of the charge, through the relationship between the merchant and the bank:

{
"id": "f0e1d2c3-b4a5-4968-8776-655443322110",
"type": "urn:almena:msg:token:1.0:token-redeem",
"from": "did:keri:EcgloQMw1LT4EwgdltxSXcrFopZbdyLZ1-_uRsc0HATg",
"to": ["did:keri:EKYLUMmNPZeEs77Zvclf0bSN5IN-mLfLpx2ySb-HDlk4"],
"created_time": 1796378400,
"body": {
"token": "eyJhbGciOiJFUzI1NiIsInR5cCI6ImRjK3NkLWp3dCJ9.eyJpc3Mi…~",
"amount": { "value": "19.90", "currency": "EUR" },
"concept": "Subscription, December 2026"
}
}

The amount is a decimal written as text, so that no precision is lost, and the currency is ISO 4217. The bank rejects a message whose id it has already received.

A result with the receipt of token.redeemed, whose details are the merchant, the bank, this thread and the ref of the token. Or a problem report with code e.p.request_rejected if it does not accept the charge.

1. Derivation of the pairwise identifier’s keys

Section titled “1. Derivation of the pairwise identifier’s keys”

The rule is in cryptography, 5: SLIP-10 over P-256, all levels hardened.

Input Value
Seed (32 bytes) 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
Entity did:keri:EKYLUMmNPZeEs77Zvclf0bSN5IN-mLfLpx2ySb-HDlk4
SHA-256 of the entity (UTF-8) 8033a111a8e283680d846035fd1ec10d24cac96aed3e8ea940a317404ba6f73b
a, b, c, d 3383569, 685933416, 226779189, 2099167501

Each index is 4 bytes of the hash, in order and big-endian, with the most significant bit set to 0.

Path Private key Public key (compressed)
m/4279373'/3383569'/685933416'/226779189'/2099167501'/0' 0bd40b416619d2db0ccbc08a74b7c8df79e78b2e9338deb9a813f163ab5fe2a1 03074206a3633976be03ba878e79f6ff67dea2c7a064998527a3872ac7a2168fcc
…/1' 1270f9f1946e031171cb0f9ad6b29ee410a1e0b057bd4e3209e928b9c6d673e7 02d7fc95c063c4870793038b0cec897df25406b17b8f2c0afa0fd5f51840fe4b41
…/2' (ML-KEM d) 1a01b775cdc1b944764fa43c2d92b88b0acae87853b958d7aaa06e111821411e —
…/3' (ML-KEM z) e34bb109f783233677782994b104aec21e8d49fd103b5cb64878c758c9b82c18 —

The rule (network, 7.1.2): commitment = SHA-256(salt ‖ JCS(details)), where the salt is 32 random bytes, JCS is the JSON canonicalization of RFC 8785 (keys sorted, no spaces) and parties is sorted alphabetically. The salt and the commitment are written in base64url without padding.

The token.issued record of step 5:

Value
Salt (hex) a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3a3
Salt (base64url) o6Ojo6Ojo6Ojo6Ojo6Ojo6Ojo6Ojo6Ojo6Ojo6Ojo6M
JCS(details) {"parties":["did:keri:EKYLUMmNPZeEs77Zvclf0bSN5IN-mLfLpx2ySb-HDlk4","did:peer:4zQmPersonWithBankExample"],"ref":"tkp-7f3c9a","thid":"5e0b9c1e-6a8f-4d9e-9b1a-2c7d4e6f8a01"}
Commitment (hex) 404d6cb7353f7ebc8cbacbd020e2f55025ca2983cc157df81625bab35184115b
Commitment (base64url) QE1stzU_fryMusvQIOL1UCXKKYPMFX34FiW6s1GEEVs

A real salt MUST be random. The one above is fixed only so that the vector can be reproduced.