@ccmsg/protocol 1.0.0 → 1.1.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.
- package/package.json +1 -1
- package/src/common/auth.ts +33 -0
- package/src/common/hello.ts +8 -3
package/package.json
CHANGED
package/src/common/auth.ts
CHANGED
|
@@ -92,6 +92,11 @@ export const RegisterClaims = Type.Object(
|
|
|
92
92
|
expires_at: Timestamp,
|
|
93
93
|
/** Names this registration, so it can be spent once. */
|
|
94
94
|
jti: Type.String({ minLength: 1 }),
|
|
95
|
+
/** What the administrator who issued the URL wrote down about who it was
|
|
96
|
+
* for. Their words, not the holder's — the label the person gives their
|
|
97
|
+
* own device is `device_label` on the record, and the two are worth telling
|
|
98
|
+
* apart when a list is read back later. */
|
|
99
|
+
issued_label: Type.Optional(Type.String({ maxLength: 128 })),
|
|
95
100
|
},
|
|
96
101
|
{ $id: "RegisterClaims" },
|
|
97
102
|
);
|
|
@@ -118,6 +123,14 @@ export const AuthRegisterArgs = Type.Object({
|
|
|
118
123
|
/** The registration URL's token, opaque to the caller and to any instance
|
|
119
124
|
* but its issuer. */
|
|
120
125
|
token: Type.String({ minLength: 1 }),
|
|
126
|
+
/** The six digits the command line showed when the URL was made, typed in by
|
|
127
|
+
* the person registering. It is not in the URL and never travels with it, so
|
|
128
|
+
* a leaked URL is not a registration: the two halves reach the browser by
|
|
129
|
+
* different routes, and only someone who was shown the terminal has both. */
|
|
130
|
+
code: Type.String({ pattern: "^[0-9]{6}$" }),
|
|
131
|
+
/** What the person calls the device they are registering, for their own use
|
|
132
|
+
* when they later read back a list of several. Nothing is decided by it. */
|
|
133
|
+
device_label: Type.Optional(Type.String({ maxLength: 128 })),
|
|
121
134
|
credential: RegistrationCredential,
|
|
122
135
|
});
|
|
123
136
|
export type AuthRegisterArgs = Static<typeof AuthRegisterArgs>;
|
|
@@ -283,7 +296,27 @@ export const CredentialRecord = Type.Object(
|
|
|
283
296
|
* zero forever, so only a pair of non-zero readings says anything, and a
|
|
284
297
|
* reading below the last one is a refusal. */
|
|
285
298
|
sign_count: Type.Optional(Type.Integer({ minimum: 0 })),
|
|
299
|
+
/** The label the administrator put on the registration URL, carried over
|
|
300
|
+
* from the claims it was spent against. */
|
|
301
|
+
issued_label: Type.Optional(Type.String({ maxLength: 128 })),
|
|
302
|
+
/** The label the person put on this device as they registered it. */
|
|
303
|
+
device_label: Type.Optional(Type.String({ maxLength: 128 })),
|
|
286
304
|
registered_at: Timestamp,
|
|
305
|
+
/** Where the registration came from and what browser sent it.
|
|
306
|
+
*
|
|
307
|
+
* None of this authenticates anything, and nothing is ever admitted or
|
|
308
|
+
* refused by it — an address is trivially chosen by whoever is making the
|
|
309
|
+
* request. They are here to be recognised by the one person reading their
|
|
310
|
+
* own list: an address that is their home provider's and a browser that is
|
|
311
|
+
* the one they use is how they place a line as theirs, or fail to, which is
|
|
312
|
+
* the whole reason to keep it. The same holds of the pair below. */
|
|
313
|
+
registered_ip: Type.Optional(Type.String({ minLength: 1, maxLength: 45 })),
|
|
314
|
+
registered_user_agent: Type.Optional(Type.String({ maxLength: 512 })),
|
|
315
|
+
/** When this credential last answered a challenge, and from where. A
|
|
316
|
+
* credential the person no longer recognises is one they remove. */
|
|
317
|
+
last_used_at: Type.Optional(Timestamp),
|
|
318
|
+
last_used_ip: Type.Optional(Type.String({ minLength: 1, maxLength: 45 })),
|
|
319
|
+
last_used_user_agent: Type.Optional(Type.String({ maxLength: 512 })),
|
|
287
320
|
},
|
|
288
321
|
{ $id: "CredentialRecord" },
|
|
289
322
|
);
|
package/src/common/hello.ts
CHANGED
|
@@ -86,7 +86,10 @@ export type HelloArgs = Static<typeof HelloArgs>;
|
|
|
86
86
|
/** One instance as seen from the instance answering `hello`. */
|
|
87
87
|
export const InstanceInfo = Type.Object(
|
|
88
88
|
{
|
|
89
|
-
|
|
89
|
+
/** Absent until the handshake with it has settled: an endpoint an operator
|
|
90
|
+
* configured is known before anything answers there, and leaving such a
|
|
91
|
+
* peer out of the list would hide the very entry whose link is down. */
|
|
92
|
+
id: Type.Optional(InstanceId),
|
|
90
93
|
/** Where it is dialed. An attribute of the instance like the host below:
|
|
91
94
|
* it is what a peer connects to and authenticates against, and it may
|
|
92
95
|
* change under a fixed `id` when the instance moves. */
|
|
@@ -107,8 +110,10 @@ export const HelloResult = Type.Object({
|
|
|
107
110
|
instance: InstanceId,
|
|
108
111
|
/** Where the answering instance is dialed. Stated beside the id because the
|
|
109
112
|
* caller reached it by some URL of its own — a proxy's, an alias — and what a
|
|
110
|
-
* peer is to dial is neither that nor derivable from the id.
|
|
111
|
-
|
|
113
|
+
* peer is to dial is neither that nor derivable from the id. Absent on an
|
|
114
|
+
* instance that joins no mesh: it is reached by the people and sessions on
|
|
115
|
+
* its own machine, and it has no URL to give a peer. */
|
|
116
|
+
endpoint: Type.Optional(Endpoint),
|
|
112
117
|
/** The instances this one knows of, itself included. */
|
|
113
118
|
instances: Type.Array(InstanceInfo),
|
|
114
119
|
/** What this instance can do. An op whose `capability` is absent here
|