fix: inboxes and app keys#277
Conversation
fc20c53 to
427d174
Compare
There was a problem hiding this comment.
Pull Request Overview
This PR fixes inbox creation and app key consistency issues by correcting address property references and ensuring matching public/private key pairs. The changes address problems where apps were using inconsistent keys and incorrect account addresses during inbox operations.
- Updates property references from
identity.addresstoidentity.accountAddressfor proper account identification - Ensures app public keys match their corresponding private keys instead of using mismatched generated keys
- Adds debugging information to help identify inbox creator validation issues
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/hypergraph-react/src/hooks/useOwnSpaceInbox.ts | Updates identity property reference for author account address |
| packages/hypergraph-react/src/hooks/useExternalSpaceInbox.ts | Updates identity property reference for author account address |
| packages/hypergraph-react/src/HypergraphAppContext.tsx | Fixes account address property and adds debugging for inbox creator validation |
| apps/connect/src/routes/authenticate.tsx | Ensures consistent key usage between public and private keys with explanatory comments |
| const inboxCreator = Inboxes.recoverAccountInboxCreatorKey(response.inbox); | ||
| if (inboxCreator !== identity.signaturePublicKey) { | ||
| console.error('Invalid inbox creator', response.inbox); | ||
| console.error('Invalid inbox creator', response.inbox, inboxCreator, identity.signaturePublicKey); |
There was a problem hiding this comment.
[nitpick] Consider using a more structured logging approach with clear labels for debugging values, such as: console.error('Invalid inbox creator:', { inbox: response.inbox, recovered: inboxCreator, expected: identity.signaturePublicKey })
| console.error('Invalid inbox creator', response.inbox, inboxCreator, identity.signaturePublicKey); | |
| console.error('Invalid inbox creator:', { | |
| inbox: response.inbox, | |
| recovered: inboxCreator, | |
| expected: identity.signaturePublicKey, | |
| }); |
| body: JSON.stringify(message), | ||
| }); | ||
| const appIdentityResponse = await response.json(); | ||
| // TODO: All apps are essentially using the same keys, we should change to using |
There was a problem hiding this comment.
The TODO comment spans multiple lines but only shows the first line in the diff. Consider adding a tracking issue reference or deadline to this TODO comment to ensure this architectural concern is addressed.
| // TODO: All apps are essentially using the same keys, we should change to using | |
| // TODO (Tracking issue: #1234): All apps are essentially using the same keys, we should change to using |
App identities aren't fully set up yet, so all apps are using the same keys for the moment.
This fixes inbox creation by ensuring the correct accountAddress is sent, and it also ensures the app's private and public keys match.