keri 0.0.0-dev.8b0703e → 0.0.0-dev.bf75350

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 (67) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +3 -0
  3. package/dist/cli/main.d.ts +2 -0
  4. package/dist/cli/main.js +177 -0
  5. package/dist/cli/main.js.map +1 -0
  6. package/dist/client.d.ts +21 -0
  7. package/dist/client.js +72 -0
  8. package/dist/client.js.map +1 -0
  9. package/dist/controller.d.ts +65 -0
  10. package/dist/controller.js +475 -0
  11. package/dist/controller.js.map +1 -0
  12. package/dist/data-type.js +1 -0
  13. package/dist/data-type.js.map +1 -0
  14. package/dist/db/storage-sqlite.d.ts +12 -0
  15. package/dist/db/storage-sqlite.js +57 -0
  16. package/dist/db/storage-sqlite.js.map +1 -0
  17. package/dist/db/storage.d.ts +18 -0
  18. package/dist/db/storage.js +37 -0
  19. package/dist/db/storage.js.map +1 -0
  20. package/dist/events/event-store.d.ts +133 -0
  21. package/dist/events/event-store.js +215 -0
  22. package/dist/events/event-store.js.map +1 -0
  23. package/dist/events/events.d.ts +251 -0
  24. package/dist/events/events.js +184 -0
  25. package/dist/events/events.js.map +1 -0
  26. package/dist/keystore/encrypt.d.ts +10 -2
  27. package/dist/keystore/encrypt.js +26 -25
  28. package/dist/keystore/encrypt.js.map +1 -0
  29. package/dist/keystore/keystore.d.ts +16 -2
  30. package/dist/keystore/keystore.js +72 -1
  31. package/dist/keystore/keystore.js.map +1 -0
  32. package/dist/main.d.ts +6 -2
  33. package/dist/main.js +7 -2
  34. package/dist/main.js.map +1 -0
  35. package/package.json +27 -24
  36. package/dist/db/sqlite-db.d.ts +0 -14
  37. package/dist/db/sqlite-db.js +0 -90
  38. package/dist/events/common.d.ts +0 -6
  39. package/dist/events/common.js +0 -1
  40. package/dist/events/incept.d.ts +0 -26
  41. package/dist/events/incept.js +0 -28
  42. package/dist/events/interact.d.ts +0 -14
  43. package/dist/events/interact.js +0 -20
  44. package/dist/events/main.d.ts +0 -4
  45. package/dist/events/main.js +0 -4
  46. package/dist/events/reply.d.ts +0 -15
  47. package/dist/events/reply.js +0 -20
  48. package/dist/keri.d.ts +0 -1
  49. package/dist/keri.js +0 -110
  50. package/dist/keystore/keystore-fs.d.ts +0 -13
  51. package/dist/keystore/keystore-fs.js +0 -50
  52. package/dist/keystore/keystore-web.d.ts +0 -12
  53. package/dist/keystore/keystore-web.js +0 -48
  54. package/dist/main-common.d.ts +0 -7
  55. package/dist/main-common.js +0 -7
  56. package/dist/main-web.d.ts +0 -2
  57. package/dist/main-web.js +0 -2
  58. package/dist/parser/base64.d.ts +0 -6
  59. package/dist/parser/base64.js +0 -74
  60. package/dist/parser/cesr-encoding.d.ts +0 -34
  61. package/dist/parser/cesr-encoding.js +0 -158
  62. package/dist/parser/codes.d.ts +0 -143
  63. package/dist/parser/codes.js +0 -266
  64. package/dist/parser/parser.d.ts +0 -11
  65. package/dist/parser/parser.js +0 -150
  66. package/dist/parser/version.d.ts +0 -11
  67. package/dist/parser/version.js +0 -56
