@graphprotocol/hypergraph 0.0.1 → 0.0.3
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.
- package/dist/connect/abis/MainVotingPlugin.json +1865 -0
- package/dist/connect/abis/PersonalSpaceAdminPlugin.json +531 -0
- package/dist/connect/abis.d.ts +115 -0
- package/dist/connect/abis.d.ts.map +1 -0
- package/dist/connect/abis.js +141 -0
- package/dist/connect/abis.js.map +1 -0
- package/dist/connect/auth-storage.d.ts +15 -0
- package/dist/connect/auth-storage.js +53 -0
- package/dist/connect/auth-storage.js.map +1 -0
- package/dist/connect/create-app-identity.d.ts +7 -0
- package/dist/connect/create-app-identity.js +15 -0
- package/dist/connect/create-app-identity.js.map +1 -0
- package/dist/connect/create-auth-url.d.ts +15 -0
- package/dist/connect/create-callback-params.d.ts +28 -0
- package/dist/connect/create-callback-params.d.ts.map +1 -1
- package/dist/connect/create-callback-params.js.map +1 -1
- package/dist/connect/create-identity-keys.d.ts +3 -0
- package/dist/connect/create-identity-keys.js +20 -0
- package/dist/connect/create-identity-keys.js.map +1 -0
- package/dist/connect/identity-encryption.d.ts +12 -0
- package/dist/connect/identity-encryption.d.ts.map +1 -1
- package/dist/connect/identity-encryption.js +187 -0
- package/dist/connect/identity-encryption.js.map +1 -0
- package/dist/connect/index.d.ts +11 -0
- package/dist/connect/index.d.ts.map +1 -1
- package/dist/connect/index.js +11 -0
- package/dist/connect/index.js.map +1 -0
- package/dist/connect/login.d.ts +22 -0
- package/dist/connect/login.d.ts.map +1 -1
- package/dist/connect/login.js +172 -0
- package/dist/connect/login.js.map +1 -0
- package/dist/connect/parse-auth-params.d.ts +14 -0
- package/dist/connect/parse-auth-params.d.ts.map +1 -0
- package/dist/connect/parse-auth-params.js +40 -0
- package/dist/connect/parse-auth-params.js.map +1 -0
- package/dist/connect/parse-callback-params.d.ts +13 -0
- package/dist/connect/parse-callback-params.d.ts.map +1 -1
- package/dist/connect/parse-callback-params.js +4 -1
- package/dist/connect/parse-callback-params.js.map +1 -1
- package/dist/connect/smart-account.d.ts +96 -0
- package/dist/connect/smart-account.d.ts.map +1 -0
- package/dist/connect/smart-account.js +761 -0
- package/dist/connect/smart-account.js.map +1 -0
- package/dist/connect/types.d.ts +2 -0
- package/dist/connect/types.d.ts.map +1 -1
- package/dist/connect/types.js.map +1 -1
- package/dist/entity/create.d.ts +8 -0
- package/dist/entity/create.js +51 -0
- package/dist/entity/create.js.map +1 -0
- package/dist/entity/decodedEntitiesCache.d.ts +23 -0
- package/dist/entity/decodedEntitiesCache.d.ts.map +1 -1
- package/dist/entity/decodedEntitiesCache.js +2 -0
- package/dist/entity/decodedEntitiesCache.js.map +1 -0
- package/dist/entity/delete.d.ts +12 -0
- package/dist/entity/delete.js +44 -0
- package/dist/entity/delete.js.map +1 -0
- package/dist/entity/entity.d.ts +18 -0
- package/dist/entity/entity.js +19 -0
- package/dist/entity/entity.js.map +1 -0
- package/dist/entity/entityRelationParentsMap.d.ts +4 -0
- package/dist/entity/entityRelationParentsMap.js +2 -0
- package/dist/entity/entityRelationParentsMap.js.map +1 -0
- package/dist/entity/findMany.d.ts +22 -0
- package/dist/entity/findMany.d.ts.map +1 -1
- package/dist/entity/findMany.js +8 -8
- package/dist/entity/findMany.js.map +1 -1
- package/dist/entity/findOne.d.ts +8 -0
- package/dist/entity/findOne.js +31 -0
- package/dist/entity/findOne.js.map +1 -0
- package/dist/entity/getEntityRelations.d.ts +4 -0
- package/dist/entity/getEntityRelations.d.ts.map +1 -1
- package/dist/entity/getEntityRelations.js +35 -0
- package/dist/entity/getEntityRelations.js.map +1 -0
- package/dist/entity/hasValidTypesProperty.d.ts +2 -0
- package/dist/entity/hasValidTypesProperty.d.ts.map +1 -0
- package/dist/entity/hasValidTypesProperty.js +4 -0
- package/dist/entity/hasValidTypesProperty.js.map +1 -0
- package/dist/entity/index.d.ts +9 -0
- package/dist/entity/index.js +9 -0
- package/dist/entity/index.js.map +1 -0
- package/dist/entity/relationParentsMap.d.ts +4 -0
- package/dist/entity/relationParentsMap.js +2 -0
- package/dist/entity/relationParentsMap.js.map +1 -0
- package/dist/entity/removeRelation.d.ts +7 -0
- package/dist/entity/removeRelation.js +17 -0
- package/dist/entity/removeRelation.js.map +1 -0
- package/dist/entity/test.d.ts +2 -0
- package/dist/entity/test.d.ts.map +1 -0
- package/dist/entity/test.js +2 -0
- package/dist/entity/test.js.map +1 -0
- package/dist/entity/types.d.ts +8 -8
- package/dist/entity/update.d.ts +8 -0
- package/dist/entity/update.js +58 -0
- package/dist/entity/update.js.map +1 -0
- package/dist/entity/variant-schema.d.ts +247 -0
- package/dist/entity/variant-schema.d.ts.map +1 -0
- package/dist/entity/variant-schema.js +204 -0
- package/dist/entity/variant-schema.js.map +1 -0
- package/dist/identity/auth-storage.d.ts +6 -0
- package/dist/identity/auth-storage.d.ts.map +1 -1
- package/dist/identity/auth-storage.js +52 -0
- package/dist/identity/auth-storage.js.map +1 -0
- package/dist/identity/get-verified-identity.d.ts +7 -0
- package/dist/identity/get-verified-identity.d.ts.map +1 -1
- package/dist/identity/get-verified-identity.js +37 -0
- package/dist/identity/get-verified-identity.js.map +1 -0
- package/dist/identity/identity-encryption.d.ts +7 -0
- package/dist/identity/identity-encryption.js +120 -0
- package/dist/identity/identity-encryption.js.map +1 -0
- package/dist/identity/index.d.ts +7 -0
- package/dist/identity/index.d.ts.map +1 -1
- package/dist/identity/index.js +7 -0
- package/dist/identity/index.js.map +1 -0
- package/dist/identity/logout.d.ts +3 -0
- package/dist/identity/logout.js +9 -0
- package/dist/identity/logout.js.map +1 -0
- package/dist/identity/prove-ownership.d.ts +15 -0
- package/dist/identity/prove-ownership.d.ts.map +1 -1
- package/dist/identity/prove-ownership.js +90 -0
- package/dist/identity/prove-ownership.js.map +1 -0
- package/dist/identity/types.d.ts +37 -0
- package/dist/identity/types.d.ts.map +1 -0
- package/dist/identity/types.js +11 -0
- package/dist/identity/types.js.map +1 -0
- package/dist/inboxes/create-inbox.d.ts +22 -0
- package/dist/inboxes/create-inbox.js +76 -0
- package/dist/inboxes/create-inbox.js.map +1 -0
- package/dist/inboxes/get-list-inboxes.d.ts +20 -0
- package/dist/inboxes/get-list-inboxes.js +45 -0
- package/dist/inboxes/get-list-inboxes.js.map +1 -0
- package/dist/inboxes/index.d.ts +11 -0
- package/dist/inboxes/index.js +11 -0
- package/dist/inboxes/index.js.map +1 -0
- package/dist/inboxes/merge-messages.d.ts +6 -0
- package/dist/inboxes/merge-messages.js +23 -0
- package/dist/inboxes/merge-messages.js.map +1 -0
- package/dist/inboxes/message-encryption.d.ts +15 -0
- package/dist/inboxes/message-encryption.js +29 -0
- package/dist/inboxes/message-encryption.js.map +1 -0
- package/dist/inboxes/message-validation.d.ts +6 -0
- package/dist/inboxes/message-validation.d.ts.map +1 -1
- package/dist/inboxes/message-validation.js +53 -0
- package/dist/inboxes/message-validation.js.map +1 -0
- package/dist/inboxes/prepare-message.d.ts +2 -2
- package/dist/inboxes/prepare-message.js +78 -0
- package/dist/inboxes/prepare-message.js.map +1 -0
- package/dist/inboxes/recover-inbox-creator.d.ts +5 -0
- package/dist/inboxes/recover-inbox-creator.js +24 -0
- package/dist/inboxes/recover-inbox-creator.js.map +1 -0
- package/dist/inboxes/recover-inbox-message-signer.d.ts +4 -0
- package/dist/inboxes/recover-inbox-message-signer.js +32 -0
- package/dist/inboxes/recover-inbox-message-signer.js.map +1 -0
- package/dist/inboxes/send-message.d.ts +19 -0
- package/dist/inboxes/send-message.js +58 -0
- package/dist/inboxes/send-message.js.map +1 -0
- package/dist/inboxes/types.d.ts +4 -0
- package/dist/inboxes/types.d.ts.map +1 -0
- package/dist/inboxes/types.js +3 -0
- package/dist/inboxes/types.js.map +1 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -0
- package/dist/key/create-key.d.ts +11 -0
- package/dist/key/create-key.d.ts.map +1 -0
- package/dist/key/create-key.js +22 -0
- package/dist/key/create-key.js.map +1 -0
- package/dist/key/decrypt-key.d.ts +9 -0
- package/dist/key/decrypt-key.d.ts.map +1 -0
- package/dist/key/decrypt-key.js +16 -0
- package/dist/key/decrypt-key.js.map +1 -0
- package/dist/key/encrypt-key.d.ts +11 -0
- package/dist/key/encrypt-key.d.ts.map +1 -0
- package/dist/key/encrypt-key.js +20 -0
- package/dist/key/encrypt-key.js.map +1 -0
- package/dist/key/index.d.ts +5 -0
- package/dist/key/index.d.ts.map +1 -0
- package/dist/key/index.js +5 -0
- package/dist/key/index.js.map +1 -0
- package/dist/key/key-box.d.ts +19 -0
- package/dist/key/key-box.d.ts.map +1 -0
- package/dist/key/key-box.js +38 -0
- package/dist/key/key-box.js.map +1 -0
- package/dist/messages/decrypt-message.d.ts +7 -0
- package/dist/messages/decrypt-message.d.ts.map +1 -0
- package/dist/messages/decrypt-message.js +11 -0
- package/dist/messages/decrypt-message.js.map +1 -0
- package/dist/messages/encrypt-message.d.ts +7 -0
- package/dist/messages/encrypt-message.d.ts.map +1 -0
- package/dist/messages/encrypt-message.js +12 -0
- package/dist/messages/encrypt-message.js.map +1 -0
- package/dist/messages/index.d.ts +6 -0
- package/dist/messages/index.js +6 -0
- package/dist/messages/index.js.map +1 -0
- package/dist/messages/serialize.d.ts +3 -0
- package/dist/messages/serialize.d.ts.map +1 -0
- package/dist/messages/serialize.js +30 -0
- package/dist/messages/serialize.js.map +1 -0
- package/dist/messages/signed-update-message.d.ts +23 -0
- package/dist/messages/signed-update-message.js +56 -0
- package/dist/messages/signed-update-message.js.map +1 -0
- package/dist/messages/types.d.ts +1268 -0
- package/dist/messages/types.d.ts.map +1 -1
- package/dist/messages/types.js +312 -0
- package/dist/messages/types.js.map +1 -0
- package/dist/space-events/accept-invitation.d.ts +9 -0
- package/dist/space-events/accept-invitation.js +28 -0
- package/dist/space-events/accept-invitation.js.map +1 -0
- package/dist/space-events/apply-event.d.ts +11 -0
- package/dist/space-events/apply-event.js +130 -0
- package/dist/space-events/apply-event.js.map +1 -0
- package/dist/space-events/create-inbox.d.ts +14 -0
- package/dist/space-events/create-inbox.js +41 -0
- package/dist/space-events/create-inbox.js.map +1 -0
- package/dist/space-events/create-invitation.d.ts +12 -0
- package/dist/space-events/create-invitation.js +30 -0
- package/dist/space-events/create-invitation.js.map +1 -0
- package/dist/space-events/create-space.d.ts +9 -0
- package/dist/space-events/create-space.js +29 -0
- package/dist/space-events/create-space.js.map +1 -0
- package/dist/space-events/delete-space.d.ts +10 -0
- package/dist/space-events/delete-space.js +30 -0
- package/dist/space-events/delete-space.js.map +1 -0
- package/dist/space-events/hash-event.d.ts +3 -0
- package/dist/space-events/hash-event.js +7 -0
- package/dist/space-events/hash-event.js.map +1 -0
- package/dist/space-events/index.d.ts +9 -0
- package/dist/space-events/index.js +9 -0
- package/dist/space-events/index.js.map +1 -0
- package/dist/space-events/types.d.ts +222 -0
- package/dist/space-events/types.d.ts.map +1 -0
- package/dist/space-events/types.js +102 -0
- package/dist/space-events/types.js.map +1 -0
- package/dist/space-info/decrypt-space-info.d.ts +7 -0
- package/dist/space-info/decrypt-space-info.js +18 -0
- package/dist/space-info/decrypt-space-info.js.map +1 -0
- package/dist/space-info/encrypt-and-sign-space-info.d.ts +17 -0
- package/dist/space-info/encrypt-and-sign-space-info.js +39 -0
- package/dist/space-info/encrypt-and-sign-space-info.js.map +1 -0
- package/dist/space-info/index.d.ts +4 -0
- package/dist/space-info/index.js +4 -0
- package/dist/space-info/index.js.map +1 -0
- package/dist/space-info/types.d.ts +6 -0
- package/dist/space-info/types.d.ts.map +1 -0
- package/dist/space-info/types.js +5 -0
- package/dist/space-info/types.js.map +1 -0
- package/dist/store-connect.d.ts +149 -0
- package/dist/store-connect.d.ts.map +1 -1
- package/dist/store-connect.js +289 -0
- package/dist/store-connect.js.map +1 -0
- package/dist/store.d.ts +158 -0
- package/dist/store.d.ts.map +1 -1
- package/dist/store.js +354 -0
- package/dist/store.js.map +1 -0
- package/dist/type/type.d.ts +14 -0
- package/dist/type/type.d.ts.map +1 -1
- package/dist/type/type.js +25 -0
- package/dist/type/type.js.map +1 -0
- package/dist/types.d.ts +80 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +37 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/assertExhaustive.d.ts +2 -0
- package/dist/utils/assertExhaustive.d.ts.map +1 -0
- package/dist/utils/assertExhaustive.js +4 -0
- package/dist/utils/assertExhaustive.js.map +1 -0
- package/dist/utils/automergeId.d.ts +1 -1
- package/dist/utils/automergeId.d.ts.map +1 -1
- package/dist/utils/automergeId.js +1 -1
- package/dist/utils/automergeId.js.map +1 -1
- package/dist/utils/base58.d.ts +36 -0
- package/dist/utils/base58.d.ts.map +1 -0
- package/dist/utils/base58.js +62 -0
- package/dist/utils/base58.js.map +1 -0
- package/dist/utils/hexBytesAddressUtils.d.ts +4 -0
- package/dist/utils/hexBytesAddressUtils.d.ts.map +1 -0
- package/dist/utils/hexBytesAddressUtils.js +21 -0
- package/dist/utils/hexBytesAddressUtils.js.map +1 -0
- package/dist/utils/index.d.ts +9 -0
- package/dist/utils/index.js +9 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/internal/base58Utils.d.ts +4 -0
- package/dist/utils/internal/base58Utils.d.ts.map +1 -0
- package/dist/utils/internal/base58Utils.js +40 -0
- package/dist/utils/internal/base58Utils.js.map +1 -0
- package/dist/utils/internal/deep-merge.d.ts +7 -0
- package/dist/utils/internal/deep-merge.d.ts.map +1 -0
- package/dist/utils/internal/deep-merge.js +33 -0
- package/dist/utils/internal/deep-merge.js.map +1 -0
- package/dist/utils/isRelationField.d.ts +3 -0
- package/dist/utils/isRelationField.d.ts.map +1 -0
- package/dist/utils/isRelationField.js +8 -0
- package/dist/utils/isRelationField.js.map +1 -0
- package/dist/utils/jsc.d.ts +49 -0
- package/dist/utils/jsc.d.ts.map +1 -0
- package/dist/utils/jsc.js +88 -0
- package/dist/utils/jsc.js.map +1 -0
- package/dist/utils/stringToUint8Array.d.ts +3 -0
- package/dist/utils/stringToUint8Array.d.ts.map +1 -0
- package/dist/utils/stringToUint8Array.js +9 -0
- package/dist/utils/stringToUint8Array.js.map +1 -0
- package/package.json +5 -2
- package/src/connect/abis/MainVotingPlugin.json +1865 -0
- package/src/connect/abis/PersonalSpaceAdminPlugin.json +531 -0
- package/src/connect/abis.ts +183 -0
- package/src/connect/create-callback-params.ts +4 -1
- package/src/connect/identity-encryption.ts +10 -14
- package/src/connect/index.ts +1 -1
- package/src/connect/login.ts +106 -18
- package/src/connect/parse-callback-params.ts +4 -1
- package/src/connect/smart-account.ts +915 -0
- package/src/connect/types.ts +2 -0
- package/src/entity/decodedEntitiesCache.ts +1 -1
- package/src/entity/findMany.ts +16 -14
- package/src/entity/getEntityRelations.ts +1 -1
- package/src/entity/types.ts +8 -8
- package/src/identity/auth-storage.ts +11 -1
- package/src/identity/get-verified-identity.ts +6 -1
- package/src/identity/index.ts +1 -1
- package/src/identity/prove-ownership.ts +52 -8
- package/src/inboxes/message-validation.ts +17 -2
- package/src/messages/types.ts +6 -0
- package/src/store-connect.ts +1 -52
- package/src/store.ts +78 -48
- package/src/type/type.ts +4 -2
- package/src/types.ts +19 -1
- package/src/utils/automergeId.ts +1 -1
- package/dist/connect/prove-ownership.d.ts.map +0 -1
- package/src/connect/prove-ownership.ts +0 -58
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/messages/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAC;AAWxC,eAAO,MAAM,YAAY;;;;;;;;EAKvB,CAAC;AAEH,eAAO,MAAM,OAAO;;;;;;;;;;;;EAIlB,CAAC;AAEH,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,OAAO,CAAC,CAAC;AAEzD,eAAO,MAAM,MAAM;;;;;EAKjB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,MA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AO,MAAM,gCAAgC;;;;;;;;;;;;EAE3C,CAAC;AAEH,MAAM,MAAM,gCAAgC,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,gCAAgC,CAAC,CAAC;AAE3G,eAAO,MAAM,6BAA6B;;EAExC,CAAC;AAEH,MAAM,MAAM,6BAA6B,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,6BAA6B,CAAC,CAAC;AAErG,eAAO,MAAM,2BAA2B;;EAEtC,CAAC;AAEH,MAAM,MAAM,2BAA2B,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,2BAA2B,CAAC,CAAC"}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
import * as Schema from 'effect/Schema';
|
|
2
|
+
import { InboxSenderAuthPolicy } from '../inboxes/types.js';
|
|
3
|
+
import { AcceptInvitationEvent, CreateInvitationEvent, CreateSpaceEvent, CreateSpaceInboxEvent, SpaceEvent } from '../space-events/index.js';
|
|
4
|
+
import { SignatureWithRecovery } from '../types.js';
|
|
5
|
+
export const SignedUpdate = /*#__PURE__*/Schema.Struct({
|
|
6
|
+
update: Schema.Uint8Array,
|
|
7
|
+
accountAddress: Schema.String,
|
|
8
|
+
signature: SignatureWithRecovery,
|
|
9
|
+
updateId: Schema.String
|
|
10
|
+
});
|
|
11
|
+
export const Updates = /*#__PURE__*/Schema.Struct({
|
|
12
|
+
updates: /*#__PURE__*/Schema.Array(SignedUpdate),
|
|
13
|
+
firstUpdateClock: Schema.Number,
|
|
14
|
+
lastUpdateClock: Schema.Number
|
|
15
|
+
});
|
|
16
|
+
export const KeyBox = /*#__PURE__*/Schema.Struct({
|
|
17
|
+
accountAddress: Schema.String,
|
|
18
|
+
ciphertext: Schema.String,
|
|
19
|
+
nonce: Schema.String,
|
|
20
|
+
authorPublicKey: Schema.String
|
|
21
|
+
});
|
|
22
|
+
export const KeyBoxWithKeyId = /*#__PURE__*/Schema.Struct({
|
|
23
|
+
...KeyBox.fields,
|
|
24
|
+
id: Schema.String
|
|
25
|
+
});
|
|
26
|
+
export const IdentityKeyBox = /*#__PURE__*/Schema.Struct({
|
|
27
|
+
signer: Schema.String,
|
|
28
|
+
accountAddress: Schema.String,
|
|
29
|
+
ciphertext: Schema.String,
|
|
30
|
+
nonce: Schema.String
|
|
31
|
+
});
|
|
32
|
+
export const RequestCreateSpaceEvent = /*#__PURE__*/Schema.Struct({
|
|
33
|
+
type: /*#__PURE__*/Schema.Literal('create-space-event'),
|
|
34
|
+
spaceId: Schema.String,
|
|
35
|
+
event: CreateSpaceEvent,
|
|
36
|
+
keyBox: KeyBoxWithKeyId,
|
|
37
|
+
name: Schema.String
|
|
38
|
+
});
|
|
39
|
+
export const RequestConnectCreateSpaceEvent = /*#__PURE__*/Schema.Struct({
|
|
40
|
+
type: /*#__PURE__*/Schema.Literal('connect-create-space-event'),
|
|
41
|
+
accountAddress: Schema.String,
|
|
42
|
+
spaceId: Schema.String,
|
|
43
|
+
event: CreateSpaceEvent,
|
|
44
|
+
keyBox: KeyBoxWithKeyId,
|
|
45
|
+
infoContent: Schema.String,
|
|
46
|
+
infoSignature: SignatureWithRecovery,
|
|
47
|
+
name: Schema.String
|
|
48
|
+
});
|
|
49
|
+
export const RequestCreateInvitationEvent = /*#__PURE__*/Schema.Struct({
|
|
50
|
+
type: /*#__PURE__*/Schema.Literal('create-invitation-event'),
|
|
51
|
+
spaceId: Schema.String,
|
|
52
|
+
event: CreateInvitationEvent,
|
|
53
|
+
keyBoxes: /*#__PURE__*/Schema.Array(KeyBoxWithKeyId)
|
|
54
|
+
});
|
|
55
|
+
export const RequestConnectAddAppIdentityToSpaces = /*#__PURE__*/Schema.Struct({
|
|
56
|
+
type: /*#__PURE__*/Schema.Literal('connect-add-app-identity-to-spaces'),
|
|
57
|
+
appIdentityAddress: Schema.String,
|
|
58
|
+
accountAddress: Schema.String,
|
|
59
|
+
spacesInput: /*#__PURE__*/Schema.Array(/*#__PURE__*/Schema.Struct({
|
|
60
|
+
id: Schema.String,
|
|
61
|
+
keyBoxes: /*#__PURE__*/Schema.Array(KeyBoxWithKeyId)
|
|
62
|
+
}))
|
|
63
|
+
});
|
|
64
|
+
export const RequestAcceptInvitationEvent = /*#__PURE__*/Schema.Struct({
|
|
65
|
+
type: /*#__PURE__*/Schema.Literal('accept-invitation-event'),
|
|
66
|
+
spaceId: Schema.String,
|
|
67
|
+
event: AcceptInvitationEvent
|
|
68
|
+
});
|
|
69
|
+
export const RequestSubscribeToSpace = /*#__PURE__*/Schema.Struct({
|
|
70
|
+
type: /*#__PURE__*/Schema.Literal('subscribe-space'),
|
|
71
|
+
id: Schema.String,
|
|
72
|
+
lastKnownUpdateClock: /*#__PURE__*/Schema.optional(Schema.Number)
|
|
73
|
+
});
|
|
74
|
+
export const RequestListSpaces = /*#__PURE__*/Schema.Struct({
|
|
75
|
+
type: /*#__PURE__*/Schema.Literal('list-spaces')
|
|
76
|
+
});
|
|
77
|
+
export const RequestListInvitations = /*#__PURE__*/Schema.Struct({
|
|
78
|
+
type: /*#__PURE__*/Schema.Literal('list-invitations')
|
|
79
|
+
});
|
|
80
|
+
export const RequestCreateUpdate = /*#__PURE__*/Schema.Struct({
|
|
81
|
+
type: /*#__PURE__*/Schema.Literal('create-update'),
|
|
82
|
+
accountAddress: Schema.String,
|
|
83
|
+
update: Schema.Uint8Array,
|
|
84
|
+
spaceId: Schema.String,
|
|
85
|
+
updateId: Schema.String,
|
|
86
|
+
// used to identify the confirmation message
|
|
87
|
+
signature: SignatureWithRecovery
|
|
88
|
+
});
|
|
89
|
+
export const RequestCreateAccountInbox = /*#__PURE__*/Schema.Struct({
|
|
90
|
+
type: /*#__PURE__*/Schema.Literal('create-account-inbox'),
|
|
91
|
+
accountAddress: Schema.String,
|
|
92
|
+
inboxId: Schema.String,
|
|
93
|
+
isPublic: Schema.Boolean,
|
|
94
|
+
authPolicy: InboxSenderAuthPolicy,
|
|
95
|
+
encryptionPublicKey: Schema.String,
|
|
96
|
+
signature: SignatureWithRecovery
|
|
97
|
+
});
|
|
98
|
+
export const RequestCreateSpaceInboxEvent = /*#__PURE__*/Schema.Struct({
|
|
99
|
+
type: /*#__PURE__*/Schema.Literal('create-space-inbox-event'),
|
|
100
|
+
spaceId: Schema.String,
|
|
101
|
+
event: CreateSpaceInboxEvent
|
|
102
|
+
});
|
|
103
|
+
export const RequestGetLatestSpaceInboxMessages = /*#__PURE__*/Schema.Struct({
|
|
104
|
+
type: /*#__PURE__*/Schema.Literal('get-latest-space-inbox-messages'),
|
|
105
|
+
spaceId: Schema.String,
|
|
106
|
+
inboxId: Schema.String,
|
|
107
|
+
since: Schema.Date
|
|
108
|
+
});
|
|
109
|
+
export const RequestGetLatestAccountInboxMessages = /*#__PURE__*/Schema.Struct({
|
|
110
|
+
type: /*#__PURE__*/Schema.Literal('get-latest-account-inbox-messages'),
|
|
111
|
+
accountAddress: Schema.String,
|
|
112
|
+
inboxId: Schema.String,
|
|
113
|
+
since: Schema.Date
|
|
114
|
+
});
|
|
115
|
+
export const RequestGetAccountInboxes = /*#__PURE__*/Schema.Struct({
|
|
116
|
+
type: /*#__PURE__*/Schema.Literal('get-account-inboxes')
|
|
117
|
+
});
|
|
118
|
+
export const RequestMessage = /*#__PURE__*/Schema.Union(RequestCreateSpaceEvent, RequestCreateInvitationEvent, RequestAcceptInvitationEvent, RequestSubscribeToSpace, RequestListSpaces, RequestListInvitations, RequestCreateUpdate, RequestCreateAccountInbox, RequestCreateSpaceInboxEvent, RequestGetLatestSpaceInboxMessages, RequestGetLatestAccountInboxMessages, RequestGetAccountInboxes);
|
|
119
|
+
export const RequestLoginNonce = /*#__PURE__*/Schema.Struct({
|
|
120
|
+
accountAddress: Schema.String
|
|
121
|
+
});
|
|
122
|
+
export const RequestLogin = /*#__PURE__*/Schema.Struct({
|
|
123
|
+
accountAddress: Schema.String,
|
|
124
|
+
message: Schema.String,
|
|
125
|
+
signature: Schema.String
|
|
126
|
+
});
|
|
127
|
+
export const RequestLoginWithSigningKey = /*#__PURE__*/Schema.Struct({
|
|
128
|
+
accountAddress: Schema.String,
|
|
129
|
+
message: Schema.String,
|
|
130
|
+
publicKey: Schema.String,
|
|
131
|
+
signature: Schema.String
|
|
132
|
+
});
|
|
133
|
+
export const RequestCreateIdentity = /*#__PURE__*/Schema.Struct({
|
|
134
|
+
keyBox: IdentityKeyBox,
|
|
135
|
+
accountProof: Schema.String,
|
|
136
|
+
keyProof: Schema.String,
|
|
137
|
+
message: Schema.String,
|
|
138
|
+
signaturePublicKey: Schema.String,
|
|
139
|
+
encryptionPublicKey: Schema.String,
|
|
140
|
+
signature: Schema.String
|
|
141
|
+
});
|
|
142
|
+
export const RequestConnectCreateIdentity = /*#__PURE__*/Schema.Struct({
|
|
143
|
+
keyBox: IdentityKeyBox,
|
|
144
|
+
accountProof: Schema.String,
|
|
145
|
+
keyProof: Schema.String,
|
|
146
|
+
signaturePublicKey: Schema.String,
|
|
147
|
+
encryptionPublicKey: Schema.String
|
|
148
|
+
});
|
|
149
|
+
export const RequestConnectCreateAppIdentity = /*#__PURE__*/Schema.Struct({
|
|
150
|
+
appId: Schema.String,
|
|
151
|
+
address: Schema.String,
|
|
152
|
+
accountAddress: Schema.String,
|
|
153
|
+
ciphertext: Schema.String,
|
|
154
|
+
nonce: Schema.String,
|
|
155
|
+
signaturePublicKey: Schema.String,
|
|
156
|
+
encryptionPublicKey: Schema.String,
|
|
157
|
+
accountProof: Schema.String,
|
|
158
|
+
keyProof: Schema.String
|
|
159
|
+
});
|
|
160
|
+
export const ResponseConnectCreateIdentity = /*#__PURE__*/Schema.Struct({
|
|
161
|
+
success: Schema.Boolean
|
|
162
|
+
});
|
|
163
|
+
export const RequestCreateSpaceInboxMessage = /*#__PURE__*/Schema.Struct({
|
|
164
|
+
ciphertext: Schema.String,
|
|
165
|
+
signature: /*#__PURE__*/Schema.optional(SignatureWithRecovery),
|
|
166
|
+
authorAccountAddress: /*#__PURE__*/Schema.optional(Schema.String)
|
|
167
|
+
});
|
|
168
|
+
export const RequestCreateAccountInboxMessage = /*#__PURE__*/Schema.Struct({
|
|
169
|
+
ciphertext: Schema.String,
|
|
170
|
+
signature: /*#__PURE__*/Schema.optional(SignatureWithRecovery),
|
|
171
|
+
authorAccountAddress: /*#__PURE__*/Schema.optional(Schema.String)
|
|
172
|
+
});
|
|
173
|
+
export const ResponseListSpaces = /*#__PURE__*/Schema.Struct({
|
|
174
|
+
type: /*#__PURE__*/Schema.Literal('list-spaces'),
|
|
175
|
+
spaces: /*#__PURE__*/Schema.Array(/*#__PURE__*/Schema.Struct({
|
|
176
|
+
id: Schema.String,
|
|
177
|
+
name: Schema.String
|
|
178
|
+
}))
|
|
179
|
+
});
|
|
180
|
+
export const Invitation = /*#__PURE__*/Schema.Struct({
|
|
181
|
+
id: Schema.String,
|
|
182
|
+
previousEventHash: Schema.String,
|
|
183
|
+
spaceId: Schema.String
|
|
184
|
+
});
|
|
185
|
+
export const ResponseListInvitations = /*#__PURE__*/Schema.Struct({
|
|
186
|
+
type: /*#__PURE__*/Schema.Literal('list-invitations'),
|
|
187
|
+
invitations: /*#__PURE__*/Schema.Array(Invitation)
|
|
188
|
+
});
|
|
189
|
+
export const ResponseSpaceEvent = /*#__PURE__*/Schema.Struct({
|
|
190
|
+
type: /*#__PURE__*/Schema.Literal('space-event'),
|
|
191
|
+
spaceId: Schema.String,
|
|
192
|
+
event: SpaceEvent
|
|
193
|
+
});
|
|
194
|
+
export const InboxMessage = /*#__PURE__*/Schema.Struct({
|
|
195
|
+
id: Schema.String,
|
|
196
|
+
ciphertext: Schema.String,
|
|
197
|
+
signature: /*#__PURE__*/Schema.optional(SignatureWithRecovery),
|
|
198
|
+
authorAccountAddress: /*#__PURE__*/Schema.optional(Schema.String),
|
|
199
|
+
createdAt: Schema.Date
|
|
200
|
+
});
|
|
201
|
+
export const SpaceInbox = /*#__PURE__*/Schema.Struct({
|
|
202
|
+
inboxId: Schema.String,
|
|
203
|
+
isPublic: Schema.Boolean,
|
|
204
|
+
authPolicy: InboxSenderAuthPolicy,
|
|
205
|
+
encryptionPublicKey: Schema.String,
|
|
206
|
+
secretKey: Schema.String
|
|
207
|
+
});
|
|
208
|
+
export const AccountInbox = /*#__PURE__*/Schema.Struct({
|
|
209
|
+
accountAddress: Schema.String,
|
|
210
|
+
inboxId: Schema.String,
|
|
211
|
+
isPublic: Schema.Boolean,
|
|
212
|
+
authPolicy: InboxSenderAuthPolicy,
|
|
213
|
+
encryptionPublicKey: Schema.String,
|
|
214
|
+
signature: SignatureWithRecovery
|
|
215
|
+
});
|
|
216
|
+
export const ResponseAccountInbox = /*#__PURE__*/Schema.Struct({
|
|
217
|
+
type: /*#__PURE__*/Schema.Literal('account-inbox'),
|
|
218
|
+
inbox: AccountInbox
|
|
219
|
+
});
|
|
220
|
+
export const ResponseSpace = /*#__PURE__*/Schema.Struct({
|
|
221
|
+
type: /*#__PURE__*/Schema.Literal('space'),
|
|
222
|
+
id: Schema.String,
|
|
223
|
+
name: Schema.String,
|
|
224
|
+
events: /*#__PURE__*/Schema.Array(SpaceEvent),
|
|
225
|
+
keyBoxes: /*#__PURE__*/Schema.Array(KeyBoxWithKeyId),
|
|
226
|
+
updates: /*#__PURE__*/Schema.optional(Updates),
|
|
227
|
+
inboxes: /*#__PURE__*/Schema.Array(SpaceInbox)
|
|
228
|
+
});
|
|
229
|
+
export const ResponseUpdateConfirmed = /*#__PURE__*/Schema.Struct({
|
|
230
|
+
type: /*#__PURE__*/Schema.Literal('update-confirmed'),
|
|
231
|
+
updateId: Schema.String,
|
|
232
|
+
clock: Schema.Number,
|
|
233
|
+
spaceId: Schema.String
|
|
234
|
+
});
|
|
235
|
+
export const ResponseUpdatesNotification = /*#__PURE__*/Schema.Struct({
|
|
236
|
+
type: /*#__PURE__*/Schema.Literal('updates-notification'),
|
|
237
|
+
updates: Updates,
|
|
238
|
+
spaceId: Schema.String
|
|
239
|
+
});
|
|
240
|
+
export const ResponseSpaceInboxMessage = /*#__PURE__*/Schema.Struct({
|
|
241
|
+
type: /*#__PURE__*/Schema.Literal('space-inbox-message'),
|
|
242
|
+
spaceId: Schema.String,
|
|
243
|
+
inboxId: Schema.String,
|
|
244
|
+
message: InboxMessage
|
|
245
|
+
});
|
|
246
|
+
export const ResponseSpaceInboxMessages = /*#__PURE__*/Schema.Struct({
|
|
247
|
+
type: /*#__PURE__*/Schema.Literal('space-inbox-messages'),
|
|
248
|
+
spaceId: Schema.String,
|
|
249
|
+
inboxId: Schema.String,
|
|
250
|
+
messages: /*#__PURE__*/Schema.Array(InboxMessage)
|
|
251
|
+
});
|
|
252
|
+
export const ResponseAccountInboxMessage = /*#__PURE__*/Schema.Struct({
|
|
253
|
+
type: /*#__PURE__*/Schema.Literal('account-inbox-message'),
|
|
254
|
+
accountAddress: Schema.String,
|
|
255
|
+
inboxId: Schema.String,
|
|
256
|
+
message: InboxMessage
|
|
257
|
+
});
|
|
258
|
+
export const ResponseAccountInboxMessages = /*#__PURE__*/Schema.Struct({
|
|
259
|
+
type: /*#__PURE__*/Schema.Literal('account-inbox-messages'),
|
|
260
|
+
accountAddress: Schema.String,
|
|
261
|
+
inboxId: Schema.String,
|
|
262
|
+
messages: /*#__PURE__*/Schema.Array(InboxMessage)
|
|
263
|
+
});
|
|
264
|
+
export const ResponseAccountInboxes = /*#__PURE__*/Schema.Struct({
|
|
265
|
+
type: /*#__PURE__*/Schema.Literal('account-inboxes'),
|
|
266
|
+
inboxes: /*#__PURE__*/Schema.Array(AccountInbox)
|
|
267
|
+
});
|
|
268
|
+
export const ResponseMessage = /*#__PURE__*/Schema.Union(ResponseListSpaces, ResponseListInvitations, ResponseSpace, ResponseSpaceEvent, ResponseUpdateConfirmed, ResponseUpdatesNotification, ResponseAccountInbox, ResponseSpaceInboxMessage, ResponseSpaceInboxMessages, ResponseAccountInboxMessage, ResponseAccountInboxMessages, ResponseAccountInboxes);
|
|
269
|
+
export const ResponseIdentityEncrypted = /*#__PURE__*/Schema.Struct({
|
|
270
|
+
keyBox: IdentityKeyBox
|
|
271
|
+
});
|
|
272
|
+
export const ResponseIdentity = /*#__PURE__*/Schema.Struct({
|
|
273
|
+
accountAddress: Schema.String,
|
|
274
|
+
signaturePublicKey: Schema.String,
|
|
275
|
+
encryptionPublicKey: Schema.String,
|
|
276
|
+
accountProof: Schema.String,
|
|
277
|
+
keyProof: Schema.String
|
|
278
|
+
});
|
|
279
|
+
export const SpaceInboxPublic = /*#__PURE__*/Schema.Struct({
|
|
280
|
+
inboxId: Schema.String,
|
|
281
|
+
isPublic: Schema.Boolean,
|
|
282
|
+
authPolicy: InboxSenderAuthPolicy,
|
|
283
|
+
encryptionPublicKey: Schema.String,
|
|
284
|
+
creationEvent: CreateSpaceInboxEvent
|
|
285
|
+
});
|
|
286
|
+
export const ResponseSpaceInboxPublic = /*#__PURE__*/Schema.Struct({
|
|
287
|
+
inbox: SpaceInboxPublic
|
|
288
|
+
});
|
|
289
|
+
export const ResponseListSpaceInboxesPublic = /*#__PURE__*/Schema.Struct({
|
|
290
|
+
inboxes: /*#__PURE__*/Schema.Array(SpaceInboxPublic)
|
|
291
|
+
});
|
|
292
|
+
export const AccountInboxPublic = /*#__PURE__*/Schema.Struct({
|
|
293
|
+
accountAddress: Schema.String,
|
|
294
|
+
inboxId: Schema.String,
|
|
295
|
+
isPublic: Schema.Boolean,
|
|
296
|
+
authPolicy: InboxSenderAuthPolicy,
|
|
297
|
+
encryptionPublicKey: Schema.String,
|
|
298
|
+
signature: SignatureWithRecovery
|
|
299
|
+
});
|
|
300
|
+
export const ResponseAccountInboxPublic = /*#__PURE__*/Schema.Struct({
|
|
301
|
+
inbox: AccountInboxPublic
|
|
302
|
+
});
|
|
303
|
+
export const ResponseListAccountInboxesPublic = /*#__PURE__*/Schema.Struct({
|
|
304
|
+
inboxes: /*#__PURE__*/Schema.Array(AccountInboxPublic)
|
|
305
|
+
});
|
|
306
|
+
export const ResponseIdentityNotFoundError = /*#__PURE__*/Schema.Struct({
|
|
307
|
+
accountAddress: Schema.String
|
|
308
|
+
});
|
|
309
|
+
export const ResponseIdentityExistsError = /*#__PURE__*/Schema.Struct({
|
|
310
|
+
accountAddress: Schema.String
|
|
311
|
+
});
|
|
312
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","names":["Schema","InboxSenderAuthPolicy","AcceptInvitationEvent","CreateInvitationEvent","CreateSpaceEvent","CreateSpaceInboxEvent","SpaceEvent","SignatureWithRecovery","SignedUpdate","Struct","update","Uint8Array","accountAddress","String","signature","updateId","Updates","updates","Array","firstUpdateClock","Number","lastUpdateClock","KeyBox","ciphertext","nonce","authorPublicKey","KeyBoxWithKeyId","fields","id","IdentityKeyBox","signer","RequestCreateSpaceEvent","type","Literal","spaceId","event","keyBox","name","RequestConnectCreateSpaceEvent","infoContent","infoSignature","RequestCreateInvitationEvent","keyBoxes","RequestConnectAddAppIdentityToSpaces","appIdentityAddress","spacesInput","RequestAcceptInvitationEvent","RequestSubscribeToSpace","lastKnownUpdateClock","optional","RequestListSpaces","RequestListInvitations","RequestCreateUpdate","RequestCreateAccountInbox","inboxId","isPublic","Boolean","authPolicy","encryptionPublicKey","RequestCreateSpaceInboxEvent","RequestGetLatestSpaceInboxMessages","since","Date","RequestGetLatestAccountInboxMessages","RequestGetAccountInboxes","RequestMessage","Union","RequestLoginNonce","RequestLogin","message","RequestLoginWithSigningKey","publicKey","RequestCreateIdentity","accountProof","keyProof","signaturePublicKey","RequestConnectCreateIdentity","RequestConnectCreateAppIdentity","appId","address","ResponseConnectCreateIdentity","success","RequestCreateSpaceInboxMessage","authorAccountAddress","RequestCreateAccountInboxMessage","ResponseListSpaces","spaces","Invitation","previousEventHash","ResponseListInvitations","invitations","ResponseSpaceEvent","InboxMessage","createdAt","SpaceInbox","secretKey","AccountInbox","ResponseAccountInbox","inbox","ResponseSpace","events","inboxes","ResponseUpdateConfirmed","clock","ResponseUpdatesNotification","ResponseSpaceInboxMessage","ResponseSpaceInboxMessages","messages","ResponseAccountInboxMessage","ResponseAccountInboxMessages","ResponseAccountInboxes","ResponseMessage","ResponseIdentityEncrypted","ResponseIdentity","SpaceInboxPublic","creationEvent","ResponseSpaceInboxPublic","ResponseListSpaceInboxesPublic","AccountInboxPublic","ResponseAccountInboxPublic","ResponseListAccountInboxesPublic","ResponseIdentityNotFoundError","ResponseIdentityExistsError"],"sources":["../../src/messages/types.ts"],"sourcesContent":[null],"mappings":"AAAA,OAAO,KAAKA,MAAM,MAAM,eAAe;AAEvC,SAASC,qBAAqB,QAAQ,qBAAqB;AAC3D,SACEC,qBAAqB,EACrBC,qBAAqB,EACrBC,gBAAgB,EAChBC,qBAAqB,EACrBC,UAAU,QACL,0BAA0B;AACjC,SAASC,qBAAqB,QAAQ,aAAa;AACnD,OAAO,MAAMC,YAAY,gBAAGR,MAAM,CAACS,MAAM,CAAC;EACxCC,MAAM,EAAEV,MAAM,CAACW,UAAU;EACzBC,cAAc,EAAEZ,MAAM,CAACa,MAAM;EAC7BC,SAAS,EAAEP,qBAAqB;EAChCQ,QAAQ,EAAEf,MAAM,CAACa;CAClB,CAAC;AAEF,OAAO,MAAMG,OAAO,gBAAGhB,MAAM,CAACS,MAAM,CAAC;EACnCQ,OAAO,eAAEjB,MAAM,CAACkB,KAAK,CAACV,YAAY,CAAC;EACnCW,gBAAgB,EAAEnB,MAAM,CAACoB,MAAM;EAC/BC,eAAe,EAAErB,MAAM,CAACoB;CACzB,CAAC;AAIF,OAAO,MAAME,MAAM,gBAAGtB,MAAM,CAACS,MAAM,CAAC;EAClCG,cAAc,EAAEZ,MAAM,CAACa,MAAM;EAC7BU,UAAU,EAAEvB,MAAM,CAACa,MAAM;EACzBW,KAAK,EAAExB,MAAM,CAACa,MAAM;EACpBY,eAAe,EAAEzB,MAAM,CAACa;CACzB,CAAC;AAIF,OAAO,MAAMa,eAAe,gBAAG1B,MAAM,CAACS,MAAM,CAAC;EAC3C,GAAGa,MAAM,CAACK,MAAM;EAChBC,EAAE,EAAE5B,MAAM,CAACa;CACZ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MAAM,CAACa,MAAM;EAClCsG,aAAa,EAAE9G;CAChB,CAAC;AAIF,OAAO,MAAM+G,wBAAwB,gBAAGpH,MAAM,CAACS,MAAM,CAAC;EACpDyF,KAAK,EAAEgB;CACR,CAAC;AAIF,OAAO,MAAMG,8BAA8B,gBAAGrH,MAAM,CAACS,MAAM,CAAC;EAC1D4F,OAAO,eAAErG,MAAM,CAACkB,KAAK,CAACgG,gBAAgB;CACvC,CAAC;AAIF,OAAO,MAAMI,kBAAkB,gBAAGtH,MAAM,CAACS,MAAM,CAAC;EAC9CG,cAAc,EAAEZ,MAAM,CAACa,MAAM;EAC7ByC,OAAO,EAAEtD,MAAM,CAACa,MAAM;EACtB0C,QAAQ,EAAEvD,MAAM,CAACwD,OAAO;EACxBC,UAAU,EAAExD,qBAAqB;EACjCyD,mBAAmB,EAAE1D,MAAM,CAACa,MAAM;EAClCC,SAAS,EAAEP;CACZ,CAAC;AAIF,OAAO,MAAMgH,0BAA0B,gBAAGvH,MAAM,CAACS,MAAM,CAAC;EACtDyF,KAAK,EAAEoB;CACR,CAAC;AAIF,OAAO,MAAME,gCAAgC,gBAAGxH,MAAM,CAACS,MAAM,CAAC;EAC5D4F,OAAO,eAAErG,MAAM,CAACkB,KAAK,CAACoG,kBAAkB;CACzC,CAAC;AAIF,OAAO,MAAMG,6BAA6B,gBAAGzH,MAAM,CAACS,MAAM,CAAC;EACzDG,cAAc,EAAEZ,MAAM,CAACa;CACxB,CAAC;AAIF,OAAO,MAAM6G,2BAA2B,gBAAG1H,MAAM,CAACS,MAAM,CAAC;EACvDG,cAAc,EAAEZ,MAAM,CAACa;CACxB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { AcceptInvitationEvent, Author } from './types.js';
|
|
3
|
+
type Params = {
|
|
4
|
+
author: Author;
|
|
5
|
+
previousEventHash: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const acceptInvitation: ({ author, previousEventHash, }: Params) => Effect.Effect<AcceptInvitationEvent, undefined>;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=accept-invitation.d.ts.map
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { secp256k1 } from '@noble/curves/secp256k1';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
import { canonicalize, generateId, hexToBytes, stringToUint8Array } from '../utils/index.js';
|
|
4
|
+
export const acceptInvitation = ({
|
|
5
|
+
author,
|
|
6
|
+
previousEventHash
|
|
7
|
+
}) => {
|
|
8
|
+
const transaction = {
|
|
9
|
+
id: generateId(),
|
|
10
|
+
type: 'accept-invitation',
|
|
11
|
+
previousEventHash
|
|
12
|
+
};
|
|
13
|
+
const encodedTransaction = stringToUint8Array(canonicalize(transaction));
|
|
14
|
+
const signatureResult = secp256k1.sign(encodedTransaction, hexToBytes(author.signaturePrivateKey), {
|
|
15
|
+
prehash: true
|
|
16
|
+
});
|
|
17
|
+
return Effect.succeed({
|
|
18
|
+
transaction,
|
|
19
|
+
author: {
|
|
20
|
+
accountAddress: author.accountAddress,
|
|
21
|
+
signature: {
|
|
22
|
+
hex: signatureResult.toCompactHex(),
|
|
23
|
+
recovery: signatureResult.recovery
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=accept-invitation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"accept-invitation.js","names":["secp256k1","Effect","canonicalize","generateId","hexToBytes","stringToUint8Array","acceptInvitation","author","previousEventHash","transaction","id","type","encodedTransaction","signatureResult","sign","signaturePrivateKey","prehash","succeed","accountAddress","signature","hex","toCompactHex","recovery"],"sources":["../../src/space-events/accept-invitation.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,SAAS,QAAQ,yBAAyB;AACnD,SAASC,MAAM,QAAQ,QAAQ;AAE/B,SAASC,YAAY,EAAEC,UAAU,EAAEC,UAAU,EAAEC,kBAAkB,QAAQ,mBAAmB;AAQ5F,OAAO,MAAMC,gBAAgB,GAAGA,CAAC;EAC/BC,MAAM;EACNC;AAAiB,CACV,KAAqD;EAC5D,MAAMC,WAAW,GAAG;IAClBC,EAAE,EAAEP,UAAU,EAAE;IAChBQ,IAAI,EAAE,mBAA4B;IAClCH;GACD;EACD,MAAMI,kBAAkB,GAAGP,kBAAkB,CAACH,YAAY,CAACO,WAAW,CAAC,CAAC;EACxE,MAAMI,eAAe,GAAGb,SAAS,CAACc,IAAI,CAACF,kBAAkB,EAAER,UAAU,CAACG,MAAM,CAACQ,mBAAmB,CAAC,EAAE;IACjGC,OAAO,EAAE;GACV,CAAC;EAEF,OAAOf,MAAM,CAACgB,OAAO,CAAC;IACpBR,WAAW;IACXF,MAAM,EAAE;MACNW,cAAc,EAAEX,MAAM,CAACW,cAAc;MACrCC,SAAS,EAAE;QACTC,GAAG,EAAEP,eAAe,CAACQ,YAAY,EAAE;QACnCC,QAAQ,EAAET,eAAe,CAACS;;;GAG/B,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { InvalidIdentityError, PublicIdentity } from '../identity/types.js';
|
|
3
|
+
import { type ApplyError, SpaceEvent, type SpaceState } from './types.js';
|
|
4
|
+
type Params = {
|
|
5
|
+
state: SpaceState | undefined;
|
|
6
|
+
event: SpaceEvent;
|
|
7
|
+
getVerifiedIdentity: (accountAddress: string) => Effect.Effect<PublicIdentity, InvalidIdentityError>;
|
|
8
|
+
};
|
|
9
|
+
export declare const applyEvent: ({ state, event: rawEvent, getVerifiedIdentity, }: Params) => Effect.Effect<SpaceState, ApplyError>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=apply-event.d.ts.map
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { secp256k1 } from '@noble/curves/secp256k1';
|
|
2
|
+
import { sha256 } from '@noble/hashes/sha256';
|
|
3
|
+
import { Effect, Schema } from 'effect';
|
|
4
|
+
import { canonicalize, stringToUint8Array } from '../utils/index.js';
|
|
5
|
+
import { hashEvent } from './hash-event.js';
|
|
6
|
+
import { InvalidEventError, SpaceEvent, VerifySignatureError } from './types.js';
|
|
7
|
+
const decodeSpaceEvent = /*#__PURE__*/Schema.decodeUnknownEither(SpaceEvent);
|
|
8
|
+
export const applyEvent = ({
|
|
9
|
+
state,
|
|
10
|
+
event: rawEvent,
|
|
11
|
+
getVerifiedIdentity
|
|
12
|
+
}) => {
|
|
13
|
+
const decodedEvent = decodeSpaceEvent(rawEvent);
|
|
14
|
+
if (decodedEvent._tag === 'Left') {
|
|
15
|
+
return decodedEvent.left;
|
|
16
|
+
}
|
|
17
|
+
const event = decodedEvent.right;
|
|
18
|
+
if (event.transaction.type !== 'create-space') {
|
|
19
|
+
if (state === undefined) {
|
|
20
|
+
return Effect.fail(new InvalidEventError());
|
|
21
|
+
}
|
|
22
|
+
if (event.transaction.previousEventHash !== state.lastEventHash) {
|
|
23
|
+
return Effect.fail(new InvalidEventError());
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const encodedTransaction = stringToUint8Array(canonicalize(event.transaction));
|
|
27
|
+
let signatureInstance = secp256k1.Signature.fromCompact(event.author.signature.hex);
|
|
28
|
+
signatureInstance = signatureInstance.addRecoveryBit(event.author.signature.recovery);
|
|
29
|
+
const authorPublicKey = `0x${signatureInstance.recoverPublicKey(sha256(encodedTransaction)).toHex()}`;
|
|
30
|
+
return Effect.gen(function* () {
|
|
31
|
+
const identity = yield* getVerifiedIdentity(event.author.accountAddress);
|
|
32
|
+
if (authorPublicKey !== identity.signaturePublicKey) {
|
|
33
|
+
yield* Effect.fail(new VerifySignatureError());
|
|
34
|
+
}
|
|
35
|
+
let id = '';
|
|
36
|
+
let members = {};
|
|
37
|
+
let removedMembers = {};
|
|
38
|
+
let invitations = {};
|
|
39
|
+
let inboxes = {};
|
|
40
|
+
if (event.transaction.type === 'create-space') {
|
|
41
|
+
id = event.transaction.id;
|
|
42
|
+
members[event.transaction.creatorAccountAddress] = {
|
|
43
|
+
accountAddress: event.transaction.creatorAccountAddress,
|
|
44
|
+
role: 'admin'
|
|
45
|
+
};
|
|
46
|
+
} else if (state !== undefined) {
|
|
47
|
+
id = state.id;
|
|
48
|
+
members = {
|
|
49
|
+
...state.members
|
|
50
|
+
};
|
|
51
|
+
removedMembers = {
|
|
52
|
+
...state.removedMembers
|
|
53
|
+
};
|
|
54
|
+
invitations = {
|
|
55
|
+
...state.invitations
|
|
56
|
+
};
|
|
57
|
+
inboxes = {
|
|
58
|
+
...state.inboxes
|
|
59
|
+
};
|
|
60
|
+
if (event.transaction.type === 'accept-invitation') {
|
|
61
|
+
// is already a member
|
|
62
|
+
if (members[event.author.accountAddress] !== undefined) {
|
|
63
|
+
yield* Effect.fail(new InvalidEventError());
|
|
64
|
+
}
|
|
65
|
+
// find the invitation
|
|
66
|
+
const result = Object.entries(invitations).find(([, invitation]) => invitation.inviteeAccountAddress === event.author.accountAddress);
|
|
67
|
+
if (!result) {
|
|
68
|
+
yield* Effect.fail(new InvalidEventError());
|
|
69
|
+
}
|
|
70
|
+
// @ts-expect-error type issue? we checked that result is not undefined before
|
|
71
|
+
const [id, invitation] = result;
|
|
72
|
+
members[invitation.inviteeAccountAddress] = {
|
|
73
|
+
accountAddress: invitation.inviteeAccountAddress,
|
|
74
|
+
role: 'member'
|
|
75
|
+
};
|
|
76
|
+
delete invitations[id];
|
|
77
|
+
if (removedMembers[event.author.accountAddress] !== undefined) {
|
|
78
|
+
delete removedMembers[event.author.accountAddress];
|
|
79
|
+
}
|
|
80
|
+
} else {
|
|
81
|
+
// check if the author is an admin
|
|
82
|
+
if (members[event.author.accountAddress]?.role !== 'admin') {
|
|
83
|
+
yield* Effect.fail(new InvalidEventError());
|
|
84
|
+
}
|
|
85
|
+
if (event.transaction.type === 'delete-space') {
|
|
86
|
+
removedMembers = {
|
|
87
|
+
...members
|
|
88
|
+
};
|
|
89
|
+
members = {};
|
|
90
|
+
invitations = {};
|
|
91
|
+
} else if (event.transaction.type === 'create-invitation') {
|
|
92
|
+
if (members[event.transaction.inviteeAccountAddress] !== undefined) {
|
|
93
|
+
yield* Effect.fail(new InvalidEventError());
|
|
94
|
+
}
|
|
95
|
+
for (const invitation of Object.values(invitations)) {
|
|
96
|
+
if (invitation.inviteeAccountAddress === event.transaction.inviteeAccountAddress) {
|
|
97
|
+
yield* Effect.fail(new InvalidEventError());
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
invitations[event.transaction.id] = {
|
|
101
|
+
inviteeAccountAddress: event.transaction.inviteeAccountAddress
|
|
102
|
+
};
|
|
103
|
+
} else if (event.transaction.type === 'create-space-inbox') {
|
|
104
|
+
if (inboxes[event.transaction.inboxId] !== undefined) {
|
|
105
|
+
yield* Effect.fail(new InvalidEventError());
|
|
106
|
+
}
|
|
107
|
+
inboxes[event.transaction.inboxId] = {
|
|
108
|
+
inboxId: event.transaction.inboxId,
|
|
109
|
+
encryptionPublicKey: event.transaction.encryptionPublicKey,
|
|
110
|
+
isPublic: event.transaction.isPublic,
|
|
111
|
+
authPolicy: event.transaction.authPolicy,
|
|
112
|
+
secretKey: event.transaction.secretKey
|
|
113
|
+
};
|
|
114
|
+
} else {
|
|
115
|
+
// state is required for all events except create-space
|
|
116
|
+
yield* Effect.fail(new InvalidEventError());
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return {
|
|
121
|
+
id,
|
|
122
|
+
members,
|
|
123
|
+
removedMembers,
|
|
124
|
+
invitations,
|
|
125
|
+
inboxes,
|
|
126
|
+
lastEventHash: hashEvent(event)
|
|
127
|
+
};
|
|
128
|
+
});
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=apply-event.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply-event.js","names":["secp256k1","sha256","Effect","Schema","canonicalize","stringToUint8Array","hashEvent","InvalidEventError","SpaceEvent","VerifySignatureError","decodeSpaceEvent","decodeUnknownEither","applyEvent","state","event","rawEvent","getVerifiedIdentity","decodedEvent","_tag","left","right","transaction","type","undefined","fail","previousEventHash","lastEventHash","encodedTransaction","signatureInstance","Signature","fromCompact","author","signature","hex","addRecoveryBit","recovery","authorPublicKey","recoverPublicKey","toHex","gen","identity","accountAddress","signaturePublicKey","id","members","removedMembers","invitations","inboxes","creatorAccountAddress","role","result","Object","entries","find","invitation","inviteeAccountAddress","values","inboxId","encryptionPublicKey","isPublic","authPolicy","secretKey"],"sources":["../../src/space-events/apply-event.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,SAAS,QAAQ,yBAAyB;AACnD,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AAEvC,SAASC,YAAY,EAAEC,kBAAkB,QAAQ,mBAAmB;AACpE,SAASC,SAAS,QAAQ,iBAAiB;AAC3C,SAEEC,iBAAiB,EACjBC,UAAU,EAKVC,oBAAoB,QACf,YAAY;AAQnB,MAAMC,gBAAgB,gBAAGP,MAAM,CAACQ,mBAAmB,CAACH,UAAU,CAAC;AAE/D,OAAO,MAAMI,UAAU,GAAGA,CAAC;EACzBC,KAAK;EACLC,KAAK,EAAEC,QAAQ;EACfC;AAAmB,CACZ,KAA2C;EAClD,MAAMC,YAAY,GAAGP,gBAAgB,CAACK,QAAQ,CAAC;EAC/C,IAAIE,YAAY,CAACC,IAAI,KAAK,MAAM,EAAE;IAChC,OAAOD,YAAY,CAACE,IAAI;EAC1B;EACA,MAAML,KAAK,GAAGG,YAAY,CAACG,KAAK;EAEhC,IAAIN,KAAK,CAACO,WAAW,CAACC,IAAI,KAAK,cAAc,EAAE;IAC7C,IAAIT,KAAK,KAAKU,SAAS,EAAE;MACvB,OAAOrB,MAAM,CAACsB,IAAI,CAAC,IAAIjB,iBAAiB,EAAE,CAAC;IAC7C;IACA,IAAIO,KAAK,CAACO,WAAW,CAACI,iBAAi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O,WAAW,CAACoC,OAAO,CAAC,GAAG;YACnCA,OAAO,EAAE3C,KAAK,CAACO,WAAW,CAACoC,OAAO;YAClCC,mBAAmB,EAAE5C,KAAK,CAACO,WAAW,CAACqC,mBAAmB;YAC1DC,QAAQ,EAAE7C,KAAK,CAACO,WAAW,CAACsC,QAAQ;YACpCC,UAAU,EAAE9C,KAAK,CAACO,WAAW,CAACuC,UAAU;YACxCC,SAAS,EAAE/C,KAAK,CAACO,WAAW,CAACwC;WAC9B;QACH,CAAC,MAAM;UACL;UACA,OAAO3D,MAAM,CAACsB,IAAI,CAAC,IAAIjB,iBAAiB,EAAE,CAAC;QAC7C;MACF;IACF;IAEA,OAAO;MACLoC,EAAE;MACFC,OAAO;MACPC,cAAc;MACdC,WAAW;MACXC,OAAO;MACPrB,aAAa,EAAEpB,SAAS,CAACQ,KAAK;KAC/B;EACH,CAAC,CAAC;AACJ,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { InboxSenderAuthPolicy } from '../inboxes/types.js';
|
|
3
|
+
import type { Author, CreateSpaceInboxEvent } from './types.js';
|
|
4
|
+
export declare const createInbox: ({ author, spaceId, inboxId, encryptionPublicKey, secretKey, isPublic, authPolicy, previousEventHash, }: {
|
|
5
|
+
author: Author;
|
|
6
|
+
spaceId: string;
|
|
7
|
+
inboxId: string;
|
|
8
|
+
encryptionPublicKey: string;
|
|
9
|
+
previousEventHash: string;
|
|
10
|
+
secretKey: string;
|
|
11
|
+
isPublic: boolean;
|
|
12
|
+
authPolicy: InboxSenderAuthPolicy;
|
|
13
|
+
}) => Effect.Effect<CreateSpaceInboxEvent, undefined>;
|
|
14
|
+
//# sourceMappingURL=create-inbox.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { secp256k1 } from '@noble/curves/secp256k1';
|
|
2
|
+
import { Effect } from 'effect';
|
|
3
|
+
import { canonicalize, generateId, hexToBytes, stringToUint8Array } from '../utils/index.js';
|
|
4
|
+
export const createInbox = ({
|
|
5
|
+
author,
|
|
6
|
+
spaceId,
|
|
7
|
+
inboxId,
|
|
8
|
+
encryptionPublicKey,
|
|
9
|
+
secretKey,
|
|
10
|
+
isPublic,
|
|
11
|
+
authPolicy,
|
|
12
|
+
previousEventHash
|
|
13
|
+
}) => {
|
|
14
|
+
const transaction = {
|
|
15
|
+
type: 'create-space-inbox',
|
|
16
|
+
id: generateId(),
|
|
17
|
+
spaceId,
|
|
18
|
+
inboxId,
|
|
19
|
+
encryptionPublicKey,
|
|
20
|
+
secretKey,
|
|
21
|
+
isPublic,
|
|
22
|
+
authPolicy,
|
|
23
|
+
previousEventHash
|
|
24
|
+
};
|
|
25
|
+
const signature = secp256k1.sign(stringToUint8Array(canonicalize(transaction)), hexToBytes(author.signaturePrivateKey), {
|
|
26
|
+
prehash: true
|
|
27
|
+
});
|
|
28
|
+
// Create a SpaceEvent to create the inbox and sign it
|
|
29
|
+
const spaceEvent = {
|
|
30
|
+
transaction,
|
|
31
|
+
author: {
|
|
32
|
+
accountAddress: author.accountAddress,
|
|
33
|
+
signature: {
|
|
34
|
+
hex: signature.toCompactHex(),
|
|
35
|
+
recovery: signature.recovery
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
return Effect.succeed(spaceEvent);
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=create-inbox.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-inbox.js","names":["secp256k1","Effect","canonicalize","generateId","hexToBytes","stringToUint8Array","createInbox","author","spaceId","inboxId","encryptionPublicKey","secretKey","isPublic","authPolicy","previousEventHash","transaction","type","id","signature","sign","signaturePrivateKey","prehash","spaceEvent","accountAddress","hex","toCompactHex","recovery","succeed"],"sources":["../../src/space-events/create-inbox.ts"],"sourcesContent":[null],"mappings":"AAAA,SAASA,SAAS,QAAQ,yBAAyB;AACnD,SAASC,MAAM,QAAQ,QAAQ;AAE/B,SAASC,YAAY,EAAEC,UAAU,EAAEC,UAAU,EAAEC,kBAAkB,QAAQ,mBAAmB;AAG5F,OAAO,MAAMC,WAAW,GAAGA,CAAC;EAC1BC,MAAM;EACNC,OAAO;EACPC,OAAO;EACPC,mBAAmB;EACnBC,SAAS;EACTC,QAAQ;EACRC,UAAU;EACVC;AAAiB,CAUlB,KAAqD;EACpD,MAAMC,WAAW,GAAG;IAClBC,IAAI,EAAE,oBAA6B;IACnCC,EAAE,EAAEd,UAAU,EAAE;IAChBK,OAAO;IACPC,OAAO;IACPC,mBAAmB;IACnBC,SAAS;IACTC,QAAQ;IACRC,UAAU;IACVC;GACD;EACD,MAAMI,SAAS,GAAGlB,SAAS,CAACmB,IAAI,CAC9Bd,kBAAkB,CAACH,YAAY,CAACa,WAAW,CAAC,CAAC,EAC7CX,UAAU,CAACG,MAAM,CAACa,mBAAmB,CAAC,EACtC;IAAEC,OAAO,EAAE;EAAI,CAAE,CAClB;EAED;EACA,MAAMC,UAAU,GAAG;IACjBP,WAAW;IACXR,MAAM,EAAE;MACNgB,cAAc,EAAEhB,MAAM,CAACgB,cAAc;MACrCL,SAAS,EAAE;QACTM,GAAG,EAAEN,SAAS,CAACO,YAAY,EAAE;QAC7BC,QAAQ,EAAER,SAAS,CAACQ;;;GAGO;EAEjC,OAAOzB,MAAM,CAAC0B,OAAO,CAACL,UAAU,CAAC;AACnC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Effect } from 'effect';
|
|
2
|
+
import type { Author, CreateInvitationEvent } from './types.js';
|
|
3
|
+
type Params = {
|
|
4
|
+
author: Author;
|
|
5
|
+
previousEventHash: string;
|
|
6
|
+
invitee: {
|
|
7
|
+
accountAddress: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare const createInvitation: ({ author, previousEventHash, invitee, }: Params) => Effect.Effect<CreateInvitationEvent, undefined>;
|
|
11
|
+
export {};
|
|
12
|
+
//# sourceMappingURL=create-invitation.d.ts.map
|