@adea-ai/runtime-gateway-protocol 1.17.0 → 1.17.2
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/content-key.js +3 -2
- package/dist/device-relay.js +10 -10
- package/dist/device-sync.js +4 -5
- package/package.json +4 -5
package/dist/content-key.js
CHANGED
|
@@ -3,6 +3,7 @@ import { DhkemX25519HkdfSha256 } from '@hpke/dhkem-x25519';
|
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { canonicalJsonStringify } from '@adea-ai/contracts/canonical-json';
|
|
5
5
|
import { decodeBase64Url, encodeBase64Url, signRelayBytes, verifyRelayBytes, } from './device-relay.js';
|
|
6
|
+
import { TimestampSchema, SyncAuthorKeyIdSchema } from '@adea-ai/contracts';
|
|
6
7
|
export const CONTENT_KEY_BYTES = 32;
|
|
7
8
|
export const CONTENT_SEAL_VERSION = 1;
|
|
8
9
|
export const CONTENT_KEY_WRAP_VERSION = 1;
|
|
@@ -126,14 +127,14 @@ export const ContentKeyWrapBodySchema = z
|
|
|
126
127
|
workspaceId: IdentifierSchema,
|
|
127
128
|
ckv: VersionSchema,
|
|
128
129
|
keyringRevision: VersionSchema,
|
|
129
|
-
recipientKeyId:
|
|
130
|
+
recipientKeyId: SyncAuthorKeyIdSchema,
|
|
130
131
|
recipientEncryptionKeyId: z
|
|
131
132
|
.string()
|
|
132
133
|
.min(8)
|
|
133
134
|
.max(96)
|
|
134
135
|
.regex(/^(?:hpk|rpk)_[a-f0-9]+$/),
|
|
135
136
|
primarySigningKeyId: z.string().regex(/^dpk_[a-f0-9]{32}$/),
|
|
136
|
-
wrappedAt:
|
|
137
|
+
wrappedAt: TimestampSchema,
|
|
137
138
|
encapsulatedKey: Base64UrlSchema.length(43),
|
|
138
139
|
ciphertext: Base64UrlSchema.length(64),
|
|
139
140
|
})
|
package/dist/device-relay.js
CHANGED
|
@@ -2,6 +2,7 @@ import { Aes128Gcm, CipherSuite, HkdfSha256 } from '@hpke/core';
|
|
|
2
2
|
import { DhkemX25519HkdfSha256 } from '@hpke/dhkem-x25519';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
import { canonicalJsonStringify } from '@adea-ai/contracts/canonical-json';
|
|
5
|
+
import { Sha256DigestSchema, TimestampSchema, SyncAuthorKeyIdSchema, } from '@adea-ai/contracts';
|
|
5
6
|
export const RELAY_HPKE_SUITE = 'DHKEM_X25519_HKDF_SHA256_HKDF_SHA256_AES_128_GCM';
|
|
6
7
|
export const MAX_RELAY_CIPHERTEXT_BYTES = 1024 * 1024;
|
|
7
8
|
export const MAX_RELAY_CLOCK_SKEW_MS = 5 * 60 * 1000;
|
|
@@ -30,7 +31,6 @@ const HostKeyIdSchema = z
|
|
|
30
31
|
.min(8)
|
|
31
32
|
.max(96)
|
|
32
33
|
.regex(/^(?:hpk|rpk)_[a-f0-9]+$/);
|
|
33
|
-
const SigningKeyIdSchema = z.string().regex(/^(?:spk|dpk)_[a-f0-9]{32}$/);
|
|
34
34
|
const Base64UrlSchema = z
|
|
35
35
|
.string()
|
|
36
36
|
.min(1)
|
|
@@ -84,10 +84,10 @@ const HeaderFields = {
|
|
|
84
84
|
targetDeviceId: IdentifierSchema,
|
|
85
85
|
commandId: IdentifierSchema,
|
|
86
86
|
payloadSchemaVersion: z.number().int().min(1).max(65_535),
|
|
87
|
-
issuedAt:
|
|
88
|
-
expiresAt:
|
|
89
|
-
contentDigest:
|
|
90
|
-
senderKeyId:
|
|
87
|
+
issuedAt: TimestampSchema,
|
|
88
|
+
expiresAt: TimestampSchema,
|
|
89
|
+
contentDigest: Sha256DigestSchema,
|
|
90
|
+
senderKeyId: SyncAuthorKeyIdSchema,
|
|
91
91
|
senderPrincipalId: IdentifierSchema,
|
|
92
92
|
nonce: NonceSchema,
|
|
93
93
|
};
|
|
@@ -117,15 +117,15 @@ export const AuthenticatedRelayCommandEnvelopeSchema = AuthenticatedRelayCommand
|
|
|
117
117
|
export const AuthenticatedRelayResultEnvelopeSchema = AuthenticatedRelayResultHeaderSchema.extend(SealedFields).strict();
|
|
118
118
|
export const AuthorizedSenderKeySchema = z
|
|
119
119
|
.object({
|
|
120
|
-
senderKeyId:
|
|
120
|
+
senderKeyId: SyncAuthorKeyIdSchema,
|
|
121
121
|
kind: z.enum(['session', 'device']),
|
|
122
122
|
principalId: IdentifierSchema,
|
|
123
123
|
deviceId: IdentifierSchema.optional(),
|
|
124
124
|
signingPublicKey: PublicKeySchema,
|
|
125
125
|
encryptionKeyId: HostKeyIdSchema.optional(),
|
|
126
126
|
encryptionPublicKey: PublicKeySchema.optional(),
|
|
127
|
-
approvedAt:
|
|
128
|
-
revokedAt:
|
|
127
|
+
approvedAt: TimestampSchema,
|
|
128
|
+
revokedAt: TimestampSchema.optional(),
|
|
129
129
|
scope: z.literal('content').optional(),
|
|
130
130
|
})
|
|
131
131
|
.strict()
|
|
@@ -145,9 +145,9 @@ export const AuthorizedSenderKeyringBodySchema = z
|
|
|
145
145
|
keyringVersion: z.literal(1),
|
|
146
146
|
workspaceId: IdentifierSchema,
|
|
147
147
|
revision: z.number().int().min(1),
|
|
148
|
-
issuedAt:
|
|
148
|
+
issuedAt: TimestampSchema,
|
|
149
149
|
primaryDeviceId: IdentifierSchema,
|
|
150
|
-
primarySigningKeyId:
|
|
150
|
+
primarySigningKeyId: SyncAuthorKeyIdSchema,
|
|
151
151
|
entries: z.array(AuthorizedSenderKeySchema).max(256),
|
|
152
152
|
})
|
|
153
153
|
.strict();
|
package/dist/device-sync.js
CHANGED
|
@@ -3,6 +3,7 @@ import { canonicalJsonStringify } from '@adea-ai/contracts/canonical-json';
|
|
|
3
3
|
import { MAX_SYNC_ENTRY_BYTES, SignedSyncEntrySchema, SyncObjectIdSchema, SyncEntryIdSchema, } from '@adea-ai/contracts/device-sync';
|
|
4
4
|
import { ContentKeyError, ContentSealSchema, openContent, sealContent, } from './content-key.js';
|
|
5
5
|
import { MAX_RELAY_CLOCK_SKEW_MS, decodeBase64Url, encodeBase64Url, sha256, signRelayBytes, verifyRelayBytes, } from './device-relay.js';
|
|
6
|
+
import { Sha256DigestSchema, TimestampSchema, SyncAuthorKeyIdSchema, } from '@adea-ai/contracts';
|
|
6
7
|
export { DeviceSyncErrorCodeSchema, MAX_SYNC_BATCH, MAX_SYNC_CIPHERTEXT_BYTES, MAX_SYNC_ENTRY_BYTES, MAX_SYNC_LOG_PAGE, MIN_SYNC_CIPHERTEXT_BYTES, SignedSyncEntrySchema, StoredSyncEntrySchema, SyncAppendRequestSchema, SyncAppendResponseSchema, SyncCommitResponseSchema, SyncDownloadRequestSchema, SyncDownloadResponseSchema, SyncEntryIdSchema, SyncLogPageSchema, SyncLogRequestSchema, SyncObjectIdSchema, SyncObjectRequestSchema, SyncReleaseResponseSchema, SyncUploadRequestSchema, SyncUploadResponseSchema, SyncUsageSchema, } from '@adea-ai/contracts/device-sync';
|
|
7
8
|
export const SYNC_BLOB_VERSION = 1;
|
|
8
9
|
export const SYNC_ENTRY_VERSION = 1;
|
|
@@ -32,8 +33,6 @@ const IdentifierSchema = z
|
|
|
32
33
|
.min(1)
|
|
33
34
|
.max(128)
|
|
34
35
|
.regex(/^[A-Za-z0-9._:-]+$/);
|
|
35
|
-
const AuthorKeyIdSchema = z.string().regex(/^(?:spk|dpk)_[a-f0-9]{32}$/);
|
|
36
|
-
const Sha256Schema = z.string().regex(/^sha256:[a-f0-9]{64}$/);
|
|
37
36
|
export const SyncItemIdSchema = z.string().regex(/^sit_[a-f0-9]{32}$/);
|
|
38
37
|
function randomId(prefix) {
|
|
39
38
|
const bytes = globalThis.crypto.getRandomValues(new Uint8Array(16));
|
|
@@ -311,7 +310,7 @@ export const SyncHlcSchema = z
|
|
|
311
310
|
.object({
|
|
312
311
|
wallMs: z.number().int().min(0),
|
|
313
312
|
counter: z.number().int().min(0).max(0xffff),
|
|
314
|
-
node:
|
|
313
|
+
node: SyncAuthorKeyIdSchema,
|
|
315
314
|
})
|
|
316
315
|
.strict();
|
|
317
316
|
export function nextSyncHlc(previous, nowMs, node) {
|
|
@@ -351,7 +350,7 @@ export const SyncPutEntrySchema = z
|
|
|
351
350
|
path: SyncPathSchema,
|
|
352
351
|
objectId: SyncObjectIdSchema,
|
|
353
352
|
dataKey: ContentSealSchema,
|
|
354
|
-
plaintextSha256:
|
|
353
|
+
plaintextSha256: Sha256DigestSchema,
|
|
355
354
|
size: z.number().int().min(0).max(MAX_SYNC_OBJECT_BYTES),
|
|
356
355
|
contentType: z.string().min(1).max(255).optional(),
|
|
357
356
|
mtimeMs: z.number().int().min(0).optional(),
|
|
@@ -419,7 +418,7 @@ export function syncAuthor(keyring, workspaceId, keyId, at) {
|
|
|
419
418
|
export async function openSyncEntry(input) {
|
|
420
419
|
const stored = SignedSyncEntrySchema.extend({
|
|
421
420
|
seq: z.number().int().min(1).optional(),
|
|
422
|
-
createdAt:
|
|
421
|
+
createdAt: TimestampSchema.optional(),
|
|
423
422
|
})
|
|
424
423
|
.strict()
|
|
425
424
|
.safeParse(input.entry);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adea-ai/runtime-gateway-protocol",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.2",
|
|
4
4
|
"description": "Device relay envelopes and workspace content keys shared by the Control Plane and Adea clients.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agents",
|
|
@@ -43,17 +43,16 @@
|
|
|
43
43
|
}
|
|
44
44
|
},
|
|
45
45
|
"publishConfig": {
|
|
46
|
-
"access": "public"
|
|
47
|
-
"provenance": true
|
|
46
|
+
"access": "public"
|
|
48
47
|
},
|
|
49
48
|
"scripts": {
|
|
50
49
|
"build": "tsc -p tsconfig.json",
|
|
51
|
-
"typecheck": "bun check -p tsconfig.json",
|
|
50
|
+
"typecheck": "bun check -p tsconfig.json && bun check -p tsconfig.test.json",
|
|
52
51
|
"lint": "oxlint src",
|
|
53
52
|
"test": "bun test src"
|
|
54
53
|
},
|
|
55
54
|
"dependencies": {
|
|
56
|
-
"@adea-ai/contracts": "^
|
|
55
|
+
"@adea-ai/contracts": "^5.0.2",
|
|
57
56
|
"@hpke/core": "1.9.0",
|
|
58
57
|
"@hpke/dhkem-x25519": "1.8.0",
|
|
59
58
|
"zod": "4.6.6"
|