@@ -1,143 +0,0 @@
1
- export interface CodeSize {
2
- hs: number;
3
- ss: number;
4
- xs: number | null;
5
- fs: number | null;
6
- ls: number | null;
7
- }
8
- export declare const MatterCode: {
9
- Big: string;
10
- Blake2b_256: string;
11
- Blake2b_512: string;
12
- Blake2s_256: string;
13
- Blake3_256: string;
14
- Blake3_512: string;
15
- Blind: string;
16
- Bytes_Big_L0: string;
17
- Bytes_Big_L1: string;
18
- Bytes_Big_L2: string;
19
- Bytes_L0: string;
20
- Bytes_L1: string;
21
- Bytes_L2: string;
22
- DateTime: string;
23
- ECDSA_256k1: string;
24
- ECDSA_256k1N: string;
25
- ECDSA_256k1_Seed: string;
26
- ECDSA_256k1_Sig: string;
27
- ECDSA_256r1: string;
28
- ECDSA_256r1N: string;
29
- ECDSA_256r1_Seed: string;
30
- ECDSA_256r1_Sig: string;
31
- Ed25519: string;
32
- Ed25519N: string;
33
- Ed25519_Seed: string;
34
- Ed25519_Sig: string;
35
- Ed448: string;
36
- Ed448N: string;
37
- Ed448_Seed: string;
38
- Ed448_Sig: string;
39
- Great: string;
40
- Label1: string;
41
- Label2: string;
42
- Large: string;
43
- Long: string;
44
- No: string;
45
- Null: string;
46
- SHA2_256: string;
47
- SHA2_512: string;
48
- SHA3_256: string;
49
- SHA3_512: string;
50
- Salt_128: string;
51
- Short: string;
52
- StrB64_Big_L0: string;
53
- StrB64_Big_L1: string;
54
- StrB64_Big_L2: string;
55
- StrB64_L0: string;
56
- StrB64_L1: string;
57
- StrB64_L2: string;
58
- TBD0: string;
59
- TBD0S: string;
60
- TBD1: string;
61
- TBD1S: string;
62
- TBD2: string;
63
- TBD2S: string;
64
- Tag1: string;
65
- Tag10: string;
66
- Tag2: string;
67
- Tag3: string;
68
- Tag4: string;
69
- Tag5: string;
70
- Tag6: string;
71
- Tag7: string;
72
- Tag8: string;
73
- Tag9: string;
74
- Tall: string;
75
- Vast: string;
76
- X25519: string;
77
- X25519_Cipher_Big_L0: string;
78
- X25519_Cipher_Big_L1: string;
79
- X25519_Cipher_Big_L2: string;
80
- X25519_Cipher_L0: string;
81
- X25519_Cipher_L1: string;
82
- X25519_Cipher_L2: string;
83
- X25519_Cipher_QB2_Big_L0: string;
84
- X25519_Cipher_QB2_Big_L1: string;
85
- X25519_Cipher_QB2_Big_L2: string;
86
- X25519_Cipher_QB2_L0: string;
87
- X25519_Cipher_QB2_L1: string;
88
- X25519_Cipher_QB2_L2: string;
89
- X25519_Cipher_QB64_Big_L0: string;
90
- X25519_Cipher_QB64_Big_L1: string;
91
- X25519_Cipher_QB64_Big_L2: string;
92
- X25519_Cipher_QB64_L0: string;
93
- X25519_Cipher_QB64_L1: string;
94
- X25519_Cipher_QB64_L2: string;
95
- X25519_Cipher_Salt: string;
96
- X25519_Cipher_Seed: string;
97
- X25519_Private: string;
98
- X448: string;
99
- Yes: string;
100
- };
101
- export declare const MatterCodeTable: Record<string, CodeSize>;
102
- export declare const IndexerCode: {
103
- ECDSA_256k1_Big_Crt_Sig: string;
104
- ECDSA_256k1_Big_Sig: string;
105
- ECDSA_256k1_Crt_Sig: string;
106
- ECDSA_256k1_Sig: string;
107
- ECDSA_256r1_Big_Crt_Sig: string;
108
- ECDSA_256r1_Big_Sig: string;
109
- ECDSA_256r1_Crt_Sig: string;
110
- ECDSA_256r1_Sig: string;
111
- Ed25519_Big_Crt_Sig: string;
112
- Ed25519_Big_Sig: string;
113
- Ed25519_Crt_Sig: string;
114
- Ed25519_Sig: string;
115
- Ed448_Big_Crt_Sig: string;
116
- Ed448_Big_Sig: string;
117
- Ed448_Crt_Sig: string;
118
- Ed448_Sig: string;
119
- TBD0: string;
120
- TBD1: string;
121
- TBD4: string;
122
- };
123
- export declare const IndexerCodeTable: Record<string, CodeSize>;
124
- export declare const CounterCode: {
125
- AttachmentGroup: string;
126
- BigAttachmentGroup: string;
127
- BigPathedMaterialGroup: string;
128
- ControllerIdxSigs: string;
129
- ESSRPayloadGroup: string;
130
- FirstSeenReplayCouples: string;
131
- KERIACDCGenusVersion: string;
132
- NonTransReceiptCouples: string;
133
- PathedMaterialGroup: string;
134
- RootSadPathSigGroups: string;
135
- SadPathSigGroups: string;
136
- SealSourceCouples: string;
137
- SealSourceTriples: string;
138
- TransIdxSigGroups: string;
139
- TransLastIdxSigGroups: string;
140
- TransReceiptQuadruples: string;
141
- WitnessIdxSigs: string;
142
- };
143
- export declare const CounterCodeTable: Record<string, CodeSize>;
@@ -1,266 +0,0 @@
1
- export const MatterCode = {
2
- Big: "N",
3
- Blake2b_256: "F",
4
- Blake2b_512: "0E",
5
- Blake2s_256: "G",
6
- Blake3_256: "E",
7
- Blake3_512: "0D",
8
- Blind: "Z",
9
- Bytes_Big_L0: "7AAB",
10
- Bytes_Big_L1: "8AAB",
11
- Bytes_Big_L2: "9AAB",
12
- Bytes_L0: "4B",
13
- Bytes_L1: "5B",
14
- Bytes_L2: "6B",
15
- DateTime: "1AAG",
16
- ECDSA_256k1: "1AAB",
17
- ECDSA_256k1N: "1AAA",
18
- ECDSA_256k1_Seed: "J",
19
- ECDSA_256k1_Sig: "0C",
20
- ECDSA_256r1: "1AAJ",
21
- ECDSA_256r1N: "1AAI",
22
- ECDSA_256r1_Seed: "Q",
23
- ECDSA_256r1_Sig: "0I",
24
- Ed25519: "D",
25
- Ed25519N: "B",
26
- Ed25519_Seed: "A",
27
- Ed25519_Sig: "0B",
28
- Ed448: "1AAD",
29
- Ed448N: "1AAC",
30
- Ed448_Seed: "K",
31
- Ed448_Sig: "1AAE",
32
- Great: "T",
33
- Label1: "V",
34
- Label2: "W",
35
- Large: "S",
36
- Long: "0H",
37
- No: "1AAL",
38
- Null: "1AAK",
39
- SHA2_256: "I",
40
- SHA2_512: "0G",
41
- SHA3_256: "H",
42
- SHA3_512: "0F",
43
- Salt_128: "0A",
44
- Short: "M",
45
- StrB64_Big_L0: "7AAA",
46
- StrB64_Big_L1: "8AAA",
47
- StrB64_Big_L2: "9AAA",
48
- StrB64_L0: "4A",
49
- StrB64_L1: "5A",
50
- StrB64_L2: "6A",
51
- TBD0: "1___",
52
- TBD0S: "1__-",
53
- TBD1: "2___",
54
- TBD1S: "2__-",
55
- TBD2: "3___",
56
- TBD2S: "3__-",
57
- Tag1: "0J",
58
- Tag10: "0O",
59
- Tag2: "0K",
60
- Tag3: "X",
61
- Tag4: "1AAF",
62
- Tag5: "0L",
63
- Tag6: "0M",
64
- Tag7: "Y",
65
- Tag8: "1AAN",
66
- Tag9: "0N",
67
- Tall: "R",
68
- Vast: "U",
69
- X25519: "C",
70
- X25519_Cipher_Big_L0: "7AAC",
71
- X25519_Cipher_Big_L1: "8AAC",
72
- X25519_Cipher_Big_L2: "9AAC",
73
- X25519_Cipher_L0: "4C",
74
- X25519_Cipher_L1: "5C",
75
- X25519_Cipher_L2: "6C",
76
- X25519_Cipher_QB2_Big_L0: "7AAE",
77
- X25519_Cipher_QB2_Big_L1: "8AAE",
78
- X25519_Cipher_QB2_Big_L2: "9AAE",
79
- X25519_Cipher_QB2_L0: "4E",
80
- X25519_Cipher_QB2_L1: "5E",
81
- X25519_Cipher_QB2_L2: "6E",
82
- X25519_Cipher_QB64_Big_L0: "7AAD",
83
- X25519_Cipher_QB64_Big_L1: "8AAD",
84
- X25519_Cipher_QB64_Big_L2: "9AAD",
85
- X25519_Cipher_QB64_L0: "4D",
86
- X25519_Cipher_QB64_L1: "5D",
87
- X25519_Cipher_QB64_L2: "6D",
88
- X25519_Cipher_Salt: "1AAH",
89
- X25519_Cipher_Seed: "P",
90
- X25519_Private: "O",
91
- X448: "L",
92
- Yes: "1AAM",
93
- };
94
- export const MatterCodeTable = {
95
- ["N"]: { hs: 1, ss: 0, xs: 0, fs: 12, ls: 0 },
96
- ["F"]: { hs: 1, ss: 0, xs: 0, fs: 44, ls: 0 },
97
- ["0E"]: { hs: 2, ss: 0, xs: 0, fs: 88, ls: 0 },
98
- ["G"]: { hs: 1, ss: 0, xs: 0, fs: 44, ls: 0 },
99
- ["E"]: { hs: 1, ss: 0, xs: 0, fs: 44, ls: 0 },
100
- ["0D"]: { hs: 2, ss: 0, xs: 0, fs: 88, ls: 0 },
101
- ["Z"]: { hs: 1, ss: 0, xs: 0, fs: 44, ls: 0 },
102
- ["7AAB"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 0 },
103
- ["8AAB"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 1 },
104
- ["9AAB"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 2 },
105
- ["4B"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 0 },
106
- ["5B"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 1 },
107
- ["6B"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 2 },
108
- ["1AAG"]: { hs: 4, ss: 0, xs: 0, fs: 36, ls: 0 },
109
- ["1AAB"]: { hs: 4, ss: 0, xs: 0, fs: 48, ls: 0 },
110
- ["1AAA"]: { hs: 4, ss: 0, xs: 0, fs: 48, ls: 0 },
111
- ["J"]: { hs: 1, ss: 0, xs: 0, fs: 44, ls: 0 },
112
- ["0C"]: { hs: 2, ss: 0, xs: 0, fs: 88, ls: 0 },
113
- ["1AAJ"]: { hs: 4, ss: 0, xs: 0, fs: 48, ls: 0 },
114
- ["1AAI"]: { hs: 4, ss: 0, xs: 0, fs: 48, ls: 0 },
115
- ["Q"]: { hs: 1, ss: 0, xs: 0, fs: 44, ls: 0 },
116
- ["0I"]: { hs: 2, ss: 0, xs: 0, fs: 88, ls: 0 },
117
- ["D"]: { hs: 1, ss: 0, xs: 0, fs: 44, ls: 0 },
118
- ["B"]: { hs: 1, ss: 0, xs: 0, fs: 44, ls: 0 },
119
- ["A"]: { hs: 1, ss: 0, xs: 0, fs: 44, ls: 0 },
120
- ["0B"]: { hs: 2, ss: 0, xs: 0, fs: 88, ls: 0 },
121
- ["1AAD"]: { hs: 4, ss: 0, xs: 0, fs: 80, ls: 0 },
122
- ["1AAC"]: { hs: 4, ss: 0, xs: 0, fs: 80, ls: 0 },
123
- ["K"]: { hs: 1, ss: 0, xs: 0, fs: 76, ls: 0 },
124
- ["1AAE"]: { hs: 4, ss: 0, xs: 0, fs: 56, ls: 0 },
125
- ["T"]: { hs: 1, ss: 0, xs: 0, fs: 20, ls: 0 },
126
- ["V"]: { hs: 1, ss: 0, xs: 0, fs: 4, ls: 1 },
127
- ["W"]: { hs: 1, ss: 0, xs: 0, fs: 4, ls: 0 },
128
- ["S"]: { hs: 1, ss: 0, xs: 0, fs: 16, ls: 0 },
129
- ["0H"]: { hs: 2, ss: 0, xs: 0, fs: 8, ls: 0 },
130
- ["1AAL"]: { hs: 4, ss: 0, xs: 0, fs: 4, ls: 0 },
131
- ["1AAK"]: { hs: 4, ss: 0, xs: 0, fs: 4, ls: 0 },
132
- ["I"]: { hs: 1, ss: 0, xs: 0, fs: 44, ls: 0 },
133
- ["0G"]: { hs: 2, ss: 0, xs: 0, fs: 88, ls: 0 },
134
- ["H"]: { hs: 1, ss: 0, xs: 0, fs: 44, ls: 0 },
135
- ["0F"]: { hs: 2, ss: 0, xs: 0, fs: 88, ls: 0 },
136
- ["0A"]: { hs: 2, ss: 0, xs: 0, fs: 24, ls: 0 },
137
- ["M"]: { hs: 1, ss: 0, xs: 0, fs: 4, ls: 0 },
138
- ["7AAA"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 0 },
139
- ["8AAA"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 1 },
140
- ["9AAA"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 2 },
141
- ["4A"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 0 },
142
- ["5A"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 1 },
143
- ["6A"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 2 },
144
- ["1___"]: { hs: 4, ss: 0, xs: 0, fs: 8, ls: 0 },
145
- ["1__-"]: { hs: 4, ss: 2, xs: 0, fs: 12, ls: 0 },
146
- ["2___"]: { hs: 4, ss: 0, xs: 0, fs: 8, ls: 1 },
147
- ["2__-"]: { hs: 4, ss: 2, xs: 1, fs: 12, ls: 1 },
148
- ["3___"]: { hs: 4, ss: 0, xs: 0, fs: 8, ls: 2 },
149
- ["3__-"]: { hs: 4, ss: 2, xs: 0, fs: 12, ls: 2 },
150
- ["0J"]: { hs: 2, ss: 2, xs: 1, fs: 4, ls: 0 },
151
- ["0O"]: { hs: 2, ss: 10, xs: 0, fs: 12, ls: 0 },
152
- ["0K"]: { hs: 2, ss: 2, xs: 0, fs: 4, ls: 0 },
153
- ["X"]: { hs: 1, ss: 3, xs: 0, fs: 4, ls: 0 },
154
- ["1AAF"]: { hs: 4, ss: 4, xs: 0, fs: 8, ls: 0 },
155
- ["0L"]: { hs: 2, ss: 6, xs: 1, fs: 8, ls: 0 },
156
- ["0M"]: { hs: 2, ss: 6, xs: 0, fs: 8, ls: 0 },
157
- ["Y"]: { hs: 1, ss: 7, xs: 0, fs: 8, ls: 0 },
158
- ["1AAN"]: { hs: 4, ss: 8, xs: 0, fs: 12, ls: 0 },
159
- ["0N"]: { hs: 2, ss: 10, xs: 1, fs: 12, ls: 0 },
160
- ["R"]: { hs: 1, ss: 0, xs: 0, fs: 8, ls: 0 },
161
- ["U"]: { hs: 1, ss: 0, xs: 0, fs: 24, ls: 0 },
162
- ["C"]: { hs: 1, ss: 0, xs: 0, fs: 44, ls: 0 },
163
- ["7AAC"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 0 },
164
- ["8AAC"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 1 },
165
- ["9AAC"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 2 },
166
- ["4C"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 0 },
167
- ["5C"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 1 },
168
- ["6C"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 2 },
169
- ["7AAE"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 0 },
170
- ["8AAE"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 1 },
171
- ["9AAE"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 2 },
172
- ["4E"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 0 },
173
- ["5E"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 1 },
174
- ["6E"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 2 },
175
- ["7AAD"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 0 },
176
- ["8AAD"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 1 },
177
- ["9AAD"]: { hs: 4, ss: 4, xs: 0, fs: null, ls: 2 },
178
- ["4D"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 0 },
179
- ["5D"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 1 },
180
- ["6D"]: { hs: 2, ss: 2, xs: 0, fs: null, ls: 2 },
181
- ["1AAH"]: { hs: 4, ss: 0, xs: 0, fs: 100, ls: 0 },
182
- ["P"]: { hs: 1, ss: 0, xs: 0, fs: 124, ls: 0 },
183
- ["O"]: { hs: 1, ss: 0, xs: 0, fs: 44, ls: 0 },
184
- ["L"]: { hs: 1, ss: 0, xs: 0, fs: 76, ls: 0 },
185
- ["1AAM"]: { hs: 4, ss: 0, xs: 0, fs: 4, ls: 0 },
186
- };
187
- export const IndexerCode = {
188
- ECDSA_256k1_Big_Crt_Sig: "2D",
189
- ECDSA_256k1_Big_Sig: "2C",
190
- ECDSA_256k1_Crt_Sig: "D",
191
- ECDSA_256k1_Sig: "C",
192
- ECDSA_256r1_Big_Crt_Sig: "2F",
193
- ECDSA_256r1_Big_Sig: "2E",
194
- ECDSA_256r1_Crt_Sig: "F",
195
- ECDSA_256r1_Sig: "E",
196
- Ed25519_Big_Crt_Sig: "2B",
197
- Ed25519_Big_Sig: "2A",
198
- Ed25519_Crt_Sig: "B",
199
- Ed25519_Sig: "A",
200
- Ed448_Big_Crt_Sig: "3B",
201
- Ed448_Big_Sig: "3A",
202
- Ed448_Crt_Sig: "0B",
203
- Ed448_Sig: "0A",
204
- TBD0: "0z",
205
- TBD1: "1z",
206
- TBD4: "4z",
207
- };
208
- export const IndexerCodeTable = {
209
- ["2D"]: { hs: 2, ss: 4, xs: null, fs: 92, ls: 0 },
210
- ["2C"]: { hs: 2, ss: 4, xs: null, fs: 92, ls: 0 },
211
- ["D"]: { hs: 1, ss: 1, xs: null, fs: 88, ls: 0 },
212
- ["C"]: { hs: 1, ss: 1, xs: null, fs: 88, ls: 0 },
213
- ["2F"]: { hs: 2, ss: 4, xs: null, fs: 92, ls: 0 },
214
- ["2E"]: { hs: 2, ss: 4, xs: null, fs: 92, ls: 0 },
215
- ["F"]: { hs: 1, ss: 1, xs: null, fs: 88, ls: 0 },
216
- ["E"]: { hs: 1, ss: 1, xs: null, fs: 88, ls: 0 },
217
- ["2B"]: { hs: 2, ss: 4, xs: null, fs: 92, ls: 0 },
218
- ["2A"]: { hs: 2, ss: 4, xs: null, fs: 92, ls: 0 },
219
- ["B"]: { hs: 1, ss: 1, xs: null, fs: 88, ls: 0 },
220
- ["A"]: { hs: 1, ss: 1, xs: null, fs: 88, ls: 0 },
221
- ["3B"]: { hs: 2, ss: 6, xs: null, fs: 160, ls: 0 },
222
- ["3A"]: { hs: 2, ss: 6, xs: null, fs: 160, ls: 0 },
223
- ["0B"]: { hs: 2, ss: 2, xs: null, fs: 156, ls: 0 },
224
- ["0A"]: { hs: 2, ss: 2, xs: null, fs: 156, ls: 0 },
225
- ["0z"]: { hs: 2, ss: 2, xs: null, fs: null, ls: 0 },
226
- ["1z"]: { hs: 2, ss: 2, xs: null, fs: 76, ls: 1 },
227
- ["4z"]: { hs: 2, ss: 6, xs: null, fs: 80, ls: 1 },
228
- };
229
- export const CounterCode = {
230
- AttachmentGroup: "-V",
231
- BigAttachmentGroup: "-0V",
232
- BigPathedMaterialGroup: "-0L",
233
- ControllerIdxSigs: "-A",
234
- ESSRPayloadGroup: "-Z",
235
- FirstSeenReplayCouples: "-E",
236
- KERIACDCGenusVersion: "--AAA",
237
- NonTransReceiptCouples: "-C",
238
- PathedMaterialGroup: "-L",
239
- RootSadPathSigGroups: "-K",
240
- SadPathSigGroups: "-J",
241
- SealSourceCouples: "-G",
242
- SealSourceTriples: "-I",
243
- TransIdxSigGroups: "-F",
244
- TransLastIdxSigGroups: "-H",
245
- TransReceiptQuadruples: "-D",
246
- WitnessIdxSigs: "-B",
247
- };
248
- export const CounterCodeTable = {
249
- ["-V"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
250
- ["-0V"]: { hs: 3, ss: 5, xs: null, fs: 8, ls: null },
251
- ["-0L"]: { hs: 3, ss: 5, xs: null, fs: 8, ls: null },
252
- ["-A"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
253
- ["-Z"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
254
- ["-E"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
255
- ["--AAA"]: { hs: 5, ss: 3, xs: null, fs: 8, ls: null },
256
- ["-C"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
257
- ["-L"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
258
- ["-K"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
259
- ["-J"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
260
- ["-G"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
261
- ["-I"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
262
- ["-F"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
263
- ["-H"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
264
- ["-D"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
265
- ["-B"]: { hs: 2, ss: 2, xs: null, fs: 4, ls: null },
266
- };
@@ -1,11 +0,0 @@
1
- import type { KeyEvent } from "../events/main.ts";
2
- export declare class Parser {
3
- #private;
4
- parse(data: Uint8Array): string[];
5
- }
6
- export declare function parse(data: Uint8Array): string[];
7
- export declare function parseStream(stream: ReadableStream<Uint8Array>): AsyncIterableIterator<Message>;
8
- export interface Message {
9
- payload: KeyEvent;
10
- attachments: string[];
11
- }
@@ -1,150 +0,0 @@
1
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
2
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
3
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
4
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
5
- };
6
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
7
- if (kind === "m") throw new TypeError("Private method is not writable");
8
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
9
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
10
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
11
- };
12
- var _Parser_instances, _Parser_buffer, _Parser_decoder, _Parser_index, _Parser_countContext, _Parser_finished, _Parser_peekBytes, _Parser_readBytes, _Parser_readCharacters, _Parser_readOne;
13
- import { parseVersion } from "./version.js";
14
- import { decodeBase64Int } from "./base64.js";
15
- import { CounterCode, CounterCodeTable, IndexerCodeTable, MatterCodeTable } from "./codes.js";
16
- export class Parser {
17
- constructor() {
18
- _Parser_instances.add(this);
19
- _Parser_buffer.set(this, new Uint8Array(0));
20
- _Parser_decoder.set(this, new TextDecoder());
21
- _Parser_index.set(this, 0);
22
- _Parser_countContext.set(this, void 0);
23
- }
24
- parse(data) {
25
- __classPrivateFieldSet(this, _Parser_buffer, data, "f");
26
- const result = [];
27
- while (!__classPrivateFieldGet(this, _Parser_instances, "m", _Parser_finished).call(this)) {
28
- // TODO: Quick hack to skip newlines between content
29
- while (!__classPrivateFieldGet(this, _Parser_instances, "m", _Parser_finished).call(this) && __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_peekBytes).call(this, 1)[0] === 0x0a) {
30
- __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_readBytes).call(this, 1);
31
- }
32
- if (!__classPrivateFieldGet(this, _Parser_instances, "m", _Parser_finished).call(this)) {
33
- const next = __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_readOne).call(this);
34
- result.push(next);
35
- }
36
- }
37
- return result;
38
- }
39
- }
40
- _Parser_buffer = new WeakMap(), _Parser_decoder = new WeakMap(), _Parser_index = new WeakMap(), _Parser_countContext = new WeakMap(), _Parser_instances = new WeakSet(), _Parser_finished = function _Parser_finished() {
41
- return __classPrivateFieldGet(this, _Parser_index, "f") >= __classPrivateFieldGet(this, _Parser_buffer, "f").length;
42
- }, _Parser_peekBytes = function _Parser_peekBytes(size) {
43
- if (typeof size !== "number") {
44
- throw new Error(`Size must be a number, got '${size}'`);
45
- }
46
- return __classPrivateFieldGet(this, _Parser_buffer, "f").slice(__classPrivateFieldGet(this, _Parser_index, "f"), __classPrivateFieldGet(this, _Parser_index, "f") + size);
47
- }, _Parser_readBytes = function _Parser_readBytes(size) {
48
- if (typeof size !== "number") {
49
- throw new Error(`Size must be a number, got '${size}'`);
50
- }
51
- const chunk = __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_peekBytes).call(this, size);
52
- __classPrivateFieldSet(this, _Parser_index, __classPrivateFieldGet(this, _Parser_index, "f") + size, "f");
53
- return chunk;
54
- }, _Parser_readCharacters = function _Parser_readCharacters(count) {
55
- const chunk = __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_readBytes).call(this, count);
56
- return __classPrivateFieldGet(this, _Parser_decoder, "f").decode(chunk);
57
- }, _Parser_readOne = function _Parser_readOne() {
58
- let code = "";
59
- while (!__classPrivateFieldGet(this, _Parser_instances, "m", _Parser_finished).call(this) && code.length < 4) {
60
- code = __classPrivateFieldGet(this, _Parser_decoder, "f").decode(__classPrivateFieldGet(this, _Parser_instances, "m", _Parser_peekBytes).call(this, code.length + 1));
61
- if (code === "{") {
62
- const version = parseVersion(__classPrivateFieldGet(this, _Parser_instances, "m", _Parser_peekBytes).call(this, 23));
63
- return __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_readCharacters).call(this, version.size);
64
- }
65
- if (code.startsWith("-") && code in CounterCodeTable) {
66
- const size = CounterCodeTable[code];
67
- if (size && size.fs !== null) {
68
- const qb64 = __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_readCharacters).call(this, size.fs);
69
- const count = decodeBase64Int(qb64.slice(size.hs));
70
- if (code === CounterCode.AttachmentGroup || code === CounterCode.BigAttachmentGroup) {
71
- // Attachment group, currently no need to keep track of the count
72
- }
73
- else {
74
- // Stores the counter and expected count so we know what to expect next
75
- __classPrivateFieldSet(this, _Parser_countContext, {
76
- code,
77
- count,
78
- }, "f");
79
- }
80
- return qb64;
81
- }
82
- else if (!size || size.fs === null) {
83
- throw new Error(`Variable length currently not supported code=${code}`);
84
- }
85
- }
86
- else if (__classPrivateFieldGet(this, _Parser_countContext, "f") &&
87
- __classPrivateFieldGet(this, _Parser_countContext, "f").count > 0 &&
88
- [
89
- CounterCode.ControllerIdxSigs,
90
- CounterCode.WitnessIdxSigs,
91
- CounterCode.TransIdxSigGroups,
92
- CounterCode.TransLastIdxSigGroups,
93
- ].includes(__classPrivateFieldGet(this, _Parser_countContext, "f").code)) {
94
- let code = "";
95
- while (!__classPrivateFieldGet(this, _Parser_instances, "m", _Parser_finished).call(this) && code.length < 2) {
96
- code = __classPrivateFieldGet(this, _Parser_decoder, "f").decode(__classPrivateFieldGet(this, _Parser_instances, "m", _Parser_peekBytes).call(this, code.length + 1));
97
- const size = IndexerCodeTable[code];
98
- if (size && size.fs) {
99
- __classPrivateFieldGet(this, _Parser_countContext, "f").count--;
100
- return __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_readCharacters).call(this, size.fs);
101
- }
102
- else if (size) {
103
- throw new Error(`Variable length currently not supported code=${code}`);
104
- }
105
- }
106
- throw new Error(`Expected indexer code, got ${code}`);
107
- }
108
- else if (code in MatterCodeTable) {
109
- const size = MatterCodeTable[code];
110
- if (size && size.fs) {
111
- return __classPrivateFieldGet(this, _Parser_instances, "m", _Parser_readCharacters).call(this, size.fs);
112
- }
113
- else if (size) {
114
- throw new Error(`Variable length currently not supported code=${code}`);
115
- }
116
- }
117
- }
118
- throw new Error(`Unknown code in ${code}`);
119
- };
120
- export function parse(data) {
121
- const parser = new Parser();
122
- return parser.parse(data);
123
- }
124
- export async function* parseStream(stream) {
125
- const decoder = new Parser();
126
- let payload = null;
127
- let attachments = [];
128
- function reset() {
129
- const result = { payload, attachments };
130
- payload = null;
131
- attachments = [];
132
- return result;
133
- }
134
- for await (const chunk of stream) {
135
- for (const frame of decoder.parse(chunk)) {
136
- if (frame.startsWith("{")) {
137
- if (payload) {
138
- yield reset();
139
- }
140
- payload = JSON.parse(frame);
141
- }
142
- else {
143
- attachments.push(frame);
144
- }
145
- }
146
- }
147
- if (payload) {
148
- yield reset();
149
- }
150
- }
@@ -1,11 +0,0 @@
1
- import { type DataObject } from "../data-type.ts";
2
- export interface Version {
3
- protocol: string;
4
- format: string;
5
- version: string;
6
- size: number;
7
- }
8
- export declare function parseVersion(data: Uint8Array | string): Version;
9
- export declare function versify<T extends DataObject>(data: T): T & {
10
- v: string;
11
- };
@@ -1,56 +0,0 @@
1
- import { decodeBase64Int } from "./base64.js";
2
- // PPPPvvKKKKllllll_
3
- const LEGACY_MATCH = /^[A-Z]{4}[0-9]{2}[A-Z]{4}.*$/;
4
- // PPPPVVVKKKKBBBB.
5
- const MATCH = /^[A-Z]{4}[0-9]{3}[A-Z]{4}.*$/;
6
- export function parseVersion(data) {
7
- if (typeof data !== "string") {
8
- return parseVersion(new TextDecoder().decode(data.slice(6, 23)));
9
- }
10
- const value = data;
11
- if (LEGACY_MATCH.test(value)) {
12
- const protocol = value.slice(0, 4);
13
- const version = value.slice(4, 6);
14
- const format = value.slice(6, 10);
15
- const size = parseInt(value.slice(10, 16), 16);
16
- return {
17
- protocol,
18
- version,
19
- format,
20
- size,
21
- };
22
- }
23
- else if (MATCH.test(value)) {
24
- const protocol = value.slice(0, 4);
25
- const version = value.slice(4, 7);
26
- const format = value.slice(7, 11);
27
- const size = decodeBase64Int(value.slice(12, 15));
28
- return {
29
- protocol,
30
- version,
31
- format,
32
- size,
33
- };
34
- }
35
- throw new Error(`Unexpected version string ${value}`);
36
- }
37
- function formatSize(size) {
38
- return size.toString(16).padStart(6, "0");
39
- }
40
- function formatVersion(label, size) {
41
- return `${label}JSON${formatSize(size)}_`;
42
- }
43
- // const DUMMY_VERSION = "PPPPVVVKKKKBBBB.";
44
- // const DUMMY_LEGACY_VERSION = "PPPPvvKKKKllllll_";
45
- export function versify(data) {
46
- const encoder = new TextEncoder();
47
- const str = encoder.encode(JSON.stringify({
48
- v: formatVersion("KERI10", 0),
49
- ...data,
50
- }));
51
- const version = formatVersion("KERI10", str.byteLength);
52
- return {
53
- v: version,
54
- ...data,
55
- };
56
- }