@CassOnMars — two architectural questions for shared mutation hooks in @quilibrium/quorum-shared. Sibling to #65, #66.
1. CryptoProvider DI
Mobile uses NativeCryptoProvider ad-hoc at every space-crypto call site, plus a module-level singleton for DM crypto. When a shared hook needs crypto, it has to get a provider from somewhere.
Two paths:
- Context —
CryptoContext + useCryptoProvider(), matching the existing StorageContext pattern. Shared hooks call useCryptoProvider() internally.
- Parameter — shared hooks accept
cryptoProvider as an option. Cleaner separation, more boilerplate at each consumer.
2. Broadcast pattern for shared mutation hooks
When a shared mutation hook produces a new state, it has to broadcast a WS envelope. The send is platform-specific (broadcastSpaceUpdate on mobile, SpaceService.updateSpace on desktop).
Two paths:
- Return the envelope — caller dispatches via their platform's broadcast function.
- Callback — hook accepts
onBroadcast(envelope) and calls it internally.
Issue #66 (channel reorder mutations not broadcasting) is a live instance of this question.
Or...
Defer shared mutation hooks entirely for now and migrate only read-query hooks until the patterns are clearer?
@CassOnMars — two architectural questions for shared mutation hooks in
@quilibrium/quorum-shared. Sibling to #65, #66.1. CryptoProvider DI
Mobile uses
NativeCryptoProviderad-hoc at every space-crypto call site, plus a module-level singleton for DM crypto. When a shared hook needs crypto, it has to get a provider from somewhere.Two paths:
CryptoContext+useCryptoProvider(), matching the existingStorageContextpattern. Shared hooks calluseCryptoProvider()internally.cryptoProvideras an option. Cleaner separation, more boilerplate at each consumer.2. Broadcast pattern for shared mutation hooks
When a shared mutation hook produces a new state, it has to broadcast a WS envelope. The send is platform-specific (
broadcastSpaceUpdateon mobile,SpaceService.updateSpaceon desktop).Two paths:
onBroadcast(envelope)and calls it internally.Issue #66 (channel reorder mutations not broadcasting) is a live instance of this question.
Or...
Defer shared mutation hooks entirely for now and migrate only read-query hooks until the patterns are clearer?