blind-peer 0.0.3 → 2.7.4

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.
@@ -1,234 +0,0 @@
1
- // This file is autogenerated by the hyperschema compiler
2
- // Schema Version: 1
3
- /* eslint-disable camelcase */
4
- /* eslint-disable quotes */
5
-
6
- const VERSION = 1
7
- const { c } = require('hyperschema/runtime')
8
-
9
- // eslint-disable-next-line no-unused-vars
10
- let version = VERSION
11
-
12
- // @blind-peer/request-mailbox
13
- const encoding0 = {
14
- preencode (state, m) {
15
- let flags = 0
16
- if (m.blockEncryptionKey) flags |= 1
17
-
18
- c.fixed32.preencode(state, m.autobase)
19
- c.uint.preencode(state, flags)
20
-
21
- if (m.blockEncryptionKey) c.fixed32.preencode(state, m.blockEncryptionKey)
22
- },
23
- encode (state, m) {
24
- let flags = 0
25
- if (m.blockEncryptionKey) flags |= 1
26
-
27
- c.fixed32.encode(state, m.autobase)
28
- c.uint.encode(state, flags)
29
-
30
- if (m.blockEncryptionKey) c.fixed32.encode(state, m.blockEncryptionKey)
31
- },
32
- decode (state) {
33
- const res = {}
34
- res.autobase = null
35
- res.blockEncryptionKey = null
36
-
37
- res.autobase = c.fixed32.decode(state)
38
-
39
- const flags = state.start < state.end ? c.uint.decode(state) : 0
40
- if ((flags & 1) !== 0) res.blockEncryptionKey = c.fixed32.decode(state)
41
-
42
- return res
43
- }
44
- }
45
-
46
- // @blind-peer/response-mailbox
47
- const encoding1 = {
48
- preencode (state, m) {
49
- let flags = 0
50
- if (m.open) flags |= 1
51
-
52
- c.fixed32.preencode(state, m.autobase)
53
- c.fixed32.preencode(state, m.writer)
54
- c.uint.preencode(state, flags)
55
- },
56
- encode (state, m) {
57
- let flags = 0
58
- if (m.open) flags |= 1
59
-
60
- c.fixed32.encode(state, m.autobase)
61
- c.fixed32.encode(state, m.writer)
62
- c.uint.encode(state, flags)
63
- },
64
- decode (state) {
65
- const res = {}
66
- res.autobase = null
67
- res.writer = null
68
- res.open = false
69
-
70
- res.autobase = c.fixed32.decode(state)
71
- res.writer = c.fixed32.decode(state)
72
-
73
- const flags = state.start < state.end ? c.uint.decode(state) : 0
74
- if ((flags & 1) !== 0) res.open = true
75
-
76
- return res
77
- }
78
- }
79
-
80
- // @blind-peer/request-post
81
- const encoding2 = {
82
- preencode (state, m) {
83
- let flags = 0
84
- if (m.message) flags |= 1
85
-
86
- c.fixed32.preencode(state, m.autobase)
87
- c.uint.preencode(state, flags)
88
-
89
- if (m.message) c.buffer.preencode(state, m.message)
90
- },
91
- encode (state, m) {
92
- let flags = 0
93
- if (m.message) flags |= 1
94
-
95
- c.fixed32.encode(state, m.autobase)
96
- c.uint.encode(state, flags)
97
-
98
- if (m.message) c.buffer.encode(state, m.message)
99
- },
100
- decode (state) {
101
- const res = {}
102
- res.autobase = null
103
- res.message = null
104
-
105
- res.autobase = c.fixed32.decode(state)
106
-
107
- const flags = state.start < state.end ? c.uint.decode(state) : 0
108
- if ((flags & 1) !== 0) res.message = c.buffer.decode(state)
109
-
110
- return res
111
- }
112
- }
113
-
114
- // @blind-peer/response-post
115
- const encoding3 = {
116
- preencode (state, m) {
117
- c.uint.preencode(state, m.length)
118
- },
119
- encode (state, m) {
120
- c.uint.encode(state, m.length)
121
- },
122
- decode (state) {
123
- const res = {}
124
- res.length = 0
125
-
126
- res.length = c.uint.decode(state)
127
-
128
- return res
129
- }
130
- }
131
-
132
- // @blind-peer/mailbox
133
- const encoding4 = {
134
- preencode (state, m) {
135
- let flags = 0
136
- if (m.blockEncryptionKey) flags |= 1
137
-
138
- c.fixed32.preencode(state, m.autobase)
139
- c.fixed32.preencode(state, m.writer)
140
- c.uint.preencode(state, flags)
141
-
142
- if (m.blockEncryptionKey) c.fixed32.preencode(state, m.blockEncryptionKey)
143
- },
144
- encode (state, m) {
145
- let flags = 0
146
- if (m.blockEncryptionKey) flags |= 1
147
-
148
- c.fixed32.encode(state, m.autobase)
149
- c.fixed32.encode(state, m.writer)
150
- c.uint.encode(state, flags)
151
-
152
- if (m.blockEncryptionKey) c.fixed32.encode(state, m.blockEncryptionKey)
153
- },
154
- decode (state) {
155
- const res = {}
156
- res.autobase = null
157
- res.writer = null
158
- res.blockEncryptionKey = null
159
-
160
- res.autobase = c.fixed32.decode(state)
161
- res.writer = c.fixed32.decode(state)
162
-
163
- const flags = state.start < state.end ? c.uint.decode(state) : 0
164
- if ((flags & 1) !== 0) res.blockEncryptionKey = c.fixed32.decode(state)
165
-
166
- return res
167
- }
168
- }
169
-
170
- // @blind-peer/mailbox/value
171
- const encoding5 = {
172
- preencode (state, m) {
173
- let flags = 0
174
- if (m.blockEncryptionKey) flags |= 1
175
-
176
- c.fixed32.preencode(state, m.writer)
177
- c.uint.preencode(state, flags)
178
-
179
- if (m.blockEncryptionKey) c.fixed32.preencode(state, m.blockEncryptionKey)
180
- },
181
- encode (state, m) {
182
- let flags = 0
183
- if (m.blockEncryptionKey) flags |= 1
184
-
185
- c.fixed32.encode(state, m.writer)
186
- c.uint.encode(state, flags)
187
-
188
- if (m.blockEncryptionKey) c.fixed32.encode(state, m.blockEncryptionKey)
189
- },
190
- decode (state) {
191
- const res = {}
192
- res.writer = null
193
- res.blockEncryptionKey = null
194
-
195
- res.writer = c.fixed32.decode(state)
196
-
197
- const flags = state.start < state.end ? c.uint.decode(state) : 0
198
- if ((flags & 1) !== 0) res.blockEncryptionKey = c.fixed32.decode(state)
199
-
200
- return res
201
- }
202
- }
203
-
204
- function getStructByName (name) {
205
- switch (name) {
206
- case '@blind-peer/request-mailbox': return encoding0
207
- case '@blind-peer/response-mailbox': return encoding1
208
- case '@blind-peer/request-post': return encoding2
209
- case '@blind-peer/response-post': return encoding3
210
- case '@blind-peer/mailbox': return encoding4
211
- case '@blind-peer/mailbox/value': return encoding5
212
- default: throw new Error('Encoder not found ' + name)
213
- }
214
- }
215
-
216
- function resolveStruct (name, v = VERSION) {
217
- const enc = getStructByName(name)
218
- return {
219
- preencode (state, m) {
220
- version = v
221
- enc.preencode(state, m)
222
- },
223
- encode (state, m) {
224
- version = v
225
- enc.encode(state, m)
226
- },
227
- decode (state) {
228
- version = v
229
- return enc.decode(state)
230
- }
231
- }
232
- }
233
-
234
- module.exports = { resolveStruct, version }
@@ -1,199 +0,0 @@
1
- // This file is autogenerated by the hyperschema compiler
2
- // Schema Version: 1
3
- /* eslint-disable camelcase */
4
- /* eslint-disable quotes */
5
-
6
- const VERSION = 1
7
- const { c } = require('hyperschema/runtime')
8
-
9
- // eslint-disable-next-line no-unused-vars
10
- let version = VERSION
11
-
12
- // @blind-peer/request-mailbox
13
- const encoding0 = {
14
- preencode (state, m) {
15
- let flags = 0
16
- if (m.blockEncryptionKey) flags |= 1
17
-
18
- c.fixed32.preencode(state, m.autobase)
19
- c.uint.preencode(state, flags)
20
-
21
- if (m.blockEncryptionKey) c.fixed32.preencode(state, m.blockEncryptionKey)
22
- },
23
- encode (state, m) {
24
- let flags = 0
25
- if (m.blockEncryptionKey) flags |= 1
26
-
27
- c.fixed32.encode(state, m.autobase)
28
- c.uint.encode(state, flags)
29
-
30
- if (m.blockEncryptionKey) c.fixed32.encode(state, m.blockEncryptionKey)
31
- },
32
- decode (state) {
33
- const res = {}
34
- res.autobase = null
35
- res.blockEncryptionKey = null
36
-
37
- res.autobase = c.fixed32.decode(state)
38
-
39
- const flags = state.start < state.end ? c.uint.decode(state) : 0
40
- if ((flags & 1) !== 0) res.blockEncryptionKey = c.fixed32.decode(state)
41
-
42
- return res
43
- }
44
- }
45
-
46
- // @blind-peer/response-mailbox
47
- const encoding1 = {
48
- preencode (state, m) {
49
- let flags = 0
50
- if (m.open) flags |= 1
51
-
52
- c.fixed32.preencode(state, m.autobase)
53
- c.fixed32.preencode(state, m.writer)
54
- c.uint.preencode(state, flags)
55
- },
56
- encode (state, m) {
57
- let flags = 0
58
- if (m.open) flags |= 1
59
-
60
- c.fixed32.encode(state, m.autobase)
61
- c.fixed32.encode(state, m.writer)
62
- c.uint.encode(state, flags)
63
- },
64
- decode (state) {
65
- const res = {}
66
- res.autobase = null
67
- res.writer = null
68
- res.open = false
69
-
70
- res.autobase = c.fixed32.decode(state)
71
- res.writer = c.fixed32.decode(state)
72
-
73
- const flags = state.start < state.end ? c.uint.decode(state) : 0
74
- if ((flags & 1) !== 0) res.open = true
75
-
76
- return res
77
- }
78
- }
79
-
80
- // @blind-peer/request-post
81
- const encoding2 = {
82
- preencode (state, m) {
83
- let flags = 0
84
- if (m.message) flags |= 1
85
-
86
- c.fixed32.preencode(state, m.autobase)
87
- c.uint.preencode(state, flags)
88
-
89
- if (m.message) c.buffer.preencode(state, m.message)
90
- },
91
- encode (state, m) {
92
- let flags = 0
93
- if (m.message) flags |= 1
94
-
95
- c.fixed32.encode(state, m.autobase)
96
- c.uint.encode(state, flags)
97
-
98
- if (m.message) c.buffer.encode(state, m.message)
99
- },
100
- decode (state) {
101
- const res = {}
102
- res.autobase = null
103
- res.message = null
104
-
105
- res.autobase = c.fixed32.decode(state)
106
-
107
- const flags = state.start < state.end ? c.uint.decode(state) : 0
108
- if ((flags & 1) !== 0) res.message = c.buffer.decode(state)
109
-
110
- return res
111
- }
112
- }
113
-
114
- // @blind-peer/response-post
115
- const encoding3 = {
116
- preencode (state, m) {
117
- c.uint.preencode(state, m.length)
118
- },
119
- encode (state, m) {
120
- c.uint.encode(state, m.length)
121
- },
122
- decode (state) {
123
- const res = {}
124
- res.length = 0
125
-
126
- res.length = c.uint.decode(state)
127
-
128
- return res
129
- }
130
- }
131
-
132
- // @blind-peer/mailbox
133
- const encoding4 = {
134
- preencode (state, m) {
135
- let flags = 0
136
- if (m.blockEncryptionKey) flags |= 1
137
-
138
- c.fixed32.preencode(state, m.autobase)
139
- c.fixed32.preencode(state, m.writer)
140
- c.uint.preencode(state, flags)
141
-
142
- if (m.blockEncryptionKey) c.fixed32.preencode(state, m.blockEncryptionKey)
143
- },
144
- encode (state, m) {
145
- let flags = 0
146
- if (m.blockEncryptionKey) flags |= 1
147
-
148
- c.fixed32.encode(state, m.autobase)
149
- c.fixed32.encode(state, m.writer)
150
- c.uint.encode(state, flags)
151
-
152
- if (m.blockEncryptionKey) c.fixed32.encode(state, m.blockEncryptionKey)
153
- },
154
- decode (state) {
155
- const res = {}
156
- res.autobase = null
157
- res.writer = null
158
- res.blockEncryptionKey = null
159
-
160
- res.autobase = c.fixed32.decode(state)
161
- res.writer = c.fixed32.decode(state)
162
-
163
- const flags = state.start < state.end ? c.uint.decode(state) : 0
164
- if ((flags & 1) !== 0) res.blockEncryptionKey = c.fixed32.decode(state)
165
-
166
- return res
167
- }
168
- }
169
-
170
- function getStructByName (name) {
171
- switch (name) {
172
- case '@blind-peer/request-mailbox': return encoding0
173
- case '@blind-peer/response-mailbox': return encoding1
174
- case '@blind-peer/request-post': return encoding2
175
- case '@blind-peer/response-post': return encoding3
176
- case '@blind-peer/mailbox': return encoding4
177
- default: throw new Error('Encoder not found ' + name)
178
- }
179
- }
180
-
181
- function resolveStruct (name, v = VERSION) {
182
- const enc = getStructByName(name)
183
- return {
184
- preencode (state, m) {
185
- version = v
186
- enc.preencode(state, m)
187
- },
188
- encode (state, m) {
189
- version = v
190
- enc.encode(state, m)
191
- },
192
- decode (state) {
193
- version = v
194
- return enc.decode(state)
195
- }
196
- }
197
- }
198
-
199
- module.exports = { resolveStruct, version }
@@ -1,107 +0,0 @@
1
- {
2
- "version": 1,
3
- "schema": [
4
- {
5
- "name": "request-mailbox",
6
- "namespace": "blind-peer",
7
- "compact": false,
8
- "flagsPosition": 1,
9
- "fields": [
10
- {
11
- "name": "autobase",
12
- "required": true,
13
- "type": "fixed32",
14
- "version": 1
15
- },
16
- {
17
- "name": "blockEncryptionKey",
18
- "type": "fixed32",
19
- "version": 1
20
- }
21
- ]
22
- },
23
- {
24
- "name": "response-mailbox",
25
- "namespace": "blind-peer",
26
- "compact": false,
27
- "flagsPosition": 2,
28
- "fields": [
29
- {
30
- "name": "autobase",
31
- "required": true,
32
- "type": "fixed32",
33
- "version": 1
34
- },
35
- {
36
- "name": "writer",
37
- "required": true,
38
- "type": "fixed32",
39
- "version": 1
40
- },
41
- {
42
- "name": "open",
43
- "type": "bool",
44
- "version": 1
45
- }
46
- ]
47
- },
48
- {
49
- "name": "request-post",
50
- "namespace": "blind-peer",
51
- "compact": false,
52
- "flagsPosition": 1,
53
- "fields": [
54
- {
55
- "name": "autobase",
56
- "required": true,
57
- "type": "fixed32",
58
- "version": 1
59
- },
60
- {
61
- "name": "message",
62
- "type": "buffer",
63
- "version": 1
64
- }
65
- ]
66
- },
67
- {
68
- "name": "response-post",
69
- "namespace": "blind-peer",
70
- "compact": false,
71
- "flagsPosition": -1,
72
- "fields": [
73
- {
74
- "name": "length",
75
- "required": true,
76
- "type": "uint",
77
- "version": 1
78
- }
79
- ]
80
- },
81
- {
82
- "name": "mailbox",
83
- "namespace": "blind-peer",
84
- "compact": false,
85
- "flagsPosition": 2,
86
- "fields": [
87
- {
88
- "name": "autobase",
89
- "required": true,
90
- "type": "fixed32",
91
- "version": 1
92
- },
93
- {
94
- "name": "writer",
95
- "required": true,
96
- "type": "fixed32",
97
- "version": 1
98
- },
99
- {
100
- "name": "blockEncryptionKey",
101
- "type": "fixed32",
102
- "version": 1
103
- }
104
- ]
105
- }
106
- ]
107
- }