mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-11-22 01:27:27 +00:00
* core: add prepaid name codes and length bounds * store: run the names migration after badges * store: issue and revoke prepaid name codes * store: document issuing prepaid name codes * store: move the ABI helpers to Names.Abi * store: read the [names] and [chain] settings * store: add the names chain client and reads * store: refuse group name codes while names are off * store: search names and preview links * store: serve each site on its own port * scripts: deploy the badges and names sites * store: document search and the two sites * store: add the drop_taken_codes migration * store: read the names codes_only setting * store: add the names store and order signatures * store: take name orders by card, crypto or code * store: document name orders and codes-only * store: add the names transaction sender * store: commit and register queued orders * store: reveal and retry an owner's order * store: document the gas key * store: add the name balance migrations * store: read crypto units, rates and confirmations * store: keep a taken order's money as a balance * store: spend a balance on another name * store: record refunds with //refund * store: document balances and refunds * store: add the agreed terms migration * store: read the terms and community names * store: answer community and terms in search * store: sign and store the agreed terms * store: document the terms and community names * store: add the invoiced units migration * store: read the crypto an invoice asks * store: credit late and overpaid crypto by share * store: document crediting late crypto by share * store: add the record changes migration * store: find an owner's orders and move one * store: relay owners' link edits on chain * store: document link edits * store: move isLoopbackHost to Config * store: trust dev issuer keys on the local chain * scripts: build the names site from a submodule * scripts: add the dev setup and contract run * store: document the dev setup and names image * store: send a Stripe idempotency key for names * tests: wait until a relay lets go of its edit * store: refuse a link edit deadline under 10 min * store: count reverted link edits in the year limit * store: require https for a remote chain node * store: refuse zero chain confirmations * store: set up the dev stack from the names branch * store: rerun a failed unpaid cleanup next pass * store: never replace a succeeded Stripe intent * store: refuse an ini setting written as key: value * store: note the webapp submodule's pinned branch * store: document confirmLanded judging by ownerOf * store: update the names webapp submodule * store-service: register names under the name policy, every name accepting its terms on chain (#7889) * store: accept each name's terms on chain under the name policy * ci: run the reduced build on sh/names-deploy * store: address review: policy re-read, terms reads and startup log * store: never credit an unconfirmed extra * store: alert money sent to a paid name invoice * store: refuse to start on another chain's node * store: keep orders while the allowance is used up * store: replace a stalled transaction after 3 blocks * store: judge a name taken at confirmation depth * store: bind the template's listener to loopback * store: scan only the ids of active name orders * store: refuse unknown [names] and [chain] settings * store: fetch the webapp submodule in upgrade steps * store: delete definitions only tests use * store: lock only name invoices at settlement * store: retry an unexpired commitment as usual * store: share the helpers defined twice * store: test route limits on the running service * store: fix tests that could not fail * ci: test the store service on Postgres * store: count IPv6 clients by their /64 * store: sweep invoices read alone past a list cap * store: cap checkouts of all clients together * store: cap the long polls held at once * store: stop the old badge project at upgrade * store: keep search lookups free of previews * store: read the ini as UTF-8 in any locale * ci: run Postgres store tests in a UTF-8 locale * store: cap the transactions one order sends * store: cancel a card intent after three declines * store: refuse a name price under a cent * store: send each transaction with gas headroom * store: cap searches and read terms once per block * store: never log the group join link * store: mask the database password at startup * store: run one instance per database * store: limit name codes to admins, 100 a day * store: refuse HighSpeed settlement with names * store: no unverified receipts with a trusted key * store: cap the log lines of refused webhooks * store: check Apple certificates at the signed date * store: refuse a malformed Stripe publishable key * store: check the owner before a refund * store: fold the names migrations into one * store: read onion name links through the proxy * store: refund money after paid once confirmed * store: limit the allowance wait to a dry run * store: bind loopback when upgrading * ci: cache and widen the store Postgres job * store: fix stale and duplicate names tests * store: fix the submodule path in the upgrade * store: refuse unpaid name codes on the CLI * store: apply the review's names test list * store: finish the review's names test list * store: restore the base registration tests * store: pass link hosts that do not resolve here * store: refuse a move once its sends are used up * store: take the shared checkout at the provider * store: hold a search slot for chain reads only * store: state which refunds are safe on a reference * store: check a failed order's name before refusing its move (#8060) * store: test and document the shared checkout cap for name orders * store: check a failed order's name on chain before refusing its move * store: test name links whose host lookup fails * store: test that a search holds its slot through the chain reads only * store: restore the signed transaction check in the chain tests * store: remove the chain tests' copy of the signed transaction check * store: correct the search slot texts and the README's balance endpoints * docs: system and sequence diagrams of the names service (#8068) --------- Co-authored-by: sh-agents <350651734+sh-agents@users.noreply.github.com> Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com> Co-authored-by: brenzi-agent <brenzi-agent@brenzi.ch> Co-authored-by: Evgeny @ SimpleX Chat <259188159+evgeny-simplex@users.noreply.github.com>
172 lines
9.1 KiB
Plaintext
172 lines
9.1 KiB
Plaintext
[listener]
|
|
; loopback, where only Caddy reaches it: trust_forwarded_for below believes any caller's X-Forwarded-For
|
|
host = 127.0.0.1
|
|
; the API and the webhooks, and the badges site when serve_webapp = on
|
|
badges_port = 8080
|
|
; the builds are read from the image's /srv/badges and /srv/names, the defaults of badges_static_dir
|
|
; and names_static_dir
|
|
; split deployment: Caddy serves the exported folders; this service is the API and webhooks only.
|
|
; Set to on for an all-in-one deployment where this service serves the sites itself, the names
|
|
; site on names_port (default 8081), which also answers the API and the webhooks.
|
|
serve_webapp = off
|
|
; the badges site is written here at boot with the publishable key injected; compose bind-mounts it
|
|
; to a host path Caddy serves. Unset it when serve_webapp = on.
|
|
badges_export_dir = /srv/badges-export
|
|
; the names site (simplex.domains), with [names] only: the folder it is exported to, which compose
|
|
; bind-mounts to ./names for Caddy
|
|
;names_export_dir = /srv/names-export
|
|
; on because Caddy proxies /api and /webhooks to this service; without it the rate limiter keys on
|
|
; Caddy's address and shares one bucket across all callers
|
|
trust_forwarded_for = on
|
|
|
|
[btcpay]
|
|
host = https://btcpay.example.org
|
|
api_key = replace-me
|
|
store_id = replace-me
|
|
webhook_secret = replace-me
|
|
expiry_minutes = 60
|
|
speed_policy = MediumSpeed
|
|
payment_tolerance = 0.5
|
|
|
|
; optional; omit the whole [stripe] section to disable card payments
|
|
[stripe]
|
|
; restricted key (rk_): Payment Intents write + Charges read — never a full secret key (sk_)
|
|
secret_key = rk_test_replace-me
|
|
publishable_key = pk_test_REPLACEME
|
|
; the signing secret of the /webhooks/stripe endpoint configured in the Dashboard
|
|
webhook_secret = whsec_replace-me
|
|
; minutes the service holds an unpaid card invoice open before it expires it; 1-1440
|
|
session_minutes = 60
|
|
|
|
[poll]
|
|
waiting_seconds = 3
|
|
idle_seconds = 60
|
|
|
|
; optional; without it every App Store receipt is answered provider_not_configured, which the app retries later.
|
|
; root_certificates lists, comma-separated, the roots trusted to sign receipts, each in DER and placed
|
|
; in config/. Today that is https://www.apple.com/certificateauthority/AppleRootCA-G3.cer.
|
|
; When Apple adds a root, list it beside the old one rather than in its place.
|
|
; the api_ keys, set together, verify subscriptions with the in-app purchase key App Store Connect
|
|
; issues; without them every App Store subscription is answered provider_not_configured. Place the .p8
|
|
; in config/; it must be readable by the service's user alone. api_host defaults to production, the
|
|
; only host accepted unless [dev] credit_test_purchases = on, which needs the Sandbox host instead.
|
|
;[apple]
|
|
;bundle_id = chat.simplex.app
|
|
;root_certificates = /etc/simplex-store-service/AppleRootCA-G3.cer
|
|
;api_key_id = 2X9R4HXF34
|
|
;api_issuer_id = 57246542-96fe-1a63-e053-0824d011072a
|
|
;api_private_key_file = /etc/simplex-store-service/AuthKey_2X9R4HXF34.p8
|
|
;api_host = https://api.storekit.itunes.apple.com
|
|
|
|
; optional; without it every Play receipt is answered provider_not_configured, which the app retries later.
|
|
; service_account_file is the JSON key of a service account with the Play Console permissions "View
|
|
; financial data, orders, and cancellation survey responses" and "Manage orders and subscriptions", to
|
|
; read and acknowledge purchases. Without the second, a purchase the app has not already acknowledged
|
|
; itself is answered internal until the permission is granted. Place it in config/; the file must be readable by the service's user alone.
|
|
;[google]
|
|
;package_name = chat.simplex.app
|
|
;service_account_file = /etc/simplex-store-service/play-service-account.json
|
|
|
|
; index is the one clients verify against; private_key is from `simplex-chat badge keygen`.
|
|
; To rotate, change both together, once clients trust the new index.
|
|
[issuer]
|
|
index = 1
|
|
private_key = replace-me
|
|
|
|
; Optional. When present, the service creates and manages one group on its first
|
|
; start without --run-cli, and logs its join link once, on the start that creates it.
|
|
; The link is a bearer secret that stays valid, so keep that log private. The first
|
|
; member to join is promoted to owner, so join right away.
|
|
; Moderators can /issue and /bulk codes; admins and owners can also /revoke.
|
|
; display_name must be a name the chat core accepts unchanged: one it would spell
|
|
; differently stops the whole service, payments included, from starting.
|
|
;[group]
|
|
;display_name = SimpleX Badges
|
|
;description = Welcome to the badges group
|
|
|
|
; the names store: omit [names] and [chain] together to turn it off.
|
|
;[names]
|
|
; testing until the .simplex TLD is deployed
|
|
;tld = testing
|
|
; the paid years of a name, except a community name's, which are 2; at least 2, the controller's minimum
|
|
;years = 2
|
|
; a name's term starts here; the days until then are free
|
|
;term_start = 2027-01-01T00:00:00Z
|
|
; how far an order's duration may be from the one the service computes
|
|
;term_slack_seconds = 3600
|
|
; a commitment with less than this left before its reveal deadline is not reused
|
|
;reveal_margin_seconds = 900
|
|
; how many times one order may move to another name
|
|
;max_order_moves = 3
|
|
; on: only prepaid codes register names, and every paid name order answers 403 codes_only
|
|
;codes_only = off
|
|
; the owner's link edits relayed for one name in any 365 days, each a transaction whose gas the
|
|
; service pays; 1 to 100. A request refused, never sent or reverted on chain does not count
|
|
;record_edits_per_year = 3
|
|
;
|
|
; what each community name is for, with [names] only (the name policy on chain lists the names):
|
|
; one line per name, `<label> = <what it is for>`, the label in
|
|
; lower case and listed once, the text 1 to 200 characters without a full stop at the end, which
|
|
; the page adds; read only at startup, see apps/simplex-store-service/README.md
|
|
;[community]
|
|
;bakers = bakers and bakeries in Portugal
|
|
;
|
|
; the chain the names are registered on. rpc_url can carry a provider's API key and service_key
|
|
; pays for every commit and register: keep both secret. Neither is ever logged. rpc_url must be
|
|
; https unless the node is on loopback (127.0.0.1, ::1 or localhost)
|
|
;[chain]
|
|
; the reth node
|
|
;rpc_url = http://127.0.0.1:8545
|
|
; 1 for Ethereum mainnet
|
|
;chain_id = 1
|
|
;controller = 0x...
|
|
;sponsor = 0x...
|
|
;base_registrar = 0x...
|
|
;resolver = 0x...
|
|
; 0x and 64 hex digits: the registrar key the service sends transactions with; create, fund and
|
|
; rotate it as apps/simplex-store-service/README.md, "The gas key", says
|
|
;service_key = 0x...
|
|
; blocks after a register's receipt before a name counts as registered, at least 1, which is the
|
|
; receipt's own block
|
|
;confirmations = 3
|
|
; the most gas any one transaction may use
|
|
;gas_limit_cap = 8000000
|
|
; the most wei per gas any transaction may pay (100 gwei); a transaction that needs more waits
|
|
;max_fee_per_gas = 100000000000
|
|
|
|
; the lowest level of the lines printed: trace, debug, info, note, warn or error. The service's
|
|
; routine lines are note, so warn and error hide them, the group's join link included. The level
|
|
; applies to the whole process, so below note the SMP agent's lines print too.
|
|
; --log-agent or -l debug sets the level from -l instead.
|
|
[log]
|
|
level = note
|
|
|
|
; local testing only, in both run modes: accepts any well-formed App Store or Play receipt without
|
|
; verifying it, so anyone who can reach this service can mint badges. The service refuses to start
|
|
; with this on beside an [apple] or [google] section. Its issuer key is always one released apps
|
|
; trust, so they accept every badge minted this way.
|
|
; A subscription is answered renewing and charged for its plan: the App Store product's, or the base
|
|
; plan a Play test token test.<basePlanId>.<uuid> names when it is a plan of that product, and else
|
|
; the product's monthly base plan, so a licence tester's purchase is credited too. An App Store tier
|
|
; raise is charged for the raised plan, which its renewals then charge. The plans are kept in memory,
|
|
; so a restart answers later renewals as ended, and refunds the unissued
|
|
; months of a plan still covered at its next month. Nothing is acknowledged, so Play refunds a
|
|
; licence tester's subscription once its acknowledgement window lapses.
|
|
[dev]
|
|
accept_unverified_store_receipts = off
|
|
; only beside accept_unverified_store_receipts or credit_test_purchases = on: every issue request for a
|
|
; subscription asks its store, while coverage runs too, and banks the months each check charges, to
|
|
; watch a renewal by hand.
|
|
check_store_during_coverage = off
|
|
|
|
; local testing only, beside a real [apple] or [google]: credits a purchase the store itself calls a
|
|
; test - an App Store sandbox purchase, or a Play licence tester's - which no real buyer pays for.
|
|
; Without it such a purchase is refused as test_purchase, which is terminal, so it can never be credited.
|
|
; Beside [apple] the service starts with this on only when its api_ keys are set with
|
|
; api_host = https://api.storekit-sandbox.itunes.apple.com, since a sandbox receipt verifies like any
|
|
; other and would otherwise be credited as a real purchase. Beside [google] it is allowed: never turn it
|
|
; on beside the production app's [google], as the issuer key is one released apps trust and every
|
|
; licence tester the Play Console lists would get a badge without paying. Each test purchase or test
|
|
; subscription taken as paid is logged as a warning.
|
|
credit_test_purchases = off
|