@adea-ai/runtime-gateway-protocol 1.17.1 → 1.17.3

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.
@@ -3,6 +3,8 @@ 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 { SyncAuthorKeyIdSchema } from '@adea-ai/contracts/device-sync';
7
+ import { TimestampSchema } from '@adea-ai/contracts/primitives';
6
8
  export const CONTENT_KEY_BYTES = 32;
7
9
  export const CONTENT_SEAL_VERSION = 1;
8
10
  export const CONTENT_KEY_WRAP_VERSION = 1;
@@ -126,14 +128,14 @@ export const ContentKeyWrapBodySchema = z
126
128
  workspaceId: IdentifierSchema,
127
129
  ckv: VersionSchema,
128
130
  keyringRevision: VersionSchema,
129
- recipientKeyId: z.string().regex(/^(?:spk|dpk)_[a-f0-9]{32}$/),
131
+ recipientKeyId: SyncAuthorKeyIdSchema,
130
132
  recipientEncryptionKeyId: z
131
133
  .string()
132
134
  .min(8)
133
135
  .max(96)
134
136
  .regex(/^(?:hpk|rpk)_[a-f0-9]+$/),
135
137
  primarySigningKeyId: z.string().regex(/^dpk_[a-f0-9]{32}$/),
136
- wrappedAt: z.iso.datetime(),
138
+ wrappedAt: TimestampSchema,
137
139
  encapsulatedKey: Base64UrlSchema.length(43),
138
140
  ciphertext: Base64UrlSchema.length(64),
139
141
  })
@@ -2,6 +2,8 @@ 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 { SyncAuthorKeyIdSchema } from '@adea-ai/contracts/device-sync';
6
+ import { Sha256DigestSchema, TimestampSchema } from '@adea-ai/contracts/primitives';
5
7
  export const RELAY_HPKE_SUITE = 'DHKEM_X25519_HKDF_SHA256_HKDF_SHA256_AES_128_GCM';
6
8
  export const MAX_RELAY_CIPHERTEXT_BYTES = 1024 * 1024;
7
9
  export const MAX_RELAY_CLOCK_SKEW_MS = 5 * 60 * 1000;
@@ -30,7 +32,6 @@ const HostKeyIdSchema = z
30
32
  .min(8)
31
33
  .max(96)
32
34
  .regex(/^(?:hpk|rpk)_[a-f0-9]+$/);
33
- const SigningKeyIdSchema = z.string().regex(/^(?:spk|dpk)_[a-f0-9]{32}$/);
34
35
  const Base64UrlSchema = z
35
36
  .string()
36
37
  .min(1)
@@ -84,10 +85,10 @@ const HeaderFields = {
84
85
  targetDeviceId: IdentifierSchema,
85
86
  commandId: IdentifierSchema,
86
87
  payloadSchemaVersion: z.number().int().min(1).max(65_535),
87
- issuedAt: z.iso.datetime(),
88
- expiresAt: z.iso.datetime(),
89
- contentDigest: z.string().regex(/^sha256:[a-f0-9]{64}$/),
90
- senderKeyId: SigningKeyIdSchema,
88
+ issuedAt: TimestampSchema,
89
+ expiresAt: TimestampSchema,
90
+ contentDigest: Sha256DigestSchema,
91
+ senderKeyId: SyncAuthorKeyIdSchema,
91
92
  senderPrincipalId: IdentifierSchema,
92
93
  nonce: NonceSchema,
93
94
  };
@@ -117,15 +118,15 @@ export const AuthenticatedRelayCommandEnvelopeSchema = AuthenticatedRelayCommand
117
118
  export const AuthenticatedRelayResultEnvelopeSchema = AuthenticatedRelayResultHeaderSchema.extend(SealedFields).strict();
118
119
  export const AuthorizedSenderKeySchema = z
