@dxos/protocols 2.33.9-dev.7d11f506 → 2.33.9-dev.8e92e630
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/src/index.d.ts +0 -1
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +0 -1
- package/dist/src/index.js.map +1 -1
- package/dist/src/proto/index.d.ts +0 -1
- package/dist/src/proto/index.d.ts.map +1 -1
- package/dist/src/proto/index.js +0 -16
- package/dist/src/proto/index.js.map +1 -1
- package/dist/src/public-key.d.ts +2 -2
- package/dist/src/public-key.d.ts.map +1 -1
- package/dist/src/public-key.js +31 -7
- package/dist/src/public-key.js.map +1 -1
- package/dist/src/timeframe.d.ts +1 -1
- package/dist/src/timeframe.d.ts.map +1 -1
- package/dist/src/timeframe.js +2 -2
- package/dist/src/timeframe.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -4
- package/src/index.ts +0 -1
- package/src/proto/dxos/bot.proto +21 -21
- package/src/proto/dxos/client.proto +17 -17
- package/src/proto/dxos/config.proto +90 -90
- package/src/proto/dxos/devtools.proto +15 -15
- package/src/proto/dxos/echo/feed.proto +9 -9
- package/src/proto/dxos/echo/invitation.proto +2 -2
- package/src/proto/dxos/echo/metadata.proto +4 -4
- package/src/proto/dxos/echo/snapshot.proto +5 -4
- package/src/proto/dxos/halo/auth.proto +2 -2
- package/src/proto/dxos/halo/greet.proto +1 -1
- package/src/proto/dxos/halo/keys.proto +6 -6
- package/src/proto/dxos/halo/signed.proto +14 -7
- package/src/proto/dxos/rpc.proto +3 -3
- package/src/proto/index.ts +0 -2
- package/src/public-key.ts +32 -4
- package/src/timeframe.ts +1 -1
|
@@ -23,20 +23,27 @@ message SignedMessage {
|
|
|
23
23
|
// Provides the common metadata needed for all signed objects.
|
|
24
24
|
//
|
|
25
25
|
message Signed {
|
|
26
|
-
|
|
26
|
+
/// RFC-3339 datetime string.
|
|
27
|
+
required string created = 1;
|
|
27
28
|
required bytes nonce = 2;
|
|
28
|
-
|
|
29
|
+
/// The payload to be signed.
|
|
30
|
+
required google.protobuf.Any payload = 10;
|
|
29
31
|
}
|
|
30
32
|
|
|
31
33
|
//
|
|
32
34
|
// The signature data itself.
|
|
33
35
|
//
|
|
34
36
|
message Signature {
|
|
35
|
-
|
|
36
|
-
required
|
|
37
|
-
|
|
37
|
+
/// The publicKey of the keypair that made this signature.
|
|
38
|
+
required PubKey key = 1;
|
|
39
|
+
/// The bytes of the signature.
|
|
40
|
+
required bytes signature = 2;
|
|
41
|
+
/// The certification chain of SignedMessages for this key.
|
|
42
|
+
optional KeyChain keyChain = 3;
|
|
38
43
|
}
|
|
39
44
|
|
|
40
|
-
|
|
41
|
-
|
|
45
|
+
/// The signed message contents.
|
|
46
|
+
required Signed signed = 1;
|
|
47
|
+
/// An array of Signatures, one for each key that signed the message.
|
|
48
|
+
repeated Signature signatures = 2;
|
|
42
49
|
}
|
package/src/proto/dxos/rpc.proto
CHANGED
package/src/proto/index.ts
CHANGED
package/src/public-key.ts
CHANGED
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// Copyright 2020 DXOS.org
|
|
3
3
|
//
|
|
4
4
|
|
|
5
|
-
import assert from 'assert';
|
|
5
|
+
import assert from 'node:assert';
|
|
6
|
+
import { inspect, InspectOptionsStylized } from 'node:util';
|
|
6
7
|
import randomBytes from 'randombytes';
|
|
7
|
-
import { inspect } from 'util';
|
|
8
8
|
|
|
9
9
|
export const PUBLIC_KEY_LENGTH = 32;
|
|
10
10
|
export const SECRET_KEY_LENGTH = 64;
|
|
@@ -156,8 +156,36 @@ export class PublicKey {
|
|
|
156
156
|
/**
|
|
157
157
|
* Used by NodeJS to get textual representation of this object when it's printed with a `console.log` statement.
|
|
158
158
|
*/
|
|
159
|
-
[inspect.custom] () {
|
|
160
|
-
|
|
159
|
+
[inspect.custom] (depth: number, options: InspectOptionsStylized) {
|
|
160
|
+
if (!options.colors || !process.stdout.hasColors()) {
|
|
161
|
+
return `<PublicKey ${this.truncate()}>`;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
const printControlCode = (code: number) => {
|
|
165
|
+
return `\x1b[${code}m`;
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// Compute simple hash of the key.
|
|
169
|
+
const hash = Math.abs(this._value.reduce((acc, val) => acc ^ val | 0, 0));
|
|
170
|
+
|
|
171
|
+
const colors = [
|
|
172
|
+
'red',
|
|
173
|
+
'green',
|
|
174
|
+
'yellow',
|
|
175
|
+
'blue',
|
|
176
|
+
'magenta',
|
|
177
|
+
'cyan',
|
|
178
|
+
'redBright',
|
|
179
|
+
'greenBright',
|
|
180
|
+
'yellowBright',
|
|
181
|
+
'blueBright',
|
|
182
|
+
'magentaBright',
|
|
183
|
+
'cyanBright',
|
|
184
|
+
'whiteBright'
|
|
185
|
+
];
|
|
186
|
+
const color = colors[hash % colors.length];
|
|
187
|
+
|
|
188
|
+
return `<PublicKey ${printControlCode(inspect.colors[color]![0])}${this.truncate()}${printControlCode(inspect.colors.reset![0])}>`;
|
|
161
189
|
}
|
|
162
190
|
|
|
163
191
|
/**
|