zeekay
ad4f429f1e
fix: per-org MPC isolation — orgID end-to-end threading + security hardening
...
- M-1 CRITICAL: Remove legacy key share fallback (cross-tenant leak)
- M-2 HIGH: orgID now required string on all Node methods (not variadic)
- M-3 HIGH: Key material zeroing after signing sessions
- Thread orgID through MPCBackend interface, all API handlers
- Reshare + TFHE sessions use OrgScopedKey for reads/writes
- Remove hardcoded JWT default (fail-hard if not set)
- Add warning log for empty orgID legacy path
- Regression tests: TestGetKeyShareWithFallback_M1_CrossTenantLeak
2025-12-28 00:20:28 -08:00
zeekay
3954d11f50
fix: goimports formatting + CGO_ENABLED=0 for CI tests
...
- Run goimports -w on all 17 Go files with formatting issues
- Set CGO_ENABLED=0 on all CI steps (test, lint, build, CodeQL, SBOM)
- Remove -race flag from tests (requires CGO which pulls in blst.h)
- All 17 test packages pass with CGO_ENABLED=0
2025-12-27 23:01:00 -08:00
zeekay
0d7a523c3e
security: add orgID multi-tenancy isolation, rename badger to zapdb
...
Multi-tenancy isolation (addresses Dragonfire review MPC audit):
- Add OrgID field to all event messages (keygen, sign, reshare)
- Scope session dedup keys as orgID-walletID-txID
- Namespace KVStore keys with org prefix (org:<orgID>:<key>)
- Backward-compatible fallback to legacy unscoped keys
- New org_kvstore.go with OrgScopedKey/GetKeyShareWithFallback
Naming cleanup:
- Rename all badger references to zapdb in code, config, tests
- config.yaml: badger_password → zapdb_password
- AppConfig: BadgerPassword → ZapDBPassword
- Fix MPCiumVersion typo → MPCVersion
2025-12-27 22:41:08 -08:00
zeekay
4641ad7c09
feat: BLS threshold + security hardening + ZapDB KMS-backing
...
Security (from red team review):
- Replay protection: request_id + timestamp freshness on sign API
- Ed25519 message auth re-enabled on all protocol messages
- DKG timeout (5min) + signing timeout (30s) with watchdog
- Dedup map TTL cleanup (10min expiry, 2min sweep)
BLS threshold signing:
- KeyTypeBLS + keygen/signing sessions
- TrustedDealer pattern for BLS DKG
- CBOR serialization for BLS config
- 8 tests
ZapDB KMS-backing:
- HSM PasswordProvider wired to ZapDB init
- Supports: AWS KMS, GCP KMS, Azure KV, env, file
- Default env for backward compat
- 19 tests
Also: sr25519 sessions, fixed SignWireMessage build break
2025-12-27 21:54:46 -08:00
zeekay
b143c542e4
feat: sr25519 threshold signing for Polkadot/Substrate
...
MPC daemon now supports sr25519 (Schnorrkel) key generation and
threshold signing using FROST over the ristretto255 group.
New files:
- pkg/mpc/sr25519_keygen_session.go — threshold keygen
- pkg/mpc/sr25519_signing_session.go — threshold signing
- pkg/mpc/sr25519_config_marshal.go — CBOR serialization
- pkg/mpc/ristretto255.go — local curve implementation
- pkg/eventconsumer/signing_handler_sr25519.go — event routing
Wiring:
- KeyTypeSR25519 constant + session type
- Event consumer routes sr25519 keygen/signing events
- API accepts "sr25519" as valid protocol
- DOT/KSM network codes mapped to sr25519 key type
- Signing context configurable (default "substrate")
14 tests passing.
2025-12-27 21:41:32 -08:00
zeekay
18b0d5e1c3
fix: add missing session.Init() call in CGGMP21 signing handler
...
The CGGMP21 signing handler never called session.Init(), which creates
the protocol handler. Without it, no protocol round messages are
generated and the signing session stalls indefinitely.
2025-12-27 15:10:50 -08:00
zeekay
369c76432b
feat: add /keygen HTTP endpoint, PubSub self-delivery, increase keygen timeout
...
- Add POST /keygen endpoint for triggering MPC keygen via HTTP API
- Fix PubSub self-delivery: Publish now delivers to local subscribers
before broadcasting to peers (required for consensus mode keygen)
- Increase KeyGenTimeOut from 30s to 120s (Paillier prime generation
takes 6-15s per node, multi-round protocol needs more time)
- Add pubKeyToEthAddress helper for deriving ETH addresses from ECDSA keys
- Bump version to 0.3.3
2025-12-27 12:51:46 -08:00
zeekay
9385abddd2
Sync improvements from hanzoai/mpc
...
Features:
- Add FROST keygen and signing sessions for EdDSA/Taproot
- Add LSS keygen and signing sessions with dynamic resharing
- Add CBOR serialization for FROST and LSS configs (fix JSON corruption)
- Add recovery byte calculation for Ethereum compatibility
- Add FROST signing handler for EdDSA signatures
- Upgrade threshold library to v1.5.2
Security:
- Fix config serialization using CBOR instead of JSON
- Add security audit findings to LLM.md
- Document blockchain support matrix
Files added:
- frost_config_marshal.go, frost_keygen_session.go
- lss_config_marshal.go, keygen_session_lss.go
- signing_session_frost.go, signing_session_lss.go
- recovery.go, signing_handler_frost.go
2025-12-27 09:06:37 -08:00
zeekay
b45ac639ac
Fix remaining import formatting issues
...
- Run goimports on all pkg files
- Ensure consistent import grouping throughout codebase
2025-08-02 22:30:28 -05:00
zeekay
83969bc35e
feat: Complete migration to luxfi/threshold library
...
Major changes:
- Replaced Binance TSS library with luxfi/threshold (supports CGGMP21 & FROST)
- Added XRPL network support for secp256k1 signatures
- Implemented resharing functionality for both ECDSA and EdDSA
- Fixed protocol adapters for CGGMP21 and FROST
- Updated event consumer to use new node methods
- Fixed all build errors in core packages
Technical improvements:
- Simplified party.ID usage (now string-based)
- Added proper message types and encoding
- Updated session interfaces with required methods
- Fixed test suite to work with new library structure
All core package tests passing. Ready for mainnet deployment.
2025-08-02 20:49:39 -05:00
zeekay
0b8661ced9
Use new threshold lib
2025-08-02 15:49:26 -05:00
zeekay
4ec50522c9
Add benchmarks, tests, updated docs
2025-08-02 15:27:50 -05:00
Vo Tuan Thanh and GitHub
8d92c012ed
Fix error message when signing with duplicate tx_id (Issue #60 ) ( #63 )
...
* Fix error message when signing with duplicate tx id
* Update error message for duplicate signing requests to be more concise
2025-07-30 22:35:50 +07:00
anhthii
70fdddd6bd
Skip logging error on duplicate key gen
2025-07-17 21:55:20 +07:00
anhthii
55fbf8685f
Fix keygen topic
2025-07-13 22:21:32 +07:00
anhthii
5e48a47019
Add missing error handling
2025-07-11 21:08:02 +07:00
Poseidon-G and anhthii
160603f299
Remove jetstream pubsub change to message broker
2025-07-10 08:46:22 +07:00
Cody and GitHub
c6e2c3c06f
Add integration, unit testing CI pipelines ( #48 )
...
* Add comprehensive tests for multiple pkg
* Add db_path to config
* Add e2e testing pipeline
* Add github workflow
* Remove config.test.yaml
* Fix lint issue
* Increase timeout
* Add e2e testing for signing
* Skip signing if node is not in participant list
* Code cleanup
* Add e2e testing for signing and resharing
* Increase timeout
* Add test instructions
* Update github workflow branching
* Add vulnerabilties check in CI
* Fix ci
2025-07-06 14:26:03 +07:00
anhthii
19905b55ad
Consistent reshare result topic and fix Inconsistent Success Event
2025-07-04 17:02:25 +07:00
anhthii
0d36129fdd
Refactor handle resharing error
2025-07-04 16:25:37 +07:00
anhthii
8912fda251
Fix resharing, only require t+1 participants, add session_id to remove idempotempt issue
2025-07-04 14:13:17 +07:00
anhthii
134ba09ad2
Rename success event -> result event
2025-07-03 21:59:46 +07:00
anhthii
1fdaafa4b9
Include error in keygen and reshare event
2025-07-03 21:52:41 +07:00
anhthii
f2aaedf8f8
Rename to improve consistent naming
2025-07-03 18:08:20 +07:00
anhthii
f4c3cd315c
Implement coordination, waiting for enough peers before consuming sign message
2025-07-03 15:31:04 +07:00
anhthii
ad234cf7ad
Fix signing eddsa crash on key v1
2025-07-03 14:57:43 +07:00
anhthii
93140ff954
Enrich signing session message
2025-07-03 12:40:50 +07:00
anhthii
21a0688d70
Better error handling
2025-07-03 12:03:54 +07:00
anhthii
d4b07dbb74
Adjust signing logic, only require t+1 nodes to participate
2025-07-03 10:31:07 +07:00
vietddude
942afd3f65
refactor: improve session type handling and key storage logic
2025-07-02 22:00:33 +07:00
vietddude
b59005c8ff
chore: resolve PR review comments
2025-07-02 16:26:15 +07:00
vietddude
f5fc40a17c
remove debug log
2025-07-02 14:56:03 +07:00
vietddude
41beae472e
complete reshare ecdsa supports input threshold and peer ids
2025-07-02 14:24:37 +07:00
vietddude
a865d5765c
Enhance reshare session management by introducing versioning and updating party ID generation logic
2025-07-01 23:50:35 +07:00
vietddude
689406518f
Update reshare event handling logic and clean up ECDSA reshare session initialization
2025-07-01 17:55:22 +07:00
vietddude
3e058330ad
Fix KeyTypeEd25519 declaration for consistency in eventconsumer and mpc packages
2025-07-01 17:40:44 +07:00
vietddude
d4172726d5
preload preparams
2025-07-01 17:32:43 +07:00
vietddude
95af28f8f1
Add resharing functionality with event handling and session management
2025-07-01 16:03:58 +07:00
anhthii
71f19b31c0
Add config max concurrent keygen
2025-06-27 16:03:10 +07:00
anhthii
91af31e885
Refactor session
2025-06-27 15:41:20 +07:00
anhthii
625f590be5
More granular logs on key type
2025-06-27 14:16:08 +07:00
anhthii
0ff4c0e9b7
Process key gen event concurrently
2025-06-27 10:03:37 +07:00
anhthii
e7da31eb7c
Add version for cli
2025-04-30 21:44:48 +07:00
anhthii
1ee63ba4cb
Relocate package
2025-04-30 19:06:46 +07:00
anhthii
db4785e76e
Code refactoring for identity store
2025-04-29 19:21:56 +07:00
anhthii
ed87c4ce61
Load mpc threshold from config
2025-04-25 20:54:11 +07:00
anhthii
b5bb177f80
Use onSuccess callback when sign session succeeds
2025-04-12 21:13:22 +07:00
anhthii
694d3a0791
Fix bug signing doesn't work after all nodes are backup
2025-04-02 20:35:41 +07:00
anhthii
36598a87ec
Handle duplicate message
2025-04-02 19:29:14 +07:00
Luc Nguyen
578a7dea3f
Update timeout consumer keep subscribe on time
2025-03-31 15:59:18 +07:00