Skip to content

Commit 81dbd36

Browse files
authored
Ng/fix private spaces (#261)
1 parent 2896173 commit 81dbd36

File tree

6 files changed

+115
-1514
lines changed

6 files changed

+115
-1514
lines changed

apps/connect/src/routes/authenticate.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ function AuthenticateComponent() {
246246

247247
const privateSpacesInput = privateSpacesData
248248
? privateSpacesData
249-
.filter((space) => selectedPrivateSpaces.has(space.id))
249+
// .filter((space) => selectedPrivateSpaces.has(space.id))
250250
.map((space) => {
251251
// TODO: currently without checking we assume all keyboxes exists and we don't create any - we should check if the keyboxes exist and create them if they don't
252252
if (space.appIdentities.some((spaceAppIdentity) => spaceAppIdentity.address === appIdentity.address))

packages/hypergraph-react/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@
3939
},
4040
"dependencies": {
4141
"@automerge/automerge": "^2.2.9",
42-
"@automerge/automerge-repo": "=2.0.0-beta.5",
43-
"@automerge/automerge-repo-react-hooks": "=2.0.0-beta.5",
42+
"@automerge/automerge-repo": "^2.0.6",
43+
"@automerge/automerge-repo-react-hooks": "^2.0.6",
4444
"@graphprotocol/grc-20": "^0.21.2",
4545
"@noble/hashes": "^1.8.0",
4646
"@tanstack/react-query": "^5.75.5",

packages/hypergraph/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
},
4444
"dependencies": {
4545
"@automerge/automerge": "^2.2.9",
46-
"@automerge/automerge-repo": "=2.0.0-beta.5",
46+
"@automerge/automerge-repo": "^2.0.6",
4747
"@effect/experimental": "^0.44.20",
4848
"@graphprotocol/grc-20": "^0.21.2",
4949
"@noble/ciphers": "^1.3.0",

packages/hypergraph/src/identity/prove-ownership.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,13 @@ export const verifyIdentityOwnership = async (
6464
chain,
6565
transport: http(rpcUrl),
6666
});
67-
console.log('publicClient', publicClient);
68-
console.log('rpcUrl', rpcUrl);
69-
console.log('chain', chain);
67+
// console.log('publicClient', publicClient);
68+
// console.log('rpcUrl', rpcUrl);
69+
// console.log('chain', chain);
7070

71-
console.log('accountProof', accountProof);
72-
console.log('accountAddress', accountAddress);
73-
console.log('publicKey', publicKey);
71+
// console.log('accountProof', accountProof);
72+
// console.log('accountAddress', accountAddress);
73+
// console.log('publicKey', publicKey);
7474

7575
const accountProofMessage = getAccountProofMessage(accountAddress, publicKey);
7676
const validAccountProof = await publicClient.verifyTypedData({

packages/hypergraph/src/store.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { AnyDocumentId, DocHandle, Repo } from '@automerge/automerge-repo';
22
import { type Store, createStore } from '@xstate/store';
33
import type { PrivateAppIdentity } from './connect/types.js';
4+
import type { DocumentContent } from './entity/types.js';
45
import { mergeMessages } from './inboxes/merge-messages.js';
56
import type { InboxSenderAuthPolicy } from './inboxes/types.js';
67
import type { Invitation, Updates } from './messages/index.js';
@@ -47,7 +48,7 @@ export type SpaceStorageEntry = {
4748
events: SpaceEvent[];
4849
state: SpaceState | undefined;
4950
keys: { id: string; key: string }[];
50-
automergeDocHandle: DocHandle<unknown> | undefined;
51+
automergeDocHandle: DocHandle<DocumentContent>;
5152
inboxes: SpaceInboxStorageEntry[];
5253
};
5354

@@ -194,7 +195,7 @@ export const store: Store<StoreContext, StoreEvent, GenericEventObject> = create
194195
for (const space of event.spaces) {
195196
const existingSpace = context.spaces.find((s) => s.id === space.id);
196197
const lastUpdateClock = context.lastUpdateClock[space.id] ?? -1;
197-
const result = context.repo.findWithProgress(idToAutomergeId(space.id) as AnyDocumentId);
198+
const result = context.repo.findWithProgress<DocumentContent>(idToAutomergeId(space.id) as AnyDocumentId);
198199

199200
// set it to ready to interact with the document
200201
result.handle.doneLoading();
@@ -245,8 +246,6 @@ export const store: Store<StoreContext, StoreEvent, GenericEventObject> = create
245246
}
246247
}
247248

248-
console.log('storecontext', storeContext);
249-
250249
return storeContext;
251250
},
252251
applyEvent: (context, event: { spaceId: string; event: SpaceEvent; state: SpaceState }) => {
@@ -439,7 +438,7 @@ export const store: Store<StoreContext, StoreEvent, GenericEventObject> = create
439438
) => {
440439
const existingSpace = context.spaces.find((s) => s.id === event.spaceId);
441440
if (!existingSpace && context.repo) {
442-
const result = context.repo.findWithProgress(idToAutomergeId(event.spaceId) as AnyDocumentId);
441+
const result = context.repo.findWithProgress<DocumentContent>(idToAutomergeId(event.spaceId) as AnyDocumentId);
443442
// set it to ready to interact with the document
444443
result.handle.doneLoading();
445444

0 commit comments

Comments
 (0)