@graphprotocol/hypergraph 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/Entity.d.ts +69 -0
  2. package/dist/Entity.d.ts.map +1 -0
  3. package/dist/Entity.js +174 -0
  4. package/dist/Entity.js.map +1 -0
  5. package/dist/identity/create-identity-keys.d.ts +3 -0
  6. package/dist/identity/create-identity-keys.d.ts.map +1 -0
  7. package/dist/identity/create-identity-keys.js +20 -0
  8. package/dist/identity/create-identity-keys.js.map +1 -0
  9. package/dist/identity/login.d.ts +38 -0
  10. package/dist/identity/login.d.ts.map +1 -0
  11. package/dist/identity/login.js +241 -0
  12. package/dist/identity/login.js.map +1 -0
  13. package/dist/index.d.ts +1 -0
  14. package/dist/index.d.ts.map +1 -1
  15. package/dist/index.js +1 -0
  16. package/dist/index.js.map +1 -1
  17. package/dist/mapping/Mapping.d.ts +418 -0
  18. package/dist/mapping/Mapping.d.ts.map +1 -0
  19. package/dist/mapping/Mapping.js +554 -0
  20. package/dist/mapping/Mapping.js.map +1 -0
  21. package/dist/mapping/Utils.d.ts +74 -0
  22. package/dist/mapping/Utils.d.ts.map +1 -0
  23. package/dist/mapping/Utils.js +144 -0
  24. package/dist/mapping/Utils.js.map +1 -0
  25. package/dist/mapping/index.d.ts +3 -0
  26. package/dist/mapping/index.d.ts.map +1 -0
  27. package/dist/mapping/index.js +3 -0
  28. package/dist/mapping/index.js.map +1 -0
  29. package/dist/store.d.ts +1 -1
  30. package/dist/store.d.ts.map +1 -1
  31. package/dist/store.js.map +1 -1
  32. package/dist/utils/hasArrayField.d.ts +2 -0
  33. package/dist/utils/hasArrayField.d.ts.map +1 -0
  34. package/dist/utils/hasArrayField.js +5 -0
  35. package/dist/utils/hasArrayField.js.map +1 -0
  36. package/package.json +3 -5
  37. package/src/index.ts +1 -0
  38. package/src/mapping/Mapping.ts +771 -0
  39. package/src/mapping/Utils.ts +156 -0
  40. package/src/mapping/index.ts +2 -0
  41. package/src/store.ts +1 -1
