Expand description
This crate is the base foundation to build things that can interact with the CDK (Cashu Development Kit) and their internal crates.
This is meant to contain the shared types, traits and common functions that are used across the internal crates.
§CDK Common
ALPHA This library is in early development, the API will change and should be used with caution.
Common types and utilities shared across the Cashu Development Kit (CDK) crates.
§Installation
Add this to your Cargo.toml:
[dependencies]
cdk-common = "*"§Features
This crate provides common functionality used across CDK crates including:
- Common data types and structures
- Shared traits and interfaces
- Utility functions
- Error types
The http feature enables CDK common’s HTTP-facing helpers and re-exports,
including cdk-http-client types, the WebSocket client re-export, HTTP error
conversion, and OIDC auth helpers.
cdk-common/http selects the default bitreq backend so consumers get a working
HTTP client automatically. Applications that need the reqwest backend can add a
direct cdk-http-client dependency with the reqwest feature; backend features
are additive, and reqwest takes precedence when both are enabled.
§License
This project is licensed under the MIT License.
Re-exports§
pub use common::FinalizedMelt;pub use error::Error;pub use melt::MeltQuoteCreateResponse;pub use melt::MeltQuoteRequest;pub use melt::MeltQuoteResponse;pub use mint_quote::MintQuoteRequest;pub use mint_quote::MintQuoteResponse;pub use bitcoin;pub use cashu::lightning_invoice;pub use parking_lot;
Modules§
- amount
- CDK Amount
- common
- Types
- database
- CDK Database
- dhke
- Diffie-Hellmann key exchange
- error
- Errors
- melt
- Unified Melt Quote types for melt use-cases.
- mint
- Mint types
- mint_
quote - Unified Mint Quote types for mint use-cases.
- mint_
url - Url
- nut00
- NUT-00: Notation and Models
- nut01
- NUT-01: Mint public key exchange
- nut02
- NUT-02: Keysets and keyset ID
- nut03
- NUT-03: Swap
- nut04
- NUT-04: Mint Tokens via Bolt11
- nut05
- NUT-05: Melting Tokens
- nut06
- NUT-06: Mint Information
- nut07
- NUT-07: Spendable Check
- nut08
- NUT-08: Lightning fee return
- nut09
- NUT-09: Restore signatures
- nut10
- NUT-10: Spending conditions
- nut11
- NUT-11: Pay to Public Key (P2PK)
- nut12
- NUT-12: Offline ecash signature validation
- nut13
- NUT-13: Deterministic Secrets
- nut14
- NUT-14: Hashed Time Lock Contacts (HTLC)
- nut15
- NUT-15: Multipart payments
- nut16
- NUT-16: Animated QR codes
- nut17
- Specific Subscription for the cdk crate
- nut18
- NUT-18: Payment Requests
- nut19
- NUT-19: Cached Responses
- nut20
- Mint Quote Signatures
- nut21
- 21 Clear Auth
- nut22
- 22 Blind Auth
- nut23
- Bolt11
- nut25
- Bolt12
- nut26
- NUT-26: Payment Request Bech32m Encoding
- nut28
- Pay-to-Blinded-Key (P2BK) Implementation
- nut29
- NUT-29: Batch Mint Tokens
- nut30
- NUT-30 onchain payment method
- nuts
- Nuts
- payment
- CDK mint payment backend interface
- pub_sub
- Publish/Subscribe core
- quote_
id - Quote ID. The specifications only define a string but CDK uses Uuid, so we use an enum to port compatibility.
- redact
- Helpers for formatting potentially sensitive values safely.
- secret
- Secret
- state
- State transition rules
- stream
- Supervision for long-lived streaming subscriptions.
- subscription
- Subscription types and traits
- task
- Thin wrapper for spawn and spawn_local for native and wasm.
- util
- Cashu utils
- wallet
- Wallet Types
- ws
- Websocket types and functions for the CDK.
Structs§
- Amount
- Amount can be any unit
- Auth
Proof - Auth Proofs
- Batch
Check Mint Quote Request - Batch check mint quote request per NUT-29
- Batch
Mint Request - Batch mint request per NUT-29
- Blind
Auth Settings - Blind auth settings
- Blind
Auth Token - Blind Auth Token
- Blind
Signature - Blind Signature (also called
promise) - Blind
Signature Dleq - Blinded Signature on Dleq
- Blinded
Message - Blinded Message (also called
output) - Bolt11
Invoice - Represents a syntactically and semantically correct lightning BOLT11 invoice.
- Check
State Request - Check spendable request [NUT-07]
- Check
State Response - Check Spendable Response [NUT-07]
- Clear
Auth Settings - Clear Auth Settings
- Conditions
- P2PK and HTLC spending conditions
- Contact
Info - Contact Info
- HTLC
Witness - HTLC Witness
- Id
- A keyset ID is an identifier for a specific keyset. It can be derived by anyone who knows the set of public keys of a mint. The keyset ID CAN be stored in a Cashu token such that the token can be used to identify which mint or keyset it was generated from.
- KeySet
- Keyset
- KeySet
Info - KeySetInfo
- Keys
- Mint public keys per amount.
- Keys
Response - Mint Public Keys [NUT-01]
- Keyset
Response - Mint Keysets [NUT-02] Ids of mints keyset ids
- Melt
Method Settings - Melt Method Settings
- Melt
Onchain Request - Melt onchain request
- Melt
Quote Bolt11 Request - BOLT11 melt quote request [NUT-23]
- Melt
Quote Bolt11 Response - Melt quote response [NUT-05]
- Melt
Quote Bolt12 Request - Melt quote request [NUT-18]
- Melt
Quote Bolt12 Response - Melt quote response [NUT-25]
- Melt
Quote Custom Request - Custom payment method melt quote request
- Melt
Quote Custom Response - Custom payment method melt quote response
- Melt
Quote Onchain Request - Melt quote onchain request
- Melt
Quote Onchain Response - Melt quote onchain response
- Melt
Request - Melt Bolt11 Request [NUT-05]
- Mint
Auth Request - Mint auth request [NUT-XX]
- Mint
Info - Mint Info [NUT-06]
- Mint
KeySet - MintKeyset
- Mint
Method Settings - Mint Method Settings
- Mint
Quote Bolt11 Request - Mint quote request [NUT-04]
- Mint
Quote Bolt11 Response - Mint quote response [NUT-04]
- Mint
Quote Bolt12 Request - Mint quote request [NUT-24]
- Mint
Quote Bolt12 Response - Mint quote response [NUT-24]
- Mint
Quote Custom Request - Custom payment method mint quote request
- Mint
Quote Custom Response - Custom payment method mint quote response
- Mint
Quote Onchain Request - Mint quote onchain request
- Mint
Quote Onchain Response - Mint quote onchain response
- Mint
Request - Mint request [NUT-04]
- Mint
Response - Mint response [NUT-04]
- Mint
Version - Mint Version
- Mpp
- Multi-part payment
- MppMethod
Settings - Mpp Method Settings
- NUT04
Settings - Mint Settings
- NUT05
Settings - Melt Settings
- NUT15
Settings - Mpp Settings
- Nut10
Secret - NUT10 Secret
- Nut10
Secret Request - Nut10Secret without nonce for payment requests
- Nut29
Settings - NUT-29 Settings for mint info
- Nuts
- Supported nuts and settings
- P2PK
Witness - P2Pk Witness
- Payment
Request - NUT-18 payment request.
- Payment
Request Builder - Builder for PaymentRequest
- Payment
Request Payload - Payment Request Payload
- PreMint
- PreMint
- PreMint
Secrets - Premint Secrets
- PreSwap
- Preswap information
- Proof
- Proofs
- Proof
Dleq - Proof Dleq
- Proof
State - Proof state [NUT-07]
- Protected
Endpoint - List of the methods and paths that are protected
- Public
Key - PublicKey
- Restore
Request - Restore Request [NUT-09]
- Restore
Response - Restore Response [NUT-09]
- Secret
Data - Secret Date
- Secret
Key - Secret key material.
- Supported
Method - Payment method accepted by the receiver for a payment request.
- Swap
Request - Swap Request [NUT-03]
- Swap
Response - Split Response [NUT-06]
- Token
UrDecoder - Reassembles a
Tokenfrom scanned UR fragments - Token
UrEncoder - Encodes a
Tokeninto UR fragments for display as an animated QR code - TokenV3
- Token
- TokenV4
- Token V4
- Transport
- Transport
- Transport
Builder - Builder for Transport
Enums§
- Auth
Required - Required Auth
- Auth
Token - Auth Token
- Currency
Unit - Currency Unit
- Kind
- NUT10 Secret Kind
- Melt
Options - Melt Options
- Melt
Quote State - Possible states of a quote
- Method
- HTTP method
- Mint
Quote State - Possible states of a quote
- Notification
Payload - Subscription response
- Payment
Method - Payment Method
- QuoteId
- Mint Quote ID
- Quote
IdError - Invalid UUID
- Route
Path - Route path
- SigFlag
- Signature flag
- Spending
Conditions - Spending Conditions
- State
- State of Proof
- Token
- Token Enum
- Transport
Type - Transport Type
- Witness
- Witness
Constants§
- MINT_
RPC_ PROTOCOL_ VERSION - Protocol version for gRPC Mint RPC communication
- PAYMENT_
PROCESSOR_ PROTOCOL_ VERSION - Protocol version for gRPC Payment Processor communication
Statics§
- SECP256
K1 - Secp256k1 global context
Traits§
- Proofs
Methods - Utility methods for Proofs
- Spending
Condition Verification - Trait for requests that spend proofs (SwapRequest, MeltRequest)