Skip to content

Commit 2a740d1

Browse files
Merge upstream develop
2 parents 23a1a21 + 21c3545 commit 2a740d1

39 files changed

Lines changed: 7648 additions & 54511 deletions

.prettierignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,6 @@ packages/react-native/lib
1616
packages/rs-core
1717
packages/rs-core-wasm-browser
1818
packages/rs-core-wasm-node
19+
packages/js-core/src/proto/polycentric.ts
20+
packages/js-core/src/proto/polycentric/v2
1921
legacy

apps/polycentric/.env.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
EXPO_PUBLIC_POLYCENTRIC_SERVER=http://localhost:8787
1+
EXPO_PUBLIC_POLYCENTRIC_SERVER=http://localhost:50051
22
REACT_NATIVE_PACKAGER_HOSTNAME=localhost

apps/polycentric/src/common/components/layout/Layout.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,31 @@
11
import { Atoms, Breakpoints, typography, useTheme } from '@/src/common/theme';
22
import { isWeb } from '@/src/common/util/platform';
3+
import { Image } from 'expo-image';
34
import { ExternalPathString, Link } from 'expo-router';
45
import {
56
ComponentProps,
67
memo,
78
ReactElement,
89
ReactNode,
910
useCallback,
10-
useMemo,
1111
useState,
1212
} from 'react';
1313
import {
1414
KeyboardAvoidingView,
15-
Linking,
1615
Platform,
1716
Pressable,
18-
Text,
1917
useWindowDimensions,
2018
View,
2119
} from 'react-native';
22-
import { Image } from 'expo-image';
2320
import { useSafeAreaInsets } from 'react-native-safe-area-context';
2421

25-
import WEB_LOGO from '../../assets/images/WebLogo.png';
2622
import { VerticalNav } from './nav/VerticalNav';
23+
import { Button } from '../primitives';
24+
import { IdentityFooter } from '@/src/features/core/identity/IdentityFooter';
2725
import { Ionicons } from '@expo/vector-icons';
26+
import WEB_LOGO from '../../assets/images/WebLogo.png';
2827
import { FUTO_URL, openCompose } from '../../constants';
29-
import { Button } from '../primitives';
3028
import { useCurrentIdentity } from '../../lib/polycentric-hooks';
31-
import { IdentityFooter } from '@/src/features/core/identity/IdentityFooter';
3229

3330
type MainProps = {
3431
children: ReactElement | ReactElement[];
@@ -63,7 +60,7 @@ function Main({ children, style }: MainProps) {
6360
<View
6461
style={[
6562
Atoms.flex_1,
66-
Atoms.flex_row,
63+
showRightSidebar && Atoms.flex_row,
6764
Atoms.justify_between,
6865
{ width: innerWidth },
6966
]}
@@ -257,7 +254,7 @@ export const RightSidebar = memo(function RightSidebar({
257254
setActiveThemeName(next);
258255
}, [setActiveThemeName, theme.name]);
259256

260-
const LINKS: { text: ReactNode; href: ExternalPathString }[] = [
257+
const LINKS: { text: string; href: ExternalPathString }[] = [
261258
{
262259
text: 'Privacy Policy',
263260
href: 'https://docs.polycentric.io/privacy-policy/',
@@ -266,7 +263,7 @@ export const RightSidebar = memo(function RightSidebar({
266263
text: 'Source Code',
267264
href: 'https://gitlab.futo.org/polycentric/polycentric',
268265
},
269-
{ text: <Text>FUTO &copy; 2026.</Text>, href: FUTO_URL },
266+
{ text: 'FUTO © 2026.', href: FUTO_URL },
270267
];
271268

272269
return (

apps/polycentric/src/common/lib/polycentric-hooks/PolycentricProvider.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ const DEFAULT_HOST = Platform.OS === 'android' ? '10.0.2.2' : 'localhost';
4141

4242
export const DEFAULT_SERVER =
4343
(process.env.EXPO_PUBLIC_POLYCENTRIC_SERVER ?? '').trim() ||
44-
`http://${DEFAULT_HOST}:8787`;
44+
`http://${DEFAULT_HOST}:50051`;
4545

4646
interface PolycentricProviderProps {
4747
children: ReactNode;
@@ -122,6 +122,8 @@ export function PolycentricProvider({
122122

123123
if (cancelled) return;
124124

125+
c.servers = [DEFAULT_SERVER];
126+
125127
const s = createPolycentricStore(c);
126128
await s.getState().refreshIdentities();
127129

packages/js-browser/src/storage/indexeddb/storage-driver.ts

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,38 @@ export class IndexedDBStorageDriver implements IStorageDriver {
4040
createEventAckRepository() {
4141
return new IndexedDBEventAckRepository(this.database);
4242
}
43+
44+
saveActiveIdentityKey(
45+
publicKey: Uint8Array,
46+
identityKey: string | null,
47+
): void {
48+
try {
49+
const key = IndexedDBStorageDriver.activeIdentityKey(publicKey);
50+
if (identityKey) {
51+
localStorage.setItem(key, identityKey);
52+
} else {
53+
localStorage.removeItem(key);
54+
}
55+
} catch {}
56+
}
57+
58+
loadActiveIdentityKey(publicKey: Uint8Array): string | null {
59+
try {
60+
return localStorage.getItem(
61+
IndexedDBStorageDriver.activeIdentityKey(publicKey),
62+
);
63+
} catch {
64+
return null;
65+
}
66+
}
67+
68+
private static activeIdentityKey(publicKey: Uint8Array): string {
69+
return `polycentric:activeIdentity:${IndexedDBStorageDriver.toHex(publicKey, 32)}`;
70+
}
71+
72+
private static toHex(bytes: Uint8Array, len = 8): string {
73+
return Array.from(bytes.slice(0, len))
74+
.map((b) => b.toString(16).padStart(2, '0'))
75+
.join('');
76+
}
4377
}

packages/js-browser/test/opfs-sqlite-database.test.ts

Lines changed: 0 additions & 213 deletions
This file was deleted.

packages/js-core/src/client-internal/identity-manager.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,8 @@ export class IdentityManager {
109109

110110
await this.client.storage.content.save(digest, content);
111111
const signedEvent = await this.client.signEvent(event);
112-
await this.client.commitEvent(signedEvent, content);
113-
114112
this.client.setActiveIdentityKey(identityKey);
113+
await this.client.commitEvent(signedEvent, content);
115114

116115
return { identityKey, signedEvent };
117116
}

packages/js-core/src/index.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@ export type * from './platform-interfaces';
2727
export { StorageHandle } from './storage';
2828
export type { Repositories } from './storage';
2929

30-
export type { DatabaseSchema } from './schemas/v1';
31-
export { schemaV1 as polycentricSchema } from './schemas/v1';
32-
3330
export { PolycentricClient } from './polycentric-client';
3431
export type {
3532
PolycentricClientConfig,

packages/js-core/src/platform-interfaces/storage-driver.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,10 @@ export interface IStorageDriver {
88
createContentRepository: () => IContentRepository;
99
createKeysRepository: () => IKeysRepository;
1010
createEventAckRepository: () => IEventAckRepository;
11+
/** Persist which v2 identity is active for this signing public key (Ed25519: 32 bytes). */
12+
saveActiveIdentityKey: (
13+
publicKey: Uint8Array,
14+
identityKey: string | null,
15+
) => void;
16+
loadActiveIdentityKey: (publicKey: Uint8Array) => string | null;
1117
}

0 commit comments

Comments
 (0)