@punica/editor 1.13.0 → 1.14.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/package.json
CHANGED
|
@@ -266,6 +266,48 @@ declare module 'punica' {
|
|
|
266
266
|
approvals: ApprovalRecord[];
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
+
/**
|
|
270
|
+
* A signed approval grant. The gate matches a grant by (kind, id) plus
|
|
271
|
+
* scope and workspace; the token is what lets a later reader prove the
|
|
272
|
+
* grant was really issued and not edited afterwards.
|
|
273
|
+
*/
|
|
274
|
+
export interface ApprovalTokenPayload {
|
|
275
|
+
scope: ApprovalScope;
|
|
276
|
+
capabilityId: string;
|
|
277
|
+
expiry: number;
|
|
278
|
+
jti: string;
|
|
279
|
+
issuer: string;
|
|
280
|
+
workspaceId?: string;
|
|
281
|
+
delegatedFrom?: string;
|
|
282
|
+
delegationDepth?: number;
|
|
283
|
+
approval?: PolicyApproval;
|
|
284
|
+
risk?: PolicyRisk;
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Signs approval grants. The substrate default is HMAC-SHA256 over an
|
|
289
|
+
* in-memory ephemeral key, which does not survive a restart; a
|
|
290
|
+
* production host injects its own through
|
|
291
|
+
* `punica.runtime.setApprovalTokenSigner`.
|
|
292
|
+
*/
|
|
293
|
+
export interface ApprovalTokenSigner {
|
|
294
|
+
/** Sign `payload`; returns the compact token string. */
|
|
295
|
+
sign(payload: ApprovalTokenPayload): Promise<string>;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/** Verifies (and revokes) approval tokens. */
|
|
299
|
+
export interface ApprovalTokenVerifier {
|
|
300
|
+
/**
|
|
301
|
+
* Parse, check the header and signature, check expiry and jti
|
|
302
|
+
* revocation. Returns the payload, or throws with a stable code.
|
|
303
|
+
*/
|
|
304
|
+
verify(token: string): Promise<ApprovalTokenPayload>;
|
|
305
|
+
/** Mark a jti revoked; tokens carrying it then fail verification. */
|
|
306
|
+
revoke(jti: string): void;
|
|
307
|
+
/** Is a jti currently revoked? */
|
|
308
|
+
isRevoked(jti: string): boolean;
|
|
309
|
+
}
|
|
310
|
+
|
|
269
311
|
export namespace Policy {
|
|
270
312
|
const manager: PolicyApi;
|
|
271
313
|
}
|
|
@@ -187,7 +187,50 @@ declare module 'punica' {
|
|
|
187
187
|
setResourcesProvider: (provider: ResourcesApi) => void;
|
|
188
188
|
setTasksProvider: (provider: TaskRunnerApi) => void;
|
|
189
189
|
setSecretsProvider: (provider: SecretsApi) => void;
|
|
190
|
+
|
|
191
|
+
/**
|
|
192
|
+
* Approval-token signing. The substrate default mints an in-memory
|
|
193
|
+
* ephemeral HMAC key on the first signature and loses it when the
|
|
194
|
+
* process exits, so a token signed before a restart no longer
|
|
195
|
+
* verifies after one — fine for dev and demo, useless as evidence.
|
|
196
|
+
* A production host installs a stable secret from the OS keychain
|
|
197
|
+
* during bootstrap, before `initialize()`:
|
|
198
|
+
*
|
|
199
|
+
* punica.runtime.installDefaultApprovalTokenPair(secret)
|
|
200
|
+
*
|
|
201
|
+
* The two setters are the same seam for a host that brings its own
|
|
202
|
+
* signer (KMS, HSM); passing `undefined` restores the substrate
|
|
203
|
+
* default. The key belongs to the host and never to an extension —
|
|
204
|
+
* an extension that can reach the signing key can also produce the
|
|
205
|
+
* thing it signs.
|
|
206
|
+
*/
|
|
207
|
+
installDefaultApprovalTokenPair: (secret: Uint8Array | string) => void;
|
|
208
|
+
setApprovalTokenSigner: (
|
|
209
|
+
signer: kernel.ApprovalTokenSigner | undefined
|
|
210
|
+
) => void;
|
|
211
|
+
setApprovalTokenVerifier: (
|
|
212
|
+
verifier: kernel.ApprovalTokenVerifier | undefined
|
|
213
|
+
) => void;
|
|
214
|
+
|
|
215
|
+
/**
|
|
216
|
+
* Who is at this workstation, so a user-initiated call's audit record
|
|
217
|
+
* names a subject instead of leaving `actor.id` empty. Absent is a
|
|
218
|
+
* normal state — a trial licence has no account — and the substrate
|
|
219
|
+
* invents nothing to fill it. Passing `undefined` clears it.
|
|
220
|
+
*/
|
|
221
|
+
setHostIdentity: (identity: HostIdentity | undefined) => void;
|
|
190
222
|
}
|
|
223
|
+
|
|
224
|
+
/**
|
|
225
|
+
* The person a licence belongs to, as the host knows them. `email` is
|
|
226
|
+
* the identifier (a registry guarantees it unique and present);
|
|
227
|
+
* `displayName` is presentation and may be absent.
|
|
228
|
+
*/
|
|
229
|
+
export interface HostIdentity {
|
|
230
|
+
email: string;
|
|
231
|
+
displayName?: string | null;
|
|
232
|
+
}
|
|
233
|
+
|
|
191
234
|
}
|
|
192
235
|
|
|
193
236
|
export const runtime: runtime.RuntimeApi;
|