Skip to content

Clients should stop retrying requests if they get a OHTTP key rejection #615

@spacebear21

Description

@spacebear21

When a directory responds with Key Configuration Rejected 400 error, clients should switch on that error variant and attempt to re-fetch fresh OHTTP keys. Currently they keep retrying and failing:

2025-03-31T15:41:51.163943Z DEBUG payjoin_directory: serve_payjoin_directory: ["", ".well-known", "ohttp-gateway"]
2025-03-31T15:41:51.164681Z TRACE bitcoin_ohttp: HPKE info: 6d6573736167652f626874747020726571756573740001001600010003    
2025-03-31T15:41:51.165224Z ERROR payjoin_directory: Bad request: Key configuration rejected: a problem occurred with HPKE: Failed to open ciphertext
2025-03-31T15:41:52.216120Z DEBUG payjoin_directory: serve_payjoin_directory: ["", ".well-known", "ohttp-gateway"]
2025-03-31T15:41:52.217250Z TRACE bitcoin_ohttp: HPKE info: 6d6573736167652f626874747020726571756573740001001600010003    
2025-03-31T15:41:52.217875Z ERROR payjoin_directory: Bad request: Key configuration rejected: a problem occurred with HPKE: Failed to open ciphertext
2025-03-31T15:41:53.449042Z DEBUG payjoin_directory: serve_payjoin_directory: ["", ".well-known", "ohttp-gateway"]
2025-03-31T15:41:53.450171Z TRACE bitcoin_ohttp: HPKE info: 6d6573736167652f626874747020726571756573740001001600010003    
2025-03-31T15:41:53.450777Z ERROR payjoin_directory: Bad request: Key configuration rejected: a problem occurred with HPKE: Failed to open ciphertext
2025-03-31T15:41:54.145756Z DEBUG payjoin_directory: serve_payjoin_directory: ["", ".well-known", "ohttp-gateway"]
2025-03-31T15:41:54.146435Z TRACE bitcoin_ohttp: HPKE info: 6d6573736167652f626874747020726571756573740001001600010003    
2025-03-31T15:41:54.146954Z ERROR payjoin_directory: Bad request: Key configuration rejected: a problem occurred with HPKE: Failed to open ciphertext

For receivers, this requires making SessionContext modifiable (specifically providing a way to update ohttp_keys and persisting the change).

For senders, it means falling back to the io::fetch_ohttp_keys functionality if the OHTTP keys provided in the receiver's payjoin URL are stale.

Relates to #614

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions