@astrale-os/kernel-protocol 0.5.0-beta.9 → 0.5.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/dist/artifact/index.d.ts +1 -1
- package/dist/artifact/index.js +1 -1
- package/dist/artifact/ref.d.ts +2 -0
- package/dist/artifact/ref.js +4 -3
- package/dist/codecs/index.d.ts +1 -2
- package/dist/codecs/index.js +1 -2
- package/dist/codecs/media-types.d.ts +0 -1
- package/dist/codecs/media-types.js +0 -1
- package/dist/errors/index.d.ts +1 -0
- package/dist/errors/index.js +1 -0
- package/dist/errors/retry.d.ts +25 -0
- package/dist/errors/retry.js +46 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/invocation/admission.d.ts +2 -2
- package/dist/invocation/admission.js +5 -5
- package/dist/invocation/binary.d.ts +1 -0
- package/dist/invocation/binary.js +21 -4
- package/dist/invocation/binding-codecs.d.ts +3 -2
- package/dist/invocation/binding-codecs.js +1 -6
- package/dist/invocation/delegate.d.ts +0 -20
- package/dist/invocation/delegate.js +2 -34
- package/dist/invocation/http/binary.d.ts +3 -1
- package/dist/invocation/http/binary.js +6 -1
- package/dist/invocation/http/index.d.ts +2 -1
- package/dist/invocation/http/index.js +2 -1
- package/dist/invocation/http/negotiation.js +3 -10
- package/dist/invocation/http/request.d.ts +11 -0
- package/dist/invocation/http/request.js +69 -0
- package/dist/invocation/index.d.ts +5 -4
- package/dist/invocation/index.js +4 -3
- package/dist/invocation/maintenance.d.ts +14 -0
- package/dist/invocation/maintenance.js +18 -0
- package/dist/invocation/redirect.d.ts +10 -12
- package/dist/invocation/redirect.js +10 -22
- package/dist/invocation/request.d.ts +3 -0
- package/dist/invocation/request.js +9 -2
- package/dist/invocation/response.d.ts +6 -1
- package/dist/invocation/response.js +26 -15
- package/dist/invocation/routing.d.ts +14 -4
- package/dist/invocation/routing.js +35 -20
- package/dist/invocation/schema.d.ts +6 -4
- package/dist/invocation/schema.js +5 -11
- package/dist/invocation/service-reason.d.ts +20 -15
- package/dist/invocation/service-reason.js +27 -19
- package/dist/invocation/stale-route.d.ts +3 -3
- package/dist/invocation/target.d.ts +5 -2
- package/dist/invocation/target.js +25 -3
- package/dist/invocation/websocket/binary.js +1 -0
- package/dist/invocation/websocket/index.d.ts +1 -1
- package/dist/invocation/websocket/index.js +1 -1
- package/dist/invocation/websocket/subprotocol.d.ts +1 -2
- package/dist/invocation/websocket/subprotocol.js +3 -4
- package/dist/issuer/claims.d.ts +7 -0
- package/dist/issuer/claims.js +7 -0
- package/dist/issuer/index.d.ts +2 -0
- package/dist/issuer/index.js +2 -0
- package/dist/issuer/paths.d.ts +2 -0
- package/dist/issuer/paths.js +1 -0
- package/dist/issuer/workflow-engine.d.ts +18 -0
- package/dist/issuer/workflow-engine.js +59 -0
- package/dist/{publication → release}/bindings/callable.js +6 -6
- package/dist/release/bindings/invocation.js +13 -0
- package/dist/release/bindings/view.d.ts +11 -0
- package/dist/release/bindings/view.js +54 -0
- package/dist/release/build.d.ts +6 -0
- package/dist/release/build.js +7 -0
- package/dist/release/bundle-admission.d.ts +21 -0
- package/dist/{publication → release}/bundle-admission.js +15 -20
- package/dist/{publication → release}/bundle-descriptor.js +6 -6
- package/dist/release/bundle-evidence.d.ts +3 -0
- package/dist/release/bundle-evidence.js +13 -0
- package/dist/{publication → release}/bundle.d.ts +5 -2
- package/dist/{publication → release}/bundle.js +13 -7
- package/dist/{publication → release}/delivery/attestation.d.ts +1 -0
- package/dist/{publication → release}/delivery/claims.d.ts +7 -2
- package/dist/{publication → release}/delivery/claims.js +20 -13
- package/dist/release/delivery/delivery.d.ts +11 -0
- package/dist/{publication → release}/delivery/delivery.js +7 -12
- package/dist/{publication → release}/delivery/error.d.ts +2 -0
- package/dist/{publication → release}/delivery/error.js +1 -0
- package/dist/{publication → release}/delivery/index.d.ts +5 -1
- package/dist/{publication → release}/delivery/index.js +4 -0
- package/dist/{publication → release}/delivery/limits.d.ts +2 -1
- package/dist/release/delivery/limits.js +5 -0
- package/dist/{publication → release}/delivery/request.d.ts +10 -9
- package/dist/{publication → release}/delivery/request.js +9 -10
- package/dist/{publication → release}/delivery-declaration.js +4 -4
- package/dist/release/delivery-endpoint.js +22 -0
- package/dist/release/digest.d.ts +13 -0
- package/dist/{publication/etag.js → release/digest.js} +1 -6
- package/dist/release/error.d.ts +7 -0
- package/dist/release/error.js +11 -0
- package/dist/release/index.d.ts +17 -0
- package/dist/release/index.js +10 -0
- package/dist/release/issuer.d.ts +5 -0
- package/dist/release/issuer.js +34 -0
- package/dist/release/manifest.d.ts +6 -0
- package/dist/release/manifest.js +22 -0
- package/dist/release/reference.d.ts +26 -0
- package/dist/release/reference.js +70 -0
- package/dist/release/release.d.ts +60 -0
- package/dist/release/release.js +125 -0
- package/dist/release/requirements.d.ts +41 -0
- package/dist/release/requirements.js +306 -0
- package/dist/{publication → release}/route.js +24 -24
- package/dist/{publication → release}/schema.js +4 -4
- package/dist/release/served.d.ts +27 -0
- package/dist/release/served.js +56 -0
- package/dist/release/shape.d.ts +8 -0
- package/dist/routes/admission.d.ts +1 -1
- package/dist/routes/admission.js +7 -85
- package/dist/routes/binding.d.ts +3 -3
- package/dist/routes/binding.js +11 -21
- package/dist/routes/compiler.d.ts +2 -2
- package/dist/routes/compiler.js +7 -3
- package/dist/routes/credential.d.ts +12 -2
- package/dist/routes/credential.js +9 -4
- package/dist/routes/decode.d.ts +5 -2
- package/dist/routes/decode.js +24 -17
- package/dist/routes/deployment-retired.d.ts +30 -0
- package/dist/routes/deployment-retired.js +96 -0
- package/dist/routes/encode.js +12 -5
- package/dist/routes/entries.d.ts +23 -0
- package/dist/routes/entries.js +150 -0
- package/dist/routes/evidence.d.ts +3 -3
- package/dist/routes/evidence.js +7 -33
- package/dist/routes/header.d.ts +9 -0
- package/dist/routes/header.js +34 -0
- package/dist/routes/index.d.ts +2 -2
- package/dist/routes/index.js +2 -2
- package/dist/routes/mapping.d.ts +1 -1
- package/dist/routes/mapping.js +4 -4
- package/dist/routes/match.d.ts +1 -1
- package/dist/routes/placement.d.ts +2 -2
- package/dist/routes/plan.d.ts +1 -1
- package/dist/routes/request.d.ts +3 -1
- package/dist/routes/reservation.d.ts +4 -2
- package/dist/routes/reservation.js +14 -8
- package/dist/routes/routing.d.ts +18 -6
- package/dist/routes/routing.js +28 -49
- package/dist/routes/select.d.ts +1 -1
- package/dist/routes/table.d.ts +3 -2
- package/dist/routes/target.d.ts +5 -0
- package/dist/routes/target.js +16 -0
- package/dist/routes/template.d.ts +0 -1
- package/dist/routes/template.js +0 -3
- package/dist/runtime/artifact.d.ts +5 -4
- package/dist/runtime/artifact.js +7 -4
- package/dist/runtime/index.d.ts +1 -1
- package/dist/runtime/index.js +1 -1
- package/dist/schema/installation/codec.d.ts +9 -0
- package/dist/schema/installation/codec.js +82 -0
- package/dist/schema/installation/index.d.ts +2 -0
- package/dist/schema/installation/index.js +1 -0
- package/dist/schema/installation/introspection/codec.d.ts +5 -2
- package/dist/schema/installation/introspection/codec.js +319 -193
- package/dist/schema/installation/introspection/index.d.ts +2 -2
- package/dist/schema/installation/introspection/index.js +1 -1
- package/dist/schema/installation/introspection/result.d.ts +84 -25
- package/dist/schema/installation/result.d.ts +15 -0
- package/dist/schema/installation/result.js +1 -0
- package/package.json +21 -75
- package/dist/codecs/msgpack.d.ts +0 -4
- package/dist/codecs/msgpack.js +0 -50
- package/dist/publication/bindings/invocation.js +0 -13
- package/dist/publication/bindings/view.d.ts +0 -7
- package/dist/publication/bindings/view.js +0 -28
- package/dist/publication/bundle-admission.d.ts +0 -4
- package/dist/publication/bundle-evidence.d.ts +0 -3
- package/dist/publication/bundle-evidence.js +0 -13
- package/dist/publication/content.d.ts +0 -10
- package/dist/publication/delivery/delivery.d.ts +0 -9
- package/dist/publication/delivery/limits.js +0 -4
- package/dist/publication/delivery-endpoint.js +0 -22
- package/dist/publication/error.d.ts +0 -7
- package/dist/publication/error.js +0 -11
- package/dist/publication/etag.d.ts +0 -6
- package/dist/publication/index.d.ts +0 -17
- package/dist/publication/index.js +0 -10
- package/dist/publication/manifest.d.ts +0 -6
- package/dist/publication/manifest.js +0 -30
- package/dist/publication/publication.d.ts +0 -36
- package/dist/publication/publication.js +0 -133
- package/dist/publication/reference.d.ts +0 -17
- package/dist/publication/reference.js +0 -68
- package/dist/publication/requirements.d.ts +0 -26
- package/dist/publication/requirements.js +0 -180
- package/dist/routes/release-unavailable.d.ts +0 -8
- package/dist/routes/release-unavailable.js +0 -32
- /package/dist/{publication → release}/bindings/callable.d.ts +0 -0
- /package/dist/{publication → release}/bindings/index.d.ts +0 -0
- /package/dist/{publication → release}/bindings/index.js +0 -0
- /package/dist/{publication → release}/bindings/invocation.d.ts +0 -0
- /package/dist/{publication → release}/bundle-descriptor.d.ts +0 -0
- /package/dist/{publication → release}/declaration.d.ts +0 -0
- /package/dist/{publication → release}/declaration.js +0 -0
- /package/dist/{publication → release}/delivery/attestation.js +0 -0
- /package/dist/{publication → release}/delivery-declaration.d.ts +0 -0
- /package/dist/{publication → release}/delivery-endpoint.d.ts +0 -0
- /package/dist/{publication → release}/route.d.ts +0 -0
- /package/dist/{publication → release}/schema.d.ts +0 -0
- /package/dist/{publication/content.js → release/shape.js} +0 -0
|
@@ -14,6 +14,7 @@ export function encodeBinary(response) {
|
|
|
14
14
|
requestId: response.requestId,
|
|
15
15
|
invocation: response.invocation,
|
|
16
16
|
mediaType: response.mediaType,
|
|
17
|
+
status: response.status,
|
|
17
18
|
...(headers === undefined ? {} : { headers }),
|
|
18
19
|
}));
|
|
19
20
|
if (metadata.byteLength > MAXIMUM_METADATA_BYTES)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { decodeBinary, encodeBinary } from './binary.js';
|
|
2
|
-
export { JSON_SUBPROTOCOL,
|
|
2
|
+
export { JSON_SUBPROTOCOL, selectSubprotocol, subprotocolFor, type Subprotocol, type SubprotocolSelection, } from './subprotocol.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { decodeBinary, encodeBinary } from './binary.js';
|
|
2
|
-
export { JSON_SUBPROTOCOL,
|
|
2
|
+
export { JSON_SUBPROTOCOL, selectSubprotocol, subprotocolFor, } from './subprotocol.js';
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { Codec } from '../../codecs/index.js';
|
|
2
2
|
export declare const JSON_SUBPROTOCOL: 'astrale.invocation.v2.json';
|
|
3
|
-
export
|
|
4
|
-
export type Subprotocol = typeof JSON_SUBPROTOCOL | typeof MSGPACK_SUBPROTOCOL;
|
|
3
|
+
export type Subprotocol = typeof JSON_SUBPROTOCOL;
|
|
5
4
|
export interface SubprotocolSelection {
|
|
6
5
|
readonly subprotocol: Subprotocol;
|
|
7
6
|
readonly codec: Codec;
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import { admitSupportedCodecs, codecProfile } from '../binding-codecs.js';
|
|
2
2
|
export const JSON_SUBPROTOCOL = 'astrale.invocation.v2.json';
|
|
3
|
-
export const MSGPACK_SUBPROTOCOL = 'astrale.invocation.v2.msgpack';
|
|
4
3
|
const TOKEN = /^[!#$%&'*+.^_`|~0-9A-Za-z-]+$/u;
|
|
5
4
|
export function subprotocolFor(codec) {
|
|
6
|
-
|
|
7
|
-
if (profile === undefined)
|
|
5
|
+
if (codecProfile(codec) === undefined) {
|
|
8
6
|
throw new TypeError('codec is not a canonical Invocation codec.');
|
|
9
|
-
|
|
7
|
+
}
|
|
8
|
+
return JSON_SUBPROTOCOL;
|
|
10
9
|
}
|
|
11
10
|
export function selectSubprotocol(offered, supported) {
|
|
12
11
|
const admitted = admitSupportedCodecs(supported);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Private JWT claim of the self credential a durable step's Domain signs for the Kernel: the id of
|
|
3
|
+
* the Execution the step belongs to. After a consented issuer change, the Kernel accepts the
|
|
4
|
+
* replaced issuer past its window only for a credential naming an unfinished run of its Domain
|
|
5
|
+
* that was in flight at that change.
|
|
6
|
+
*/
|
|
7
|
+
export declare const EXECUTION_CLAIM = "execution";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Private JWT claim of the self credential a durable step's Domain signs for the Kernel: the id of
|
|
3
|
+
* the Execution the step belongs to. After a consented issuer change, the Kernel accepts the
|
|
4
|
+
* replaced issuer past its window only for a credential naming an unfinished run of its Domain
|
|
5
|
+
* that was in flight at that change.
|
|
6
|
+
*/
|
|
7
|
+
export const EXECUTION_CLAIM = 'execution';
|
package/dist/issuer/index.d.ts
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
export { EXECUTION_CLAIM } from './claims.js';
|
|
1
2
|
export { acceptConfiguration, configuration, type Configuration, type ConfigurationOptions, } from './configuration.js';
|
|
2
3
|
export { DiscoveryError, type DiscoveryErrorCode } from './error.js';
|
|
3
4
|
export { hosted } from './hosted.js';
|
|
4
5
|
export { acceptKeySet, keySet, type KeySet } from './key-set.js';
|
|
5
6
|
export { paths, type Paths } from './paths.js';
|
|
7
|
+
export { acceptWorkflowEngine, acceptWorkflowEngineIdentityKey, workflowEngine, type WorkflowEngine, } from './workflow-engine.js';
|
|
6
8
|
export * as exchange from './exchange.js';
|
package/dist/issuer/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
export { EXECUTION_CLAIM } from './claims.js';
|
|
1
2
|
export { acceptConfiguration, configuration, } from './configuration.js';
|
|
2
3
|
export { DiscoveryError } from './error.js';
|
|
3
4
|
export { hosted } from './hosted.js';
|
|
4
5
|
export { acceptKeySet, keySet } from './key-set.js';
|
|
5
6
|
export { paths } from './paths.js';
|
|
7
|
+
export { acceptWorkflowEngine, acceptWorkflowEngineIdentityKey, workflowEngine, } from './workflow-engine.js';
|
|
6
8
|
export * as exchange from './exchange.js';
|
package/dist/issuer/paths.d.ts
CHANGED
|
@@ -2,5 +2,7 @@ export interface Paths {
|
|
|
2
2
|
readonly configuration: string;
|
|
3
3
|
readonly keys: string;
|
|
4
4
|
readonly tokenExchange: string;
|
|
5
|
+
/** Where Domains discover the workflow engine of a Kernel that drives one. */
|
|
6
|
+
readonly workflowEngine: string;
|
|
5
7
|
}
|
|
6
8
|
export declare function paths(issuer: string): Paths;
|
package/dist/issuer/paths.js
CHANGED
|
@@ -6,5 +6,6 @@ export function paths(issuer) {
|
|
|
6
6
|
configuration: `${pathname}/.well-known/openid-configuration`,
|
|
7
7
|
keys: `${pathname}/.well-known/jwks.json`,
|
|
8
8
|
tokenExchange: `${pathname}/.well-known/astrale/token`,
|
|
9
|
+
workflowEngine: `${pathname}/.well-known/astrale/workflow-engine.json`,
|
|
9
10
|
});
|
|
10
11
|
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
2
|
+
/**
|
|
3
|
+
* The workflow engine a Kernel drives, as Domains discover it at
|
|
4
|
+
* `<issuer>/.well-known/astrale/workflow-engine.json`: the engine signs every request to a Domain with
|
|
5
|
+
* one of these Restate request identity keys. Several keys let the Host rotate without a gap.
|
|
6
|
+
*/
|
|
7
|
+
export interface WorkflowEngine {
|
|
8
|
+
readonly issuer: IssuerId;
|
|
9
|
+
readonly identity_keys: readonly [string, ...string[]];
|
|
10
|
+
}
|
|
11
|
+
/** Admit one Restate request identity key without imposing a key-set policy. */
|
|
12
|
+
export declare function acceptWorkflowEngineIdentityKey(input: unknown): string;
|
|
13
|
+
export declare function workflowEngine(issuer: string, identityKeys: readonly string[]): WorkflowEngine;
|
|
14
|
+
/**
|
|
15
|
+
* Admit a discovered engine for the expected issuer. Unlike issuer configuration, unknown fields are
|
|
16
|
+
* ignored: the Kernel may add some without breaking deployed Domains.
|
|
17
|
+
*/
|
|
18
|
+
export declare function acceptWorkflowEngine(input: unknown, expectedIssuer?: string): WorkflowEngine;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { fail } from './error.js';
|
|
2
|
+
import { acceptIssuer } from './url.js';
|
|
3
|
+
/** Restate's `publickeyv1_` id: base58btc of a raw Ed25519 public key. */
|
|
4
|
+
const IDENTITY_KEY = /^publickeyv1_[1-9A-HJ-NP-Za-km-z]{32,64}$/u;
|
|
5
|
+
const BASE58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
|
|
6
|
+
const MAXIMUM_IDENTITY_KEYS = 8;
|
|
7
|
+
/** Admit one Restate request identity key without imposing a key-set policy. */
|
|
8
|
+
export function acceptWorkflowEngineIdentityKey(input) {
|
|
9
|
+
if (typeof input !== 'string' || !IDENTITY_KEY.test(input) || decodedKeyBytes(input) !== 32) {
|
|
10
|
+
fail('ISSUER_DISCOVERY_INVALID', 'Workflow engine identity keys are invalid.');
|
|
11
|
+
}
|
|
12
|
+
return input;
|
|
13
|
+
}
|
|
14
|
+
export function workflowEngine(issuer, identityKeys) {
|
|
15
|
+
return Object.freeze({
|
|
16
|
+
issuer: acceptIssuer(issuer),
|
|
17
|
+
identity_keys: acceptIdentityKeys(identityKeys),
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Admit a discovered engine for the expected issuer. Unlike issuer configuration, unknown fields are
|
|
22
|
+
* ignored: the Kernel may add some without breaking deployed Domains.
|
|
23
|
+
*/
|
|
24
|
+
export function acceptWorkflowEngine(input, expectedIssuer) {
|
|
25
|
+
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
26
|
+
fail('ISSUER_DISCOVERY_INVALID', 'Workflow engine discovery is invalid.');
|
|
27
|
+
}
|
|
28
|
+
const value = input;
|
|
29
|
+
const admitted = acceptIssuer(value.issuer);
|
|
30
|
+
if (expectedIssuer !== undefined && admitted !== acceptIssuer(expectedIssuer)) {
|
|
31
|
+
fail('ISSUER_DISCOVERY_MISMATCH', 'Workflow engine discovery does not match the issuer.');
|
|
32
|
+
}
|
|
33
|
+
return Object.freeze({ issuer: admitted, identity_keys: acceptIdentityKeys(value.identity_keys) });
|
|
34
|
+
}
|
|
35
|
+
function acceptIdentityKeys(input) {
|
|
36
|
+
if (!Array.isArray(input) ||
|
|
37
|
+
input.length === 0 ||
|
|
38
|
+
input.length > MAXIMUM_IDENTITY_KEYS ||
|
|
39
|
+
new Set(input).size !== input.length) {
|
|
40
|
+
fail('ISSUER_DISCOVERY_INVALID', 'Workflow engine identity keys are invalid.');
|
|
41
|
+
}
|
|
42
|
+
return Object.freeze(Array.from(input, acceptWorkflowEngineIdentityKey));
|
|
43
|
+
}
|
|
44
|
+
/** Base58 leading '1' digits represent zero bytes omitted by the integer value. */
|
|
45
|
+
function decodedKeyBytes(key) {
|
|
46
|
+
const encoded = key.slice('publickeyv1_'.length);
|
|
47
|
+
let value = 0n;
|
|
48
|
+
for (const digit of encoded)
|
|
49
|
+
value = value * 58n + BigInt(BASE58.indexOf(digit));
|
|
50
|
+
let bytes = 0;
|
|
51
|
+
for (; value > 0n; value >>= 8n)
|
|
52
|
+
bytes++;
|
|
53
|
+
for (const digit of encoded) {
|
|
54
|
+
if (digit !== '1')
|
|
55
|
+
break;
|
|
56
|
+
bytes++;
|
|
57
|
+
}
|
|
58
|
+
return bytes;
|
|
59
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { callableAddress, Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
|
-
import { exact, record } from '../content.js';
|
|
3
2
|
import { fail } from '../error.js';
|
|
3
|
+
import { exact, record } from '../shape.js';
|
|
4
4
|
import { acceptInvocationEndpoints } from './invocation.js';
|
|
5
5
|
export function admitCallableBinding(input, origin) {
|
|
6
|
-
const value = record(input, '
|
|
7
|
-
exact(value, ['callable', 'endpoint'], '
|
|
6
|
+
const value = record(input, 'RELEASE_BINDING_INVALID', 'Callable binding is invalid.');
|
|
7
|
+
exact(value, ['callable', 'endpoint'], 'RELEASE_BINDING_INVALID');
|
|
8
8
|
return Object.freeze({
|
|
9
9
|
callable: admitCallableKey(value.callable, origin),
|
|
10
10
|
endpoint: acceptInvocationEndpoints(value.endpoint),
|
|
@@ -17,18 +17,18 @@ export function admitCallableKey(input, origin) {
|
|
|
17
17
|
}
|
|
18
18
|
catch (cause) {
|
|
19
19
|
if (cause instanceof TypeError) {
|
|
20
|
-
return fail('
|
|
20
|
+
return fail('RELEASE_BINDING_INVALID', 'Callable key is invalid.', cause);
|
|
21
21
|
}
|
|
22
22
|
throw cause;
|
|
23
23
|
}
|
|
24
24
|
if (Key.origin(callable) !== origin) {
|
|
25
|
-
fail('
|
|
25
|
+
fail('RELEASE_BINDING_INVALID', 'Binding must name one callable owned by the root Domain.');
|
|
26
26
|
}
|
|
27
27
|
try {
|
|
28
28
|
callableAddress(callable);
|
|
29
29
|
}
|
|
30
30
|
catch (cause) {
|
|
31
|
-
return fail('
|
|
31
|
+
return fail('RELEASE_BINDING_INVALID', 'Binding must name one callable owned by the root Domain.', cause);
|
|
32
32
|
}
|
|
33
33
|
return callable;
|
|
34
34
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { absoluteHttpUrl, absoluteUrl, exact, record } from '../shape.js';
|
|
2
|
+
export function acceptInvocationEndpoints(input) {
|
|
3
|
+
const value = record(input, 'RELEASE_BINDING_INVALID', 'Invocation endpoints are invalid.');
|
|
4
|
+
exact(value, ['http', 'websocket'], 'RELEASE_BINDING_INVALID');
|
|
5
|
+
const http = absoluteHttpUrl(value.http, true, 'RELEASE_BINDING_INVALID');
|
|
6
|
+
const websocket = value.websocket === undefined
|
|
7
|
+
? undefined
|
|
8
|
+
: absoluteUrl(value.websocket, ['ws:', 'wss:'], true, 'RELEASE_BINDING_INVALID');
|
|
9
|
+
return Object.freeze({
|
|
10
|
+
http,
|
|
11
|
+
...(websocket === undefined ? {} : { websocket }),
|
|
12
|
+
});
|
|
13
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type ViewHostRequirements } from '@astrale-os/kernel-core/schema/kernel/syscalls/view-resolution';
|
|
2
|
+
import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
3
|
+
export interface ViewBinding {
|
|
4
|
+
readonly view: Key.View;
|
|
5
|
+
readonly href: string;
|
|
6
|
+
readonly handshake: 'shell' | 'none';
|
|
7
|
+
readonly host?: ViewHostRequirements;
|
|
8
|
+
}
|
|
9
|
+
export declare function admitViewBinding(input: unknown, origin: string): ViewBinding;
|
|
10
|
+
/** Authoring-only normalization used before a release document is sealed. */
|
|
11
|
+
export declare function canonicalizeViewBinding(input: unknown, origin: string): ViewBinding;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { acceptViewHostRequirements, } from '@astrale-os/kernel-core/schema/kernel/syscalls/view-resolution';
|
|
2
|
+
import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
3
|
+
import { fail } from '../error.js';
|
|
4
|
+
import { absoluteHttpUrl, exact, record } from '../shape.js';
|
|
5
|
+
export function admitViewBinding(input, origin) {
|
|
6
|
+
return readViewBinding(input, origin, false);
|
|
7
|
+
}
|
|
8
|
+
/** Authoring-only normalization used before a release document is sealed. */
|
|
9
|
+
export function canonicalizeViewBinding(input, origin) {
|
|
10
|
+
return readViewBinding(input, origin, true);
|
|
11
|
+
}
|
|
12
|
+
function readViewBinding(input, origin, canonicalize) {
|
|
13
|
+
const value = record(input, 'RELEASE_VIEW_INVALID', 'Release View binding is invalid.');
|
|
14
|
+
exact(value, ['view', 'href', 'handshake', 'host'], 'RELEASE_VIEW_INVALID');
|
|
15
|
+
let view;
|
|
16
|
+
try {
|
|
17
|
+
view = Key(String(value.view));
|
|
18
|
+
}
|
|
19
|
+
catch (cause) {
|
|
20
|
+
if (cause instanceof TypeError) {
|
|
21
|
+
return fail('RELEASE_VIEW_INVALID', 'View key is invalid.', cause);
|
|
22
|
+
}
|
|
23
|
+
throw cause;
|
|
24
|
+
}
|
|
25
|
+
if (Key.origin(view) !== origin || !view.slice(view.indexOf(':') + 1).startsWith('view.')) {
|
|
26
|
+
fail('RELEASE_VIEW_INVALID', 'View binding must name a root View.');
|
|
27
|
+
}
|
|
28
|
+
if (value.handshake !== 'shell' && value.handshake !== 'none') {
|
|
29
|
+
fail('RELEASE_VIEW_INVALID', 'View handshake is invalid.');
|
|
30
|
+
}
|
|
31
|
+
let host;
|
|
32
|
+
try {
|
|
33
|
+
host = acceptViewHostRequirements(dataValue(value, 'host'), value.handshake, canonicalize);
|
|
34
|
+
}
|
|
35
|
+
catch (cause) {
|
|
36
|
+
if (cause instanceof TypeError)
|
|
37
|
+
return fail('RELEASE_VIEW_INVALID', 'View host requirements are invalid.', cause);
|
|
38
|
+
throw cause;
|
|
39
|
+
}
|
|
40
|
+
return Object.freeze({
|
|
41
|
+
view,
|
|
42
|
+
href: absoluteHttpUrl(value.href, true, 'RELEASE_VIEW_INVALID'),
|
|
43
|
+
handshake: value.handshake,
|
|
44
|
+
...(host === undefined ? {} : { host }),
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function dataValue(input, key) {
|
|
48
|
+
const descriptor = Object.getOwnPropertyDescriptor(input, key);
|
|
49
|
+
if (descriptor === undefined)
|
|
50
|
+
return undefined;
|
|
51
|
+
if (!('value' in descriptor))
|
|
52
|
+
fail('RELEASE_VIEW_INVALID', 'View requirements must be data fields.');
|
|
53
|
+
return descriptor.value;
|
|
54
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { admitDigest } from './digest.js';
|
|
2
|
+
import { exact, record } from './shape.js';
|
|
3
|
+
export function admitBuild(input) {
|
|
4
|
+
const value = record(input, 'RELEASE_INVALID', 'Release build is invalid.');
|
|
5
|
+
exact(value, ['digest'], 'RELEASE_INVALID');
|
|
6
|
+
return Object.freeze({ digest: admitDigest(value.digest) });
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Key } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
|
+
import * as dslBundle from '@astrale-os/kernel-dsl/v1/bundle';
|
|
3
|
+
import type { CallableBinding, ViewBinding } from './bindings/index.js';
|
|
4
|
+
import type { Manifest } from './manifest.js';
|
|
5
|
+
import type { Requirements } from './requirements.js';
|
|
6
|
+
import type { HttpRoute } from './route.js';
|
|
7
|
+
import type { Schema } from './schema.js';
|
|
8
|
+
/** The served release content one external Schema Bundle must exactly match. */
|
|
9
|
+
export interface ServedRelease {
|
|
10
|
+
readonly origin: Key.Origin;
|
|
11
|
+
readonly schema: Schema;
|
|
12
|
+
readonly requirements: Requirements;
|
|
13
|
+
readonly manifest?: Manifest;
|
|
14
|
+
readonly bindings: {
|
|
15
|
+
readonly callables: readonly CallableBinding[];
|
|
16
|
+
readonly views: readonly ViewBinding[];
|
|
17
|
+
};
|
|
18
|
+
readonly routes: readonly HttpRoute[];
|
|
19
|
+
}
|
|
20
|
+
export declare function acceptBundle(input: ServedRelease, artifact: unknown): dslBundle.Bundle;
|
|
21
|
+
export declare function decodeBundle(input: ServedRelease, bytes: Uint8Array): dslBundle.Bundle;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Key, MethodKey } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
2
2
|
import * as dslBundle from '@astrale-os/kernel-dsl/v1/bundle';
|
|
3
|
+
import { isMethodExecutable } from '@astrale-os/kernel-dsl/v1/language';
|
|
3
4
|
import { revision } from '@astrale-os/kernel-dsl/v1/schema/revision';
|
|
4
5
|
import { acceptBundleValue, decodeBundleValue, verifyBundleBytes } from './bundle.js';
|
|
5
6
|
import { fail } from './error.js';
|
|
@@ -15,32 +16,26 @@ export function decodeBundle(input, bytes) {
|
|
|
15
16
|
validateInventory(input, decoded);
|
|
16
17
|
return decoded;
|
|
17
18
|
}
|
|
18
|
-
function validateInventory(
|
|
19
|
+
function validateInventory(release, bundle) {
|
|
19
20
|
const root = bundle.root;
|
|
20
|
-
if (root.origin !==
|
|
21
|
-
fail('
|
|
21
|
+
if (root.origin !== release.origin || revision(root) !== release.schema.revision) {
|
|
22
|
+
fail('RELEASE_INVALID', 'Bundle root does not match the release schema.');
|
|
22
23
|
}
|
|
23
|
-
validateRequirements(root, bundle.closure,
|
|
24
|
+
validateRequirements(root, bundle.closure, release.requirements);
|
|
24
25
|
const callables = concreteCallables(root);
|
|
25
|
-
const
|
|
26
|
-
if (
|
|
27
|
-
[...callables].some((key) => !
|
|
28
|
-
fail('
|
|
26
|
+
const boundCallables = new Set(release.bindings.callables.map(({ callable }) => callable));
|
|
27
|
+
if (boundCallables.size !== callables.size ||
|
|
28
|
+
[...callables].some((key) => !boundCallables.has(key))) {
|
|
29
|
+
fail('RELEASE_BINDING_INVALID', 'Callable bindings must exhaust the root Domain.');
|
|
29
30
|
}
|
|
30
31
|
const views = new Set(Object.keys(root.views).map((name) => Key.of({ origin: root.origin, kind: 'view', name })));
|
|
31
|
-
const
|
|
32
|
-
if (
|
|
33
|
-
fail('
|
|
32
|
+
const boundViews = new Set(release.bindings.views.map(({ view }) => view));
|
|
33
|
+
if (boundViews.size !== views.size || [...views].some((key) => !boundViews.has(key))) {
|
|
34
|
+
fail('RELEASE_VIEW_INVALID', 'View bindings must exhaust the root Domain.');
|
|
34
35
|
}
|
|
35
|
-
|
|
36
|
-
(publication.manifest.entrypoint.origin !== root.origin ||
|
|
37
|
-
publication.manifest.entrypoint.kind !== 'view' ||
|
|
38
|
-
root.views[publication.manifest.entrypoint.name] === undefined)) {
|
|
39
|
-
fail('PUBLICATION_INVALID', 'Manifest entrypoint does not exist in the root schema.');
|
|
40
|
-
}
|
|
41
|
-
for (const route of publication.routes) {
|
|
36
|
+
for (const route of release.routes) {
|
|
42
37
|
if (!callables.has(route.callable)) {
|
|
43
|
-
fail('
|
|
38
|
+
fail('RELEASE_ROUTE_INVALID', `Route ${route.name} names an unknown callable.`);
|
|
44
39
|
}
|
|
45
40
|
}
|
|
46
41
|
}
|
|
@@ -57,7 +52,7 @@ function addClassMethods(result, origin, definitions) {
|
|
|
57
52
|
if (declaration.kind !== 'node')
|
|
58
53
|
continue;
|
|
59
54
|
for (const [name, method] of Object.entries(declaration.methods)) {
|
|
60
|
-
if (method
|
|
55
|
+
if (!isMethodExecutable(declaration, method))
|
|
61
56
|
continue;
|
|
62
57
|
result.add(MethodKey.of({ origin, kind: 'class', name: owner }, name));
|
|
63
58
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import * as artifact from '../artifact/index.js';
|
|
2
|
-
import { absoluteHttpUrl, exact, record } from './content.js';
|
|
3
2
|
import { fail } from './error.js';
|
|
3
|
+
import { absoluteHttpUrl, exact, record } from './shape.js';
|
|
4
4
|
export const BUNDLE_MEDIA_TYPE = 'application/vnd.astrale.domain-bundle+json;v=1';
|
|
5
5
|
export function admitBundleDescriptor(input) {
|
|
6
|
-
const value = record(input, '
|
|
7
|
-
exact(value, ['href', 'ref'], '
|
|
6
|
+
const value = record(input, 'RELEASE_INVALID', 'Bundle descriptor is invalid.');
|
|
7
|
+
exact(value, ['href', 'ref'], 'RELEASE_INVALID');
|
|
8
8
|
const ref = artifact.accept(value.ref);
|
|
9
9
|
if (ref.mediaType !== BUNDLE_MEDIA_TYPE) {
|
|
10
|
-
fail('
|
|
10
|
+
fail('RELEASE_INVALID', 'Bundle media type is unsupported.');
|
|
11
11
|
}
|
|
12
12
|
if (ref.size < 1) {
|
|
13
|
-
fail('
|
|
13
|
+
fail('RELEASE_INVALID', 'Bundle size is invalid.');
|
|
14
14
|
}
|
|
15
15
|
return Object.freeze({
|
|
16
|
-
href: absoluteHttpUrl(value.href, true, '
|
|
16
|
+
href: absoluteHttpUrl(value.href, true, 'RELEASE_INVALID'),
|
|
17
17
|
ref: Object.freeze({ ...ref, mediaType: BUNDLE_MEDIA_TYPE }),
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { sha256Hex } from './digest.js';
|
|
2
|
+
import { fail } from './error.js';
|
|
3
|
+
/** Verify exact artifact bytes without decoding an authored Schema Bundle. */
|
|
4
|
+
export function verifyBundleBytes(release, bytes) {
|
|
5
|
+
if (!(bytes instanceof Uint8Array)) {
|
|
6
|
+
fail('RELEASE_INVALID', 'Bundle artifact bytes are invalid.');
|
|
7
|
+
}
|
|
8
|
+
const descriptor = release.schema.bundle;
|
|
9
|
+
if (bytes.byteLength !== descriptor.ref.size ||
|
|
10
|
+
`sha256:${sha256Hex(bytes)}` !== descriptor.ref.digest) {
|
|
11
|
+
fail('RELEASE_INVALID', 'Bundle artifact does not match its descriptor.');
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
import * as bundle from '@astrale-os/kernel-dsl/v1/bundle/transport';
|
|
2
|
+
import type { ServedRelease } from './bundle-admission.js';
|
|
2
3
|
import type { BundleDescriptor } from './bundle-descriptor.js';
|
|
3
|
-
import
|
|
4
|
+
import * as artifact from '../artifact/index.js';
|
|
4
5
|
import { verifyBundleBytes } from './bundle-evidence.js';
|
|
6
|
+
/** Resolve immutable bundle bytes beneath the exact serving issuer. */
|
|
7
|
+
export declare function bundleUrl(issuer: string, ref: artifact.Ref): string;
|
|
5
8
|
export declare function describeBundle(input: bundle.Bundle, href: string): BundleDescriptor;
|
|
6
9
|
export declare function acceptBundleValue(input: unknown): bundle.Bundle;
|
|
7
|
-
export declare function decodeBundleValue(
|
|
10
|
+
export declare function decodeBundleValue(release: Pick<ServedRelease, 'schema'>, bytes: Uint8Array): bundle.Bundle;
|
|
8
11
|
export { verifyBundleBytes };
|
|
9
12
|
export { admitBundleDescriptor, BUNDLE_MEDIA_TYPE, type BundleDescriptor, } from './bundle-descriptor.js';
|
|
@@ -2,12 +2,18 @@ import * as bundle from '@astrale-os/kernel-dsl/v1/bundle/transport';
|
|
|
2
2
|
import * as artifact from '../artifact/index.js';
|
|
3
3
|
import { BUNDLE_MEDIA_TYPE } from './bundle-descriptor.js';
|
|
4
4
|
import { verifyBundleBytes } from './bundle-evidence.js';
|
|
5
|
-
import { absoluteHttpUrl } from './content.js';
|
|
6
5
|
import { fail } from './error.js';
|
|
6
|
+
import { servedUrl } from './issuer.js';
|
|
7
|
+
import { absoluteHttpUrl } from './shape.js';
|
|
8
|
+
/** Resolve immutable bundle bytes beneath the exact serving issuer. */
|
|
9
|
+
export function bundleUrl(issuer, ref) {
|
|
10
|
+
const digest = ref.digest.slice('sha256:'.length);
|
|
11
|
+
return servedUrl(issuer, `/.well-known/astrale/bundles/sha256/${digest}.json`);
|
|
12
|
+
}
|
|
7
13
|
export function describeBundle(input, href) {
|
|
8
14
|
const bytes = bundle.encode(input);
|
|
9
15
|
return Object.freeze({
|
|
10
|
-
href: absoluteHttpUrl(href, true, '
|
|
16
|
+
href: absoluteHttpUrl(href, true, 'RELEASE_INVALID'),
|
|
11
17
|
ref: Object.freeze({
|
|
12
18
|
...artifact.identify(bytes, BUNDLE_MEDIA_TYPE),
|
|
13
19
|
mediaType: BUNDLE_MEDIA_TYPE,
|
|
@@ -20,22 +26,22 @@ export function acceptBundleValue(input) {
|
|
|
20
26
|
}
|
|
21
27
|
catch (cause) {
|
|
22
28
|
if (cause instanceof bundle.Error) {
|
|
23
|
-
return fail('
|
|
29
|
+
return fail('RELEASE_INVALID', 'Release bundle is invalid.', cause);
|
|
24
30
|
}
|
|
25
31
|
throw cause;
|
|
26
32
|
}
|
|
27
33
|
}
|
|
28
|
-
export function decodeBundleValue(
|
|
34
|
+
export function decodeBundleValue(release, bytes) {
|
|
29
35
|
if (!(bytes instanceof Uint8Array)) {
|
|
30
|
-
fail('
|
|
36
|
+
fail('RELEASE_INVALID', 'Bundle artifact bytes are invalid.');
|
|
31
37
|
}
|
|
32
|
-
verifyBundleBytes(
|
|
38
|
+
verifyBundleBytes(release, bytes);
|
|
33
39
|
try {
|
|
34
40
|
return bundle.decode(bytes);
|
|
35
41
|
}
|
|
36
42
|
catch (cause) {
|
|
37
43
|
if (cause instanceof bundle.Error) {
|
|
38
|
-
return fail('
|
|
44
|
+
return fail('RELEASE_INVALID', 'Bundle artifact cannot be decoded.', cause);
|
|
39
45
|
}
|
|
40
46
|
throw cause;
|
|
41
47
|
}
|
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
import type { Subject } from '@astrale-os/kernel-core/auth/identity';
|
|
2
2
|
import type { Revision } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
3
3
|
import { type IssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
4
|
-
import type {
|
|
4
|
+
import type { ReleaseDigest } from '../digest.js';
|
|
5
5
|
import { PURPOSE } from './limits.js';
|
|
6
|
+
/**
|
|
7
|
+
* What a verified Delivery v2 attestation asserts: the serving Domain identity delivers the release
|
|
8
|
+
* with this digest and schema revision to the requesting Kernel, for its challenge nonce.
|
|
9
|
+
*/
|
|
6
10
|
export interface Claims {
|
|
7
11
|
readonly purpose: typeof PURPOSE;
|
|
8
12
|
readonly iss: IssuerId;
|
|
9
13
|
readonly sub: Subject;
|
|
10
14
|
readonly aud: IssuerId;
|
|
11
15
|
readonly nonce: string;
|
|
12
|
-
readonly
|
|
16
|
+
readonly release: ReleaseDigest;
|
|
13
17
|
readonly schemaRevision: Revision;
|
|
14
18
|
readonly exp: number;
|
|
15
19
|
}
|
|
20
|
+
/** Admit the claims of an attestation Core Auth already verified. */
|
|
16
21
|
export declare function acceptClaims(input: unknown): Claims;
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
import { AuthValueError } from '@astrale-os/kernel-core/auth/error';
|
|
2
2
|
import { accept as acceptIssuerId } from '@astrale-os/kernel-core/auth/issuer';
|
|
3
3
|
import { patterns } from '@astrale-os/kernel-dsl/v1/addressing';
|
|
4
|
+
import { deepFreeze } from '../shape.js';
|
|
4
5
|
import { fail } from './error.js';
|
|
5
6
|
import { NONCE_MAX_LENGTH, NONCE_MIN_LENGTH, PURPOSE } from './limits.js';
|
|
7
|
+
const FIELDS = [
|
|
8
|
+
'purpose',
|
|
9
|
+
'iss',
|
|
10
|
+
'sub',
|
|
11
|
+
'aud',
|
|
12
|
+
'nonce',
|
|
13
|
+
'release',
|
|
14
|
+
'schemaRevision',
|
|
15
|
+
'exp',
|
|
16
|
+
];
|
|
17
|
+
/** Admit the claims of an attestation Core Auth already verified. */
|
|
6
18
|
export function acceptClaims(input) {
|
|
7
19
|
if (input === null || typeof input !== 'object' || Array.isArray(input)) {
|
|
8
20
|
fail('DELIVERY_CLAIMS_INVALID', 'Expected delivery claims.');
|
|
9
21
|
}
|
|
10
22
|
const value = input;
|
|
11
|
-
|
|
12
|
-
if (Object.keys(value).some((field) => !expected.includes(field))) {
|
|
23
|
+
if (Object.keys(value).some((field) => !FIELDS.includes(field))) {
|
|
13
24
|
fail('DELIVERY_CLAIMS_INVALID', 'Delivery claims contain unknown fields.');
|
|
14
25
|
}
|
|
15
26
|
if (value.purpose !== PURPOSE ||
|
|
@@ -24,8 +35,8 @@ export function acceptClaims(input) {
|
|
|
24
35
|
}
|
|
25
36
|
const iss = acceptIssuer(value.iss);
|
|
26
37
|
const aud = acceptIssuer(value.aud);
|
|
27
|
-
if (typeof value.
|
|
28
|
-
fail('DELIVERY_CLAIMS_INVALID', 'Delivery claims
|
|
38
|
+
if (typeof value.release !== 'string' || !/^sha256:[0-9a-f]{64}$/u.test(value.release)) {
|
|
39
|
+
fail('DELIVERY_CLAIMS_INVALID', 'Delivery claims release digest is invalid.');
|
|
29
40
|
}
|
|
30
41
|
if (typeof value.schemaRevision !== 'string' || !patterns.revision.test(value.schemaRevision)) {
|
|
31
42
|
fail('DELIVERY_CLAIMS_INVALID', 'Schema revision is invalid.');
|
|
@@ -36,14 +47,17 @@ export function acceptClaims(input) {
|
|
|
36
47
|
sub: value.sub,
|
|
37
48
|
aud,
|
|
38
49
|
nonce: value.nonce,
|
|
39
|
-
|
|
50
|
+
release: value.release,
|
|
40
51
|
schemaRevision: value.schemaRevision,
|
|
41
52
|
exp: value.exp,
|
|
42
53
|
});
|
|
43
54
|
}
|
|
44
55
|
function acceptIssuer(input) {
|
|
56
|
+
if (typeof input !== 'string') {
|
|
57
|
+
fail('DELIVERY_CLAIMS_INVALID', 'Delivery claims issuer is invalid.');
|
|
58
|
+
}
|
|
45
59
|
try {
|
|
46
|
-
return acceptIssuerId(
|
|
60
|
+
return acceptIssuerId(input);
|
|
47
61
|
}
|
|
48
62
|
catch (cause) {
|
|
49
63
|
if (cause instanceof AuthValueError) {
|
|
@@ -52,10 +66,3 @@ function acceptIssuer(input) {
|
|
|
52
66
|
throw cause;
|
|
53
67
|
}
|
|
54
68
|
}
|
|
55
|
-
function deepFreeze(value) {
|
|
56
|
-
if (value === null || typeof value !== 'object' || Object.isFrozen(value))
|
|
57
|
-
return value;
|
|
58
|
-
for (const nested of Object.values(value))
|
|
59
|
-
deepFreeze(nested);
|
|
60
|
-
return Object.freeze(value);
|
|
61
|
-
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { DomainRelease } from '../release.js';
|
|
2
|
+
import type { Attestation } from './attestation.js';
|
|
3
|
+
/** The challenge-bound envelope carrying the exact `DomainRelease` a Kernel asked for. */
|
|
4
|
+
export interface Delivery {
|
|
5
|
+
readonly format: 'astrale.domain.delivery';
|
|
6
|
+
readonly version: 2;
|
|
7
|
+
readonly release: DomainRelease;
|
|
8
|
+
readonly attestation: Attestation;
|
|
9
|
+
}
|
|
10
|
+
/** Admit one Delivery v2 envelope: its release is admitted whole, its attestation stays opaque. */
|
|
11
|
+
export declare function accept(input: unknown): Delivery;
|