@@ -0,0 +1,69 @@
1
+ import type { DocHandle } from '@automerge/automerge-repo';
2
+ import * as VariantSchema from '@effect/experimental/VariantSchema';
3
+ import * as Schema from 'effect/Schema';
4
+ declare const Class: <Self = never>(identifier: string) => <const Fields extends VariantSchema.Struct.Fields>(fields: Fields & VariantSchema.Struct.Validate<Fields, "select" | "insert" | "update">, annotations?: Schema.Annotations.Schema<Self, readonly []> | undefined) => [Self] extends [never] ? "Missing `Self` generic - use `class Self extends Class<Self>()({ ... })`" : VariantSchema.Class<Self, Fields, VariantSchema.ExtractFields<"select", Fields, true> extends infer T ? { [K in keyof T]: VariantSchema.ExtractFields<"select", Fields, true>[K]; } : never, Schema.Struct.Type<VariantSchema.ExtractFields<"select", Fields, true> extends infer T_1 ? { [K in keyof T_1]: VariantSchema.ExtractFields<"select", Fields, true>[K]; } : never>, Schema.Struct.Encoded<VariantSchema.ExtractFields<"select", Fields, true> extends infer T_2 ? { [K in keyof T_2]: VariantSchema.ExtractFields<"select", Fields, true>[K]; } : never>, Schema.Schema.Context<(VariantSchema.ExtractFields<"select", Fields, true> extends infer T_3 ? { [K in keyof T_3]: VariantSchema.ExtractFields<"select", Fields, true>[K]; } : never)[keyof VariantSchema.ExtractFields<"select", Fields, true>]>, Schema.Struct.Constructor<VariantSchema.ExtractFields<"select", Fields, true> extends infer T_4 ? { [K in keyof T_4]: VariantSchema.ExtractFields<"select", Fields, true>[K]; } : never>> & {
5
+ readonly select: Schema.Struct<VariantSchema.ExtractFields<"select", Fields, false> extends infer T_5 ? { [K_1 in keyof T_5]: VariantSchema.ExtractFields<"select", Fields, false>[K_1]; } : never>;
6
+ readonly insert: Schema.Struct<VariantSchema.ExtractFields<"insert", Fields, false> extends infer T_6 ? { [K_2 in keyof T_6]: VariantSchema.ExtractFields<"insert", Fields, false>[K_2]; } : never>;
7
+ readonly update: Schema.Struct<VariantSchema.ExtractFields<"update", Fields, false> extends infer T_7 ? { [K_3 in keyof T_7]: VariantSchema.ExtractFields<"update", Fields, false>[K_3]; } : never>;
8
+ };
9
+ export { Class };
10
+ export type Any = Schema.Schema.Any & {
11
+ readonly fields: Schema.Struct.Fields;
12
+ readonly insert: Schema.Schema.Any;
13
+ readonly update: Schema.Schema.Any;
14
+ };
15
+ export type AnyNoContext = Schema.Schema.AnyNoContext & {
16
+ readonly fields: Schema.Struct.Fields;
17
+ readonly insert: Schema.Schema.AnyNoContext;
18
+ readonly update: Schema.Schema.AnyNoContext;
19
+ };
20
+ export type Update<S extends Any> = S['update'];
21
+ export type Insert<S extends Any> = S['insert'];
22
+ export interface Generated<S extends Schema.Schema.All | Schema.PropertySignature.All> extends VariantSchema.Field<{
23
+ readonly select: S;
24
+ }> {
25
+ }
26
+ /**
27
+ * A field that represents a column that is generated by the store.
28
+ */
29
+ export declare const Generated: <S extends Schema.Schema.All | Schema.PropertySignature.All>(schema: S) => Generated<S>;
30
+ export declare const Text: typeof Schema.String;
31
+ export declare const Number: typeof Schema.Number;
32
+ export declare const Checkbox: typeof Schema.Boolean;
33
+ export type DocumentContent = {
34
+ entities?: Record<string, unknown>;
35
+ };
36
+ declare const EntityNotFoundError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").Equals<A, {}> extends true ? void : { readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }) => import("effect/Cause").YieldableError & {
37
+ readonly _tag: "EntityNotFoundError";
38
+ } & Readonly<A>;
39
+ export declare class EntityNotFoundError extends EntityNotFoundError_base<{
40
+ id: string;
41
+ type: AnyNoContext;
42
+ cause?: unknown;
43
+ }> {
44
+ }
45
+ export type Entity<S extends AnyNoContext> = Schema.Schema.Type<S> & {
46
+ type: string;
47
+ };
48
+ /**
49
+ * Creates an entity model of given type and stores it in the repo.
50
+ */
51
+ export declare const create: <const S extends AnyNoContext>(handle: DocHandle<DocumentContent>, type: S) => (data: Readonly<Schema.Schema.Type<Insert<S>>>) => Entity<S>;
52
+ /**
53
+ * Update an existing entity model of given type in the repo.
54
+ */
55
+ export declare const update: <const S extends AnyNoContext>(handle: DocHandle<DocumentContent>, type: S) => (id: string, data: Schema.Simplify<Partial<Schema.Schema.Type<Update<S>>>>) => Entity<S>;
56
+ /**
57
+ * Deletes the exiting entity from the repo.
58
+ */
59
+ declare const delete$: (handle: DocHandle<DocumentContent>) => (id: string) => boolean;
60
+ export { delete$ as delete };
61
+ /**
62
+ * Queries for a list of entities of the given type from the repo.
63
+ */
64
+ export declare function findMany<const S extends AnyNoContext>(handle: DocHandle<DocumentContent>, type: S): Readonly<Array<Entity<S>>>;
65
+ /**
66
+ * Find the entity of the given type, with the given id, from the repo.
67
+ */
68
+ export declare const findOne: <const S extends AnyNoContext>(handle: DocHandle<DocumentContent>, type: S) => (id: string) => Entity<S> | undefined;
69
+ //# sourceMappingURL=Entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Entity.d.ts","sourceRoot":"","sources":["../src/Entity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,KAAK,aAAa,MAAM,oCAAoC,CAAC;AAEpE,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAGxC,QAAA,MACE,KAAK;;;;CAYL,CAAC;AAEH,OAAO,EAAE,KAAK,EAAE,CAAC;AAEjB,MAAM,MAAM,GAAG,GAAG,MAAM,CAAC,MAAM,CAAC,GAAG,GAAG;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,GAAG;IACtD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,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MAAM,CAAA;CAAE,CAAC;AAEtF;;GAEG;AACH,eAAO,MAAM,MAAM,SAAU,CAAC,SAAS,YAAY,UAAU,SAAS,CAAC,eAAe,CAAC,QAAQ,CAAC,YAOhF,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,CAAC,CAUjE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,MAAM,SAAU,CAAC,SAAS,YAAY,UAAU,SAAS,CAAC,eAAe,CAAC,QAAQ,CAAC,UASlF,MAAM,QAAQ,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,KAAG,MAAM,CAAC,CAAC,CA2B7F,CAAC;AAEF;;GAEG;AACH,QAAA,MAAM,OAAO,WAAY,SAAS,CAAC,eAAe,CAAC,UACrC,MAAM,KAAG,OAatB,CAAC;AAEF,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC;AAE7B;;GAEG;AACH,wBAAgB,QAAQ,CAAC,KAAK,CAAC,CAAC,SAAS,YAAY,EACnD,MAAM,EAAE,SAAS,CAAC,eAAe,CAAC,EAClC,IAAI,EAAE,CAAC,GACN,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,CAqB5B;AAED;;GAEG;AACH,eAAO,MAAM,OAAO,SACX,CAAC,SAAS,YAAY,UAAU,SAAS,CAAC,eAAe,CAAC,QAAQ,CAAC,UACrE,MAAM,KAAG,MAAM,CAAC,CAAC,CAAC,GAAG,SAkBzB,CAAC"}
package/dist/Entity.js ADDED
@@ -0,0 +1,174 @@
1
+ import * as VariantSchema from '@effect/experimental/VariantSchema';
2
+ import * as Data from 'effect/Data';
3
+ import * as Schema from 'effect/Schema';
4
+ import { generateId } from './utils/generateId.js';
5
+ const {
6
+ Class,
7
+ Field
8
+ // FieldExcept,
9
+ // FieldOnly,
10
+ // Struct,
11
+ // Union,
12
+ // extract,
13
+ // fieldEvolve,
14
+ // fieldFromKey
15
+ } = /*#__PURE__*/VariantSchema.make({
16
+ variants: ['select', 'insert', 'update'],
17
+ defaultVariant: 'select'
18
+ });
19
+ export { Class };
20
+ /**
21
+ * A field that represents a column that is generated by the store.
22
+ */
23
+ export const Generated = schema => Field({
24
+ select: schema
25
+ });
26
+ export const Text = Schema.String;
27
+ // biome-ignore lint/suspicious/noShadowRestrictedNames: is part of a namespaces module and therefor ok
28
+ export const Number = Schema.Number;
29
+ export const Checkbox = Schema.Boolean;
30
+ export class EntityNotFoundError extends /*#__PURE__*/Data.TaggedError('EntityNotFoundError') {}
31
+ /**
32
+ * Creates an entity model of given type and stores it in the repo.
33
+ */
34
+ export const create = (handle, type) => {
35
+ // TODO: what's the right way to get the name of the type?
36
+ // @ts-expect-error name is defined
37
+ const typeName = type.name;
38
+ const entityId = generateId();
39
+ const encode = Schema.encodeSync(type.insert);
40
+ return data => {
41
+ const encoded = encode(data);
42
+ // apply changes to the repo -> adds the entity to the repo entites document
43
+ handle.change(doc => {
44
+ doc.entities ??= {};
45
+ doc.entities[entityId] = {
46
+ ...encoded,
47
+ '@@types@@': [typeName]
48
+ };
49
+ });
50
+ return {
51
+ id: entityId,
52
+ ...encoded,
53
+ type: typeName
54
+ };
55
+ };
56
+ };
57
+ /**
58
+ * Update an existing entity model of given type in the repo.
59
+ */
60
+ export const update = (handle, type) => {
61
+ const validate = Schema.validateSync(Schema.partial(type.update));
62
+ const encode = Schema.encodeSync(type.update);
63
+ const decode = Schema.decodeUnknownSync(type.update);
64
+ // TODO: what's the right way to get the name of the type?
65
+ // @ts-expect-error name is defined
66
+ const typeName = type.name;
67
+ return (id, data) => {
68
+ validate(data);
69
+ // apply changes to the repo -> updates the existing entity to the repo entites document
70
+ let updated = undefined;
71
+ handle.change(doc => {
72
+ if (doc.entities === undefined) {
73
+ return;
74
+ }
75
+ // TODO: Fetch the pre-decoded value from the local cache.
76
+ const entity = doc.entities[id] ?? undefined;
77
+ if (entity === undefined || typeof entity !== 'object') {
78
+ return;
79
+ }
80
+ // TODO: Try to get a diff of the entitiy properties and only override the changed ones.
81
+ updated = {
82
+ ...decode(entity),
83
+ ...data
84
+ };
85
+ doc.entities[id] = {
86
+ ...encode(updated),
87
+ '@@types@@': [typeName]
88
+ };
89
+ });
90
+ if (updated === undefined) {
91
+ throw new EntityNotFoundError({
92
+ id,
93
+ type
94
+ });
95
+ }
96
+ return {
97
+ id,
98
+ type: typeName,
99
+ ...updated
100
+ };
101
+ };
102
+ };
103
+ /**
104
+ * Deletes the exiting entity from the repo.
105
+ */
106
+ const delete$ = handle => {
107
+ return id => {
108
+ let result = false;
109
+ // apply changes to the repo -> removes the existing entity by its id
110
+ handle.change(doc => {
111
+ if (doc.entities?.[id] !== undefined) {
112
+ delete doc.entities[id];
113
+ result = true;
114
+ }
115
+ });
116
+ return result;
117
+ };
118
+ };
119
+ export { delete$ as delete };
120
+ /**
121
+ * Queries for a list of entities of the given type from the repo.
122
+ */
123
+ export function findMany(handle, type) {
124
+ const decode = Schema.decodeUnknownSync(type);
125
+ // TODO: what's the right way to get the name of the type?
126
+ // @ts-expect-error name is defined
127
+ const typeName = type.name;
128
+ // TODO: Instead of this insane filtering logic, we should be keeping track of the entities in
129
+ // an index and store the decoded valeus instead of re-decoding over and over again.
130
+ const entities = handle.docSync()?.entities ?? {};
131
+ const filtered = [];
132
+ for (const id in entities) {
133
+ const entity = entities[id];
134
+ if (typeof entity === 'object' && entity != null && '@@types@@' in entity) {
135
+ const types = entity['@@types@@'];
136
+ if (Array.isArray(types) && types.includes(typeName)) {
137
+ filtered.push({
138
+ ...decode({
139
+ ...entity,
140
+ id
141
+ }),
142
+ type: typeName
143
+ });
144
+ }
145
+ }
146
+ }
147
+ return filtered;
148
+ }
149
+ /**
150
+ * Find the entity of the given type, with the given id, from the repo.
151
+ */
152
+ export const findOne = (handle, type) => id => {
153
+ const decode = Schema.decodeUnknownSync(type);
154
+ // TODO: what's the right way to get the name of the type?
155
+ // @ts-expect-error name is defined
156
+ const typeName = type.name;
157
+ // TODO: Instead of this insane filtering logic, we should be keeping track of the entities in
158
+ // an index and store the decoded valeus instead of re-decoding over and over again.
159
+ const entity = handle.docSync()?.entities?.[id];
160
+ if (typeof entity === 'object' && entity != null && '@@types@@' in entity) {
161
+ const types = entity['@@types@@'];
162
+ if (Array.isArray(types) && types.includes(typeName)) {
163
+ return {
164
+ ...decode({
165
+ ...entity,
166
+ id
167
+ }),
168
+ type: typeName
169
+ };
170
+ }
171
+ }
172
+ return undefined;
173
+ };
174
+ //# sourceMappingURL=Entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Entity.js","names":["VariantSchema","Data","Schema","generateId","Class","Field","make","variants","defaultVariant","Generated","schema","select","Text","String","Number","Checkbox","Boolean","EntityNotFoundError","TaggedError","create","handle","type","typeName","name","entityId","encode","encodeSync","insert","data","encoded","change","doc","entities","id","update","validate","validateSync","partial","decode","decodeUnknownSync","updated","undefined","entity","delete$","result","delete","findMany","docSync","filtered","types","Array","isArray","includes","push","findOne"],"sources":["../src/Entity.ts"],"sourcesContent":[null],"mappings":"AACA,OAAO,KAAKA,aAAa,MAAM,oCAAoC;AACnE,OAAO,KAAKC,IAAI,MAAM,aAAa;AACnC,OAAO,KAAKC,MAAM,MAAM,eAAe;AACvC,SAASC,UAAU,QAAQ,uBAAuB;AAElD,MAAM;EACJC,KAAK;EACLC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;CACD,gBAAGL,aAAa,CAACM,IAAI,CAAC;EACrBC,QAAQ,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC;EACxCC,cAAc,EAAE;CACjB,CAAC;AAEF,SAASJ,KAAK;AAsBd;;;AAGA,OAAO,MAAMK,SAAS,GAAgEC,MAAS,IAC7FL,KAAK,CAAC;EACJM,MAAM,EAAED;CACT,CAAC;AAEJ,OAA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,QAAQ,GAAGC,EAAE,CAAC;EAC/C,IAAI,OAAOS,MAAM,KAAK,QAAQ,IAAIA,MAAM,IAAI,IAAI,IAAI,WAAW,IAAIA,MAAM,EAAE;IACzE,MAAMO,KAAK,GAAGP,MAAM,CAAC,WAAW,CAAC;IACjC,IAAIQ,KAAK,CAACC,OAAO,CAACF,KAAK,CAAC,IAAIA,KAAK,CAACG,QAAQ,CAAC9B,QAAQ,CAAC,EAAE;MACpD,OAAO;QAAE,GAAGgB,MAAM,CAAC;UAAE,GAAGI,MAAM;UAAET;QAAE,CAAE,CAAC;QAAEZ,IAAI,EAAEC;MAAQ,CAAE;IACzD;EACF;EAEA,OAAOmB,SAAS;AAClB,CAAC","ignoreList":[]}
@@ -0,0 +1,3 @@
1
+ import type { IdentityKeys } from './types.js';
2
+ export declare const createIdentityKeys: () => IdentityKeys;
3
+ //# sourceMappingURL=create-identity-keys.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-identity-keys.d.ts","sourceRoot":"","sources":["../../src/identity/create-identity-keys.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,eAAO,MAAM,kBAAkB,QAAO,YAarC,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { secp256k1 } from '@noble/curves/secp256k1';
2
+ import { generateKeypair } from '../key/index.js';
3
+ import { bytesToHex } from '../utils/index.js';
4
+ export const createIdentityKeys = () => {
5
+ // generate a random private key for encryption
6
+ const {
7
+ publicKey: encryptionPublicKey,
8
+ secretKey: encryptionPrivateKey
9
+ } = generateKeypair();
10
+ // generate a random private key for signing
11
+ const signaturePrivateKey = secp256k1.utils.randomPrivateKey();
12
+ const signaturePublicKey = secp256k1.getPublicKey(signaturePrivateKey);
13
+ return {
14
+ encryptionPublicKey: bytesToHex(encryptionPublicKey),
15
+ encryptionPrivateKey: bytesToHex(encryptionPrivateKey),
16
+ signaturePublicKey: bytesToHex(signaturePublicKey),
17
+ signaturePrivateKey: bytesToHex(signaturePrivateKey)
18
+ };
19
+ };
20
+ //# sourceMappingURL=create-identity-keys.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-identity-keys.js","names":["secp256k1","generateKeypair","bytesToHex","createIdentityKeys","publicKey","encryptionPublicKey","secretKey","encryptionPrivateKey","signaturePrivateKey","utils","randomPrivateKey","signaturePublicKey","getPublicKey"],"sources":["../../src/identity/create-identity-keys.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,SAAS,QAAQ,yBAAyB;AAEnD,SAASC,eAAe,QAAQ,iBAAiB;AACjD,SAASC,UAAU,QAAQ,mBAAmB;AAG9C,OAAO,MAAMC,kBAAkB,GAAGA,CAAA,KAAmB;EACnD;EACA,MAAM;IAAEC,SAAS,EAAEC,mBAAmB;IAAEC,SAAS,EAAEC;EAAoB,CAAE,GAAGN,eAAe,EAAE;EAC7F;EACA,MAAMO,mBAAmB,GAAGR,SAAS,CAACS,KAAK,CAACC,gBAAgB,EAAE;EAC9D,MAAMC,kBAAkB,GAAGX,SAAS,CAACY,YAAY,CAACJ,mBAAmB,CAAC;EAEtE,OAAO;IACLH,mBAAmB,EAAEH,UAAU,CAACG,mBAAmB,CAAC;IACpDE,oBAAoB,EAAEL,UAAU,CAACK,oBAAoB,CAAC;IACtDI,kBAAkB,EAAET,UAAU,CAACS,kBAAkB,CAAC;IAClDH,mBAAmB,EAAEN,UAAU,CAACM,mBAAmB;GACpD;AACH,CAAC","ignoreList":[]}
@@ -0,0 +1,38 @@
1
+ import type { Address } from 'viem';
2
+ import type { IdentityKeys, Signer, Storage } from './types.js';
3
+ export declare function prepareSiweMessage(address: Address, nonce: string, location: {
4
+ host: string;
5
+ origin: string;
6
+ }, chainId: number): string;
7
+ export declare function identityExists(accountId: string, syncServerUri: string): Promise<boolean>;
8
+ export declare function getSessionNonce(accountId: string, syncServerUri: string): Promise<string>;
9
+ export declare function restoreKeys(signer: Signer, accountId: Address, sessionToken: string, syncServerUri: string, storage: Storage): Promise<IdentityKeys>;
10
+ export declare function signup(signer: Signer, accountId: Address, syncServerUri: string, chainId: number, storage: Storage, location: {
11
+ host: string;
12
+ origin: string;
13
+ }): Promise<{
14
+ accountId: `0x${string}`;
15
+ sessionToken: string;
16
+ keys: IdentityKeys;
17
+ }>;
18
+ export declare function loginWithWallet(signer: Signer, accountId: Address, syncServerUri: string, chainId: number, storage: Storage, location: {
19
+ host: string;
20
+ origin: string;
21
+ }, retryCount?: number): Promise<{
22
+ accountId: `0x${string}`;
23
+ sessionToken: string;
24
+ keys: IdentityKeys;
25
+ }>;
26
+ export declare function loginWithKeys(keys: IdentityKeys, accountId: Address, syncServerUri: string, chainId: number, storage: Storage, location: {
27
+ host: string;
28
+ origin: string;
29
+ }, retryCount?: number): Promise<{
30
+ accountId: `0x${string}`;
31
+ sessionToken: string;
32
+ keys: IdentityKeys;
33
+ }>;
34
+ export declare function login(signer: Signer, accountId: Address, syncServerUri: string, chainId: number, storage: Storage, location: {
35
+ host: string;
36
+ origin: string;
37
+ }): Promise<void>;
38
+ //# sourceMappingURL=login.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/identity/login.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAO,MAAM,MAAM,CAAC;AAezC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAEhE,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,EAC1C,OAAO,EAAE,MAAM,UAYhB;AAED,wBAAsB,cAAc,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,oBAK5E;AAED,wBAAsB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,mBAW7E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
+ import * as Messages from '../messages/index.js';
5
+ import { store } from '../store.js';
6
+ import { loadKeys, loadSyncServerSessionToken, storeAccountId, storeKeys, storeSyncServerSessionToken, wipeSyncServerSessionToken } from './auth-storage.js';
7
+ import { createIdentityKeys } from './create-identity-keys.js';
8
+ import { decryptIdentity, encryptIdentity } from './identity-encryption.js';
9
+ import { proveIdentityOwnership } from './prove-ownership.js';
10
+ export function prepareSiweMessage(address, nonce, location, chainId) {
11
+ return new SiweMessage({
12
+ domain: location.host,
13
+ address,
14
+ statement: 'Sign in to Hypergraph',
15
+ uri: location.origin,
16
+ version: '1',
17
+ chainId,
18
+ nonce,
19
+ expirationTime: new Date(Date.now() + 1000 * 60 * 60 * 24 * 30).toISOString()
20
+ }).prepareMessage();
21
+ }
22
+ export async function identityExists(accountId, syncServerUri) {
23
+ const res = await fetch(new URL(`/identity?accountId=${accountId}`, syncServerUri), {
24
+ method: 'GET'
25
+ });
26
+ return res.status === 200;
27
+ }
28
+ export async function getSessionNonce(accountId, syncServerUri) {
29
+ const nonceReq = {
30
+ accountId
31
+ };
32
+ const res = await fetch(new URL('/login/nonce', syncServerUri), {
33
+ method: 'POST',
34
+ headers: {
35
+ 'Content-Type': 'application/json'
36
+ },
37
+ body: JSON.stringify(nonceReq)
38
+ });
39
+ const decoded = Schema.decodeUnknownSync(Messages.ResponseLoginNonce)(await res.json());
40
+ return decoded.sessionNonce;
41
+ }
42
+ export async function restoreKeys(signer, accountId, sessionToken, syncServerUri, storage) {
43
+ const keys = loadKeys(storage, accountId);
44
+ if (keys) {
45
+ return keys;
46
+ }
47
+ // Try to get the users identity from the sync server
48
+ const res = await fetch(new URL('/identity/encrypted', syncServerUri), {
49
+ headers: {
50
+ Authorization: `Bearer ${sessionToken}`
51
+ }
52
+ });
53
+ if (res.status === 200) {
54
+ const decoded = Schema.decodeUnknownSync(Messages.ResponseIdentityEncrypted)(await res.json());
55
+ const {
56
+ keyBox
57
+ } = decoded;
58
+ const {
59
+ ciphertext,
60
+ nonce
61
+ } = keyBox;
62
+ const keys = await decryptIdentity(signer, accountId, ciphertext, nonce);
63
+ storeKeys(storage, accountId, keys);
64
+ return keys;
65
+ }
66
+ throw new Error(`Error fetching identity ${res.status}`);
67
+ }
68
+ export async function signup(signer, accountId, syncServerUri, chainId, storage, location) {
69
+ const keys = createIdentityKeys();
70
+ const {
71
+ ciphertext,
72
+ nonce
73
+ } = await encryptIdentity(signer, accountId, keys);
74
+ const {
75
+ accountProof,
76
+ keyProof
77
+ } = await proveIdentityOwnership(signer, accountId, keys);
78
+ const account = privateKeyToAccount(keys.signaturePrivateKey);
79
+ const sessionNonce = await getSessionNonce(accountId, syncServerUri);
80
+ const message = prepareSiweMessage(account.address, sessionNonce, location, chainId);
81
+ const signature = await account.signMessage({
82
+ message
83
+ });
84
+ const req = {
85
+ keyBox: {
86
+ accountId,
87
+ ciphertext,
88
+ nonce
89
+ },
90
+ accountProof,
91
+ keyProof,
92
+ message,
93
+ signaturePublicKey: keys.signaturePublicKey,
94
+ encryptionPublicKey: keys.encryptionPublicKey,
95
+ signature
96
+ };
97
+ const res = await fetch(new URL('/identity', syncServerUri), {
98
+ method: 'POST',
99
+ headers: {
100
+ 'Content-Type': 'application/json'
101
+ },
102
+ body: JSON.stringify(req)
103
+ });
104
+ if (res.status !== 200) {
105
+ // TODO: handle this better?
106
+ throw new Error(`Error creating identity: ${res.status}`);
107
+ }
108
+ const decoded = Schema.decodeUnknownSync(Messages.ResponseCreateIdentity)(await res.json());
109
+ storeAccountId(storage, accountId);
110
+ storeSyncServerSessionToken(storage, accountId, decoded.sessionToken);
111
+ storeKeys(storage, accountId, keys);
112
+ return {
113
+ accountId,
114
+ sessionToken: decoded.sessionToken,
115
+ keys
116
+ };
117
+ }
118
+ export async function loginWithWallet(signer, accountId, syncServerUri, chainId, storage, location, retryCount = 0) {
119
+ const sessionToken = loadSyncServerSessionToken(storage, accountId);
120
+ if (!sessionToken) {
121
+ const sessionNonce = await getSessionNonce(accountId, syncServerUri);
122
+ // Use SIWE to login with the server and get a token
123
+ const message = prepareSiweMessage(accountId, sessionNonce, location, chainId);
124
+ const signature = await signer.signMessage(message);
125
+ const loginReq = {
126
+ accountId,
127
+ message,
128
+ signature
129
+ };
130
+ const res = await fetch(new URL('/login', syncServerUri), {
131
+ method: 'POST',
132
+ headers: {
133
+ 'Content-Type': 'application/json'
134
+ },
135
+ body: JSON.stringify(loginReq)
136
+ });
137
+ const decoded = Schema.decodeUnknownSync(Messages.ResponseLogin)(await res.json());
138
+ storeAccountId(storage, accountId);
139
+ storeSyncServerSessionToken(storage, accountId, decoded.sessionToken);
140
+ const keys = await restoreKeys(signer, accountId, decoded.sessionToken, syncServerUri, storage);
141
+ return {
142
+ accountId,
143
+ sessionToken: decoded.sessionToken,
144
+ keys
145
+ };
146
+ }
147
+ // use whoami to check if the session token is still valid
148
+ const res = await fetch(new URL('/whoami', syncServerUri), {
149
+ headers: {
150
+ Authorization: `Bearer ${sessionToken}`
151
+ }
152
+ });
153
+ if (res.status !== 200 || (await res.text()) !== accountId) {
154
+ console.warn('Session token is invalid, wiping state and retrying login with wallet');
155
+ wipeSyncServerSessionToken(storage, accountId);
156
+ if (retryCount > 3) {
157
+ throw new Error('Could not login with wallet after several attempts');
158
+ }
159
+ return await loginWithWallet(signer, accountId, syncServerUri, chainId, storage, location, retryCount + 1);
160
+ }
161
+ const keys = await restoreKeys(signer, accountId, sessionToken, syncServerUri, storage);
162
+ return {
163
+ accountId,
164
+ sessionToken,
165
+ keys
166
+ };
167
+ }
168
+ export async function loginWithKeys(keys, accountId, syncServerUri, chainId, storage, location, retryCount = 0) {
169
+ const sessionToken = loadSyncServerSessionToken(storage, accountId);
170
+ if (sessionToken) {
171
+ // use whoami to check if the session token is still valid
172
+ const res = await fetch(new URL('/whoami', syncServerUri), {
173
+ headers: {
174
+ Authorization: `Bearer ${sessionToken}`
175
+ }
176
+ });
177
+ if (res.status !== 200 || (await res.text()) !== accountId) {
178
+ console.warn('Session token is invalid, wiping state and retrying login with keys');
179
+ wipeSyncServerSessionToken(storage, accountId);
180
+ if (retryCount > 3) {
181
+ throw new Error('Could not login with keys after several attempts');
182
+ }
183
+ return await loginWithKeys(keys, accountId, syncServerUri, chainId, storage, location, retryCount + 1);
184
+ }
185
+ return {
186
+ accountId,
187
+ sessionToken,
188
+ keys
189
+ };
190
+ }
191
+ const account = privateKeyToAccount(keys.signaturePrivateKey);
192
+ const sessionNonce = await getSessionNonce(accountId, syncServerUri);
193
+ const message = prepareSiweMessage(account.address, sessionNonce, location, chainId);
194
+ const signature = await account.signMessage({
195
+ message
196
+ });
197
+ const req = {
198
+ accountId,
199
+ message,
200
+ publicKey: keys.signaturePublicKey,
201
+ signature
202
+ };
203
+ const res = await fetch(new URL('/login/with-signing-key', syncServerUri), {
204
+ method: 'POST',
205
+ headers: {
206
+ 'Content-Type': 'application/json'
207
+ },
208
+ body: JSON.stringify(req)
209
+ });
210
+ if (res.status !== 200) {
211
+ throw new Error('Error logging in with signing key');
212
+ }
213
+ const decoded = Schema.decodeUnknownSync(Messages.ResponseLogin)(await res.json());
214
+ storeAccountId(storage, accountId);
215
+ storeSyncServerSessionToken(storage, accountId, decoded.sessionToken);
216
+ return {
217
+ accountId,
218
+ sessionToken: decoded.sessionToken,
219
+ keys
220
+ };
221
+ }
222
+ export async function login(signer, accountId, syncServerUri, chainId, storage, location) {
223
+ const keys = loadKeys(storage, accountId);
224
+ let authData;
225
+ if (!keys && !(await identityExists(accountId, syncServerUri))) {
226
+ authData = await signup(signer, accountId, syncServerUri, chainId, storage, location);
227
+ } else if (keys) {
228
+ authData = await loginWithKeys(keys, accountId, syncServerUri, chainId, storage, location);
229
+ } else {
230
+ authData = await loginWithWallet(signer, accountId, syncServerUri, chainId, storage, location);
231
+ }
232
+ console.log('Identity initialized');
233
+ store.send({
234
+ type: 'reset'
235
+ });
236
+ store.send({
237
+ ...authData,
238
+ type: 'setAuth'
239
+ });
240
+ }
241
+ //# sourceMappingURL=login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"login.js","names":["Schema","SiweMessage","privateKeyToAccount","Messages","store","loadKeys","loadSyncServerSessionToken","storeAccountId","storeKeys","storeSyncServerSessionToken","wipeSyncServerSessionToken","createIdentityKeys","decryptIdentity","encryptIdentity","proveIdentityOwnership","prepareSiweMessage","address","nonce","location","chainId","domain","host","statement","uri","origin","version","expirationTime","Date","now","toISOString","prepareMessage","identityExists","accountId","syncServerUri","res","fetch","URL","method","status","getSessionNonce","nonceReq","headers","body","JSON","stringify","decoded","decodeUnknownSync","ResponseLoginNonce","json","sessionNonce","restoreKeys","signer","sessionToken","storage","keys","Authorization","ResponseIdentityEncrypted","keyBox","ciphertext","Error","signup","accountProof","keyProof","account","signaturePrivateKey","message","signature","signMessage","req","signaturePublicKey","encryptionPublicKey","ResponseCreateIdentity","loginWithWallet","retryCount","loginReq","ResponseLogin","text","console","warn","loginWithKeys","publicKey","login","authData","log","send","type"],"sources":["../../src/identity/login.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,MAAM,MAAM,eAAe;AACvC,SAASC,WAAW,QAAQ,MAAM;AAElC,SAASC,mBAAmB,QAAQ,eAAe;AACnD,OAAO,KAAKC,QAAQ,MAAM,sBAAsB;AAChD,SAASC,KAAK,QAAQ,aAAa;AACnC,SACEC,QAAQ,EACRC,0BAA0B,EAC1BC,cAAc,EACdC,SAAS,EACTC,2BAA2B,EAC3BC,0BAA0B,QACrB,mBAAmB;AAC1B,SAASC,kBAAkB,QAAQ,2BAA2B;AAC9D,SAASC,eAAe,EAAEC,eAAe,QAAQ,0BAA0B;AAC3E,SAASC,sBAAsB,QAAQ,sBAAsB;AAG7D,OAAM,SAAUC,kBAAkBA,CAChCC,OAAgB,EAChBC,KAAa,EACbC,QAA0C,EAC1CC,OAAe;EAEf,OAAO,IAAIlB,WAAW,CAAC;IACrBmB,MAAM,EAAEF,QAAQ,CAACG,IAAI;IACrBL,OAAO;IACPM,SAAS,EAAE,uBAAuB;IAClCC,GAAG,EAA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AAI,EAAE;GACP,CAAC;AACJ","ignoreList":[]}
package/dist/index.d.ts CHANGED
@@ -3,6 +3,7 @@ export * as Entity from './entity/index.js';
3
3
  export * as Identity from './identity/index.js';
