Harden Nexus Bitcoin services for sandbox production-readiness#15
Draft
support371 wants to merge 21 commits into
Draft
Harden Nexus Bitcoin services for sandbox production-readiness#15support371 wants to merge 21 commits into
support371 wants to merge 21 commits into
Conversation
|
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's GuideHardens the Nexus card and converter microservices for sandbox-only, production-ready operation by adding HMAC-authenticated internal traffic, deterministic sandbox conversion, PostgreSQL-backed idempotency and audit logging, stricter KYC enforcement, and CI/tests to validate configuration and security behavior. Sequence diagram for sandbox fund loading with HMAC and idempotencysequenceDiagram
actor Client
participant CardAPI as card_platform_main
participant CardLogic as CardPlatformLogic
participant ConverterAPI as converter_main
participant Idempotency as IdempotencyStore
participant Conversion as ConversionLogic
Client->>CardAPI: load_card_funds
CardAPI->>CardLogic: transfer_fiat_to_crypto(user_id, fiat_amount, fiat_currency)
CardLogic->>CardLogic: sign_internal_request
CardLogic->>ConverterAPI: POST /internal/transfer_funds
Note right of CardLogic: headers INTERNAL_TIMESTAMP_HEADER, INTERNAL_SIGNATURE_HEADER
ConverterAPI->>ConverterAPI: verify_internal_request
ConverterAPI->>Idempotency: begin(transaction_key)
alt [key already completed]
ConverterAPI->>Idempotency: get_completed_response
Idempotency-->>ConverterAPI: response
ConverterAPI-->>CardLogic: idempotent_replay response
else [new processing]
ConverterAPI->>Conversion: execute_conversion_and_payout
Conversion-->>ConverterAPI: conversion_result
ConverterAPI->>Idempotency: complete(transaction_key, conversion_result)
ConverterAPI-->>CardLogic: success response
end
CardLogic-->>CardAPI: response
CardAPI-->>Client: conversion_initiated
Entity relationship diagram for Nexus core fintech schemaerDiagram
users {
TEXT user_id PK
SMALLINT kyc_tier
TEXT kyc_status
}
nexus_idempotency_keys {
TEXT idempotency_key PK
TEXT status
JSONB response_json
}
nexus_ledger_events {
TEXT event_id PK
TEXT event_type
TEXT actor_type
TEXT actor_id
TEXT subject_id
TEXT trace_id
JSONB event_data
}
nexus_conversion_records {
TEXT transaction_key PK
TEXT user_id FK
NUMERIC fiat_amount
CHAR3 fiat_currency
NUMERIC btc_amount
BIGINT satoshis
TEXT payment_mode
TEXT status
}
nexus_card_records {
TEXT card_id PK
TEXT user_id FK
TEXT card_mode
TEXT status
}
users ||--o{ nexus_conversion_records : has_conversions
users ||--o{ nexus_card_records : has_cards
users ||--o{ nexus_ledger_events : has_events
nexus_idempotency_keys ||--o{ nexus_conversion_records : correlates
nexus_ledger_events ||--o{ nexus_conversion_records : logs
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Owner
Author
|
Validation update (2026-06-21):
This PR remains draft, mergeable, sandbox-only, and unmerged. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This branch turns the existing fintech/Nexus prototype into a safer, testable backend baseline without enabling live money movement.
Included
vercel.json.env.example, unit tests, and a GitHub CI workflowValidation performed
Safety state
PAYMENTS_MODE=sandboxCARD_ISSUANCE_MODE=sandboxALLOW_LIVE_PAYMENTS=falseALLOW_LIVE_CARD_ISSUANCE=falseRemaining external gates
Summary by Sourcery
Harden Nexus card and conversion services for sandbox-only operation with authenticated internal traffic, database-backed idempotency, and production-ready configuration and CI.
New Features:
Enhancements:
Build:
CI:
Documentation:
Tests: