wallet-kit / src / ardegazu / wallet / index.cljs
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
;; ardegazu-wallet-kit — the artifact layer of the ardegazu.ro economy.
;;
;; Any identity can found a bank (that is banca's job) and issue its own
;; currency; any app can embed this kit to hold balances and pay, WITHOUT
;; replicating a bank's log. A wallet holds settled receipts and pending signed
;; orders, and a balance is a fold over receipts.
;;
;; This package is the core and nothing else: shapes, a ledger fold, a deep
;; link. No transport, no UI, no stakes, no trust graph — those ship on top of
;; it, and none of them can change what a signature covers.
;;
;; The package root: one var per public symbol of the "." export, re-exported by
;; the :index module as dist/index.js. "./paylink" is its own module so a page
;; that only reads links stays small; "./selftest" is dev-only.
(ns ardegazu.wallet.index
  (:require [ardegazu.wallet.consts :as consts]
            [ardegazu.wallet.ledger :as ledger]
            [ardegazu.wallet.paylink :as paylink]
            [ardegazu.wallet.shapes :as shapes]))

;; consts — the wire's constants, all of them golden-vectored. There is no
;; WALLET_SALT: this layer derives nothing, so shipping one would publish a
;; constant no vector pins and nothing agrees to (see consts.cljs).
(def DOM-PAY-REQ consts/DOM-PAY-REQ)
(def DOM-PAY-ORD consts/DOM-PAY-ORD)
(def DOM-PAY-RCP consts/DOM-PAY-RCP)
(def DOM-PAY-ISS consts/DOM-PAY-ISS)
(def DOM-PAY-LOCK consts/DOM-PAY-LOCK)
(def DOM-PAY-REL consts/DOM-PAY-REL)
(def AMT-MIN consts/AMT-MIN)
(def AMT-MAX consts/AMT-MAX)
(def CTX-MAX consts/CTX-MAX)
(def MEMO-MAX consts/MEMO-MAX)
(def PUB-RE consts/PUB-RE)
(def SIG-RE consts/SIG-RE)
(def ORDER-ID-RE consts/ORDER-ID-RE)
(def DIGEST-RE consts/DIGEST-RE)
(def CODE-RE consts/CODE-RE)
(def CUR-RE consts/CUR-RE)
(def NEUTRAL-BANKER consts/NEUTRAL-BANKER)
(def NEUTRAL-CODE consts/NEUTRAL-CODE)
(def NEUTRAL-UNIT consts/NEUTRAL-UNIT)
(def SKEW-MS consts/SKEW-MS)
(def REQ-TTL-MS consts/REQ-TTL-MS)
(def ORDER-TTL-MS consts/ORDER-TTL-MS)
(def MAX-TTL-MS consts/MAX-TTL-MS)
(def MAX-ARTIFACT-BYTES consts/MAX-ARTIFACT-BYTES)
(def MAX-SETTLEMENT-BYTES consts/MAX-SETTLEMENT-BYTES)
(def DECLINE-REASONS consts/DECLINE-REASONS)
(def LEDGER-KEY-PREFIX consts/LEDGER-KEY-PREFIX)
(def PAY-BASE-URL consts/PAY-BASE-URL)
(def PAY-FRAGMENT-KEY consts/PAY-FRAGMENT-KEY)

;; currency ids
(def parse-currency shapes/parse-currency)
(def is-payable-currency shapes/is-payable-currency)
(def is-neutral-unit shapes/is-neutral-unit)
(def banker-of shapes/banker-of)

;; text clamps (build side)
(def sanitize-ctx shapes/sanitize-ctx)
(def sanitize-memo shapes/sanitize-memo)

;; signature preimages — the interop contract
(def unsigned-pay-request shapes/unsigned-pay-request)
(def unsigned-order shapes/unsigned-order)
(def unsigned-settlement shapes/unsigned-settlement)
(def pay-request-preimage shapes/pay-request-preimage)
(def order-preimage shapes/order-preimage)
(def settlement-preimage shapes/settlement-preimage)
(def unsigned-issuance shapes/unsigned-issuance)
(def issuance-preimage shapes/issuance-preimage)
(def unsigned-lock shapes/unsigned-lock)
(def lock-preimage shapes/lock-preimage)
(def unsigned-lock-receipt shapes/unsigned-lock-receipt)
(def lock-receipt-preimage shapes/lock-receipt-preimage)
(def unsigned-release shapes/unsigned-release)
(def release-preimage shapes/release-preimage)

;; dedup keys + liveness
(def order-id shapes/order-id)
(def receipt-key shapes/receipt-key)
(def issuance-key shapes/issuance-key)
(def lock-id shapes/lock-id)
(def lock-receipt-key shapes/lock-receipt-key)
(def expired shapes/expired)

;; hashlocks — the escrow condition
(def new-hashlock shapes/new-hashlock)
(def hashlock-matches shapes/hashlock-matches)

;; structural checks (synchronous, signature-free)
(def pay-request-shape shapes/pay-request-shape)
(def order-shape shapes/order-shape)
(def settlement-shape shapes/settlement-shape)
(def issuance-shape shapes/issuance-shape)
(def lock-shape shapes/lock-shape)
(def lock-receipt-shape shapes/lock-receipt-shape)
(def release-shape shapes/release-shape)

;; the eight artifacts
(def build-pay-request shapes/build-pay-request)
(def verify-pay-request shapes/verify-pay-request)
(def build-order shapes/build-order)
(def verify-order shapes/verify-order)
(def build-settlement shapes/build-settlement)
(def verify-settlement shapes/verify-settlement)
(def build-issuance-receipt shapes/build-issuance-receipt)
(def verify-issuance-receipt shapes/verify-issuance-receipt)
(def build-lock shapes/build-lock)
(def verify-lock shapes/verify-lock)
(def build-lock-receipt shapes/build-lock-receipt)
(def verify-lock-receipt shapes/verify-lock-receipt)
(def build-release shapes/build-release)
(def verify-release shapes/verify-release)

;; the ledger
(def LedgerStore ledger/LedgerStore)

;; pay links — also their own module ("./paylink"), for pages that want nothing
;; else from this kit
(def pay-request-url paylink/pay-request-url)
(def parse-pay-fragment paylink/parse-pay-fragment)

static mirror of HEAD · about · clone: git clone https://git.ardegazu.ro/wallet-kit.git