@serve.zone/interfaces 31.9.0 → 32.0.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.
Files changed (204) hide show
  1. package/.smartconfig.json +1 -0
  2. package/changelog.md +467 -0
  3. package/dist_ts/00_commitinfo_data.js +3 -3
  4. package/dist_ts/appstore/types.d.ts +4 -6
  5. package/dist_ts/appstore/types.js +5 -5
  6. package/dist_ts/data/backup.d.ts +3 -26
  7. package/dist_ts/data/cluster.d.ts +36 -11
  8. package/dist_ts/data/cluster.js +33 -22
  9. package/dist_ts/data/clusteringress.d.ts +8 -0
  10. package/dist_ts/data/clusteringress.js +13 -8
  11. package/dist_ts/data/clusternode.d.ts +121 -74
  12. package/dist_ts/data/clusternode.js +109 -132
  13. package/dist_ts/data/coremail.d.ts +3 -7
  14. package/dist_ts/data/coremail.js +2 -2
  15. package/dist_ts/data/coremail.runtime.d.ts +0 -1
  16. package/dist_ts/data/coremail.runtime.js +5 -22
  17. package/dist_ts/data/deploymentadoption.d.ts +0 -2
  18. package/dist_ts/data/deploymentadoption.js +40 -6
  19. package/dist_ts/data/deploymentoperation.js +16 -3
  20. package/dist_ts/data/deploymentpreflight.d.ts +0 -2
  21. package/dist_ts/data/deploymentpreflight.js +1 -1
  22. package/dist_ts/data/immutableimage.d.ts +38 -21
  23. package/dist_ts/data/immutableimage.js +45 -5
  24. package/dist_ts/data/index.d.ts +1 -1
  25. package/dist_ts/data/isolatedrestore.d.ts +139 -21
  26. package/dist_ts/data/isolatedrestore.golden.d.ts +0 -1
  27. package/dist_ts/data/isolatedrestore.golden.js +6 -9
  28. package/dist_ts/data/isolatedrestore.js +176 -40
  29. package/dist_ts/data/mail.d.ts +1 -1
  30. package/dist_ts/data/networkaddressplan.d.ts +8 -8
  31. package/dist_ts/data/networkaddressplan.js +4 -4
  32. package/dist_ts/data/networkauthority.d.ts +20 -22
  33. package/dist_ts/data/networkauthority.js +26 -28
  34. package/dist_ts/data/networkcredential.d.ts +10 -10
  35. package/dist_ts/data/networkcredential.js +16 -16
  36. package/dist_ts/data/networkdelivery.d.ts +18 -18
  37. package/dist_ts/data/networkdelivery.js +16 -16
  38. package/dist_ts/data/networklease.d.ts +18 -7
  39. package/dist_ts/data/networklease.js +29 -7
  40. package/dist_ts/data/networknode.d.ts +2 -2
  41. package/dist_ts/data/networkprojection.d.ts +59 -60
  42. package/dist_ts/data/networkprojection.js +53 -57
  43. package/dist_ts/data/networkprotection.d.ts +27 -28
  44. package/dist_ts/data/networkprotection.js +36 -36
  45. package/dist_ts/data/networkrouter.d.ts +11 -11
  46. package/dist_ts/data/networkrouter.js +1 -1
  47. package/dist_ts/data/networksigning.d.ts +16 -18
  48. package/dist_ts/data/networksigning.js +20 -21
  49. package/dist_ts/data/nodecredential.d.ts +4 -6
  50. package/dist_ts/data/nodeenrollment.d.ts +35 -40
  51. package/dist_ts/data/nodeenrollment.js +57 -72
  52. package/dist_ts/data/privatenetwork.d.ts +21 -24
  53. package/dist_ts/data/privatenetwork.js +39 -54
  54. package/dist_ts/data/runtimeassignment.d.ts +50 -34
  55. package/dist_ts/data/runtimeassignment.js +79 -45
  56. package/dist_ts/data/runtimeconfig.d.ts +21 -22
  57. package/dist_ts/data/runtimeconfig.js +24 -24
  58. package/dist_ts/data/runtimesession.d.ts +100 -62
  59. package/dist_ts/data/runtimesession.js +98 -79
  60. package/dist_ts/data/runtimeterminalreceipt.d.ts +28 -29
  61. package/dist_ts/data/runtimeterminalreceipt.js +42 -42
  62. package/dist_ts/data/secret.d.ts +18 -25
  63. package/dist_ts/data/secret.js +12 -52
  64. package/dist_ts/data/servicecredential.d.ts +14 -16
  65. package/dist_ts/data/servicecredential.js +17 -28
  66. package/dist_ts/data/serviceruntime.d.ts +7 -7
  67. package/dist_ts/data/serviceruntime.js +4 -4
  68. package/dist_ts/data/sparknodereport.d.ts +27 -14
  69. package/dist_ts/data/sparknodereport.js +35 -28
  70. package/dist_ts/data/webpush.d.ts +0 -1
  71. package/dist_ts/index.d.ts +2 -1
  72. package/dist_ts/index.js +3 -2
  73. package/dist_ts/platform/objectstorageretention.d.ts +21 -24
  74. package/dist_ts/platform/objectstorageretention.js +6 -18
  75. package/dist_ts/platform/storage.d.ts +1 -3
  76. package/dist_ts/platform/storagemigration.d.ts +0 -7
  77. package/dist_ts/platform/storagemigration.golden.d.ts +0 -1
  78. package/dist_ts/platform/storagemigration.golden.js +8 -12
  79. package/dist_ts/platform/storagemigration.js +6 -51
  80. package/dist_ts/platform/types.d.ts +2 -2
  81. package/dist_ts/private/canonicaljson.d.ts +9 -1
  82. package/dist_ts/private/canonicaljson.js +14 -2
  83. package/dist_ts/private/dataproperties.d.ts +62 -0
  84. package/dist_ts/private/dataproperties.js +117 -0
  85. package/dist_ts/private/networkcontract.d.ts +10 -10
  86. package/dist_ts/private/networkcontract.js +1 -1
  87. package/dist_ts/private/releaseversion.d.ts +37 -0
  88. package/dist_ts/private/releaseversion.js +48 -0
  89. package/dist_ts/private/runtimepolicy.d.ts +2 -2
  90. package/dist_ts/private/runtimepolicy.js +1 -1
  91. package/dist_ts/private/tokenlist.d.ts +9 -0
  92. package/dist_ts/private/tokenlist.js +23 -0
  93. package/dist_ts/protocol.d.ts +137 -0
  94. package/dist_ts/protocol.js +255 -0
  95. package/dist_ts/requests/admin.d.ts +8 -8
  96. package/dist_ts/requests/backup.d.ts +102 -112
  97. package/dist_ts/requests/cluster.d.ts +10 -10
  98. package/dist_ts/requests/clusteringress.d.ts +9 -0
  99. package/dist_ts/requests/clusteringress.js +1 -1
  100. package/dist_ts/requests/config.d.ts +3 -3
  101. package/dist_ts/requests/corestore.d.ts +0 -3
  102. package/dist_ts/requests/corestore.js +5 -9
  103. package/dist_ts/requests/network.d.ts +30 -30
  104. package/dist_ts/requests/node.d.ts +15 -28
  105. package/dist_ts/requests/pallet.d.ts +13 -13
  106. package/dist_ts/requests/runtimesession.d.ts +53 -41
  107. package/dist_ts/requests/secret.d.ts +4 -5
  108. package/dist_ts/requests/secret.js +1 -5
  109. package/dist_ts/runtime.corestore.d.ts +56 -74
  110. package/dist_ts/runtime.corestore.databaseexportpackage.d.ts +30 -36
  111. package/dist_ts/runtime.corestore.databaseexportpackage.golden.d.ts +11 -12
  112. package/dist_ts/runtime.corestore.databaseexportpackage.golden.js +54 -71
  113. package/dist_ts/runtime.corestore.databaseexportpackage.js +9 -25
  114. package/dist_ts/runtime.corestore.js +35 -135
  115. package/dist_ts/runtime.corestore.relay.js +2 -7
  116. package/dist_ts/runtime.d.ts +38 -48
  117. package/dist_ts/runtime.js +20 -77
  118. package/dist_ts/runtime.networkprojection.d.ts +4 -4
  119. package/dist_ts/runtime.networkprojection.js +18 -18
  120. package/dist_ts/runtime.workloadinit.d.ts +23 -24
  121. package/dist_ts/runtime.workloadinit.js +6 -13
  122. package/package.json +2 -2
  123. package/readme.md +421 -270
  124. package/ts/00_commitinfo_data.ts +3 -3
  125. package/ts/appstore/types.ts +4 -6
  126. package/ts/data/backup.ts +3 -38
  127. package/ts/data/cluster.ts +51 -34
  128. package/ts/data/clusteringress.ts +12 -12
  129. package/ts/data/clusternode.ts +204 -232
  130. package/ts/data/coremail.runtime.ts +4 -21
  131. package/ts/data/coremail.ts +3 -7
  132. package/ts/data/deploymentadoption.ts +46 -4
  133. package/ts/data/deploymentoperation.ts +16 -1
  134. package/ts/data/deploymentpreflight.ts +0 -2
  135. package/ts/data/immutableimage.ts +71 -24
  136. package/ts/data/index.ts +1 -1
  137. package/ts/data/isolatedrestore.golden.ts +5 -9
  138. package/ts/data/isolatedrestore.ts +339 -54
  139. package/ts/data/mail.ts +1 -1
  140. package/ts/data/networkaddressplan.ts +13 -13
  141. package/ts/data/networkauthority.ts +42 -46
  142. package/ts/data/networkcredential.ts +24 -24
  143. package/ts/data/networkdelivery.ts +27 -27
  144. package/ts/data/networklease.ts +40 -13
  145. package/ts/data/networknode.ts +2 -2
  146. package/ts/data/networkprojection.ts +119 -124
  147. package/ts/data/networkprotection.ts +54 -55
  148. package/ts/data/networkrouter.ts +14 -14
  149. package/ts/data/networksigning.ts +29 -32
  150. package/ts/data/nodecredential.ts +4 -6
  151. package/ts/data/nodeenrollment.ts +96 -114
  152. package/ts/data/privatenetwork.ts +58 -74
  153. package/ts/data/runtimeassignment.ts +143 -94
  154. package/ts/data/runtimeconfig.ts +45 -46
  155. package/ts/data/runtimesession.ts +185 -138
  156. package/ts/data/runtimeterminalreceipt.ts +72 -73
  157. package/ts/data/secret.ts +28 -76
  158. package/ts/data/servicecredential.ts +33 -43
  159. package/ts/data/serviceruntime.ts +11 -11
  160. package/ts/data/sparknodereport.ts +48 -36
  161. package/ts/data/webpush.ts +0 -1
  162. package/ts/index.ts +2 -0
  163. package/ts/platform/objectstorageretention.ts +36 -55
  164. package/ts/platform/storage.ts +1 -3
  165. package/ts/platform/storagemigration.golden.ts +7 -11
  166. package/ts/platform/storagemigration.ts +5 -55
  167. package/ts/platform/types.ts +2 -2
  168. package/ts/private/canonicaljson.ts +13 -1
  169. package/ts/private/dataproperties.ts +139 -0
  170. package/ts/private/networkcontract.ts +9 -9
  171. package/ts/private/releaseversion.ts +70 -0
  172. package/ts/private/runtimepolicy.ts +2 -2
  173. package/ts/private/tokenlist.ts +30 -0
  174. package/ts/protocol.ts +364 -0
  175. package/ts/requests/admin.ts +11 -11
  176. package/ts/requests/backup.ts +112 -117
  177. package/ts/requests/cluster.ts +13 -13
  178. package/ts/requests/clusteringress.ts +9 -0
  179. package/ts/requests/config.ts +3 -3
  180. package/ts/requests/corestore.ts +4 -16
  181. package/ts/requests/network.ts +40 -40
  182. package/ts/requests/node.ts +21 -38
  183. package/ts/requests/pallet.ts +17 -17
  184. package/ts/requests/runtimesession.ts +63 -51
  185. package/ts/requests/secret.ts +5 -10
  186. package/ts/runtime.corestore.databaseexportpackage.golden.ts +77 -95
  187. package/ts/runtime.corestore.databaseexportpackage.ts +51 -73
  188. package/ts/runtime.corestore.relay.ts +1 -10
  189. package/ts/runtime.corestore.ts +118 -268
  190. package/ts/runtime.networkprojection.ts +30 -30
  191. package/ts/runtime.ts +83 -158
  192. package/ts/runtime.workloadinit.ts +36 -48
  193. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.d.ts +0 -902
  194. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.golden.d.ts +0 -35
  195. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.golden.js +0 -315
  196. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.js +0 -3315
  197. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.d.ts +0 -291
  198. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.d.ts +0 -30
  199. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.js +0 -408
  200. package/dist_ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.js +0 -1126
  201. package/ts/runtime.cloudlylegacydeploymentsettlement.golden.ts +0 -421
  202. package/ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.golden.ts +0 -510
  203. package/ts/runtime.cloudlylegacydeploymentsettlement.offlineexport.ts +0 -2470
  204. package/ts/runtime.cloudlylegacydeploymentsettlement.ts +0 -6630
