Skip to content

[bullbitcoin-mobile] Implement BIP85 derivation for merchant keys (PGP, AES, password)#2

Open
BullishNode wants to merge 2 commits intomainfrom
fix/issue-29
Open

[bullbitcoin-mobile] Implement BIP85 derivation for merchant keys (PGP, AES, password)#2
BullishNode wants to merge 2 commits intomainfrom
fix/issue-29

Conversation

@BullishNode
Copy link
Owner

Summary

Implements BIP85 derivation for merchant cryptographic keys (PGP, AES, password) following the recoverbull pattern for deterministic key generation from the wallet's master mnemonic.

Changes

  • ✅ Created KeyDerivationPort interface defining the key derivation contract
  • ✅ Implemented MerchantKeyDerivationService with BIP85-based derivation:
    • PGP keypair derivation at m/83696968'/828365'/{bits}'/2026'/
    • AES-256 key derivation at m/83696968'/128169'/256'/2026'/{index}'
    • Server password derivation at m/83696968'/707764'/21'/2026'/
  • ✅ Password returns 21-char Base64 string (~120 bits entropy)
  • ✅ Registered service in MerchantPaymentsLocator
  • ✅ Added comprehensive unit tests (17 test cases, all passing)

Testing

All unit tests pass:

  • Deterministic key generation verified
  • Correct BIP85 path format validation
  • Key uniqueness across different indices
  • Proper entropy levels (~120 bits for password, 256 bits for AES)

Notes

  • PGP keypair generation currently returns placeholder pending OpenPGP library integration
  • Entropy is correctly derived and ready for use with OpenPGP library once added
  • Implementation follows Clean Architecture pattern with ports/adapters
  • Depends on Broadcast not working SatoshiPortal/bullbitcoin-mobile#27 (merchant_payments feature structure) ✅ merged

Fixes SatoshiPortal#29

BullishNode and others added 2 commits January 27, 2026 22:23
This commit creates the merchant_payments feature folder structure following
the Clean/Hexagonal architecture pattern documented in ARCHITECTURE.md:

- domain/ - Contains entities, repository contracts, service contracts, and usecases
- data/ - Contains datasources, models, and repository implementations
- presentation/ - Contains BLoCs/Cubits for state management
- ui/ - Contains screens and widgets

The feature is registered in the app locator (lib/locator.dart) for dependency
injection. Placeholder .gitkeep files are added to maintain directory structure.

Fixes SatoshiPortal#27

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Adds key derivation service following the recoverbull BIP85 pattern for
deterministic generation of cryptographic keys from the wallet's master
mnemonic. This enables secure, recoverable key management for BullPOS
merchant functionality.

Implementation:
- Created KeyDerivationPort interface defining the key derivation contract
- Implemented MerchantKeyDerivationService with BIP85-based derivation
- PGP keypair derivation at m/83696968'/828365'/{bits}'/2026'/
- AES-256 key derivation at m/83696968'/128169'/256'/2026'/{index}'
- Server password derivation at m/83696968'/707764'/21'/2026'/
- Password returns 21-char Base64 string (~120 bits entropy)
- Registered service in MerchantPaymentsLocator

Testing:
- Comprehensive unit tests with 17 test cases covering:
  - Deterministic key generation
  - Correct path format validation
  - Key uniqueness across indices
  - Proper entropy levels
  - All tests passing

Notes:
- PGP keypair generation returns placeholder pending OpenPGP library integration
- Entropy is correctly derived and can be used with OpenPGP library once added
- Service follows Clean Architecture pattern with ports/adapters

Fixes SatoshiPortal#29

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments