Skip to content

feat: BRC-138 single-use signed proofs (login in one request) - #6

Merged
kryp2 merged 1 commit into
masterfrom
feat/brc138-auth-proofs-2026-08-17
Aug 18, 2026
Merged

feat: BRC-138 single-use signed proofs (login in one request)#6
kryp2 merged 1 commit into
masterfrom
feat/brc138-auth-proofs-2026-08-17

Conversation

@kryp2

@kryp2 kryp2 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Agent: dsh-peck/deepseek-v4-flash

Summary

Modernization round for bsv-brc-python against the 2026-08 BRC ecosystem
(spec set current to 2026-08-12, 150+ standards): the first Python
implementation of BRC-138 — Single-Use Signed Proofs for Request
Authentication
, proven byte-compatible with the canonical TypeScript
reference @bsv/auth.

What's included

  • bsv_brc.brc138create_auth_proof / verify_auth_proof /
    check_auth_proof_data over the spec's canonical encoding, BRC-42/43
    child-key derivation per proof (protocolID [2, name], keyID = nonce,
    counterparty = verifier), SHA-256 + DER ECDSA signing (matches
    @bsv/sdk createSignature). Wire form per spec (signature = byte
    values; hex accepted for wallet interop). Optional request-payload
    binding (VarInt length-prefixed).
  • Single-use storesSingleUseStore ABC, MemorySingleUseStore
    (locked, lazy eviction), SqliteSingleUseStore (atomic
    INSERT OR IGNORE, bounded retention).
  • AuthProofMiddleware — optional Starlette/ASGI auth gate
    (x-bsv-auth-proof header or JSON body proof member).
  • crypto.keys.derive_signing_public_key — verifier-side BRC-43
    derivation (inverse of derive_signing_key).
  • Interop proofexamples/brc138_interop/ live 4-way check against
    @bsv/auth + @bsv/sdk (Python↔Node, bodyless + body-bound), plus
    pinned certified vectors in tests/test_brc138_interop.py (Node-free
    regression).
  • docs/MODERNIZATION.md — full gap analysis vs the current BRC set:
    402 payment family (BRC-118 multipart, BRC-120 x402, BRC-121 simple 402),
    BEEF V2 (BRC-96/158), overlay sync (BRC-76 GASP, BRC-136 BASM), BRC-35;
    corrects the stale/factually-wrong "out of scope" claims in README/CHANGELOG
    (BRC-101 is SHIP/SLAP facilitator URLs, BRC-108 is the Identity-Linked
    Token Protocol, BRC-116 is Wallet Permissions — nothing sCrypt).

Verification

  • Full suite: 235 tests pass (197 pre-existing + 38 new) on Python 3.14
    with latest bsv-sdk 2.3.3 (pin floor was 2.1.3 — suite was already
    green on the newer SDK).
  • Live cross-implementation check against @bsv/auth (Node): all 4
    directions pass.

Notes for review

  • Branch: feat/brc138-auth-proofs-2026-08-17
  • The examples/brc138_interop/ package-lock.json pins @bsv/auth
    0.1.3 / @bsv/sdk 2.4.1 for reproducible interop runs; node_modules/
    is gitignored.
  • Default protocol [2, "bsv auth proof"] matches @bsv/auth so proofs
    interop across languages out of the box.

Adds the first Python implementation of BRC-138 (Single-Use Signed Proofs
for Request Authentication), byte-compatible with the reference TypeScript
@bsv/auth implementation:

- bsv_brc.brc138: create_auth_proof / verify_auth_proof over the spec's
  canonical encoding, BRC-42/43 child-key derivation per proof
  (protocolID [2, name], keyID = nonce, counterparty = verifier),
  SHA-256 + DER signing matching @bsv/sdk createSignature.
- SingleUseStore ABC + MemorySingleUseStore + SqliteSingleUseStore
  (atomic uniqueness, bounded retention).
- AuthProofMiddleware (optional Starlette/ASGI auth gate).
- crypto.keys.derive_signing_public_key: verifier-side BRC-43 derivation.
- Cross-implementation proof vs @bsv/auth (live harness + pinned vectors).
- docs/MODERNIZATION.md: BRC ecosystem gap analysis vs 2026-08 spec set;
  corrects stale BRC-101/108/116 claims in README/CLAUDE.

Co-authored-by: dsh-peck/deepseek-v4-flash <dsh-peck@peck.to>
@kryp2
kryp2 force-pushed the feat/brc138-auth-proofs-2026-08-17 branch from 99db065 to e042c0b Compare August 18, 2026 01:25
@kryp2
kryp2 merged commit e642e72 into master Aug 18, 2026
4 checks passed
@kryp2
kryp2 deleted the feat/brc138-auth-proofs-2026-08-17 branch August 18, 2026 01:26
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