@@ -10,11 +10,11 @@ import {
10
10
  validateSecretRecipientMetadata,
11
11
  verifySecretEnvelopeContext,
12
12
  } from './data/secret.js';
13
- import type { ISecretEnvelopeAdmissionBindingV1 } from './runtime.js';
13
+ import type { ISecretEnvelopeAdmissionBinding } from './runtime.js';
14
14
  import type {
15
- IObjectStorageRetentionIntentV1,
16
- IObjectStorageRetentionEvidenceExpectationV1,
17
- IObjectStorageRetentionEvidenceV1,
15
+ IObjectStorageRetentionIntent,
16
+ IObjectStorageRetentionEvidenceExpectation,
17
+ IObjectStorageRetentionEvidence,
18
18
  } from './platform/objectstorageretention.js';
19
19
  import {
20
20
  validateObjectStorageRetentionEvidence,
@@ -26,6 +26,7 @@ import {
26
26
  createCanonicalJsonSha256Hex,
27
27
  deepFreezeValue,
28
28
  } from './private/canonicaljson.js';
29
+ import { hasExactKeys } from './private/dataproperties.js';
29
30
 
30
31
  export type TCorestoreCredentialCapability = 'database' | 'objectstorage';
31
32
 
@@ -58,15 +59,13 @@ export const getCorestoreProviderConfigId = (
58
59
  return corestoreProviderConfigIds[capabilityArg];
59
60
  };
60
61
 
61
- export interface ICorestoreControlCredentialPlaintextV1 {
62
- schemaVersion: 1;
62
+ export interface ICorestoreControlCredentialPlaintext {
63
63
  key: typeof corestoreControlCredentialKey;
64
64
  environment: typeof corestoreCredentialEnvironment;
65
65
  value: string;
66
66
  }
67
67
 
68
- export interface ICorestoreControlCredentialMaterialV1 {
69
- schemaVersion: 1;
68
+ export interface ICorestoreControlCredentialMaterial {
70
69
  requestId: string;
71
70
  clusterId: string;
72
71
  capability: TCorestoreCredentialCapability;
@@ -94,11 +93,11 @@ extends plugins.typedrequestInterfaces.implementsTR<
94
93
  expectedRecipientGeneration: number;
95
94
  };
96
95
  response: {
97
- material: ICorestoreControlCredentialMaterialV1;
96
+ material: ICorestoreControlCredentialMaterial;
98
97
  };
99
98
  }
100
99
 
101
- export interface ICorestoreControlCredentialMaterialExpectationV1 {
100
+ export interface ICorestoreControlCredentialMaterialExpectation {
102
101
  requestId: string;
103
102
  clusterId: string;
104
103
  capability: TCorestoreCredentialCapability;
@@ -106,7 +105,7 @@ export interface ICorestoreControlCredentialMaterialExpectationV1 {
106
105
  expectedRecipientGeneration: number;
107
106
  }
108
107
 
109
- export interface ICorestoreControlCredentialMaterialContextInputV1 {
108
+ export interface ICorestoreControlCredentialMaterialContextInput {
110
109
  requestId: string;
111
110
  clusterId: string;
112
111
  capability: TCorestoreCredentialCapability;
@@ -116,7 +115,6 @@ export interface ICorestoreControlCredentialMaterialContextInputV1 {
116
115
 
117
116
  const identifierPattern = /^[A-Za-z0-9][A-Za-z0-9:._-]{0,199}$/;
118
117
  const bareSha256Pattern = /^[a-f0-9]{64}$/;
119
- const environmentKeyPattern = /^[A-Z_][A-Z0-9_]{0,127}$/;
120
118
 
121
119
  const isRecord = (valueArg: unknown): valueArg is Record<string, unknown> => (
122
120
  Boolean(valueArg)
@@ -126,24 +124,6 @@ const isRecord = (valueArg: unknown): valueArg is Record<string, unknown> => (
126
124
  || Object.getPrototypeOf(valueArg) === null)
127
125
  );
128
126
 
129
- const hasExactKeys = (
130
- valueArg: Record<string, unknown>,
131
- keysArg: readonly string[],
132
- ): boolean => {
133
- const actual = Object.keys(valueArg).sort();
134
- const expected = [...keysArg].sort();
135
- return actual.length === expected.length
136
- && actual.every((keyArg, indexArg) => keyArg === expected[indexArg]);
137
- };
138
-
139
- const hasKeys = (
140
- valueArg: Record<string, unknown>,
141
- requiredArg: readonly string[],
142
- optionalArg: readonly string[],
143
- ): boolean => requiredArg.every((keyArg) => Object.hasOwn(valueArg, keyArg))
144
- && Object.keys(valueArg).every((keyArg) => requiredArg.includes(keyArg)
145
- || optionalArg.includes(keyArg));
146
-
147
127
  const isIdentifier = (valueArg: unknown): valueArg is string => (
148
128
  typeof valueArg === 'string' && identifierPattern.test(valueArg)
149
129
  );
@@ -243,7 +223,7 @@ export const createCorestoreControlCredentialPlaintextBytes = (
243
223
  ): Uint8Array | undefined => {
244
224
  if (!isCorestoreControlTokenBytes(tokenBytesArg)) return undefined;
245
225
  const prefix = new TextEncoder().encode(
246
- `{"schemaVersion":1,"key":"${corestoreControlCredentialKey}","environment":"${
226
+ `{"key":"${corestoreControlCredentialKey}","environment":"${
247
227
  corestoreCredentialEnvironment
248
228
  }","value":"`,
249
229
  );
@@ -309,9 +289,8 @@ export const validateGetCorestoreControlCredentialMaterialRequest = (
309
289
  };
310
290
 
311
291
  export const createCorestoreControlCredentialMaterialEnvelopeContext = (
312
- materialArg: ICorestoreControlCredentialMaterialContextInputV1,
292
+ materialArg: ICorestoreControlCredentialMaterialContextInput,
313
293
  ): Uint8Array => new TextEncoder().encode(JSON.stringify({
314
- schemaVersion: 1,
315
294
  purpose: 'serve.zone/corestore-control-credential-material',
316
295
  requestId: materialArg.requestId,
317
296
  clusterId: materialArg.clusterId,
@@ -329,12 +308,11 @@ export const validateCorestoreControlCredentialPlaintext = (
329
308
  plaintextArg: unknown,
330
309
  ): string[] => {
331
310
  if (!isRecord(plaintextArg)
332
- || !hasExactKeys(plaintextArg, ['schemaVersion', 'key', 'environment', 'value'])) {
311
+ || !hasExactKeys(plaintextArg, ['key', 'environment', 'value'])) {
333
312
  return ['corestore control credential plaintext must use its exact schema'];
334
313
  }
335
314
  const errors: string[] = [];
336
- if (plaintextArg.schemaVersion !== 1
337
- || plaintextArg.key !== corestoreControlCredentialKey
315
+ if (plaintextArg.key !== corestoreControlCredentialKey
338
316
  || plaintextArg.environment !== corestoreCredentialEnvironment) {
339
317
  errors.push('corestore control credential plaintext constants must be canonical');
340
318
  }
@@ -346,11 +324,10 @@ export const validateCorestoreControlCredentialPlaintext = (
346
324
 
347
325
  export const validateCorestoreControlCredentialMaterial = async (
348
326
  materialArg: unknown,
349
- expectedArg: ICorestoreControlCredentialMaterialExpectationV1,
327
+ expectedArg: ICorestoreControlCredentialMaterialExpectation,
350
328
  ): Promise<string[]> => {
351
329
  if (!isRecord(materialArg)
352
330
  || !hasExactKeys(materialArg, [
353
- 'schemaVersion',
354
331
  'requestId',
355
332
  'clusterId',
356
333
  'capability',
@@ -366,8 +343,7 @@ export const validateCorestoreControlCredentialMaterial = async (
366
343
  return ['corestore control credential material must use its exact schema'];
367
344
  }
368
345
  const errors: string[] = [];
369
- if (materialArg.schemaVersion !== 1
370
- || !isIdentifier(materialArg.requestId)
346
+ if (!isIdentifier(materialArg.requestId)
371
347
  || !isIdentifier(materialArg.clusterId)
372
348
  || !isIdentifier(materialArg.recipientKeyId)
373
349
  || !isPositiveSafeInteger(materialArg.recipientGeneration)) {
@@ -407,7 +383,7 @@ export const validateCorestoreControlCredentialMaterial = async (
407
383
  } else if (errors.length === 0 && !await verifySecretEnvelopeContext(
408
384
  envelope,
409
385
  createCorestoreControlCredentialMaterialEnvelopeContext(
410
- materialArg as unknown as ICorestoreControlCredentialMaterialContextInputV1,
386
+ materialArg as unknown as ICorestoreControlCredentialMaterialContextInput,
411
387
  ),
412
388
  )) {
413
389
  errors.push('corestore control credential envelope context must match');
@@ -416,8 +392,7 @@ export const validateCorestoreControlCredentialMaterial = async (
416
392
  return errors;
417
393
  };
418
394
 
419
- export interface ICorestoreCredentialPublicationGrantV1 {
420
- schemaVersion: 1;
395
+ export interface ICorestoreCredentialPublicationGrant {
421
396
  operationId: string;
422
397
  serviceId: string;
423
398
  bindingId: string;
@@ -429,26 +404,7 @@ export interface ICorestoreCredentialPublicationGrantV1 {
429
404
  expiresAt: number;
430
405
  }
431
406
 
432
- interface ICorestoreCredentialBindingRequestBaseV1 {
433
- schemaVersion: 1;
434
- serviceId: string;
435
- bindingId: string;
436
- providerConfigId: typeof corestoreProviderConfigIds[TCorestoreCredentialCapability];
437
- managementScope: typeof corestoreCredentialManagementScope;
438
- environment: typeof corestoreCredentialEnvironment;
439
- }
440
-
441
- export type TCorestoreCredentialBindingRequestV1 =
442
- | ICorestoreCredentialBindingRequestBaseV1 & {
443
- capability: 'database';
444
- }
445
- | ICorestoreCredentialBindingRequestBaseV1 & {
446
- capability: 'objectstorage';
447
- objectstorageRetention?: IObjectStorageRetentionIntentV1;
448
- };
449
-
450
- interface ICorestoreCredentialBindingRequestBaseV2 {
451
- schemaVersion: 2;
407
+ interface ICorestoreCredentialBindingRequestBase {
452
408
  serviceId: string;
453
409
  bindingId: string;
454
410
  providerConfigId: typeof corestoreProviderConfigIds[TCorestoreCredentialCapability];
@@ -456,16 +412,20 @@ interface ICorestoreCredentialBindingRequestBaseV2 {
456
412
  environment: typeof corestoreCredentialEnvironment;
457
413
  }
458
414
 
459
- export type TCorestoreCredentialBindingRequestV2 =
460
- | ICorestoreCredentialBindingRequestBaseV2 & {
415
+ export type TCorestoreCredentialBindingRequest =
416
+ | ICorestoreCredentialBindingRequestBase & {
461
417
  capability: 'database';
462
418
  }
463
- | ICorestoreCredentialBindingRequestBaseV2 & {
419
+ | ICorestoreCredentialBindingRequestBase & {
464
420
  capability: 'objectstorage';
465
421
  bucketName: string;
466
- objectstorageRetention?: IObjectStorageRetentionIntentV1;
422
+ objectstorageRetention?: IObjectStorageRetentionIntent;
467
423
  };
468
424
 
425
+ const failBindingRequest = (reasonArg: string): never => {
426
+ throw new Error(reasonArg);
427
+ };
428
+
469
429
  export const validateCorestoreCredentialBindingRequest = (
470
430
  requestArg: unknown,
471
431
  ): string[] => {
@@ -473,7 +433,6 @@ export const validateCorestoreCredentialBindingRequest = (
473
433
  return ['corestore credential binding request must use its exact schema'];
474
434
  }
475
435
  const baseKeys = [
476
- 'schemaVersion',
477
436
  'serviceId',
478
437
  'bindingId',
479
438
  'capability',
@@ -486,7 +445,7 @@ export const validateCorestoreCredentialBindingRequest = (
486
445
  return ['corestore database credential binding request must use its exact schema'];
487
446
  }
488
447
  } else if (requestArg.capability === 'objectstorage') {
489
- if (!hasKeys(requestArg, baseKeys, ['objectstorageRetention'])) {
448
+ if (!hasExactKeys(requestArg, [...baseKeys, 'bucketName'], ['objectstorageRetention'])) {
490
449
  return ['corestore objectstorage credential binding request must use its exact schema'];
491
450
  }
492
451
  } else {
@@ -494,8 +453,7 @@ export const validateCorestoreCredentialBindingRequest = (
494
453
  }
495
454
 
496
455
  const errors: string[] = [];
497
- if (requestArg.schemaVersion !== 1
498
- || !isIdentifier(requestArg.serviceId)
456
+ if (!isIdentifier(requestArg.serviceId)
499
457
  || !isIdentifier(requestArg.bindingId)) {
500
458
  errors.push('corestore credential binding request identity must be canonical');
501
459
  }
@@ -504,113 +462,27 @@ export const validateCorestoreCredentialBindingRequest = (
504
462
  || requestArg.environment !== corestoreCredentialEnvironment) {
505
463
  errors.push('corestore credential binding request constants must be canonical');
506
464
  }
507
- if (requestArg.capability === 'objectstorage'
508
- && requestArg.objectstorageRetention !== undefined) {
509
- errors.push(...validateObjectStorageRetentionIntent(
510
- requestArg.objectstorageRetention,
511
- 'corestore objectstorage credential binding request retention',
512
- ));
513
- }
514
- return errors;
515
- };
516
-
517
- const failBindingRequest = (reasonArg: string): never => {
518
- throw new Error(reasonArg);
519
- };
520
-
521
- export const createCorestoreCredentialBindingRequestDigestInput = (
522
- requestArg: TCorestoreCredentialBindingRequestV1,
523
- ): string => {
524
- const errors = validateCorestoreCredentialBindingRequest(requestArg);
525
- if (errors.length > 0) throw new Error(errors[0]);
526
- return canonicalizeStrictJson({
527
- schemaVersion: requestArg.schemaVersion,
528
- serviceId: requestArg.serviceId,
529
- bindingId: requestArg.bindingId,
530
- capability: requestArg.capability,
531
- providerConfigId: requestArg.providerConfigId,
532
- managementScope: requestArg.managementScope,
533
- environment: requestArg.environment,
534
- ...(requestArg.capability === 'objectstorage' && requestArg.objectstorageRetention
535
- ? {
536
- objectstorageRetention: {
537
- mode: requestArg.objectstorageRetention.mode,
538
- policyId: requestArg.objectstorageRetention.policyId,
539
- retentionDurationSeconds:
540
- requestArg.objectstorageRetention.retentionDurationSeconds,
541
- },
542
- }
543
- : {}),
544
- }, failBindingRequest, 'corestore credential binding request');
545
- };
546
-
547
- export const computeCorestoreCredentialBindingRequestSha256 = async (
548
- requestArg: TCorestoreCredentialBindingRequestV1,
549
- ): Promise<string> => createCanonicalJsonSha256Hex(
550
- createCorestoreCredentialBindingRequestDigestInput(requestArg),
551
- failBindingRequest,
552
- );
553
-
554
- export const validateCorestoreCredentialBindingRequestV2 = (
555
- requestArg: unknown,
556
- ): string[] => {
557
- if (!isRecord(requestArg)) {
558
- return ['corestore credential binding request v2 must use its exact schema'];
559
- }
560
- const baseKeys = [
561
- 'schemaVersion',
562
- 'serviceId',
563
- 'bindingId',
564
- 'capability',
565
- 'providerConfigId',
566
- 'managementScope',
567
- 'environment',
568
- ];
569
- if (requestArg.capability === 'database') {
570
- if (!hasExactKeys(requestArg, baseKeys)) {
571
- return ['corestore database credential binding request v2 must use its exact schema'];
572
- }
573
- } else if (requestArg.capability === 'objectstorage') {
574
- if (!hasKeys(requestArg, [...baseKeys, 'bucketName'], ['objectstorageRetention'])) {
575
- return ['corestore objectstorage credential binding request v2 must use its exact schema'];
576
- }
577
- } else {
578
- return ['corestore credential binding request v2 capability must be canonical'];
579
- }
580
-
581
- const errors: string[] = [];
582
- if (requestArg.schemaVersion !== 2
583
- || !isIdentifier(requestArg.serviceId)
584
- || !isIdentifier(requestArg.bindingId)) {
585
- errors.push('corestore credential binding request v2 identity must be canonical');
586
- }
587
- if (requestArg.providerConfigId !== getCorestoreProviderConfigId(requestArg.capability)
588
- || requestArg.managementScope !== corestoreCredentialManagementScope
589
- || requestArg.environment !== corestoreCredentialEnvironment) {
590
- errors.push('corestore credential binding request v2 constants must be canonical');
591
- }
592
465
  if (requestArg.capability === 'objectstorage') {
593
466
  errors.push(...validatePlatformObjectStorageBucketName(
594
467
  requestArg.bucketName,
595
- 'corestore objectstorage credential binding request v2 bucketName',
468
+ 'corestore objectstorage credential binding request bucketName',
596
469
  ));
597
470
  if (requestArg.objectstorageRetention !== undefined) {
598
471
  errors.push(...validateObjectStorageRetentionIntent(
599
472
  requestArg.objectstorageRetention,
600
- 'corestore objectstorage credential binding request v2 retention',
473
+ 'corestore objectstorage credential binding request retention',
601
474
  ));
602
475
  }
603
476
  }
604
477
  return errors;
605
478
  };
606
479
 
607
- export const createCorestoreCredentialBindingRequestDigestInputV2 = (
608
- requestArg: TCorestoreCredentialBindingRequestV2,
480
+ export const createCorestoreCredentialBindingRequestDigestInput = (
481
+ requestArg: TCorestoreCredentialBindingRequest,
609
482
  ): string => {
610
- const errors = validateCorestoreCredentialBindingRequestV2(requestArg);
483
+ const errors = validateCorestoreCredentialBindingRequest(requestArg);
611
484
  if (errors.length > 0) throw new Error(errors[0]);
612
485
  return canonicalizeStrictJson({
613
- schemaVersion: requestArg.schemaVersion,
614
486
  serviceId: requestArg.serviceId,
615
487
  bindingId: requestArg.bindingId,
616
488
  capability: requestArg.capability,
@@ -632,13 +504,13 @@ export const createCorestoreCredentialBindingRequestDigestInputV2 = (
632
504
  : {}),
633
505
  }
634
506
  : {}),
635
- }, failBindingRequest, 'corestore credential binding request v2');
507
+ }, failBindingRequest, 'corestore credential binding request');
636
508
  };
637
509
 
638
- export const computeCorestoreCredentialBindingRequestSha256V2 = async (
639
- requestArg: TCorestoreCredentialBindingRequestV2,
510
+ export const computeCorestoreCredentialBindingRequestSha256 = async (
511
+ requestArg: TCorestoreCredentialBindingRequest,
640
512
  ): Promise<string> => createCanonicalJsonSha256Hex(
641
- createCorestoreCredentialBindingRequestDigestInputV2(requestArg),
513
+ createCorestoreCredentialBindingRequestDigestInput(requestArg),
642
514
  failBindingRequest,
643
515
  );
644
516
 
@@ -648,7 +520,6 @@ export const validateCorestoreCredentialPublicationGrant = (
648
520
  ): string[] => {
649
521
  if (!isRecord(grantArg)
650
522
  || !hasExactKeys(grantArg, [
651
- 'schemaVersion',
652
523
  'operationId',
653
524
  'serviceId',
654
525
  'bindingId',
@@ -662,9 +533,6 @@ export const validateCorestoreCredentialPublicationGrant = (
662
533
  return ['corestore credential publication grant must use its exact schema'];
663
534
  }
664
535
  const errors: string[] = [];
665
- if (grantArg.schemaVersion !== 1) {
666
- errors.push('corestore credential publication grant schemaVersion must be 1');
667
- }
668
536
  if (!isIdentifier(grantArg.operationId)
669
537
  || !isIdentifier(grantArg.serviceId)
670
538
  || !isIdentifier(grantArg.bindingId)) {
@@ -702,30 +570,28 @@ export const corestoreCredentialPublicationGrantsEqual = (
702
570
  rightArg: unknown,
703
571
  ): boolean => validateCorestoreCredentialPublicationGrant(leftArg).length === 0
704
572
  && validateCorestoreCredentialPublicationGrant(rightArg).length === 0
705
- && (leftArg as ICorestoreCredentialPublicationGrantV1).schemaVersion
706
- === (rightArg as ICorestoreCredentialPublicationGrantV1).schemaVersion
707
- && (leftArg as ICorestoreCredentialPublicationGrantV1).operationId
708
- === (rightArg as ICorestoreCredentialPublicationGrantV1).operationId
709
- && (leftArg as ICorestoreCredentialPublicationGrantV1).serviceId
710
- === (rightArg as ICorestoreCredentialPublicationGrantV1).serviceId
711
- && (leftArg as ICorestoreCredentialPublicationGrantV1).bindingId
712
- === (rightArg as ICorestoreCredentialPublicationGrantV1).bindingId
713
- && (leftArg as ICorestoreCredentialPublicationGrantV1).capability
714
- === (rightArg as ICorestoreCredentialPublicationGrantV1).capability
715
- && (leftArg as ICorestoreCredentialPublicationGrantV1).reconciliationGeneration
716
- === (rightArg as ICorestoreCredentialPublicationGrantV1).reconciliationGeneration
717
- && (leftArg as ICorestoreCredentialPublicationGrantV1).expectedTargetSecretsRevision
718
- === (rightArg as ICorestoreCredentialPublicationGrantV1).expectedTargetSecretsRevision
719
- && (leftArg as ICorestoreCredentialPublicationGrantV1).bindingRequestDigest
720
- === (rightArg as ICorestoreCredentialPublicationGrantV1).bindingRequestDigest
721
- && (leftArg as ICorestoreCredentialPublicationGrantV1).issuedAt
722
- === (rightArg as ICorestoreCredentialPublicationGrantV1).issuedAt
723
- && (leftArg as ICorestoreCredentialPublicationGrantV1).expiresAt
724
- === (rightArg as ICorestoreCredentialPublicationGrantV1).expiresAt;
573
+ && (leftArg as ICorestoreCredentialPublicationGrant).operationId
574
+ === (rightArg as ICorestoreCredentialPublicationGrant).operationId
575
+ && (leftArg as ICorestoreCredentialPublicationGrant).serviceId
576
+ === (rightArg as ICorestoreCredentialPublicationGrant).serviceId
577
+ && (leftArg as ICorestoreCredentialPublicationGrant).bindingId
578
+ === (rightArg as ICorestoreCredentialPublicationGrant).bindingId
579
+ && (leftArg as ICorestoreCredentialPublicationGrant).capability
580
+ === (rightArg as ICorestoreCredentialPublicationGrant).capability
581
+ && (leftArg as ICorestoreCredentialPublicationGrant).reconciliationGeneration
582
+ === (rightArg as ICorestoreCredentialPublicationGrant).reconciliationGeneration
583
+ && (leftArg as ICorestoreCredentialPublicationGrant).expectedTargetSecretsRevision
584
+ === (rightArg as ICorestoreCredentialPublicationGrant).expectedTargetSecretsRevision
585
+ && (leftArg as ICorestoreCredentialPublicationGrant).bindingRequestDigest
586
+ === (rightArg as ICorestoreCredentialPublicationGrant).bindingRequestDigest
587
+ && (leftArg as ICorestoreCredentialPublicationGrant).issuedAt
588
+ === (rightArg as ICorestoreCredentialPublicationGrant).issuedAt
589
+ && (leftArg as ICorestoreCredentialPublicationGrant).expiresAt
590
+ === (rightArg as ICorestoreCredentialPublicationGrant).expiresAt;
725
591
 
726
592
  const comparePublicationGrants = (
727
- leftArg: ICorestoreCredentialPublicationGrantV1,
728
- rightArg: ICorestoreCredentialPublicationGrantV1,
593
+ leftArg: ICorestoreCredentialPublicationGrant,
594
+ rightArg: ICorestoreCredentialPublicationGrant,
729
595
  ): number => leftArg.bindingId < rightArg.bindingId
730
596
  ? -1
731
597
  : leftArg.bindingId > rightArg.bindingId
@@ -745,12 +611,12 @@ export const validateCorestoreCredentialPublicationGrants = (
745
611
  return ['corestore credential publication grants must be a bounded array'];
746
612
  }
747
613
  const errors: string[] = [];
748
- let previous: ICorestoreCredentialPublicationGrantV1 | undefined;
614
+ let previous: ICorestoreCredentialPublicationGrant | undefined;
749
615
  for (const [index, grantArg] of grantsArg.entries()) {
750
616
  const grantErrors = validateCorestoreCredentialPublicationGrant(grantArg, trustedNowArg);
751
617
  errors.push(...grantErrors.map((errorArg) => `publication grants[${index}] ${errorArg}`));
752
618
  if (grantErrors.length === 0) {
753
- const grant = grantArg as ICorestoreCredentialPublicationGrantV1;
619
+ const grant = grantArg as ICorestoreCredentialPublicationGrant;
754
620
  if (previous && comparePublicationGrants(previous, grant) >= 0) {
755
621
  errors.push('corestore credential publication grants must be unique and sorted by bindingId then operationId');
756
622
  }
@@ -798,29 +664,27 @@ export type TCorestoreCredentialSecretKey =
798
664
  | TCorestoreDatabaseCredentialKey
799
665
  | TCorestoreObjectStorageCredentialSecretKey;
800
666
 
801
- export type TCorestoreDatabaseCredentialValuesV1 = {
667
+ export type TCorestoreDatabaseCredentialValues = {
802
668
  [TKey in TCorestoreDatabaseCredentialKey]: string;
803
669
  };
804
670
 
805
- export interface ICorestoreDatabaseCredentialPlaintextMaterialV1 {
806
- schemaVersion: 1;
671
+ export interface ICorestoreDatabaseCredentialPlaintextMaterial {
807
672
  capability: 'database';
808
- values: TCorestoreDatabaseCredentialValuesV1;
673
+ values: TCorestoreDatabaseCredentialValues;
809
674
  }
810
675
 
811
- export interface ICorestoreObjectStorageCredentialPlaintextMaterialV1 {
812
- schemaVersion: 1;
676
+ export interface ICorestoreObjectStorageCredentialPlaintextMaterial {
813
677
  capability: 'objectstorage';
814
678
  values: {
815
679
  accessKeyId: string;
816
680
  secretAccessKey: string;
817
681
  };
818
- retention?: IObjectStorageRetentionEvidenceV1;
682
+ retention?: IObjectStorageRetentionEvidence;
819
683
  }
820
684
 
821
- export type TCorestoreCredentialPlaintextMaterialV1 =
822
- | ICorestoreDatabaseCredentialPlaintextMaterialV1
823
- | ICorestoreObjectStorageCredentialPlaintextMaterialV1;
685
+ export type TCorestoreCredentialPlaintextMaterial =
686
+ | ICorestoreDatabaseCredentialPlaintextMaterial
687
+ | ICorestoreObjectStorageCredentialPlaintextMaterial;
824
688
 
825
689
  const readCredentialString = (valueArg: unknown): boolean => typeof valueArg === 'string'
826
690
  && valueArg.length > 0
@@ -831,8 +695,7 @@ export const validateCorestoreDatabaseCredentialMaterial = (
831
695
  materialArg: unknown,
832
696
  ): string[] => {
833
697
  if (!isRecord(materialArg)
834
- || !hasExactKeys(materialArg, ['schemaVersion', 'capability', 'values'])
835
- || materialArg.schemaVersion !== 1
698
+ || !hasExactKeys(materialArg, ['capability', 'values'])
836
699
  || materialArg.capability !== 'database'
837
700
  || !isRecord(materialArg.values)
838
701
  || !hasExactKeys(materialArg.values, corestoreDatabaseCredentialKeys)) {
@@ -866,11 +729,10 @@ export const validateCorestoreDatabaseCredentialMaterial = (
866
729
 
867
730
  export const validateCorestoreObjectStorageCredentialMaterial = async (
868
731
  materialArg: unknown,
869
- retentionExpectationArg?: IObjectStorageRetentionEvidenceExpectationV1,
732
+ retentionExpectationArg?: IObjectStorageRetentionEvidenceExpectation,
870
733
  ): Promise<string[]> => {
871
734
  if (!isRecord(materialArg)
872
- || !hasKeys(materialArg, ['schemaVersion', 'capability', 'values'], ['retention'])
873
- || materialArg.schemaVersion !== 1
735
+ || !hasExactKeys(materialArg, ['capability', 'values'], ['retention'])
874
736
  || materialArg.capability !== 'objectstorage'
875
737
  || !isRecord(materialArg.values)
876
738
  || !hasExactKeys(materialArg.values, corestoreObjectStorageCredentialPlaintextKeys)) {
@@ -898,20 +760,20 @@ export const validateCorestoreObjectStorageCredentialMaterial = async (
898
760
 
899
761
  export const validateCorestoreCredentialPlaintextMaterial = async (
900
762
  materialArg: unknown,
901
- retentionExpectationArg?: IObjectStorageRetentionEvidenceExpectationV1,
763
+ retentionExpectationArg?: IObjectStorageRetentionEvidenceExpectation,
902
764
  ): Promise<string[]> => isRecord(materialArg) && materialArg.capability === 'database'
903
765
  ? validateCorestoreDatabaseCredentialMaterial(materialArg)
904
766
  : validateCorestoreObjectStorageCredentialMaterial(materialArg, retentionExpectationArg);
905
767
 
906
- export interface ICorestoreCredentialSecretValueV1 {
768
+ export interface ICorestoreCredentialSecretValue {
907
769
  key: TCorestoreCredentialSecretKey;
908
770
  value: string;
909
771
  }
910
772
 
911
773
  export const createCorestoreCredentialSecretValues = async (
912
- materialArg: TCorestoreCredentialPlaintextMaterialV1,
913
- retentionExpectationArg?: IObjectStorageRetentionEvidenceExpectationV1,
914
- ): Promise<ICorestoreCredentialSecretValueV1[]> => {
774
+ materialArg: TCorestoreCredentialPlaintextMaterial,
775
+ retentionExpectationArg?: IObjectStorageRetentionEvidenceExpectation,
776
+ ): Promise<ICorestoreCredentialSecretValue[]> => {
915
777
  const errors = await validateCorestoreCredentialPlaintextMaterial(
916
778
  materialArg,
917
779
  retentionExpectationArg,
@@ -933,38 +795,37 @@ export const createCorestoreCredentialSecretValues = async (
933
795
  }));
934
796
  };
935
797
 
936
- export interface IPublishCorestoreCredentialMaterialRequestV1 {
798
+ export interface IPublishCorestoreCredentialMaterialRequest {
937
799
  identity: IIdentityCredential;
938
800
  mutationId: string;
939
- grant: ICorestoreCredentialPublicationGrantV1;
801
+ grant: ICorestoreCredentialPublicationGrant;
940
802
  expectedIngressRecipientKeyId: string;
941
803
  expectedIngressRecipientGeneration: number;
942
804
  envelope: plugins.smartcrypto.IX25519EnvelopeV1;
943
805
  }
944
806
 
945
- export interface ICorestoreCredentialSecretVersionReferenceV1
807
+ export interface ICorestoreCredentialSecretVersionReference
946
808
  extends ISecretVersionReference {
947
809
  key: TCorestoreCredentialSecretKey;
948
810
  }
949
811
 
950
- export interface ICorestoreCredentialPublicationCoverageV1 {
812
+ export interface ICorestoreCredentialPublicationCoverage {
951
813
  keys: TCorestoreCredentialSecretKey[];
952
- versionReferences: ICorestoreCredentialSecretVersionReferenceV1[];
814
+ versionReferences: ICorestoreCredentialSecretVersionReference[];
953
815
  }
954
816
 
955
- export interface ICorestoreCredentialPublicationReceiptV1 {
956
- schemaVersion: 1;
817
+ export interface ICorestoreCredentialPublicationReceipt {
957
818
  mutationId: string;
958
819
  organizationId: string;
959
820
  clusterId: string;
960
821
  serviceId: string;
961
822
  bindingId: string;
962
823
  capability: TCorestoreCredentialCapability;
963
- grant: ICorestoreCredentialPublicationGrantV1;
964
- coverage: ICorestoreCredentialPublicationCoverageV1;
824
+ grant: ICorestoreCredentialPublicationGrant;
825
+ coverage: ICorestoreCredentialPublicationCoverage;
965
826
  expectedTargetSecretsRevision: number;
966
827
  targetSecretsRevision: number;
967
- ingressAdmissionBinding: ISecretEnvelopeAdmissionBindingV1;
828
+ ingressAdmissionBinding: ISecretEnvelopeAdmissionBinding;
968
829
  acceptedAt: number;
969
830
  replayed: boolean;
970
831
  }
@@ -975,20 +836,18 @@ extends plugins.typedrequestInterfaces.implementsTR<
975
836
  IReq_PublishCorestoreCredentialMaterial
976
837
  > {
977
838
  method: 'publishCorestoreCredentialMaterial';
978
- request: IPublishCorestoreCredentialMaterialRequestV1;
839
+ request: IPublishCorestoreCredentialMaterialRequest;
979
840
  response: {
980
- receipt: ICorestoreCredentialPublicationReceiptV1;
841
+ receipt: ICorestoreCredentialPublicationReceipt;
981
842
  };
982
843
  }
983
844
 
984
845
  export const createPublishCorestoreCredentialMaterialEnvelopeContext = (
985
- requestArg: Omit<IPublishCorestoreCredentialMaterialRequestV1, 'identity' | 'envelope'>,
846
+ requestArg: Omit<IPublishCorestoreCredentialMaterialRequest, 'identity' | 'envelope'>,
986
847
  ): Uint8Array => new TextEncoder().encode(JSON.stringify({
987
- schemaVersion: 1,
988
848
  purpose: 'serve.zone/publish-corestore-credential-material',
989
849
  mutationId: requestArg.mutationId,
990
850
  grant: {
991
- schemaVersion: requestArg.grant.schemaVersion,
992
851
  operationId: requestArg.grant.operationId,
993
852
  serviceId: requestArg.grant.serviceId,
994
853
  bindingId: requestArg.grant.bindingId,
@@ -1005,7 +864,7 @@ export const createPublishCorestoreCredentialMaterialEnvelopeContext = (
1005
864
 
1006
865
  export const validatePublishCorestoreCredentialMaterialRequest = async (
1007
866
  requestArg: unknown,
1008
- expectedGrantArg: ICorestoreCredentialPublicationGrantV1,
867
+ expectedGrantArg: ICorestoreCredentialPublicationGrant,
1009
868
  activeRecipientArg: IActiveSecretRecipientMetadata,
1010
869
  trustedNowArg: number,
1011
870
  ): Promise<string[]> => {
@@ -1055,7 +914,7 @@ export const validatePublishCorestoreCredentialMaterialRequest = async (
1055
914
  envelope,
1056
915
  createPublishCorestoreCredentialMaterialEnvelopeContext(
1057
916
  requestArg as unknown as Omit<
1058
- IPublishCorestoreCredentialMaterialRequestV1,
917
+ IPublishCorestoreCredentialMaterialRequest,
1059
918
  'identity' | 'envelope'
1060
919
  >,
1061
920
  ),
@@ -1072,8 +931,8 @@ const expectedCoverageKeys = (
1072
931
  ? corestoreDatabaseCredentialKeys
1073
932
  : corestoreObjectStorageCredentialSecretKeys;
1074
933
 
1075
- export interface ICorestoreCredentialPublicationReceiptExpectationV1 {
1076
- request: IPublishCorestoreCredentialMaterialRequestV1;
934
+ export interface ICorestoreCredentialPublicationReceiptExpectation {
935
+ request: IPublishCorestoreCredentialMaterialRequest;
1077
936
  organizationId: string;
1078
937
  clusterId: string;
1079
938
  }
@@ -1087,7 +946,7 @@ const computeRuntimeSha256 = async (valueArg: Uint8Array): Promise<string> => {
1087
946
  };
1088
947
 
1089
948
  const verifyPublicationAdmissionBinding = async (
1090
- bindingArg: ISecretEnvelopeAdmissionBindingV1,
949
+ bindingArg: ISecretEnvelopeAdmissionBinding,
1091
950
  envelopeArg: unknown,
1092
951
  contextArg: Uint8Array,
1093
952
  ): Promise<boolean> => {
@@ -1118,11 +977,10 @@ const verifyPublicationAdmissionBinding = async (
1118
977
 
1119
978
  export const validateCorestoreCredentialPublicationReceipt = async (
1120
979
  receiptArg: unknown,
1121
- expectedArg: ICorestoreCredentialPublicationReceiptExpectationV1,
980
+ expectedArg: ICorestoreCredentialPublicationReceiptExpectation,
1122
981
  ): Promise<string[]> => {
1123
982
  if (!isRecord(receiptArg)
1124
983
  || !hasExactKeys(receiptArg, [
1125
- 'schemaVersion',
1126
984
  'mutationId',
1127
985
  'organizationId',
1128
986
  'clusterId',
@@ -1140,15 +998,14 @@ export const validateCorestoreCredentialPublicationReceipt = async (
1140
998
  return ['corestore credential publication receipt must use its exact schema'];
1141
999
  }
1142
1000
  const errors = validateCorestoreCredentialPublicationGrant(receiptArg.grant);
1143
- if (receiptArg.schemaVersion !== 1
1144
- || !isIdentifier(receiptArg.mutationId)
1001
+ if (!isIdentifier(receiptArg.mutationId)
1145
1002
  || !isIdentifier(receiptArg.organizationId)
1146
1003
  || !isIdentifier(receiptArg.clusterId)
1147
1004
  || !isIdentifier(receiptArg.serviceId)
1148
1005
  || !isIdentifier(receiptArg.bindingId)) {
1149
1006
  errors.push('corestore credential publication receipt identifiers must be canonical');
1150
1007
  }
1151
- const grant = receiptArg.grant as ICorestoreCredentialPublicationGrantV1;
1008
+ const grant = receiptArg.grant as ICorestoreCredentialPublicationGrant;
1152
1009
  if ((receiptArg.capability !== 'database' && receiptArg.capability !== 'objectstorage')
1153
1010
  || receiptArg.serviceId !== grant.serviceId
1154
1011
  || receiptArg.bindingId !== grant.bindingId
@@ -1206,13 +1063,11 @@ export const validateCorestoreCredentialPublicationReceipt = async (
1206
1063
  const admission = receiptArg.ingressAdmissionBinding;
1207
1064
  if (!isRecord(admission)
1208
1065
  || !hasExactKeys(admission, [
1209
- 'schemaVersion',
1210
1066
  'recipientKeyId',
1211
1067
  'recipientGeneration',
1212
1068
  'envelopeDigest',
1213
1069
  'requestContextDigest',
1214
1070
  ])
1215
- || admission.schemaVersion !== 1
1216
1071
  || !isIdentifier(admission.recipientKeyId)
1217
1072
  || !isPositiveSafeInteger(admission.recipientGeneration)
1218
1073
  || typeof admission.envelopeDigest !== 'string'
@@ -1223,7 +1078,7 @@ export const validateCorestoreCredentialPublicationReceipt = async (
1223
1078
  } else if (admission.recipientKeyId !== expectedArg.request.expectedIngressRecipientKeyId
1224
1079
  || admission.recipientGeneration !== expectedArg.request.expectedIngressRecipientGeneration
1225
1080
  || !await verifyPublicationAdmissionBinding(
1226
- admission as unknown as ISecretEnvelopeAdmissionBindingV1,
1081
+ admission as unknown as ISecretEnvelopeAdmissionBinding,
1227
1082
  expectedArg.request.envelope,
1228
1083
  createPublishCorestoreCredentialMaterialEnvelopeContext(expectedArg.request),
1229
1084
  )) {
@@ -1255,16 +1110,14 @@ export const corestoreCredentialPublicationErrorMetadata = Object.freeze({
1255
1110
  export type TCorestoreCredentialPublicationErrorCode =
1256
1111
  keyof typeof corestoreCredentialPublicationErrorMetadata;
1257
1112
 
1258
- export interface ICorestoreCredentialPublicationErrorMetadataV1 {
1259
- schemaVersion: 1;
1113
+ export interface ICorestoreCredentialPublicationErrorMetadata {
1260
1114
  code: TCorestoreCredentialPublicationErrorCode;
1261
1115
  retryable: boolean;
1262
1116
  }
1263
1117
 
1264
1118
  export const getCorestoreCredentialPublicationErrorMetadata = (
1265
1119
  codeArg: TCorestoreCredentialPublicationErrorCode,
1266
- ): ICorestoreCredentialPublicationErrorMetadataV1 => ({
1267
- schemaVersion: 1,
1120
+ ): ICorestoreCredentialPublicationErrorMetadata => ({
1268
1121
  code: codeArg,
1269
1122
  retryable: corestoreCredentialPublicationErrorMetadata[codeArg].retryable,
1270
1123
  });
@@ -1313,7 +1166,6 @@ export interface ICorestoreDatabaseBackupSnapshot {
1313
1166
  }
1314
1167
 
1315
1168
  export interface ICorestoreDatabaseBackupClosureReceipt {
1316
- formatVersion: 1;
1317
1169
  snapshotIds: [string];
1318
1170
  objectCount: number;
1319
1171
  packCount: number;
@@ -1323,9 +1175,22 @@ export interface ICorestoreDatabaseBackupClosureReceipt {
1323
1175
  sha256: string;
1324
1176
  }
1325
1177
 
1178
+ /**
1179
+ * The media type a Corestore database backup archive is served and stored under.
1180
+ *
1181
+ * Defined once here because four processes state it — Corestore's control server and its export
1182
+ * packager, Onebox and the cluster relay — and a content type that two of them spell differently
1183
+ * is a transfer that fails at the last hop instead of at the first. Every one of them imports this
1184
+ * constant rather than writing the bytes again.
1185
+ */
1186
+ export const corestoreDatabaseBackupMediaType =
1187
+ 'application/vnd.serve-zone.corestore-database-backup' as const;
1188
+
1189
+ /** The format a backup receipt states, which is this media type's payload contract. */
1190
+ export const corestoreDatabaseBackupFormat = 'corestore.database.backup' as const;
1191
+
1326
1192
  export interface ICorestoreDatabaseBackupReceipt {
1327
- schemaVersion: 1;
1328
- format: 'corestore.database.backup.v1';
1193
+ format: typeof corestoreDatabaseBackupFormat;
1329
1194
  backupId: string;
1330
1195
  sourceServiceId: string;
1331
1196
  createdAt: number;
@@ -1334,7 +1199,6 @@ export interface ICorestoreDatabaseBackupReceipt {
1334
1199
  }
1335
1200
 
1336
1201
  export interface ICorestoreDatabaseBackupRestoreRequest {
1337
- schemaVersion: 1;
1338
1202
  targetServiceId: string;
1339
1203
  receipt: ICorestoreDatabaseBackupReceipt;
1340
1204
  expectedDatabaseAllocation?: ICorestoreDatabaseAllocationReference;
@@ -1343,7 +1207,6 @@ export interface ICorestoreDatabaseBackupRestoreRequest {
1343
1207
  }
1344
1208
 
1345
1209
  export interface ICorestoreDatabaseBackupRestoreResponse {
1346
- schemaVersion: 1;
1347
1210
  ok: true;
1348
1211
  backupId: string;
1349
1212
  sourceServiceId: string;
@@ -1498,7 +1361,6 @@ const normalizeCorestoreDatabaseBackupReceiptInternal = (
1498
1361
  ): ICorestoreDatabaseBackupReceipt => {
1499
1362
  const value = readCorestoreDatabaseBackupRecord(valueArg, pathArg);
1500
1363
  assertCorestoreDatabaseBackupExactKeys(value, [
1501
- 'schemaVersion',
1502
1364
  'format',
1503
1365
  'backupId',
1504
1366
  'sourceServiceId',
@@ -1506,8 +1368,8 @@ const normalizeCorestoreDatabaseBackupReceiptInternal = (
1506
1368
  'snapshot',
1507
1369
  'closure',
1508
1370
  ], pathArg);
1509
- if (value.schemaVersion !== 1 || value.format !== 'corestore.database.backup.v1') {
1510
- failCorestoreDatabaseBackup(`${pathArg} version must be canonical`);
1371
+ if (value.format !== corestoreDatabaseBackupFormat) {
1372
+ failCorestoreDatabaseBackup(`${pathArg} format must be canonical`);
1511
1373
  }
1512
1374
  const backupId = readCorestoreDatabaseBackupIdentifier(value.backupId, `${pathArg}.backupId`);
1513
1375
  const sourceServiceId = readCorestoreDatabaseBackupIdentifier(
@@ -1584,7 +1446,6 @@ const normalizeCorestoreDatabaseBackupReceiptInternal = (
1584
1446
  const serviceName = tagsValue.serviceName as string;
1585
1447
  const closureValue = readCorestoreDatabaseBackupRecord(value.closure, `${pathArg}.closure`);
1586
1448
  assertCorestoreDatabaseBackupExactKeys(closureValue, [
1587
- 'formatVersion',
1588
1449
  'snapshotIds',
1589
1450
  'objectCount',
1590
1451
  'packCount',
@@ -1647,8 +1508,7 @@ const normalizeCorestoreDatabaseBackupReceiptInternal = (
1647
1508
  )
1648
1509
  : undefined;
1649
1510
  return {
1650
- schemaVersion: 1,
1651
- format: 'corestore.database.backup.v1',
1511
+ format: corestoreDatabaseBackupFormat,
1652
1512
  backupId,
1653
1513
  sourceServiceId,
1654
1514
  createdAt,
@@ -1673,9 +1533,6 @@ const normalizeCorestoreDatabaseBackupReceiptInternal = (
1673
1533
  ...(databaseAllocation ? { databaseAllocation } : {}),
1674
1534
  },
1675
1535
  closure: {
1676
- formatVersion: closureValue.formatVersion === 1
1677
- ? 1
1678
- : failCorestoreDatabaseBackup(`${pathArg}.closure formatVersion must be 1`),
1679
1536
  snapshotIds: [snapshotId],
1680
1537
  objectCount,
1681
1538
  packCount,
@@ -1714,15 +1571,11 @@ export const normalizeCorestoreDatabaseBackupRestoreRequest = (
1714
1571
  const hasAllocation = Object.hasOwn(value, 'expectedDatabaseAllocation');
1715
1572
  const hasRestoreAttemptId = Object.hasOwn(value, 'restoreAttemptId');
1716
1573
  assertCorestoreDatabaseBackupExactKeys(value, [
1717
- 'schemaVersion',
1718
1574
  'targetServiceId',
1719
1575
  'receipt',
1720
1576
  ...(hasAllocation ? ['expectedDatabaseAllocation'] : []),
1721
1577
  ...(hasRestoreAttemptId ? ['restoreAttemptId'] : []),
1722
1578
  ], 'databaseBackupRestoreRequest');
1723
- if (value.schemaVersion !== 1) {
1724
- failCorestoreDatabaseBackup('databaseBackupRestoreRequest schemaVersion must be 1');
1725
- }
1726
1579
  const receipt = normalizeCorestoreDatabaseBackupReceiptInternal(
1727
1580
  value.receipt,
1728
1581
  'databaseBackupRestoreRequest.receipt',
@@ -1740,7 +1593,6 @@ export const normalizeCorestoreDatabaseBackupRestoreRequest = (
1740
1593
  )
1741
1594
  : undefined;
1742
1595
  return finalizeCorestoreDatabaseBackup({
1743
- schemaVersion: 1,
1744
1596
  targetServiceId: readCorestoreDatabaseBackupIdentifier(
1745
1597
  value.targetServiceId,
1746
1598
  'databaseBackupRestoreRequest.targetServiceId',
@@ -1756,7 +1608,6 @@ export const normalizeCorestoreDatabaseBackupRestoreResponse = (
1756
1608
  ): Readonly<ICorestoreDatabaseBackupRestoreResponse> => {
1757
1609
  const value = readCorestoreDatabaseBackupRecord(valueArg, 'databaseBackupRestoreResponse');
1758
1610
  assertCorestoreDatabaseBackupExactKeys(value, [
1759
- 'schemaVersion',
1760
1611
  'ok',
1761
1612
  'backupId',
1762
1613
  'sourceServiceId',
@@ -1766,12 +1617,11 @@ export const normalizeCorestoreDatabaseBackupRestoreResponse = (
1766
1617
  'requestSha256',
1767
1618
  'replayed',
1768
1619
  ], 'databaseBackupRestoreResponse');
1769
- if (value.schemaVersion !== 1 || value.ok !== true || typeof value.replayed !== 'boolean') {
1620
+ if (value.ok !== true || typeof value.replayed !== 'boolean') {
1770
1621
  failCorestoreDatabaseBackup('databaseBackupRestoreResponse constants must be canonical');
1771
1622
  }
1772
1623
  const replayed = value.replayed as boolean;
1773
1624
  return finalizeCorestoreDatabaseBackup({
1774
- schemaVersion: 1,
1775
1625
  ok: true,
1776
1626
  backupId: readCorestoreDatabaseBackupIdentifier(
1777
1627
  value.backupId,