@dxos/protocols 2.28.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/src/index.d.ts +1 -0
  2. package/dist/src/index.d.ts.map +1 -0
  3. package/dist/src/index.js +5 -0
  4. package/dist/src/index.js.map +1 -0
  5. package/dist/src/proto/gen/dxos/bot.d.ts +109 -0
  6. package/dist/src/proto/gen/dxos/bot.d.ts.map +1 -0
  7. package/dist/src/proto/gen/dxos/bot.js +14 -0
  8. package/dist/src/proto/gen/dxos/bot.js.map +1 -0
  9. package/dist/src/proto/gen/dxos/client.d.ts +179 -0
  10. package/dist/src/proto/gen/dxos/client.d.ts.map +1 -0
  11. package/dist/src/proto/gen/dxos/client.js +11 -0
  12. package/dist/src/proto/gen/dxos/client.js.map +1 -0
  13. package/dist/src/proto/gen/dxos/config.d.ts +210 -0
  14. package/dist/src/proto/gen/dxos/config.d.ts.map +1 -0
  15. package/dist/src/proto/gen/dxos/config.js +29 -0
  16. package/dist/src/proto/gen/dxos/config.js.map +1 -0
  17. package/dist/src/proto/gen/dxos/credentials/auth.d.ts +11 -0
  18. package/dist/src/proto/gen/dxos/credentials/auth.d.ts.map +1 -0
  19. package/dist/src/proto/gen/dxos/credentials/auth.js +3 -0
  20. package/dist/src/proto/gen/dxos/credentials/auth.js.map +1 -0
  21. package/dist/src/proto/gen/dxos/credentials/greet.d.ts +39 -0
  22. package/dist/src/proto/gen/dxos/credentials/greet.d.ts.map +1 -0
  23. package/dist/src/proto/gen/dxos/credentials/greet.js +15 -0
  24. package/dist/src/proto/gen/dxos/credentials/greet.js.map +1 -0
  25. package/dist/src/proto/gen/dxos/credentials/identity.d.ts +10 -0
  26. package/dist/src/proto/gen/dxos/credentials/identity.d.ts.map +1 -0
  27. package/dist/src/proto/gen/dxos/credentials/identity.js +3 -0
  28. package/dist/src/proto/gen/dxos/credentials/identity.js.map +1 -0
  29. package/dist/src/proto/gen/dxos/credentials/party.d.ts +49 -0
  30. package/dist/src/proto/gen/dxos/credentials/party.d.ts.map +1 -0
  31. package/dist/src/proto/gen/dxos/credentials/party.js +15 -0
  32. package/dist/src/proto/gen/dxos/credentials/party.js.map +1 -0
  33. package/dist/src/proto/gen/dxos/credentials.d.ts +25 -0
  34. package/dist/src/proto/gen/dxos/credentials.d.ts.map +1 -0
  35. package/dist/src/proto/gen/dxos/credentials.js +3 -0
  36. package/dist/src/proto/gen/dxos/credentials.js.map +1 -0
  37. package/dist/src/proto/gen/dxos/devtools.d.ts +196 -0
  38. package/dist/src/proto/gen/dxos/devtools.d.ts.map +1 -0
  39. package/dist/src/proto/gen/dxos/devtools.js +3 -0
  40. package/dist/src/proto/gen/dxos/devtools.js.map +1 -0
  41. package/dist/src/proto/gen/dxos/echo/feed.d.ts +69 -0
  42. package/dist/src/proto/gen/dxos/echo/feed.d.ts.map +1 -0
  43. package/dist/src/proto/gen/dxos/echo/feed.js +13 -0
  44. package/dist/src/proto/gen/dxos/echo/feed.js.map +1 -0
  45. package/dist/src/proto/gen/dxos/echo/invitation.d.ts +20 -0
  46. package/dist/src/proto/gen/dxos/echo/invitation.d.ts.map +1 -0
  47. package/dist/src/proto/gen/dxos/echo/invitation.js +12 -0
  48. package/dist/src/proto/gen/dxos/echo/invitation.js.map +1 -0
  49. package/dist/src/proto/gen/dxos/echo/metadata.d.ts +19 -0
  50. package/dist/src/proto/gen/dxos/echo/metadata.d.ts.map +1 -0
  51. package/dist/src/proto/gen/dxos/echo/metadata.js +3 -0
  52. package/dist/src/proto/gen/dxos/echo/metadata.js.map +1 -0
  53. package/dist/src/proto/gen/dxos/echo/service.d.ts +47 -0
  54. package/dist/src/proto/gen/dxos/echo/service.d.ts.map +1 -0
  55. package/dist/src/proto/gen/dxos/echo/service.js +3 -0
  56. package/dist/src/proto/gen/dxos/echo/service.js.map +1 -0
  57. package/dist/src/proto/gen/dxos/echo/snapshot.d.ts +51 -0
  58. package/dist/src/proto/gen/dxos/echo/snapshot.d.ts.map +1 -0
  59. package/dist/src/proto/gen/dxos/echo/snapshot.js +3 -0
  60. package/dist/src/proto/gen/dxos/echo/snapshot.js.map +1 -0
  61. package/dist/src/proto/gen/dxos/halo/keys.d.ts +59 -0
  62. package/dist/src/proto/gen/dxos/halo/keys.d.ts.map +1 -0
  63. package/dist/src/proto/gen/dxos/halo/keys.js +13 -0
  64. package/dist/src/proto/gen/dxos/halo/keys.js.map +1 -0
  65. package/dist/src/proto/gen/dxos/rpc.d.ts +41 -0
  66. package/dist/src/proto/gen/dxos/rpc.d.ts.map +1 -0
  67. package/dist/src/proto/gen/dxos/rpc.js +12 -0
  68. package/dist/src/proto/gen/dxos/rpc.js.map +1 -0
  69. package/dist/src/proto/gen/google/protobuf.d.ts +277 -0
  70. package/dist/src/proto/gen/google/protobuf.d.ts.map +1 -0
  71. package/dist/src/proto/gen/google/protobuf.js +58 -0
  72. package/dist/src/proto/gen/google/protobuf.js.map +1 -0
  73. package/dist/src/proto/gen/index.d.ts +249 -0
  74. package/dist/src/proto/gen/index.d.ts.map +1 -0
  75. package/dist/src/proto/gen/index.js +7 -0
  76. package/dist/src/proto/gen/index.js.map +1 -0
  77. package/dist/tsconfig.tsbuildinfo +1 -0
  78. package/package.json +35 -0
  79. package/src/index.ts +3 -0
  80. package/src/proto/dxos/bot.proto +120 -0
  81. package/src/proto/dxos/client.proto +237 -0
  82. package/src/proto/dxos/config.proto +254 -0
  83. package/src/proto/dxos/devtools.proto +271 -0
  84. package/src/proto/dxos/echo/feed.proto +93 -0
  85. package/src/proto/dxos/echo/invitation.proto +29 -0
  86. package/src/proto/dxos/echo/metadata.proto +30 -0
  87. package/src/proto/dxos/echo/service.proto +64 -0
  88. package/src/proto/dxos/echo/snapshot.proto +88 -0
  89. package/src/proto/dxos/halo/auth.proto +20 -0
  90. package/src/proto/dxos/halo/greet.proto +125 -0
  91. package/src/proto/dxos/halo/identity.proto +24 -0
  92. package/src/proto/dxos/halo/keys.proto +88 -0
  93. package/src/proto/dxos/halo/party.proto +127 -0
  94. package/src/proto/dxos/halo/signed.proto +42 -0
  95. package/src/proto/dxos/rpc.proto +59 -0
  96. package/src/proto/gen/dxos/bot.ts +120 -0
  97. package/src/proto/gen/dxos/client.ts +190 -0
  98. package/src/proto/gen/dxos/config.ts +225 -0
  99. package/src/proto/gen/dxos/credentials/auth.ts +26 -0
  100. package/src/proto/gen/dxos/credentials/greet.ts +53 -0
  101. package/src/proto/gen/dxos/credentials/identity.ts +25 -0
  102. package/src/proto/gen/dxos/credentials/party.ts +63 -0
  103. package/src/proto/gen/dxos/credentials.ts +39 -0
  104. package/src/proto/gen/dxos/devtools.ts +206 -0
  105. package/src/proto/gen/dxos/echo/feed.ts +84 -0
  106. package/src/proto/gen/dxos/echo/invitation.ts +36 -0
  107. package/src/proto/gen/dxos/echo/metadata.ts +33 -0
  108. package/src/proto/gen/dxos/echo/service.ts +59 -0
  109. package/src/proto/gen/dxos/echo/snapshot.ts +66 -0
  110. package/src/proto/gen/dxos/halo/keys.ts +74 -0
  111. package/src/proto/gen/dxos/rpc.ts +56 -0
  112. package/src/proto/gen/google/protobuf.ts +293 -0
  113. package/src/proto/gen/index.ts +248 -0