119
120
  .object({
120
- senderKeyId: SigningKeyIdSchema,
121
+ senderKeyId: SyncAuthorKeyIdSchema,
121
122
  kind: z.enum(['session', 'device']),
122
123
  principalId: IdentifierSchema,
123
124
  deviceId: IdentifierSchema.optional(),
124
125
  signingPublicKey: PublicKeySchema,
125
126
  encryptionKeyId: HostKeyIdSchema.optional(),
126
127
  encryptionPublicKey: PublicKeySchema.optional(),
127
- approvedAt: z.iso.datetime(),
128
- revokedAt: z.iso.datetime().optional(),
128
+ approvedAt: TimestampSchema,
129
+ revokedAt: TimestampSchema.optional(),
129
130
  scope: z.literal('content').optional(),
130
131
  })
131
132
  .strict()
@@ -145,9 +146,9 @@ export const AuthorizedSenderKeyringBodySchema = z
145
146
  keyringVersion: z.literal(1),
146
147
  workspaceId: IdentifierSchema,
147
148
  revision: z.number().int().min(1),
148
- issuedAt: z.iso.datetime(),
149
+ issuedAt: TimestampSchema,
149
150
  primaryDeviceId: IdentifierSchema,
150
- primarySigningKeyId: SigningKeyIdSchema,
151
+ primarySigningKeyId: SyncAuthorKeyIdSchema,
151
152
  entries: z.array(AuthorizedSenderKeySchema).max(256),
152
153
  })
153
154
  .strict();
@@ -3,6 +3,8 @@ 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 { SyncAuthorKeyIdSchema } from '@adea-ai/contracts/device-sync';
7
+ import { Sha256DigestSchema, TimestampSchema } from '@adea-ai/contracts/primitives';
6
8
  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
9
  export const SYNC_BLOB_VERSION = 1;
8
10
  export const SYNC_ENTRY_VERSION = 1;
@@ -32,8 +34,6 @@ const IdentifierSchema = z
32
34
  .min(1)
33
35
  .max(128)
34
36
  .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
37
  export const SyncItemIdSchema = z.string().regex(/^sit_[a-f0-9]{32}$/);
38
38
  function randomId(prefix) {
39
39
  const bytes = globalThis.crypto.getRandomValues(new Uint8Array(16));
@@ -311,7 +311,7 @@ export const SyncHlcSchema = z
311
311
  .object({
312
312
  wallMs: z.number().int().min(0),
313
313
  counter: z.number().int().min(0).max(0xffff),
314
- node: AuthorKeyIdSchema,
314
+ node: SyncAuthorKeyIdSchema,
315
315
  })
316
316
  .strict();
317
317
  export function nextSyncHlc(previous, nowMs, node) {
@@ -351,7 +351,7 @@ export const SyncPutEntrySchema = z
351
351
  path: SyncPathSchema,
352
352
  objectId: SyncObjectIdSchema,
353
353
  dataKey: ContentSealSchema,
354
- plaintextSha256: Sha256Schema,
354
+ plaintextSha256: Sha256DigestSchema,
355
355
  size: z.number().int().min(0).max(MAX_SYNC_OBJECT_BYTES),
356
356
  contentType: z.string().min(1).max(255).optional(),
357
357
  mtimeMs: z.number().int().min(0).optional(),
@@ -419,7 +419,7 @@ export function syncAuthor(keyring, workspaceId, keyId, at) {
419
419
  export async function openSyncEntry(input) {
420
420
  const stored = SignedSyncEntrySchema.extend({
421
421
  seq: z.number().int().min(1).optional(),
422
- createdAt: z.iso.datetime().optional(),
422
+ createdAt: TimestampSchema.optional(),
423
423
  })
424
424
  .strict()
425
425
  .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.1",
3
+ "version": "1.17.3",
4
4
  "description": "Device relay envelopes and workspace content keys shared by the Control Plane and Adea clients.",
5
5
  "keywords": [
6
6
  "agents",
@@ -52,9 +52,9 @@
52
52
  "test": "bun test src"
53
53
  },
54
54
  "dependencies": {
55
- "@adea-ai/contracts": "^5.0.0",
56
- "@hpke/core": "1.9.0",
57
- "@hpke/dhkem-x25519": "1.8.0",
55
+ "@adea-ai/contracts": "^5.0.3",
56
+ "@hpke/core": "1.10.1",
57
+ "@hpke/dhkem-x25519": "1.8.1",
58
58
  "zod": "4.6.6"
59
59
  },
60
60
  "engines": {