@stryke/capnp 0.8.3 → 0.9.1

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.
@@ -0,0 +1,209 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); var _class; var _class2; var _class3; var _class4; var _class5; var _class6;
2
+
3
+
4
+
5
+ var _chunkGX6VRR3Gcjs = require('./chunk-GX6VRR3G.cjs');
6
+
7
+
8
+ var _chunkUSNT2KNTcjs = require('./chunk-USNT2KNT.cjs');
9
+
10
+ // schemas/rpc-twoparty.ts
11
+ var _capnpFileId = BigInt("0xa184c7885cdaf2a1");
12
+ var Side = {
13
+ /**
14
+ * The object lives on the "server" or "supervisor" end of the connection. Only the
15
+ * server/supervisor knows how to interpret the ref; to the client, it is opaque.
16
+ *
17
+ * Note that containers intending to implement strong confinement should rewrite SturdyRefs
18
+ * received from the external network before passing them on to the confined app. The confined
19
+ * app thus does not ever receive the raw bits of the SturdyRef (which it could perhaps
20
+ * maliciously leak), but instead receives only a thing that it can pass back to the container
21
+ * later to restore the ref. See:
22
+ * http://www.erights.org/elib/capability/dist-confine.html
23
+ *
24
+ */
25
+ SERVER: 0,
26
+ /**
27
+ * The object lives on the "client" or "confined app" end of the connection. Only the client
28
+ * knows how to interpret the ref; to the server/supervisor, it is opaque. Most clients do not
29
+ * actually know how to persist capabilities at all, so use of this is unusual.
30
+ *
31
+ */
32
+ CLIENT: 1
33
+ };
34
+ var VatId = (_class = class extends _chunkGX6VRR3Gcjs.Struct {
35
+ static {
36
+ _chunkUSNT2KNTcjs.__name.call(void 0, this, "VatId");
37
+ }
38
+ static __initStatic() {this._capnp = {
39
+ displayName: "VatId",
40
+ id: "d20b909fee733a8e",
41
+ size: new (0, _chunkGX6VRR3Gcjs.ObjectSize)(8, 0)
42
+ }}
43
+ get side() {
44
+ return _chunkGX6VRR3Gcjs.utils.getUint16(0, this);
45
+ }
46
+ set side(value) {
47
+ _chunkGX6VRR3Gcjs.utils.setUint16(0, value, this);
48
+ }
49
+ toString() {
50
+ return "VatId_" + super.toString();
51
+ }
52
+ }, _class.__initStatic(), _class);
53
+ var ProvisionId = (_class2 = class extends _chunkGX6VRR3Gcjs.Struct {
54
+ static {
55
+ _chunkUSNT2KNTcjs.__name.call(void 0, this, "ProvisionId");
56
+ }
57
+ static __initStatic2() {this._capnp = {
58
+ displayName: "ProvisionId",
59
+ id: "b88d09a9c5f39817",
60
+ size: new (0, _chunkGX6VRR3Gcjs.ObjectSize)(8, 0)
61
+ }}
62
+ /**
63
+ * The ID from `JoinKeyPart`.
64
+ *
65
+ */
66
+ get joinId() {
67
+ return _chunkGX6VRR3Gcjs.utils.getUint32(0, this);
68
+ }
69
+ set joinId(value) {
70
+ _chunkGX6VRR3Gcjs.utils.setUint32(0, value, this);
71
+ }
72
+ toString() {
73
+ return "ProvisionId_" + super.toString();
74
+ }
75
+ }, _class2.__initStatic2(), _class2);
76
+ var RecipientId = (_class3 = class extends _chunkGX6VRR3Gcjs.Struct {
77
+ static {
78
+ _chunkUSNT2KNTcjs.__name.call(void 0, this, "RecipientId");
79
+ }
80
+ static __initStatic3() {this._capnp = {
81
+ displayName: "RecipientId",
82
+ id: "89f389b6fd4082c1",
83
+ size: new (0, _chunkGX6VRR3Gcjs.ObjectSize)(0, 0)
84
+ }}
85
+ toString() {
86
+ return "RecipientId_" + super.toString();
87
+ }
88
+ }, _class3.__initStatic3(), _class3);
89
+ var ThirdPartyCapId = (_class4 = class extends _chunkGX6VRR3Gcjs.Struct {
90
+ static {
91
+ _chunkUSNT2KNTcjs.__name.call(void 0, this, "ThirdPartyCapId");
92
+ }
93
+ static __initStatic4() {this._capnp = {
94
+ displayName: "ThirdPartyCapId",
95
+ id: "b47f4979672cb59d",
96
+ size: new (0, _chunkGX6VRR3Gcjs.ObjectSize)(0, 0)
97
+ }}
98
+ toString() {
99
+ return "ThirdPartyCapId_" + super.toString();
100
+ }
101
+ }, _class4.__initStatic4(), _class4);
102
+ var JoinKeyPart = (_class5 = class extends _chunkGX6VRR3Gcjs.Struct {
103
+ static {
104
+ _chunkUSNT2KNTcjs.__name.call(void 0, this, "JoinKeyPart");
105
+ }
106
+ static __initStatic5() {this._capnp = {
107
+ displayName: "JoinKeyPart",
108
+ id: "95b29059097fca83",
109
+ size: new (0, _chunkGX6VRR3Gcjs.ObjectSize)(8, 0)
110
+ }}
111
+ /**
112
+ * A number identifying this join, chosen by the sender. May be reused once `Finish` messages are
113
+ * sent corresponding to all of the `Join` messages.
114
+ *
115
+ */
116
+ get joinId() {
117
+ return _chunkGX6VRR3Gcjs.utils.getUint32(0, this);
118
+ }
119
+ set joinId(value) {
120
+ _chunkGX6VRR3Gcjs.utils.setUint32(0, value, this);
121
+ }
122
+ /**
123
+ * The number of capabilities to be joined.
124
+ *
125
+ */
126
+ get partCount() {
127
+ return _chunkGX6VRR3Gcjs.utils.getUint16(4, this);
128
+ }
129
+ set partCount(value) {
130
+ _chunkGX6VRR3Gcjs.utils.setUint16(4, value, this);
131
+ }
132
+ /**
133
+ * Which part this request targets -- a number in the range [0, partCount).
134
+ *
135
+ */
136
+ get partNum() {
137
+ return _chunkGX6VRR3Gcjs.utils.getUint16(6, this);
138
+ }
139
+ set partNum(value) {
140
+ _chunkGX6VRR3Gcjs.utils.setUint16(6, value, this);
141
+ }
142
+ toString() {
143
+ return "JoinKeyPart_" + super.toString();
144
+ }
145
+ }, _class5.__initStatic5(), _class5);
146
+ var JoinResult = (_class6 = class extends _chunkGX6VRR3Gcjs.Struct {
147
+ static {
148
+ _chunkUSNT2KNTcjs.__name.call(void 0, this, "JoinResult");
149
+ }
150
+ static __initStatic6() {this._capnp = {
151
+ displayName: "JoinResult",
152
+ id: "9d263a3630b7ebee",
153
+ size: new (0, _chunkGX6VRR3Gcjs.ObjectSize)(8, 1)
154
+ }}
155
+ /**
156
+ * Matches `JoinKeyPart`.
157
+ *
158
+ */
159
+ get joinId() {
160
+ return _chunkGX6VRR3Gcjs.utils.getUint32(0, this);
161
+ }
162
+ set joinId(value) {
163
+ _chunkGX6VRR3Gcjs.utils.setUint32(0, value, this);
164
+ }
165
+ /**
166
+ * All JoinResults in the set will have the same value for `succeeded`. The receiver actually
167
+ * implements the join by waiting for all the `JoinKeyParts` and then performing its own join on
168
+ * them, then going back and answering all the join requests afterwards.
169
+ *
170
+ */
171
+ get succeeded() {
172
+ return _chunkGX6VRR3Gcjs.utils.getBit(32, this);
173
+ }
174
+ set succeeded(value) {
175
+ _chunkGX6VRR3Gcjs.utils.setBit(32, value, this);
176
+ }
177
+ _adoptCap(value) {
178
+ _chunkGX6VRR3Gcjs.utils.adopt(value, _chunkGX6VRR3Gcjs.utils.getPointer(0, this));
179
+ }
180
+ _disownCap() {
181
+ return _chunkGX6VRR3Gcjs.utils.disown(this.cap);
182
+ }
183
+ /**
184
+ * One of the JoinResults will have a non-null `cap` which is the joined capability.
185
+ *
186
+ */
187
+ get cap() {
188
+ return _chunkGX6VRR3Gcjs.utils.getPointer(0, this);
189
+ }
190
+ _hasCap() {
191
+ return !_chunkGX6VRR3Gcjs.utils.isNull(_chunkGX6VRR3Gcjs.utils.getPointer(0, this));
192
+ }
193
+ set cap(value) {
194
+ _chunkGX6VRR3Gcjs.utils.copyFrom(value, _chunkGX6VRR3Gcjs.utils.getPointer(0, this));
195
+ }
196
+ toString() {
197
+ return "JoinResult_" + super.toString();
198
+ }
199
+ }, _class6.__initStatic6(), _class6);
200
+
201
+
202
+
203
+
204
+
205
+
206
+
207
+
208
+
209
+ exports.JoinKeyPart = JoinKeyPart; exports.JoinResult = JoinResult; exports.ProvisionId = ProvisionId; exports.RecipientId = RecipientId; exports.Side = Side; exports.ThirdPartyCapId = ThirdPartyCapId; exports.VatId = VatId; exports._capnpFileId = _capnpFileId;
@@ -0,0 +1,171 @@
1
+ import { Struct, ObjectSize, Orphan, Pointer } from 'capnp-es';
2
+
3
+ declare const _capnpFileId: bigint;
4
+ declare const Side: {
5
+ /**
6
+ * The object lives on the "server" or "supervisor" end of the connection. Only the
7
+ * server/supervisor knows how to interpret the ref; to the client, it is opaque.
8
+ *
9
+ * Note that containers intending to implement strong confinement should rewrite SturdyRefs
10
+ * received from the external network before passing them on to the confined app. The confined
11
+ * app thus does not ever receive the raw bits of the SturdyRef (which it could perhaps
12
+ * maliciously leak), but instead receives only a thing that it can pass back to the container
13
+ * later to restore the ref. See:
14
+ * http://www.erights.org/elib/capability/dist-confine.html
15
+ *
16
+ */
17
+ readonly SERVER: 0;
18
+ /**
19
+ * The object lives on the "client" or "confined app" end of the connection. Only the client
20
+ * knows how to interpret the ref; to the server/supervisor, it is opaque. Most clients do not
21
+ * actually know how to persist capabilities at all, so use of this is unusual.
22
+ *
23
+ */
24
+ readonly CLIENT: 1;
25
+ };
26
+ type Side = (typeof Side)[keyof typeof Side];
27
+ declare class VatId extends Struct {
28
+ static readonly _capnp: {
29
+ displayName: string;
30
+ id: string;
31
+ size: ObjectSize;
32
+ };
33
+ get side(): Side;
34
+ set side(value: Side);
35
+ toString(): string;
36
+ }
37
+ /**
38
+ * Only used for joins, since three-way introductions never happen on a two-party network.
39
+ *
40
+ */
41
+ declare class ProvisionId extends Struct {
42
+ static readonly _capnp: {
43
+ displayName: string;
44
+ id: string;
45
+ size: ObjectSize;
46
+ };
47
+ /**
48
+ * The ID from `JoinKeyPart`.
49
+ *
50
+ */
51
+ get joinId(): number;
52
+ set joinId(value: number);
53
+ toString(): string;
54
+ }
55
+ /**
56
+ * Never used, because there are only two parties.
57
+ *
58
+ */
59
+ declare class RecipientId extends Struct {
60
+ static readonly _capnp: {
61
+ displayName: string;
62
+ id: string;
63
+ size: ObjectSize;
64
+ };
65
+ toString(): string;
66
+ }
67
+ /**
68
+ * Never used, because there is no third party.
69
+ *
70
+ */
71
+ declare class ThirdPartyCapId extends Struct {
72
+ static readonly _capnp: {
73
+ displayName: string;
74
+ id: string;
75
+ size: ObjectSize;
76
+ };
77
+ toString(): string;
78
+ }
79
+ /**
80
+ * Joins in the two-party case are simplified by a few observations.
81
+ *
82
+ * First, on a two-party network, a Join only ever makes sense if the receiving end is also
83
+ * connected to other networks. A vat which is not connected to any other network can safely
84
+ * reject all joins.
85
+ *
86
+ * Second, since a two-party connection bisects the network -- there can be no other connections
87
+ * between the networks at either end of the connection -- if one part of a join crosses the
88
+ * connection, then _all_ parts must cross it. Therefore, a vat which is receiving a Join request
89
+ * off some other network which needs to be forwarded across the two-party connection can
90
+ * collect all the parts on its end and only forward them across the two-party connection when all
91
+ * have been received.
92
+ *
93
+ * For example, imagine that Alice and Bob are vats connected over a two-party connection, and
94
+ * each is also connected to other networks. At some point, Alice receives one part of a Join
95
+ * request off her network. The request is addressed to a capability that Alice received from
96
+ * Bob and is proxying to her other network. Alice goes ahead and responds to the Join part as
97
+ * if she hosted the capability locally (this is important so that if not all the Join parts end
98
+ * up at Alice, the original sender can detect the failed Join without hanging). As other parts
99
+ * trickle in, Alice verifies that each part is addressed to a capability from Bob and continues
100
+ * to respond to each one. Once the complete set of join parts is received, Alice checks if they
101
+ * were all for the exact same capability. If so, she doesn't need to send anything to Bob at
102
+ * all. Otherwise, she collects the set of capabilities (from Bob) to which the join parts were
103
+ * addressed and essentially initiates a _new_ Join request on those capabilities to Bob. Alice
104
+ * does not forward the Join parts she received herself, but essentially forwards the Join as a
105
+ * whole.
106
+ *
107
+ * On Bob's end, since he knows that Alice will always send all parts of a Join together, he
108
+ * simply waits until he's received them all, then performs a join on the respective capabilities
109
+ * as if it had been requested locally.
110
+ *
111
+ */
112
+ declare class JoinKeyPart extends Struct {
113
+ static readonly _capnp: {
114
+ displayName: string;
115
+ id: string;
116
+ size: ObjectSize;
117
+ };
118
+ /**
119
+ * A number identifying this join, chosen by the sender. May be reused once `Finish` messages are
120
+ * sent corresponding to all of the `Join` messages.
121
+ *
122
+ */
123
+ get joinId(): number;
124
+ set joinId(value: number);
125
+ /**
126
+ * The number of capabilities to be joined.
127
+ *
128
+ */
129
+ get partCount(): number;
130
+ set partCount(value: number);
131
+ /**
132
+ * Which part this request targets -- a number in the range [0, partCount).
133
+ *
134
+ */
135
+ get partNum(): number;
136
+ set partNum(value: number);
137
+ toString(): string;
138
+ }
139
+ declare class JoinResult extends Struct {
140
+ static readonly _capnp: {
141
+ displayName: string;
142
+ id: string;
143
+ size: ObjectSize;
144
+ };
145
+ /**
146
+ * Matches `JoinKeyPart`.
147
+ *
148
+ */
149
+ get joinId(): number;
150
+ set joinId(value: number);
151
+ /**
152
+ * All JoinResults in the set will have the same value for `succeeded`. The receiver actually
153
+ * implements the join by waiting for all the `JoinKeyParts` and then performing its own join on
154
+ * them, then going back and answering all the join requests afterwards.
155
+ *
156
+ */
157
+ get succeeded(): boolean;
158
+ set succeeded(value: boolean);
159
+ _adoptCap(value: Orphan<Pointer>): void;
160
+ _disownCap(): Orphan<Pointer>;
161
+ /**
162
+ * One of the JoinResults will have a non-null `cap` which is the joined capability.
163
+ *
164
+ */
165
+ get cap(): Pointer;
166
+ _hasCap(): boolean;
167
+ set cap(value: Pointer);
168
+ toString(): string;
169
+ }
170
+
171
+ export { JoinKeyPart, JoinResult, ProvisionId, RecipientId, Side, ThirdPartyCapId, VatId, _capnpFileId };
@@ -0,0 +1,171 @@
1
+ import { Struct, ObjectSize, Orphan, Pointer } from 'capnp-es';
2
+
3
+ declare const _capnpFileId: bigint;
4
+ declare const Side: {
5
+ /**
6
+ * The object lives on the "server" or "supervisor" end of the connection. Only the
7
+ * server/supervisor knows how to interpret the ref; to the client, it is opaque.
8
+ *
9
+ * Note that containers intending to implement strong confinement should rewrite SturdyRefs
10
+ * received from the external network before passing them on to the confined app. The confined
11
+ * app thus does not ever receive the raw bits of the SturdyRef (which it could perhaps
12
+ * maliciously leak), but instead receives only a thing that it can pass back to the container
13
+ * later to restore the ref. See:
14
+ * http://www.erights.org/elib/capability/dist-confine.html
15
+ *
16
+ */
17
+ readonly SERVER: 0;
18
+ /**
19
+ * The object lives on the "client" or "confined app" end of the connection. Only the client
20
+ * knows how to interpret the ref; to the server/supervisor, it is opaque. Most clients do not
21
+ * actually know how to persist capabilities at all, so use of this is unusual.
22
+ *
23
+ */
24
+ readonly CLIENT: 1;
25
+ };
26
+ type Side = (typeof Side)[keyof typeof Side];
27
+ declare class VatId extends Struct {
28
+ static readonly _capnp: {
29
+ displayName: string;
30
+ id: string;
31
+ size: ObjectSize;
32
+ };
33
+ get side(): Side;
34
+ set side(value: Side);
35
+ toString(): string;
36
+ }
37
+ /**
38
+ * Only used for joins, since three-way introductions never happen on a two-party network.
39
+ *
40
+ */
41
+ declare class ProvisionId extends Struct {
42
+ static readonly _capnp: {
43
+ displayName: string;
44
+ id: string;
45
+ size: ObjectSize;
46
+ };
47
+ /**
48
+ * The ID from `JoinKeyPart`.
49
+ *
50
+ */
51
+ get joinId(): number;
52
+ set joinId(value: number);
53
+ toString(): string;
54
+ }
55
+ /**
56
+ * Never used, because there are only two parties.
57
+ *
58
+ */
59
+ declare class RecipientId extends Struct {
60
+ static readonly _capnp: {
61
+ displayName: string;
62
+ id: string;
63
+ size: ObjectSize;
64
+ };
65
+ toString(): string;
66
+ }
67
+ /**
68
+ * Never used, because there is no third party.
69
+ *
70
+ */
71
+ declare class ThirdPartyCapId extends Struct {
72
+ static readonly _capnp: {
73
+ displayName: string;
74
+ id: string;
75
+ size: ObjectSize;
76
+ };
77
+ toString(): string;
78
+ }
79
+ /**
80
+ * Joins in the two-party case are simplified by a few observations.
81
+ *
82
+ * First, on a two-party network, a Join only ever makes sense if the receiving end is also
83
+ * connected to other networks. A vat which is not connected to any other network can safely
84
+ * reject all joins.
85
+ *
86
+ * Second, since a two-party connection bisects the network -- there can be no other connections
87
+ * between the networks at either end of the connection -- if one part of a join crosses the
88
+ * connection, then _all_ parts must cross it. Therefore, a vat which is receiving a Join request
89
+ * off some other network which needs to be forwarded across the two-party connection can
90
+ * collect all the parts on its end and only forward them across the two-party connection when all
91
+ * have been received.
92
+ *
93
+ * For example, imagine that Alice and Bob are vats connected over a two-party connection, and
94
+ * each is also connected to other networks. At some point, Alice receives one part of a Join
95
+ * request off her network. The request is addressed to a capability that Alice received from
96
+ * Bob and is proxying to her other network. Alice goes ahead and responds to the Join part as
97
+ * if she hosted the capability locally (this is important so that if not all the Join parts end
98
+ * up at Alice, the original sender can detect the failed Join without hanging). As other parts
99
+ * trickle in, Alice verifies that each part is addressed to a capability from Bob and continues
100
+ * to respond to each one. Once the complete set of join parts is received, Alice checks if they
101
+ * were all for the exact same capability. If so, she doesn't need to send anything to Bob at
102
+ * all. Otherwise, she collects the set of capabilities (from Bob) to which the join parts were
103
+ * addressed and essentially initiates a _new_ Join request on those capabilities to Bob. Alice
104
+ * does not forward the Join parts she received herself, but essentially forwards the Join as a
105
+ * whole.
106
+ *
107
+ * On Bob's end, since he knows that Alice will always send all parts of a Join together, he
108
+ * simply waits until he's received them all, then performs a join on the respective capabilities
109
+ * as if it had been requested locally.
110
+ *
111
+ */
112
+ declare class JoinKeyPart extends Struct {
113
+ static readonly _capnp: {
114
+ displayName: string;
115
+ id: string;
116
+ size: ObjectSize;
117
+ };
118
+ /**
119
+ * A number identifying this join, chosen by the sender. May be reused once `Finish` messages are
120
+ * sent corresponding to all of the `Join` messages.
121
+ *
122
+ */
123
+ get joinId(): number;
124
+ set joinId(value: number);
125
+ /**
126
+ * The number of capabilities to be joined.
127
+ *
128
+ */
129
+ get partCount(): number;
130
+ set partCount(value: number);
131
+ /**
132
+ * Which part this request targets -- a number in the range [0, partCount).
133
+ *
134
+ */
135
+ get partNum(): number;
136
+ set partNum(value: number);
137
+ toString(): string;
138
+ }
139
+ declare class JoinResult extends Struct {
140
+ static readonly _capnp: {
141
+ displayName: string;
142
+ id: string;
143
+ size: ObjectSize;
144
+ };
145
+ /**
146
+ * Matches `JoinKeyPart`.
147
+ *
148
+ */
149
+ get joinId(): number;
150
+ set joinId(value: number);
151
+ /**
152
+ * All JoinResults in the set will have the same value for `succeeded`. The receiver actually
153
+ * implements the join by waiting for all the `JoinKeyParts` and then performing its own join on
154
+ * them, then going back and answering all the join requests afterwards.
155
+ *
156
+ */
157
+ get succeeded(): boolean;
158
+ set succeeded(value: boolean);
159
+ _adoptCap(value: Orphan<Pointer>): void;
160
+ _disownCap(): Orphan<Pointer>;
161
+ /**
162
+ * One of the JoinResults will have a non-null `cap` which is the joined capability.
163
+ *
164
+ */
165
+ get cap(): Pointer;
166
+ _hasCap(): boolean;
167
+ set cap(value: Pointer);
168
+ toString(): string;
169
+ }
170
+
171
+ export { JoinKeyPart, JoinResult, ProvisionId, RecipientId, Side, ThirdPartyCapId, VatId, _capnpFileId };