4
4
  export * as Inboxes from './inboxes/index.js';
5
5
  export * as Key from './key/index.js';
6
+ export * as Mapping from './mapping/index.js';
6
7
  export * as Messages from './messages/index.js';
7
8
  export * as SpaceEvents from './space-events/index.js';
8
9
  export * as SpaceInfo from './space-info/index.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,mBAAmB,CAAC;AAC5C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AACtC,OAAO,KAAK,OAAO,MAAM,oBAAoB,CAAC;AAC9C,OAAO,KAAK,QAAQ,MAAM,qBAAqB,CAAC;AAChD,OAAO,KAAK,WAAW,MAAM,yBAAyB,CAAC;AACvD,OAAO,KAAK,SAAS,MAAM,uBAAuB,CAAC;AACnD,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,YAAY,MAAM,oBAAoB,CAAC;AACnD,OAAO,KAAK,IAAI,MAAM,gBAAgB,CAAC;AACvC,cAAc,YAAY,CAAC;AAC3B,OAAO,KAAK,KAAK,MAAM,kBAAkB,CAAC"}
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ export * as Entity from './entity/index.js';
3
3
  export * as Identity from './identity/index.js';
4
4
  export * as Inboxes from './inboxes/index.js';
5
5
  export * as Key from './key/index.js';
