Skip to content

v0.4.4 — BOLT12 mint quote signing fix

Choose a tag to compare

@zeugmaster zeugmaster released this 15 Sep 13:14
· 7 commits to main since this release

BOLT12 mint quote signing fix

Typed BOLT12 minting now signs redemption requests with the quote's private key using current NUT-20. Previously, Bolt12.mint sent an unsigned request even though BOLT12 quotes require quote locking, causing conforming mints to reject issuance.

Changes

  • Add Bolt12.mint(quote:from:amount:seed:quoteKey:preferredDistribution:) and Bolt12.quoteLockingKey(seed:counter:).
  • Validate quote public keys, the supplied signing key, and quote response consistency.
  • Reject negative or inconsistent paid/issued totals and enforce the available balance while supporting partial issuance and amountless offers.
  • Validate output denominations and sum distributions without integer overflow in shared minting code.
  • Preserve the generic signed API's defaults and explicit .legacyConcat compatibility option.

BOLT12 API migration

  • Pass the private key corresponding to the quote's public key as quoteKey:. The old unsigned typed overload is deprecated and throws CashuError.quoteSigningKeyRequired before making a request.
  • Read the remaining balance with try quote.mintableAmount; malformed accounting now throws CashuError.invalidQuoteAccounting.
  • Retain the quote key or its derivation counter for later issuances of the same quote. The output seed does not replace the signing key.

See the BOLT12 usage and migration guide.

Swift Package Manager

.package(url: "https://github.com/zeugmaster/CashuSwift.git", exact: "0.4.4")

Validation

129 offline tests passed, including seven new tests covering captured HTTP requests, independent signature verification, tampered signed fields, repeated issuance, invalid inputs, and generic signing compatibility. Live mint integration tests were not run.