@@ -0,0 +1,125 @@
1
+ //
2
+ // Copyright 2020 DXOS.org
3
+ //
4
+
5
+ syntax = "proto3";
6
+
7
+ package dxos.credentials.greet;
8
+
9
+ import "keys.proto";
10
+ import "party.proto";
11
+ import "google/protobuf/any.proto";
12
+ import "google/protobuf/wrappers.proto";
13
+
14
+ //
15
+ // Greeting protocol:
16
+ //
17
+ // Two nodes: Greeter which acts like a "server" and Invitee which acts like a "client".
18
+ // All interactions are request/response with the request always sent by the Invitee and the response always
19
+ // sent by the Invitee.
20
+ //
21
+ // 1) An invitation is generated for the Invitee with a unique ID, known to the Greeter.
22
+ // 2) The Invitee connects to the Greeter over an *open* Topic, using the invitation ID as their peer ID.
23
+ // This is NOT the Topic of the Party they wish to join, it is one used for Greeting.
24
+ // 3) The Invitee sends a Command message of type BEGIN. This signals the arrival of the invitee, and if necessary,
25
+ // triggers creation or retrieval of an auth secret for the rest of the process. This secret is normally
26
+ // communicated out-of-band (eg, voice, IM, etc.). The Greeter responds with a BeginResponse message, acknowledging
27
+ // the request and indicating the Invitee should proceed to the next step:
28
+ // 4) The Invitee sends a Command message of type HANDSHAKE which includes their secret (eg, PIN, AuthMessage).
29
+ // 5) The Greeter validates the contents (it's genuine, hasn't already been redeemed, the secret matches, etc.)
30
+ // 6) The Greeter returns a HandshakeResponse message with the Party public key and challenge nonce.
31
+ // 7) The Invitee generates one or more AdmitKey and AdmitFeed messages, including the nonce from step (5) then signs
32
+ // the contents in a SignedMessage.
33
+ // 8) The Invitee sends the SignedMessages in a Command message of type NOTARIZE.
34
+ // 9) The Greeter checks credentials presented and validates the SignedMessage signatures and nonce values.
35
+ // If all the checks pass then the Admit messages may be published on the Greeter's feed for the target Party,
36
+ // placed in Envelope messages signed by the Greeter.
37
+ // 10) After writing the messages, the Greeter marks the invitation as having been redeemed, so that it cannot be
38
+ // used again.
39
+ // 11) The Greeter sends copies of the Greeter-signed Envelope messages to the Invitee in a NotarizeResponse message,
40
+ // as well as a list of "hints" regarding keys and feeds which are enrolled in the Party. The Invitee uses thes
41
+ // "hints" to construct its initial view of Party membership, necessary to participate in mutual authentication
42
+ // for Party feed replication.
43
+ // 12) The Invitee sends the Greeter a FINISH command to acknowledge receipt.
44
+
45
+ /**
46
+ * A Greeter command.
47
+ */
48
+ message Command {
49
+ enum Type {
50
+ BEGIN = 0;
51
+ HANDSHAKE = 1;
52
+ NOTARIZE = 2;
53
+ FINISH = 3;
54
+ CLAIM = 10;
55
+ }
56
+
57
+ Type command = 1;
58
+
59
+ // Auth secret (PIN, hash, AuthMessage, etc.).
60
+ bytes secret = 2;
61
+
62
+ // TODO(burdon): These seem to be signed messages? In which case we already know the type.
63
+ // TODO(dboreham): static typing of contained messages is not yet supported, change from any when it is.
64
+ // Parameters to the command.
65
+ repeated google.protobuf.Any params = 10;
66
+ };
67
+
68
+ //
69
+ // Info is optional, and not needed for very simple schemes like using a PIN, but more complicated scenarios schemes
70
+ // might need to communicate additional info in the response (eg, what key is expected for a signed AuthMessage).
71
+ //
72
+ message BeginResponse {
73
+ map<string, google.protobuf.Any> info = 1;
74
+ }
75
+
76
+ //
77
+ // The next command is 'HANDSHAKE', the invitee sends the `secret` for authentication, and if successful, the
78
+ // Greeter returns the `partyKey` and a `nonce` which the invitee will need to use for the Party credential messages.
79
+ //
80
+ message HandshakeResponse {
81
+ // Random bytes which must be included in the signed portion of messages submitted in a 'NOTARIZE' command
82
+ // (proving ownership of the keys in question).
83
+ bytes nonce = 1;
84
+
85
+ // The public key of the party.
86
+ PubKey partyKey = 2;
87
+ };
88
+
89
+ //
90
+ // The 'NOTARIZE' command takes an array of SignedMessages which the invitee would like added to the Party. The
91
+ // standard case would be a message admitting an Identity (or Device) key and a message admitting a feed.
92
+ //
93
+ message NotarizeResponse {
94
+ // A copy of each of the messages as written to the Party (now in an Envelope signed by the Greeter) and the Feed
95
+ // and key hints necessary to bootstrap the invitee into the Party.
96
+ repeated google.protobuf.Any copies = 1;
97
+
98
+ // Feed and key hints necessary to bootstrap the invitee into the Party.
99
+ repeated KeyHint hints = 2;
100
+ };
101
+
102
+ //
103
+ // Feed and key hints are required by the invitee, because even though the Party members now trust it, it does not trust
104
+ // them. Until it has a chance to replicate, it cannot construct its own understanding of the Party from party.*
105
+ // messages, but neither can it replicate unless it trusts its peers. The Hints break this cycle by providing an
106
+ // initial set of keys and Feeds to trust.
107
+ //
108
+ message KeyHint {
109
+ // TODO(telackey): These should be changed to be the full set of signed party messages, so the recipient can build
110
+ // and verify the party structure just as it would if it had obtained them from the feeds.
111
+ PubKey publicKey = 1;
112
+ KeyType type = 2;
113
+ }
114
+
115
+ //
116
+ // The 'CLAIM' command is used to trigger the Greeting flow by "claiming" a PartyInvitation which was replicated
117
+ // to the Party or presented as a "proof".
118
+ //
119
+ // The ClaimResponse provides the invitee with information about the interactive invitation triggered by the "claim",
120
+ // such as the invitation ID and the swarm key to use to connect to the Greeter.
121
+ //
122
+ message ClaimResponse {
123
+ bytes id = 1; // The ID of the invitation.
124
+ bytes rendezvousKey = 2; // The swarm key to use to rendezvous with the Greeter.
125
+ }
@@ -0,0 +1,24 @@
1
+ //
2
+ // Copyright 2020 DXOS.org
3
+ //
4
+
5
+ syntax = "proto3";
6
+
7
+ package dxos.credentials.identity;
8
+
9
+ import "google/protobuf/any.proto";
10
+ import "greet.proto";
11
+ import "keys.proto";
12
+ import "signed.proto";
13
+
14
+ // Additional, descriptive information about an Identity. Must be signed by the Identity's key.
15
+ message IdentityInfo {
16
+ PubKey publicKey = 1; // The publicKey of the Identity (must be signed by this key).
17
+ string displayName = 2; // The display name to use for this key.
18
+ }
19
+
20
+ // Additional, descriptive information about a Device. Must be signed by the Device's key.
21
+ message DeviceInfo {
22
+ PubKey publicKey = 1; // The publicKey of the Device (must be signed by this key).
23
+ string displayName = 2; // The display name to use for this key.
24
+ }
@@ -0,0 +1,88 @@
1
+ //
2
+ // Copyright 2020 DXOS.org
3
+ //
4
+
5
+ syntax = "proto3";
6
+
7
+ package dxos.halo.keys;
8
+
9
+ import "signed.proto";
10
+ import "google/protobuf/any.proto";
11
+
12
+ //
13
+ // The type/use of a public key.
14
+ //
15
+ enum KeyType {
16
+ UNKNOWN = 0;
17
+ IDENTITY = 1;
18
+ DEVICE = 2;
19
+ PARTY = 3;
20
+ FEED = 4;
21
+ DXNS_ADDRESS = 5;
22
+ }
23
+
24
+ message PubKey {
25
+ bytes data = 1;
26
+ }
27
+
28
+ message PrivKey {
29
+ bytes data = 1;
30
+ }
31
+
32
+ message KeyRecord {
33
+ /**
34
+ * - The `KeyType` type of the key. This is often unknown for keys from other sources.
35
+ */
36
+ required KeyType type = 1;
37
+
38
+ /**
39
+ * - The public key as a Buffer (required).
40
+ */
41
+ required PubKey publicKey = 2;
42
+
43
+ /**
44
+ * - The secret key as a Buffer (this will never be visible outside the Keyring).
45
+ */
46
+ PrivKey secretKey = 3;
47
+
48
+ /**
49
+ * - Is this key from a Greeting "hint"?
50
+ */
51
+ bool hint = 4;
52
+
53
+ /**
54
+ * - Is this our key? Usually true if `secretKey` is present,
55
+ * may be false for "inception keys" such as the Party key.
56
+ */
57
+ bool own = 5;
58
+
59
+ /**
60
+ * - Is this key to be trusted?
61
+ */
62
+ bool trusted = 6;
63
+
64
+ /**
65
+ * - An RFC-3339 date/time string for when the key was added to the Keyring.
66
+ */
67
+ string added = 7;
68
+
69
+ /**
70
+ * - An RFC-3339 date/time string for when the key was created.
71
+ */
72
+ string created = 8;
73
+ }
74
+
75
+ message KeyRecordList {
76
+ repeated KeyRecord keys = 1;
77
+ }
78
+
79
+ //
80
+ // A key which includes its parent keys and SignedMessages leading back to the root of its authority.
81
+ // For example, if IdentityA signed for DeviceA, which signed for DeviceB, which signed for DeviceC the chain
82
+ // would comprised: DeviceC->DeviceB->DeviceA->IdentityA moving from tip to root.
83
+ //
84
+ message KeyChain {
85
+ required PubKey publicKey = 1;
86
+ required SignedMessage message = 2;
87
+ repeated KeyChain parents = 3;
88
+ }
@@ -0,0 +1,127 @@
1
+ //
2
+ // Copyright 2020 DXOS.org
3
+ //
4
+
5
+ syntax = "proto3";
6
+
7
+ package dxos.credentials.party;
8
+
9
+ import "keys.proto";
10
+ import "signed.proto";
11
+ import "google/protobuf/any.proto";
12
+
13
+ //
14
+ // Party Credentials are messages that, by virtue of their being signed by a key that is a
15
+ // recognized authority, convey to the recipient that something should be allowed or done.
16
+ // They are therefore similar in structure and purpose to X.509 certificates and to W3C
17
+ // Verifiable Credentials. The "subject" for a Party Credential (who or what can do the thing allowed),
18
+ // along with the kind of action permitted is specified in one of the four contained message
19
+ // types: PartyGenesis, FeedGenesis, KeyAdmit, FeedAdmit. One such subject message is
20
+ // present in the contents field of each PartyCredential message.
21
+ // PartyMessage carries common metadata (created, nonce) and the type of the subject message (type).
22
+ // Note that the subject message type is explicitly present in the type field even though
23
+ // its type will be discoverable via the relevant codec at runtime. This arrangement allows
24
+ // for signing to be done over the relevant fields (fields for which signature inclusion is
25
+ // necessary to ensure the security of the system), without needing to make assumptions about
26
+ // the presence and specific form of the codec-supplied message type identification.
27
+ // The complete credential comprises the PartyCredential message contents, signed by the
28
+ // relevant authority key(s), encoded as a SignedMessage (see ../signed.proto).
29
+ //
30
+ message PartyCredential {
31
+ enum Type {
32
+ ENVELOPE = 0;
33
+ PARTY_GENESIS = 1;
34
+ FEED_GENESIS = 2;
35
+ KEY_ADMIT = 3;
36
+ FEED_ADMIT = 4;
37
+ }
38
+
39
+ Type type = 1;
40
+
41
+ oneof contents {
42
+ Envelope envelope = 10;
43
+ PartyGenesis partyGenesis = 11;
44
+ KeyAdmit keyAdmit = 12;
45
+ FeedAdmit feedAdmit = 13;
46
+ FeedGenesis feedGenesis = 14;
47
+ }
48
+ }
49
+
50
+ //
51
+ // The start-of-authority record for the Party, admitting a single key (usually a pseudonym) and a single feed.
52
+ // It must be signed by all three keys (party, key, feed). The Party private key should be destroyed after
53
+ // signing this message. This pattern is sometimes called an Inception Key.
54
+ //
55
+ message PartyGenesis {
56
+ PubKey partyKey = 1; // The party public key.
57
+ PubKey feedKey = 2; // The initial feed to admit.
58
+ PubKey admitKey = 3; // The key to admit (usually a pseudonym key).
59
+ KeyType admitKeyType = 4; // The KeyType of the admitKey.
60
+ }
61
+
62
+ //
63
+ // Admit a single public key to the Party. This message must be signed by the key to be admitted, to prevent
64
+ // impersonation attacks, and unless the contents of an Envelope, also by a key which has already been admitted.
65
+ // Admitted keys represent entities in the Party Authority trust tree, for example: an identity pseudonym key
66
+ // representing "Alice in this party", or a device pseudonym key representing "Alice's Laptop in this Party".
67
+ //
68
+ message KeyAdmit {
69
+ PubKey partyKey = 1;
70
+ PubKey admitKey = 2; // The public key to admit.
71
+ KeyType admitKeyType = 3; // The KeyType of the admitKey.
72
+ }
73
+
74
+ //
75
+ // Admit a single feed to the Party. This message must be signed by the feed key to be admitted, also by some other
76
+ // key which has already been admitted (usually by a device pseudonym key).
77
+ // FeedAdmit messages constitute the leaf nodes in the Party Authority trust tree in that Party data is transmitted
78
+ // via feeds and therefore to write to a Party a node must have at least one feed admitted.
79
+ //
80
+ message FeedAdmit {
81
+ PubKey partyKey = 1; // The Party public key.
82
+ PubKey feedKey = 2; // The Feed public key.
83
+ }
84
+
85
+ //
86
+ // The start-of-authority record for the Feed, signed by the owner of the feed and the feed.
87
+ // The owner must be a key previously admitted to the Party.
88
+ //
89
+ message FeedGenesis {
90
+ PubKey feedKey = 1; // The feed public key.
91
+ PubKey ownerKey = 2; // The public key of the owner of this feed.
92
+ }
93
+
94
+ //
95
+ // TODO(burdon): Needs discussion.
96
+ // A signed message containing a signed message. The nested signed structure allows a signed message
97
+ // received from another node that is not yet a party member (invitee), to be published on the party on behalf
98
+ // of that node by another node (greeter). It thereby provides a kind of delegated authority mechanism used to
99
+ // link signatures across the two nodes in a replay and impersonation resistant manner.
100
+ // Envelope is used by a Greeter to write, and countersign using
101
+ // its key, a message provided to it, signed by the Invitee, to the Party, via the greeting node's feed.
102
+ // The signature on the Envelope is that of the Greeter, while the signature(s) on the interior message are
103
+ // those of the Invitee, demonstrating ownership by the Invitee of the keys or feeds to be admitted.
104
+ // Envelope exists solely to include the party key under the countersignature, otherwise two nested SignedMessages
105
+ // could be used. The party key is included to prevent replay attacks where a valid credential from one
106
+ // party is used to gain access to a different party.
107
+ // The interior message can only be of types:
108
+ // KEY_ADMIT
109
+ // FEED_ADMIT
110
+ //
111
+ message Envelope {
112
+ PubKey partyKey = 1; // The Party public key.
113
+ Message message = 2; // The original Message.
114
+ }
115
+
116
+ //
117
+ // A PartyInvitation message that can be written to the Party so that any Party member can authenticate
118
+ // the invitee and perform greeting. This message must be written within a SignedMessage signed by the key (or KeyChain)
119
+ // of listed as the `issuer`. The invitee must authenticate themselves to the Greeter with Auth messages signed by
120
+ // the key (or KeyChain) of listed in the `invitee` field.
121
+ //
122
+ message PartyInvitation {
123
+ bytes id = 1; // A unique ID for this Invitation.
124
+ PubKey partyKey = 2; // The public key of the Party for which this Invitation is valid.
125
+ PubKey issuerKey = 3; // The public key of the Party member issuing this invitation.
126
+ PubKey inviteeKey = 4; // The public key of the non-member that is being invited to join the Party.
127
+ }
@@ -0,0 +1,42 @@
1
+ //
2
+ // Copyright 2020 DXOS.org
3
+ //
4
+
5
+ syntax = "proto3";
6
+
7
+ // TODO(burdon): Rename dxos.halo?
8
+ package dxos.credentials;
9
+
10
+ import "keys.proto";
11
+ import "google/protobuf/any.proto";
12
+
13
+ // TODO(burdon): Use default from codec-protobuf.
14
+ message Message {
15
+ required google.protobuf.Any payload = 1;
16
+ }
17
+
18
+ /**
19
+ * A generic container message used whenever messages are signed (e.g. PartyCredential)
20
+ */
21
+ message SignedMessage {
22
+ //
23
+ // Provides the common metadata needed for all signed objects.
24
+ //
25
+ message Signed {
26
+ required string created = 1; // RFC-3339 datetime string.
27
+ required bytes nonce = 2;
28
+ required google.protobuf.Any payload = 10; // The payload to be signed.
29
+ }
30
+
31
+ //
32
+ // The signature data itself.
33
+ //
34
+ message Signature {
35
+ required PubKey key = 1; // The publicKey of the keypair that made this signature.
36
+ required bytes signature = 2; // The bytes of the signature.
37
+ KeyChain keyChain = 3; // Optional. The certification chain of SignedMessages for this key.
38
+ }
39
+
40
+ required Signed signed = 1; // The signed message contents.
41
+ repeated Signature signatures = 2; // An array of Signatures, one for each key that signed the message.
42
+ }
@@ -0,0 +1,59 @@
1
+ //
2
+ // Copyright 2020 DXOS.org
3
+ //
4
+
5
+ syntax = "proto3";
6
+
7
+ import "google/protobuf/any.proto";
8
+
9
+ package dxos.rpc;
10
+
11
+ message RpcMessage {
12
+ oneof content {
13
+ Request request = 1;
14
+ Response response = 2;
15
+
16
+ /// Means that the node is open to receiving requests. Second stage of the hasnshake protocol.
17
+ bool open = 3;
18
+
19
+ StreamClose streamClose = 4;
20
+ }
21
+ }
22
+
23
+ message Request {
24
+ int32 id = 1;
25
+ string method = 2;
26
+ google.protobuf.Any payload = 3;
27
+ bool stream = 4;
28
+ }
29
+
30
+ message Response {
31
+ int32 id = 1;
32
+ oneof content {
33
+ google.protobuf.Any payload = 2;
34
+ Error error = 3;
35
+ // Sent when stream is closed without an error.
36
+ bool close = 4;
37
+ }
38
+ }
39
+
40
+ // Sent by client to end the streaming response.
41
+ message StreamClose {
42
+ int32 id = 1;
43
+ }
44
+
45
+ message Error {
46
+ string name = 1;
47
+ string message = 2;
48
+ string stack = 3;
49
+ }
50
+
51
+ message MessageTrace {
52
+ enum Direction {
53
+ INCOMING = 0;
54
+ OUTGOING = 1;
55
+ }
56
+
57
+ Direction direction = 1;
58
+ bytes data = 2;
59
+ }
@@ -0,0 +1,120 @@
1
+ import type { Stream } from "@dxos/codec-protobuf";
2
+ import * as dxos_client from "./client";
3
+ import * as dxos_config from "./config";
4
+ import * as dxos_credentials from "./credentials";
5
+ import * as dxos_credentials_auth from "./credentials/auth";
6
+ import * as dxos_credentials_greet from "./credentials/greet";
7
+ import * as dxos_credentials_identity from "./credentials/identity";
8
+ import * as dxos_credentials_party from "./credentials/party";
9
+ import * as dxos_devtools from "./devtools";
10
+ import * as dxos_echo_feed from "./echo/feed";
11
+ import * as dxos_echo_invitation from "./echo/invitation";
12
+ import * as dxos_echo_metadata from "./echo/metadata";
13
+ import * as dxos_echo_service from "./echo/service";
14
+ import * as dxos_echo_snapshot from "./echo/snapshot";
15
+ import * as dxos_halo_keys from "./halo/keys";
16
+ import * as dxos_rpc from "./rpc";
17
+ import * as google_protobuf from "../google/protobuf";
18
+ export interface BotPackageSpecifier {
19
+ dxn?: string;
20
+ ipfsCid?: string;
21
+ localPath?: string;
22
+ }
23
+ export interface Bot {
24
+ id?: string;
25
+ status?: Bot.Status;
26
+ packageSpecifier?: BotPackageSpecifier;
27
+ lastStart?: google_protobuf.Timestamp;
28
+ partyKey?: dxos_halo_keys.PubKey;
29
+ runtime?: Bot.Runtime;
30
+ }
31
+ export namespace Bot {
32
+ export enum Status {
33
+ STOPPED = 0,
34
+ STARTING = 1,
35
+ RUNNING = 2,
36
+ STOPPING = 3
37
+ }
38
+ export interface Runtime {
39
+ exitCode?: number;
40
+ exitSignal?: string;
41
+ error?: string;
42
+ }
43
+ }
44
+ export interface GetBotsResponse {
45
+ bots?: Bot[];
46
+ }
47
+ export interface SpawnBotRequest {
48
+ package?: BotPackageSpecifier;
49
+ /**
50
+ * Invitation for the bot to join the target party.
51
+ */
52
+ invitation?: dxos_echo_invitation.InvitationDescriptor;
53
+ /**
54
+ * Key of the party bot is invited to.
55
+ */
56
+ partyKey?: dxos_halo_keys.PubKey;
57
+ }
58
+ export interface SendCommandRequest {
59
+ botId?: string;
60
+ command?: Uint8Array;
61
+ }
62
+ export interface SendCommandResponse {
63
+ response?: Uint8Array;
64
+ }
65
+ export interface GetLogsResponse {
66
+ chunk?: Uint8Array;
67
+ }
68
+ export interface GetLogsRequest {
69
+ botId?: string;
70
+ }
71
+ /**
72
+ * Service that is used by clients to communicate with bot factory.
73
+ */
74
+ export interface BotFactoryService {
75
+ getBots: (request: void) => Promise<GetBotsResponse>;
76
+ spawnBot: (request: SpawnBotRequest) => Promise<Bot>;
77
+ start: (request: Bot) => Promise<Bot>;
78
+ stop: (request: Bot) => Promise<Bot>;
79
+ remove: (request: Bot) => Promise<void>;
80
+ getLogs: (request: GetLogsRequest) => Stream<GetLogsResponse>;
81
+ sendCommand: (request: SendCommandRequest) => Promise<SendCommandResponse>;
82
+ removeAll: (request: void) => Promise<void>;
83
+ }
84
+ export interface InitializeRequest {
85
+ /**
86
+ * Bot runtime configuration.
87
+ */
88
+ config?: dxos_config.Config;
89
+ /**
90
+ * Invitation for the bot to join the target party.
91
+ */
92
+ invitation?: dxos_echo_invitation.InvitationDescriptor;
93
+ }
94
+ export interface StartRequest {
95
+ /**
96
+ * Bot runtime configuration.
97
+ */
98
+ config?: dxos_config.Config;
99
+ }
100
+ /**
101
+ * Service that is used by bots communicating with bot factory.
102
+ */
103
+ export interface BotService {
104
+ /**
105
+ * Initialize Client, create profile, and join a party.
106
+ */
107
+ initialize: (request: InitializeRequest) => Promise<void>;
108
+ /**
109
+ * Initialize Client.
110
+ */
111
+ start: (request: StartRequest) => Promise<void>;
112
+ /**
113
+ * Custom commands sent to the bot factory.
114
+ */
115
+ command: (request: SendCommandRequest) => Promise<SendCommandResponse>;
116
+ /**
117
+ * Stop the bot.
118
+ */
119
+ stop: (request: void) => Promise<void>;
120
+ }