Skip to content

feat(sdk): label AuthFetch BRC-105 payment actions for recovery - #432

Open
shruggr wants to merge 4 commits into
bsv-blockchain:mainfrom
shruggr:feat/authfetch-brc105-payment-labels
Open

feat(sdk): label AuthFetch BRC-105 payment actions for recovery#432
shruggr wants to merge 4 commits into
bsv-blockchain:mainfrom
shruggr:feat/authfetch-brc105-payment-labels

Conversation

@shruggr

@shruggr shruggr commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

Why

BRC-105 payments can be broadcast by AuthFetch without the payment reaching the server. When that happens the money is on-chain, the server never internalized it, and the client has almost no way to find the payment again: only a human-readable description, no labels, and derivation data stuck in output customInstructions that apps cannot query via listActions. Apps that need to account for or recover stranded payments (e.g. refund flows) are stuck.

What

  • Always label BRC-105 payment actions with brc105 <hexPrefix> <hexSuffix> (hex of the base64 nonce bytes so wallet label lowercasing is lossless).
  • Accept optional caller labels on fetch options for app-level discovery.
  • Wire headers and payment construction unchanged — client-side accounting only.

Recovery path once a payment is found: hex → bytes → base64 → original prefix/suffix for the server.

Test plan

  • AuthFetch payment tests (auto label, caller merge/trim, hex round-trip)
  • AuthFetch additional tests
  • CI on this PR

Notes

  • Additive AuthFetch behavior only.
  • No BRC change (BRC-105 does not mandate client labels).

shruggr added 2 commits August 4, 2026 23:12
Always apply brc105 <prefix> <suffix> on 402 payment createAction calls,
and accept optional caller labels so apps can find and recover stranded
payments via listActions without changing wire headers.
Wallet labels are lowercased; base64 prefix/suffix would be lossy.
Store hex of the nonce bytes so derivation can be recovered for refunds.
@shruggr

shruggr commented Aug 5, 2026

Copy link
Copy Markdown
Contributor Author

I'm happy to make this optional and would love any feedback you guys want to offer. Automatic payments need to be able to be linked back to the application request which made the request somehow. If there is some alternatives I'm missing, I'd be happy to consider those as well.

@shruggr
shruggr marked this pull request as ready for review August 5, 2026 03:20
shruggr added 2 commits August 4, 2026 23:24
Release note candidates are maintainer-owned; leave versioning ledger untouched.
Match other createAction callers; wallet validateLabel already trims and lowercases.
@sonarqubecloud

sonarqubecloud Bot commented Aug 5, 2026

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant