├── VERSION ├── internal ├── routes │ ├── utils.go │ ├── admin │ │ ├── static │ │ │ ├── .gitignore │ │ │ ├── login.css │ │ │ ├── src │ │ │ │ ├── modules │ │ │ │ │ ├── core.js │ │ │ │ │ └── auth.js │ │ │ │ └── index.js │ │ │ ├── package.json │ │ │ ├── card.css │ │ │ ├── summary.css │ │ │ ├── layout.css │ │ │ ├── header.css │ │ │ ├── button.css │ │ │ ├── expansion.css │ │ │ ├── app.js │ │ │ ├── settings.css │ │ │ └── app.css │ │ ├── templates │ │ │ ├── utils.go │ │ │ ├── general.templ │ │ │ ├── layout.templ │ │ │ ├── header.templ │ │ │ ├── lightning_activity.templ │ │ │ ├── login.templ │ │ │ ├── components.templ │ │ │ └── keysets.templ │ │ ├── tabs_test.go │ │ ├── lightning.go │ │ ├── token_blacklist.go │ │ ├── logout.go │ │ ├── mint-activity.go │ │ └── keysets.go │ ├── routes.go │ ├── middleware │ │ ├── cache.go │ │ └── auth.go │ └── auth.go ├── database │ ├── goose │ │ ├── migrations │ │ │ ├── 2_add_y_to_proof.sql │ │ │ ├── 3_add_version_to_seeds.sql │ │ │ ├── 25_index_y_proofs_table.sql │ │ │ ├── 4_add_unit_to_request.sql │ │ │ ├── 35_add_final_expiry_to_seeds.sql │ │ │ ├── 31_add_pubkey_to_mint_quote.sql │ │ │ ├── 26_add_amount_to_mint_request.sql │ │ │ ├── 11_add_fees_to_keyset.sql │ │ │ ├── 14_add_mpp_melt_request.sql │ │ │ ├── 18_add_quote_reference_to_proofs.sql │ │ │ ├── 15_fix_restore_table_remove_witness.sql │ │ │ ├── 33_add_description_to_mint_request.sql │ │ │ ├── 8_add_encrypted_field_to_seeds.sql │ │ │ ├── 10_add_preimage_to_melt_request.sql │ │ │ ├── 32_remove_foreigh_key_seed_ref.sql │ │ │ ├── 24_add_paid_fee_to_melt_request.sql │ │ │ ├── 16_remove_seed_and_encrypted.sql │ │ │ ├── 7_add_witness_data.sql │ │ │ ├── 6_wallet_recovery.sql │ │ │ ├── 9_add_state_field_to_melt_mint_request.sql │ │ │ ├── 17_add_proofs_state.sql │ │ │ ├── 20_add_dleq_to_recovery.sql │ │ │ ├── 23_create_melt_change_table.sql │ │ │ ├── 22_liquidity_swap_request.sql │ │ │ ├── 12_add_nostr_login_table.sql │ │ │ ├── 21_add_unique_constraint.sql │ │ │ ├── 27_add_strike_key.sql │ │ │ ├── 13_add_seen_at_fields.sql │ │ │ ├── 34_add_icon_url_and_tos_url_to_config.sql │ │ │ ├── 30_add_user_auth_table.sql │ │ │ ├── 5_changed_payed_to_request_paid_and_addpayed_field.sql │ │ │ ├── 28_add_checking_id.sql │ │ │ ├── 19_mint_config_transition.sql │ │ │ ├── 29_auth_config_fields.sql │ │ │ └── 1_create_baseline.sql │ │ └── goose.go │ ├── mock_db │ │ ├── config.go │ │ ├── change.go │ │ ├── auth.go │ │ └── admin.go │ └── postgresql │ │ ├── auth.go │ │ └── change.go ├── utils │ ├── version.go │ ├── liquidityManager.go │ ├── proofs_test.go │ └── common.go ├── mint │ ├── oidc.go │ ├── seeds.go │ ├── websocket_test.go │ ├── proofs.go │ ├── config.go │ ├── bolt11.go │ ├── auth.go │ └── websocket.go ├── signer │ ├── interface.go │ ├── utils_test.go │ ├── types.go │ ├── remote_signer │ │ └── util.go │ ├── utils.go │ └── local_signer │ │ └── local_signer_test.go ├── lightning │ ├── utils.go │ ├── backend.go │ ├── lightning_test.go │ ├── proto │ │ └── cln_primitives.proto │ ├── invoice.go │ └── fake_wallet.go └── gen │ └── signer.proto ├── .goosehints ├── .gitignore ├── api └── cashu │ ├── erros_test.go │ ├── websocket.go │ ├── util_test.go │ ├── util.go │ ├── keys.go │ ├── swap.go │ ├── auth.go │ ├── melt_test.go │ └── errors.go ├── AGENTS.md ├── .github └── workflows │ ├── docker-build-test.yml │ ├── release-from-version.yml │ ├── docker-publish-latest.yml │ ├── docker-publish-on-tag.yml │ └── workflow.yml ├── LICENSE ├── .air.toml ├── test ├── configTest │ ├── setup.go │ └── main_test.go └── setupTest │ └── lnd_test.go ├── env.example ├── Dockerfile ├── docker-compose-dev.yml ├── test_calls.txt ├── cmd └── nutmix │ ├── info_test.go │ └── main_cache_test.go └── pkg └── crypto └── bdhke.go /VERSION: -------------------------------------------------------------------------------- 1 | 0.3.9 2 | -------------------------------------------------------------------------------- /internal/routes/utils.go: -------------------------------------------------------------------------------- 1 | package routes 2 | 3 | import "log/syslog" 4 | 5 | type Logger struct { 6 | Sysloger *syslog.Writer 7 | } 8 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/2_add_y_to_proof.sql: -------------------------------------------------------------------------------- 1 | 2 | -- +goose Up 3 | ALTER TABLE proofs ADD Y TEXT; 4 | 5 | 6 | -- +goose Down 7 | ALTER TABLE proofs DROP COLUMN Y 8 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/3_add_version_to_seeds.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE seeds ADD version INT; 3 | 4 | 5 | -- +goose Down 6 | ALTER TABLE seeds DROP COLUMN version 7 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/25_index_y_proofs_table.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | CREATE INDEX IF NOT EXISTS idx_proofs_y ON proofs (y); 3 | 4 | 5 | -- +goose Down 6 | DROP INDEX idx_proofs_y; 7 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/4_add_unit_to_request.sql: -------------------------------------------------------------------------------- 1 | 2 | -- +goose Up 3 | ALTER TABLE mint_request ADD unit TEXT; 4 | 5 | 6 | -- +goose Down 7 | ALTER TABLE mint_request DROP COLUMN unit; 8 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/35_add_final_expiry_to_seeds.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE seeds ADD COLUMN final_expiry int4; 3 | 4 | -- +goose Down 5 | ALTER TABLE seeds DROP COLUMN final_expiry; 6 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/31_add_pubkey_to_mint_quote.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE mint_request ADD pubkey bytea; 3 | 4 | 5 | 6 | -- +goose Down 7 | ALTER TABLE mint_request DROP COLUMN pubkey; 8 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/26_add_amount_to_mint_request.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE mint_request ADD amount int4; 3 | 4 | 5 | 6 | -- +goose Down 7 | ALTER TABLE mint_request DROP COLUMN amount; 8 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/11_add_fees_to_keyset.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE seeds ADD input_fee_ppk int NOT NULL DEFAULT 0; 3 | 4 | 5 | 6 | -- +goose Down 7 | ALTER TABLE seeds DROP COLUMN input_fee_ppk; 8 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/14_add_mpp_melt_request.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE melt_request ADD mpp bool NOT NULL DEFAULT false; 3 | 4 | 5 | 6 | -- +goose Down 7 | ALTER TABLE melt_request DROP COLUMN mpp; 8 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/18_add_quote_reference_to_proofs.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE proofs 3 | ADD COLUMN quote text; 4 | 5 | 6 | -- +goose Down 7 | ALTER TABLE proofs 8 | DROP COLUMN quote; 9 | 10 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/15_fix_restore_table_remove_witness.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE recovery_signature DROP COLUMN witness; 3 | 4 | 5 | 6 | -- +goose Down 7 | ALTER TABLE recovery_signature ADD witness TEXT; -------------------------------------------------------------------------------- /internal/database/goose/migrations/33_add_description_to_mint_request.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE mint_request ADD description text; 3 | 4 | 5 | 6 | -- +goose Down 7 | ALTER TABLE mint_request DROP COLUMN description; 8 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/8_add_encrypted_field_to_seeds.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE seeds ADD encrypted BOOL NOT NULL DEFAULT FALSE; 3 | 4 | 5 | 6 | -- +goose Down 7 | ALTER TABLE seeds DROP COLUMN encrypted; 8 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/10_add_preimage_to_melt_request.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE melt_request ADD payment_preimage TEXT; 3 | 4 | 5 | -- +goose Down 6 | ALTER TABLE melt_request DROP COLUMN payment_preimage; 7 | 8 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/32_remove_foreigh_key_seed_ref.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE proofs DROP CONSTRAINT proofs_seeds_fk; 3 | 4 | -- +goose Down 5 | ALTER TABLE proofs ADD CONSTRAINT proofs_seeds_fk FOREIGN KEY (id) REFERENCES seeds(id) -------------------------------------------------------------------------------- /internal/routes/admin/static/.gitignore: -------------------------------------------------------------------------------- 1 | # Node.js/npm build artifacts 2 | dist/ 3 | 4 | # npm dependencies 5 | node_modules/ 6 | 7 | # IDE files 8 | .vscode/ 9 | .idea/ 10 | *.swp 11 | *.swo 12 | 13 | # OS generated files 14 | .DS_Store 15 | Thumbs.db 16 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/24_add_paid_fee_to_melt_request.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE melt_request ADD fee_paid int8; 3 | UPDATE melt_request SET fee_paid = 0 WHERE fee_paid IS NULL; 4 | 5 | 6 | 7 | -- +goose Down 8 | ALTER TABLE melt_request DROP COLUMN fee_paid; 9 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/16_remove_seed_and_encrypted.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE seeds 3 | DROP COLUMN seed, 4 | DROP COLUMN encrypted; 5 | 6 | 7 | 8 | -- +goose Down 9 | ALTER TABLE seeds 10 | ADD seed bytea NOT NULL, 11 | ADD encrypted BOOL NOT NULL DEFAULT FALSE; 12 | -------------------------------------------------------------------------------- /internal/utils/version.go: -------------------------------------------------------------------------------- 1 | package utils 2 | 3 | var ( 4 | // AppVersion will be in 0.0.0 format 5 | AppVersion = "development" 6 | 7 | // BuildTime is the time it built, in RFC3339 8 | BuildTime = "unknown" 9 | 10 | // GitCommit is the Git commit hash 11 | GitCommit = "unknown" 12 | ) 13 | -------------------------------------------------------------------------------- /.goosehints: -------------------------------------------------------------------------------- 1 | This is a GO application that uses the GIN web framework [gin docs](https://gin-gonic.com/en/docs/). 2 | 3 | The golang application has an administrative dashboard that uses templ. View documentation: [templ docs](https://templ.guide/) for html templating. 4 | 5 | Never commit to code to git. 6 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/7_add_witness_data.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE proofs ADD witness TEXT; 3 | ALTER TABLE recovery_signature ADD witness TEXT; 4 | 5 | 6 | 7 | -- +goose Down 8 | ALTER TABLE proofs DROP COLUMN witness; 9 | ALTER TABLE recovery_signature DROP COLUMN witness; 10 | -------------------------------------------------------------------------------- /internal/routes/admin/static/login.css: -------------------------------------------------------------------------------- 1 | .center-content-login { 2 | display: flex; 3 | justify-content: center; 4 | align-items: center; 5 | } 6 | 7 | /* Login card max-width for better visual balance */ 8 | .main-content-full .card { 9 | max-width: 500px; 10 | width: 100%; 11 | } -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .env 2 | build-errors.log 3 | mint/tmp/ 4 | mint/main 5 | env/ 6 | tmp/ 7 | *_templ.go 8 | *_templ.txt 9 | *_gen.go 10 | *.pb.go 11 | 12 | tls/ 13 | 14 | build/ 15 | 16 | keycloak/keycloak_export 17 | keycloak/postgres_data 18 | 19 | .cursor/ 20 | /nutmix 21 | 22 | dist 23 | release/ 24 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/6_wallet_recovery.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | CREATE TABLE "recovery_signature" ( 3 | amount int4 NULL, 4 | id text NOT NULL, 5 | "B_" text NOT NULL, 6 | "C_" text NOT NULL, 7 | created_at int8 NOT NULL 8 | ); 9 | 10 | 11 | -- +goose Down 12 | DROP TABLE "recovery_signature"; 13 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/9_add_state_field_to_melt_mint_request.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE mint_request ADD state TEXT; 3 | ALTER TABLE melt_request ADD state TEXT; 4 | 5 | 6 | -- +goose Down 7 | ALTER TABLE mint_request DROP COLUMN state; 8 | ALTER TABLE melt_request DROP COLUMN state; 9 | 10 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/17_add_proofs_state.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE proofs ADD state TEXT; 3 | 4 | -- if the proofs have null value on state asume they are spent 5 | UPDATE proofs 6 | SET state = 'SPENT' 7 | WHERE state IS NULL; 8 | 9 | 10 | -- +goose Down 11 | ALTER TABLE proofs DROP COLUMN state 12 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/20_add_dleq_to_recovery.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | ALTER TABLE recovery_signature ADD dleq_e text; 3 | ALTER TABLE recovery_signature ADD dleq_s text; 4 | 5 | 6 | 7 | -- +goose Down 8 | ALTER TABLE recovery_signature DROP COLUMN dleq_e; 9 | ALTER TABLE recovery_signature DROP COLUMN dleq_s; 10 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/23_create_melt_change_table.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | CREATE TABLE IF NOT EXISTS "melt_change_message" ( 3 | "B_" text NOT NULL, 4 | created_at int8 NOT NULL, 5 | quote text NOT NULL, 6 | id text NOT NULL 7 | ); 8 | 9 | 10 | -- +goose Down 11 | DROP TABLE "melt_change_message"; 12 | -------------------------------------------------------------------------------- /internal/database/goose/migrations/22_liquidity_swap_request.sql: -------------------------------------------------------------------------------- 1 | -- +goose Up 2 | CREATE TABLE liquidity_swaps( 3 | amount INTEGER, 4 | id TEXT, 5 | state TEXT, 6 | type TEXT, 7 | expiration int4 NOT NULL, 8 | lightning_invoice TEXT NOT NULL 9 | ); 10 | 11 | 12 | -- +goose Down 13 | DROP TABLE IF EXISTS liquidity_swaps; 14 | -------------------------------------------------------------------------------- /internal/mint/oidc.go: -------------------------------------------------------------------------------- 1 | package mint 2 | 3 | import ( 4 | "context" 5 | 6 | "github.com/coreos/go-oidc/v3/oidc" 7 | ) 8 | 9 | func (m *Mint) SetupOidcService(ctx context.Context, url string) error { 10 | oidcClient, err := oidc.NewProvider(ctx, url) 11 | if err != nil { 12 | return err 13 | } 14 | 15 | m.OICDClient = oidcClient 16 | return nil 17 | } 18 | -------------------------------------------------------------------------------- /internal/routes/admin/templates/utils.go: -------------------------------------------------------------------------------- 1 | package templates 2 | 3 | import ( 4 | "golang.org/x/text/language" 5 | "golang.org/x/text/message" 6 | ) 7 | 8 | // formatNumber formats a number with thousand separators (periods) 9 | func FormatNumber(n uint64) string { 10 | p := message.NewPrinter(language.German) 11 | return p.Sprintf("%.0f", float64(n)) 12 | } 13 | -------------------------------------------------------------------------------- /internal/routes/admin/templates/general.templ: -------------------------------------------------------------------------------- 1 | package templates 2 | 3 | templ ErrorNotif(message string) { 4 |
{ description }
58 | } 59 |