@serve.zone/interfaces 32.116.0 → 32.117.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.
@@ -1,11 +1,14 @@
1
1
  import type * as plugins from '../plugins.js';
2
2
  import { readExactDataRecord } from '../private/dataproperties.js';
3
+ import { validateControllerIdentifier } from '../private/controllercontract.js';
4
+ import { isBoundedInteger } from '../private/runtimepolicy.js';
3
5
  import {
4
6
  snapshotControlledTakeoverAbortInput,
5
7
  snapshotControlledTakeoverGetInput,
6
8
  snapshotControlledTakeoverListInput,
7
9
  snapshotControlledTakeoverStartInput,
8
10
  snapshotNupstWebhookEndpointConfigureInput,
11
+ snapshotNupstWebhookEndpointConfig,
9
12
  snapshotNupstWebhookEndpointRotateInput,
10
13
  } from '../data/controlledtakeover.js';
11
14
  import type {
@@ -16,6 +19,7 @@ import type {
16
19
  IControlledTakeoverOperationResponse,
17
20
  IControlledTakeoverStartInput,
18
21
  INupstWebhookEndpointConfigureInput,
22
+ INupstWebhookEndpointConfig,
19
23
  INupstWebhookEndpointResponse,
20
24
  INupstWebhookEndpointRotateInput,
21
25
  TControlledTakeoverAbortResponse,
@@ -106,3 +110,58 @@ export interface IReq_Admin_Cloudly_RotateNupstWebhookEndpointSecret extends plu
106
110
  request: IControlledTakeoverAdminRequest<INupstWebhookEndpointRotateInput>;
107
111
  response: INupstWebhookEndpointResponse;
108
112
  }
113
+
114
+ /** The public endpoint snapshot contains metadata only. */
115
+ export type INupstWebhookEndpoint = INupstWebhookEndpointConfig;
116
+
117
+ /**
118
+ * Fresh human administrator on the HTTP credential endpoint only. Cloudly fences the rotation
119
+ * against the observed secret version, commits it, then may show the new secret to that same
120
+ * administrator once. A withheld credential still acknowledges the rotation.
121
+ */
122
+ export interface IReq_Admin_Cloudly_RotateNupstWebhookEndpointSecretWithDisclosure
123
+ extends plugins.typedrequestInterfaces.implementsTR<
124
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_RotateNupstWebhookEndpointSecretWithDisclosure
125
+ > {
126
+ method: 'rotateNupstWebhookEndpointSecretWithDisclosure';
127
+ request: {
128
+ identity: IIdentityCredential;
129
+ endpointId: string;
130
+ /** The observed secret version, or zero for a configured endpoint with no secret yet. */
131
+ expectedRevision: number;
132
+ };
133
+ response: {
134
+ endpoint: INupstWebhookEndpoint;
135
+ credential: { kind: 'shown'; secret: string } | { kind: 'withheld' };
136
+ };
137
+ }
138
+
139
+ const invalidDisclosure = (): never => { throw new Error('Nupst webhook secret disclosure contract rejected.'); };
140
+
141
+ export const snapshotRotateNupstWebhookEndpointSecretWithDisclosureRequest = (
142
+ value: unknown,
143
+ ): IReq_Admin_Cloudly_RotateNupstWebhookEndpointSecretWithDisclosure['request'] => {
144
+ const request = readExactDataRecord(value, ['identity', 'endpointId', 'expectedRevision']);
145
+ const identity = readExactDataRecord(request?.identity, ['jwt']);
146
+ if (!request || typeof identity?.jwt !== 'string' || identity.jwt.length === 0
147
+ || typeof request.endpointId !== 'string' || validateControllerIdentifier(request.endpointId, 'endpointId').length
148
+ || !isBoundedInteger(request.expectedRevision, 0, Number.MAX_SAFE_INTEGER)) return invalidDisclosure();
149
+ return { identity: { jwt: identity.jwt }, endpointId: request.endpointId, expectedRevision: request.expectedRevision };
150
+ };
151
+
152
+ /** Credential-bearing. Consume only on the HTTP credential path and keep out of logs and storage. */
153
+ export const snapshotRotateNupstWebhookEndpointSecretWithDisclosureResponse = (
154
+ value: unknown,
155
+ ): IReq_Admin_Cloudly_RotateNupstWebhookEndpointSecretWithDisclosure['response'] => {
156
+ const response = readExactDataRecord(value, ['endpoint', 'credential']) ?? invalidDisclosure();
157
+ const endpoint = snapshotNupstWebhookEndpointConfig(response.endpoint);
158
+ const withheld = readExactDataRecord(response.credential, ['kind']);
159
+ if (withheld?.kind === 'withheld') return { endpoint, credential: { kind: 'withheld' } };
160
+ const shown = readExactDataRecord(response.credential, ['kind', 'secret']);
161
+ // 32 bytes in padded RFC 4648 base64: 42 full sextets, four data bits, then one pad.
162
+ if (!endpoint.secretConfigured || shown?.kind !== 'shown' || typeof shown.secret !== 'string'
163
+ || shown.secret.length !== 50 || !/^whsec_[A-Za-z0-9+/]{42}[AEIMQUYcgkosw048]=$/.test(shown.secret)) {
164
+ return invalidDisclosure();
165
+ }
166
+ return { endpoint, credential: { kind: 'shown', secret: shown.secret } };
167
+ };
@@ -0,0 +1,81 @@
1
+ import type * as plugins from '../plugins.js';
2
+ import type {
3
+ IDiskEncryptionKeyReleaseChallenge, IDiskEncryptionKeyReleaseProof, IDiskEncryptionLocationRecoveryKey,
4
+ IDiskEncryptionNodeIdentity, IDiskEncryptionUnlockApproval, TDiskEncryptionKeyReleaseOutcome,
5
+ } from '../data/diskencryption.js';
6
+ import type { IIdentityCredential } from '../data/user.js';
7
+
8
+ interface IDiskEncryptionAdministratorRequest {
9
+ identity: IIdentityCredential;
10
+ }
11
+
12
+ interface IDiskEncryptionMachineRequest {
13
+ machineId: string;
14
+ }
15
+
16
+ /** Cloudly verifies TPM binding and owns the enrollment audit fields and revision. */
17
+ export interface IReq_Admin_Cloudly_EnrollDiskEncryptionIdentity extends plugins.typedrequestInterfaces.implementsTR<
18
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_EnrollDiskEncryptionIdentity
19
+ > {
20
+ method: 'enrollDiskEncryptionIdentity';
21
+ request: IDiskEncryptionAdministratorRequest & Pick<IDiskEncryptionNodeIdentity,
22
+ 'machineId' | 'machineKind' | 'locationId' | 'keyAlgorithm' | 'publicKeyPem' | 'tpmAttestationDigest'>;
23
+ response: { nodeIdentity: IDiskEncryptionNodeIdentity };
24
+ }
25
+
26
+ export interface IReq_Admin_Cloudly_RevokeDiskEncryptionIdentity extends plugins.typedrequestInterfaces.implementsTR<
27
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_RevokeDiskEncryptionIdentity
28
+ > {
29
+ method: 'revokeDiskEncryptionIdentity';
30
+ request: IDiskEncryptionAdministratorRequest & IDiskEncryptionMachineRequest & { expectedRevision: number };
31
+ response: { nodeIdentity: IDiskEncryptionNodeIdentity };
32
+ }
33
+
34
+ /** Issuing a challenge grants no authority. Cloudly binds it to the machine and its own current epoch. */
35
+ export interface IReq_Machine_Cloudly_RequestDiskEncryptionChallenge extends plugins.typedrequestInterfaces.implementsTR<
36
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Machine_Cloudly_RequestDiskEncryptionChallenge
37
+ > {
38
+ method: 'requestDiskEncryptionChallenge';
39
+ request: IDiskEncryptionMachineRequest;
40
+ response: { challenge: IDiskEncryptionKeyReleaseChallenge };
41
+ }
42
+
43
+ /**
44
+ * Cloudly consumes the exact challenge once after authenticating the TPM-signed proof. It checks
45
+ * the current machine, location and approval before releasing a key wrapped to the ephemeral key.
46
+ */
47
+ export interface IReq_Machine_Cloudly_ReleaseDiskEncryptionKey extends plugins.typedrequestInterfaces.implementsTR<
48
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Machine_Cloudly_ReleaseDiskEncryptionKey
49
+ > {
50
+ method: 'releaseDiskEncryptionKey';
51
+ request: { proof: IDiskEncryptionKeyReleaseProof };
52
+ response: TDiskEncryptionKeyReleaseOutcome;
53
+ }
54
+
55
+ /** A fresh human administrator approves one pending unexpired request. */
56
+ export interface IReq_Admin_Cloudly_ApproveDiskEncryptionUnlock extends plugins.typedrequestInterfaces.implementsTR<
57
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_ApproveDiskEncryptionUnlock
58
+ > {
59
+ method: 'approveDiskEncryptionUnlock';
60
+ request: IDiskEncryptionAdministratorRequest & { approvalId: string };
61
+ response: { approval: IDiskEncryptionUnlockApproval };
62
+ }
63
+
64
+ /** Machine-scoped observation. Neither wrapped keys nor challenge proofs appear here. */
65
+ export interface IReq_Admin_Cloudly_GetDiskEncryptionStatus extends plugins.typedrequestInterfaces.implementsTR<
66
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_GetDiskEncryptionStatus
67
+ > {
68
+ method: 'getDiskEncryptionStatus';
69
+ request: IDiskEncryptionAdministratorRequest & IDiskEncryptionMachineRequest;
70
+ response: { nodeIdentity: IDiskEncryptionNodeIdentity | null; pendingApproval: IDiskEncryptionUnlockApproval | null };
71
+ }
72
+
73
+ /** Registers the fingerprint of the separately provisioned offline key. */
74
+ export interface IReq_Admin_Cloudly_RegisterLocationRecoveryKey extends plugins.typedrequestInterfaces.implementsTR<
75
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_RegisterLocationRecoveryKey
76
+ > {
77
+ method: 'registerLocationRecoveryKey';
78
+ request: IDiskEncryptionAdministratorRequest & Pick<IDiskEncryptionLocationRecoveryKey,
79
+ 'locationId' | 'recoveryKeyId' | 'keyFingerprintSha256'>;
80
+ response: { recoveryKey: IDiskEncryptionLocationRecoveryKey };
81
+ }
@@ -111,3 +111,5 @@ export * as dcstorage from './dcstorage.js';
111
111
  export * as preparedimages from './preparedimages.js';
112
112
  export * as corestorereplication from './corestorereplication.js';
113
113
  export * as controlledtakeover from './controlledtakeover.js';
114
+ export * as diskencryption from './diskencryption.js';
115
+ export * as locationlock from './locationlock.js';
@@ -0,0 +1,119 @@
1
+ import type * as plugins from '../plugins.js';
2
+ import type { TSha256Digest } from '../data/immutableimage.js';
3
+ import type {
4
+ ILocationDestroyOperation, ILocationDestroyPlan, ILocationLockOperation, ILocationLockPlan, TLocationLockMode,
5
+ } from '../data/locationlock.js';
6
+ import type { IIdentityCredential } from '../data/user.js';
7
+
8
+ interface ILocationAdministratorRequest {
9
+ identity: IIdentityCredential;
10
+ }
11
+
12
+ interface ILocationTargetRequest extends ILocationAdministratorRequest {
13
+ locationId: string;
14
+ }
15
+
16
+ interface ILocationOperationRequest extends ILocationAdministratorRequest {
17
+ operationId: string;
18
+ }
19
+
20
+ interface ILocationOperationMutation extends ILocationOperationRequest {
21
+ expectedRevision: number;
22
+ }
23
+
24
+ /*
25
+ * Cloudly verifies administrator authority and derives actors from the verified session.
26
+ * Fresh passkey checks, direct transport and revision/membership comparisons are server-owned.
27
+ * Refusals use locationLockRefusals. No delegated administrator scope admits these requests.
28
+ */
29
+
30
+ export interface IReq_Admin_Cloudly_PlanLocationLock extends plugins.typedrequestInterfaces.implementsTR<
31
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_PlanLocationLock
32
+ > {
33
+ method: 'planLocationLock';
34
+ request: ILocationTargetRequest & { mode: TLocationLockMode };
35
+ response: { plan: ILocationLockPlan };
36
+ }
37
+
38
+ /** Fresh passkey required. Cloud access may carry Lock. An answer acknowledges the durable record. */
39
+ export interface IReq_Admin_Cloudly_StartLocationLock extends plugins.typedrequestInterfaces.implementsTR<
40
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_StartLocationLock
41
+ > {
42
+ method: 'startLocationLock';
43
+ request: IReq_Admin_Cloudly_PlanLocationLock['request'] & { membershipDigest: TSha256Digest };
44
+ response: { operation: ILocationLockOperation };
45
+ }
46
+
47
+ export interface IReq_Admin_Cloudly_GetLocationLock extends plugins.typedrequestInterfaces.implementsTR<
48
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_GetLocationLock
49
+ > {
50
+ method: 'getLocationLock';
51
+ request: ILocationOperationRequest;
52
+ response: { operation: ILocationLockOperation };
53
+ }
54
+
55
+ export interface IReq_Admin_Cloudly_ListLocationLocks extends plugins.typedrequestInterfaces.implementsTR<
56
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_ListLocationLocks
57
+ > {
58
+ method: 'listLocationLocks';
59
+ request: ILocationAdministratorRequest & { after: string | null };
60
+ response: {
61
+ /** Up to locationLockBounds.operationsPerPage entries, strictly ascending by operation ID. */
62
+ operations: ILocationLockOperation[];
63
+ /** Last returned ID if another page exists, otherwise null. */
64
+ nextAfter: string | null;
65
+ };
66
+ }
67
+
68
+ /** Fresh passkey required. Cloudly compares the observed lock revision before unlocking. */
69
+ export interface IReq_Admin_Cloudly_UnlockLocation extends plugins.typedrequestInterfaces.implementsTR<
70
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_UnlockLocation
71
+ > {
72
+ method: 'unlockLocation';
73
+ request: ILocationOperationMutation;
74
+ response: { operation: ILocationLockOperation };
75
+ }
76
+
77
+ /** Destroy administration is direct-only. Cloudly refuses cloud-access sessions. */
78
+ export interface IReq_Admin_Cloudly_PlanLocationDestroy extends plugins.typedrequestInterfaces.implementsTR<
79
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_PlanLocationDestroy
80
+ > {
81
+ method: 'planLocationDestroy';
82
+ request: ILocationTargetRequest;
83
+ response: { plan: ILocationDestroyPlan };
84
+ }
85
+
86
+ /** A fresh human administrator records a pending request over direct access. */
87
+ export interface IReq_Admin_Cloudly_InitiateLocationDestroy extends plugins.typedrequestInterfaces.implementsTR<
88
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_InitiateLocationDestroy
89
+ > {
90
+ method: 'initiateLocationDestroy';
91
+ request: ILocationTargetRequest & { membershipDigest: TSha256Digest };
92
+ response: { operation: ILocationDestroyOperation };
93
+ }
94
+
95
+ /** A different human administrator with a fresh passkey confirms the exact pending revision over direct access. */
96
+ export interface IReq_Admin_Cloudly_ConfirmLocationDestroy extends plugins.typedrequestInterfaces.implementsTR<
97
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_ConfirmLocationDestroy
98
+ > {
99
+ method: 'confirmLocationDestroy';
100
+ request: ILocationOperationMutation;
101
+ response: { operation: ILocationDestroyOperation };
102
+ }
103
+
104
+ /** Only a still-pending Destroy can be cancelled. Direct access and fresh passkey required. */
105
+ export interface IReq_Admin_Cloudly_CancelLocationDestroy extends plugins.typedrequestInterfaces.implementsTR<
106
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_CancelLocationDestroy
107
+ > {
108
+ method: 'cancelLocationDestroy';
109
+ request: ILocationOperationMutation;
110
+ response: { operation: ILocationDestroyOperation };
111
+ }
112
+
113
+ export interface IReq_Admin_Cloudly_GetLocationDestroy extends plugins.typedrequestInterfaces.implementsTR<
114
+ plugins.typedrequestInterfaces.ITypedRequest, IReq_Admin_Cloudly_GetLocationDestroy
115
+ > {
116
+ method: 'getLocationDestroy';
117
+ request: ILocationOperationRequest;
118
+ response: { operation: ILocationDestroyOperation };
119
+ }