@astrale-os/kernel-protocol 0.5.0-beta.69 → 0.5.0-beta.70

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,20 +1,11 @@
1
1
  export declare namespace Delegate {
2
+ /** One wire leaf; Identity set algebra is not supported. */
2
3
  type Expr = {
3
4
  readonly kind: 'identity';
4
5
  readonly self: true;
5
6
  } | {
6
7
  readonly kind: 'identity';
7
8
  readonly credential: string;
8
- } | {
9
- readonly kind: 'union';
10
- readonly operands: readonly Expr[];
11
- } | {
12
- readonly kind: 'intersect';
13
- readonly operands: readonly Expr[];
14
- } | {
15
- readonly kind: 'exclude';
16
- readonly base: Expr;
17
- readonly excluded: readonly Expr[];
18
9
  };
19
10
  }
20
11
  export interface Delegate {
@@ -8,6 +8,7 @@ export function acceptDelegate(input) {
8
8
  if (!Number.isSafeInteger(object.ttlSeconds) || object.ttlSeconds < 1) {
9
9
  invalid('delegate.ttlSeconds must be a positive safe integer');
10
10
  }
11
+ // Omission and `self` both carry the authenticated caller unchanged; nothing else is admitted.
11
12
  let attenuation;
12
13
  if (object.attenuation !== undefined) {
13
14
  try {
@@ -15,29 +16,14 @@ export function acceptDelegate(input) {
15
16
  }
16
17
  catch (cause) {
17
18
  if (cause instanceof AuthValueError)
18
- invalid('delegate.attenuation must be a valid expression');
19
+ invalid('delegate.attenuation must be self');
19
20
  throw cause;
20
21
  }
21
- requireTextCredentials(attenuation);
22
+ if (!('self' in attenuation))
23
+ invalid('delegate.attenuation must be self');
22
24
  }
23
25
  return Object.freeze({
24
26
  ttlSeconds: object.ttlSeconds,
25
27
  ...(attenuation === undefined ? {} : { attenuation: attenuation }),
26
28
  });
27
29
  }
28
- function requireTextCredentials(input) {
29
- if (input.kind === 'identity') {
30
- if ('credential' in input && typeof input.credential !== 'string') {
31
- invalid('delegate.attenuation credentials must be non-empty text');
32
- }
33
- return;
34
- }
35
- if (input.kind === 'exclude') {
36
- requireTextCredentials(input.base);
37
- for (const operand of input.excluded)
38
- requireTextCredentials(operand);
39
- return;
40
- }
41
- for (const operand of input.operands)
42
- requireTextCredentials(operand);
43
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astrale-os/kernel-protocol",
3
- "version": "0.5.0-beta.69",
3
+ "version": "0.5.0-beta.70",
4
4
  "description": "Portable Astrale invocation, publication, installation, routing, and issuer protocols",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -173,8 +173,8 @@
173
173
  "access": "public"
174
174
  },
175
175
  "dependencies": {
176
- "@astrale-os/kernel-core": "0.9.0-beta.63",
177
- "@astrale-os/kernel-dsl": "0.2.0-beta.45",
176
+ "@astrale-os/kernel-core": "0.9.0-beta.64",
177
+ "@astrale-os/kernel-dsl": "0.2.0-beta.46",
178
178
  "@noble/hashes": "2.3.0"
179
179
  },
180
180
  "devDependencies": {