@adea-ai/runtime-gateway-protocol 1.15.0 → 1.16.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/dist/device-relay.d.ts +4 -0
- package/dist/device-relay.js +7 -0
- package/package.json +1 -1
package/dist/device-relay.d.ts
CHANGED
|
@@ -28,6 +28,7 @@ export declare const RelayRejectionCodeSchema: z.ZodEnum<{
|
|
|
28
28
|
RELAY_ENVELOPE_REPLAYED: "RELAY_ENVELOPE_REPLAYED";
|
|
29
29
|
RELAY_ENVELOPE_TOO_LARGE: "RELAY_ENVELOPE_TOO_LARGE";
|
|
30
30
|
RELAY_KEYRING_INVALID: "RELAY_KEYRING_INVALID";
|
|
31
|
+
RELAY_SENDER_CONTENT_ONLY: "RELAY_SENDER_CONTENT_ONLY";
|
|
31
32
|
RELAY_SENDER_REVOKED: "RELAY_SENDER_REVOKED";
|
|
32
33
|
RELAY_SENDER_UNAUTHENTICATED: "RELAY_SENDER_UNAUTHENTICATED";
|
|
33
34
|
RELAY_SIGNATURE_INVALID: "RELAY_SIGNATURE_INVALID";
|
|
@@ -155,6 +156,7 @@ export declare const AuthorizedSenderKeySchema: z.ZodObject<{
|
|
|
155
156
|
encryptionPublicKey: z.ZodOptional<z.ZodString>;
|
|
156
157
|
approvedAt: z.ZodISODateTime;
|
|
157
158
|
revokedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
159
|
+
scope: z.ZodOptional<z.ZodLiteral<"content">>;
|
|
158
160
|
}, z.core.$strict>;
|
|
159
161
|
export declare const AuthorizedSenderKeyringBodySchema: z.ZodObject<{
|
|
160
162
|
keyringVersion: z.ZodLiteral<1>;
|
|
@@ -176,6 +178,7 @@ export declare const AuthorizedSenderKeyringBodySchema: z.ZodObject<{
|
|
|
176
178
|
encryptionPublicKey: z.ZodOptional<z.ZodString>;
|
|
177
179
|
approvedAt: z.ZodISODateTime;
|
|
178
180
|
revokedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
181
|
+
scope: z.ZodOptional<z.ZodLiteral<"content">>;
|
|
179
182
|
}, z.core.$strict>>;
|
|
180
183
|
}, z.core.$strict>;
|
|
181
184
|
export declare const AuthorizedSenderKeyringSchema: z.ZodObject<{
|
|
@@ -198,6 +201,7 @@ export declare const AuthorizedSenderKeyringSchema: z.ZodObject<{
|
|
|
198
201
|
encryptionPublicKey: z.ZodOptional<z.ZodString>;
|
|
199
202
|
approvedAt: z.ZodISODateTime;
|
|
200
203
|
revokedAt: z.ZodOptional<z.ZodISODateTime>;
|
|
204
|
+
scope: z.ZodOptional<z.ZodLiteral<"content">>;
|
|
201
205
|
}, z.core.$strict>>;
|
|
202
206
|
signature: z.ZodString;
|
|
203
207
|
}, z.core.$strict>;
|
package/dist/device-relay.js
CHANGED
|
@@ -62,6 +62,7 @@ export const RelayRejectionCodeSchema = z.enum([
|
|
|
62
62
|
'RELAY_ENVELOPE_REPLAYED',
|
|
63
63
|
'RELAY_SENDER_UNAUTHENTICATED',
|
|
64
64
|
'RELAY_SENDER_REVOKED',
|
|
65
|
+
'RELAY_SENDER_CONTENT_ONLY',
|
|
65
66
|
'RELAY_SIGNATURE_INVALID',
|
|
66
67
|
'RELAY_TARGET_MISMATCH',
|
|
67
68
|
'RELAY_KEYRING_INVALID',
|
|
@@ -125,12 +126,16 @@ export const AuthorizedSenderKeySchema = z
|
|
|
125
126
|
encryptionPublicKey: PublicKeySchema.optional(),
|
|
126
127
|
approvedAt: z.iso.datetime(),
|
|
127
128
|
revokedAt: z.iso.datetime().optional(),
|
|
129
|
+
scope: z.literal('content').optional(),
|
|
128
130
|
})
|
|
129
131
|
.strict()
|
|
130
132
|
.superRefine((value, context) => {
|
|
131
133
|
if ((value.kind === 'device') !== (value.deviceId !== undefined)) {
|
|
132
134
|
context.addIssue({ code: 'custom', message: 'a device key names its device' });
|
|
133
135
|
}
|
|
136
|
+
if (value.scope === 'content' && value.kind !== 'session') {
|
|
137
|
+
context.addIssue({ code: 'custom', message: 'only a session key is limited to content' });
|
|
138
|
+
}
|
|
134
139
|
if ((value.encryptionKeyId === undefined) !== (value.encryptionPublicKey === undefined)) {
|
|
135
140
|
context.addIssue({ code: 'custom', message: 'encryption key id and key go together' });
|
|
136
141
|
}
|
|
@@ -288,6 +293,8 @@ export async function openAuthenticatedRelayCommand(input) {
|
|
|
288
293
|
if (!(await verifyRelayBytes(sender.signingPublicKey, signature, await envelopeSigningInput(header, encapsulatedKey, ciphertext)))) {
|
|
289
294
|
throw new AuthenticatedRelayError('RELAY_SIGNATURE_INVALID');
|
|
290
295
|
}
|
|
296
|
+
if (sender.scope === 'content')
|
|
297
|
+
throw new AuthenticatedRelayError('RELAY_SENDER_CONTENT_ONLY');
|
|
291
298
|
const delivery = await input.replay.reserve({
|
|
292
299
|
senderKeyId: header.senderKeyId,
|
|
293
300
|
nonce: header.nonce,
|
package/package.json
CHANGED