6
+ export * as Mapping from './mapping/index.js';
6
7
  export * as Messages from './messages/index.js';
7
8
  export * as SpaceEvents from './space-events/index.js';
8
9
  export * as SpaceInfo from './space-info/index.js';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["Connect","Entity","Identity","Inboxes","Key","Messages","SpaceEvents","SpaceInfo","StoreConnect","Type","Utils"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,OAAO,MAAM,oBAAoB;AAC7C,OAAO,KAAKC,MAAM,MAAM,mBAAmB;AAC3C,OAAO,KAAKC,QAAQ,MAAM,qBAAqB;AAC/C,OAAO,KAAKC,OAAO,MAAM,oBAAoB;AAC7C,OAAO,KAAKC,GAAG,MAAM,gBAAgB;AACrC,OAAO,KAAKC,QAAQ,MAAM,qBAAqB;AAC/C,OAAO,KAAKC,WAAW,MAAM,yBAAyB;AACtD,OAAO,KAAKC,SAAS,MAAM,uBAAuB;AAClD,cAAc,YAAY;AAC1B,OAAO,KAAKC,YAAY,MAAM,oBAAoB;AAClD,OAAO,KAAKC,IAAI,MAAM,gBAAgB;AACtC,cAAc,YAAY;AAC1B,OAAO,KAAKC,KAAK,MAAM,kBAAkB","ignoreList":[]}
1
+ {"version":3,"file":"index.js","names":["Connect","Entity","Identity","Inboxes","Key","Mapping","Messages","SpaceEvents","SpaceInfo","StoreConnect","Type","Utils"],"sources":["../src/index.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,OAAO,MAAM,oBAAoB;AAC7C,OAAO,KAAKC,MAAM,MAAM,mBAAmB;AAC3C,OAAO,KAAKC,QAAQ,MAAM,qBAAqB;AAC/C,OAAO,KAAKC,OAAO,MAAM,oBAAoB;AAC7C,OAAO,KAAKC,GAAG,MAAM,gBAAgB;AACrC,OAAO,KAAKC,OAAO,MAAM,oBAAoB;AAC7C,OAAO,KAAKC,QAAQ,MAAM,qBAAqB;AAC/C,OAAO,KAAKC,WAAW,MAAM,yBAAyB;AACtD,OAAO,KAAKC,SAAS,MAAM,uBAAuB;AAClD,cAAc,YAAY;AAC1B,OAAO,KAAKC,YAAY,MAAM,oBAAoB;AAClD,OAAO,KAAKC,IAAI,MAAM,gBAAgB;AACtC,cAAc,YAAY;AAC1B,OAAO,KAAKC,KAAK,MAAM,kBAAkB","ignoreList":[]}