Something went wrong. Try again.
Something went wrong. Try again.
·
Copy SHA
·
Copy SHA
·
Copy SHA
- Swift 100%
README.md
AvocadoughKit #
Make an AT Protocol identity a Bitcoin payment address.
@alice.bsky.social → DID → PDS → xyz.avocadough.payment.endpoint → Lightning address → invoice
This package is the shared identity-to-payment layer consumed by Avocadough
(send & receive by handle) and Effem (boost a podcaster by identity). It
depends only on CoreATProtocol and is settlement-agnostic: the
xyz.avocadough.payment.endpoint lexicon advertises Lightning addresses
today, with BOLT12 offers and Cashu mints as zero-schema-change additions
later.
Lexicon and protocol documentation: https://avocadough.xyz/developers.
Pieces #
PaymentEndpointRecord— thexyz.avocadough.payment.endpointlexicon record (seeLexicons/). One canonical record per identity (rkey: self) holding an ordered list ofPaymentMethods.PaymentTarget.classify(_:)— classifies free-form input:@handle, bare handle, DID, Lightning address, BOLT11 invoice, LNURL, with or without alightning:scheme.PaymentTargetResolver— resolves any classified input to orderedResolvedPaymentMethods. The AT path composes CoreATProtocol'sIdentityResolverwith an unauthenticatedATRepoService.getRecordagainst the identity's own PDS; raw Lightning inputs pass through. No session needed.PaymentEndpointPublisher— writes/reads/removes the signed-in user's endpoint record (authenticated session required).LNURLPayService— turns a Lightning address into a payable BOLT11 invoice (LUD-06/16, comments per LUD-12, verify per LUD-21).
Usage #
// Pay an identity (no auth needed)
let target = try await PaymentTargetResolver().resolve("@alice.bsky.social")
if let address = target.preferredLightningAddress,
let lightningAddress = LightningAddress(address) {
let invoice = try await LNURLPayService().invoice(for: lightningAddress, amountMsat: 21_000)
// pay invoice.pr with any Lightning wallet (e.g. NostrKit's WalletConnectManager)
}
// Become payable (authenticated session)
try await PaymentEndpointPublisher().publish(lightningAddress: "thomas@getalby.com", repo: did)