@owlmeans/auth-common 0.1.18-rc.2 → 0.1.18-rc.21

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 (55) hide show
  1. package/README.md +20 -15
  2. package/agent-meta/manifest.json +2 -2
  3. package/agent-meta/skills/auth-common/SKILL.md +113 -23
  4. package/build/consts.d.ts +28 -0
  5. package/build/consts.d.ts.map +1 -1
  6. package/build/consts.js +28 -0
  7. package/build/consts.js.map +1 -1
  8. package/build/entity.d.ts +43 -0
  9. package/build/entity.d.ts.map +1 -0
  10. package/build/entity.js +68 -0
  11. package/build/entity.js.map +1 -0
  12. package/build/entrypoints.d.ts +41 -0
  13. package/build/entrypoints.d.ts.map +1 -0
  14. package/build/entrypoints.js +46 -0
  15. package/build/entrypoints.js.map +1 -0
  16. package/build/guards/basic-ed25519/service.js +1 -1
  17. package/build/guards/basic-ed25519/service.js.map +1 -1
  18. package/build/helper.d.ts +1 -0
  19. package/build/helper.d.ts.map +1 -0
  20. package/build/helper.js +2 -0
  21. package/build/helper.js.map +1 -0
  22. package/build/index.d.ts +3 -1
  23. package/build/index.d.ts.map +1 -1
  24. package/build/index.js +3 -1
  25. package/build/index.js.map +1 -1
  26. package/build/middleware.d.ts.map +1 -1
  27. package/build/middleware.js +12 -11
  28. package/build/middleware.js.map +1 -1
  29. package/build/schemas.d.ts +16 -0
  30. package/build/schemas.d.ts.map +1 -0
  31. package/build/schemas.js +10 -0
  32. package/build/schemas.js.map +1 -0
  33. package/build/types.d.ts +52 -1
  34. package/build/types.d.ts.map +1 -1
  35. package/build/utils/trusted.d.ts.map +1 -1
  36. package/build/utils/trusted.js +2 -1
  37. package/build/utils/trusted.js.map +1 -1
  38. package/package.json +12 -12
  39. package/src/consts.ts +32 -0
  40. package/src/entity.ts +82 -0
  41. package/src/entrypoints.ts +73 -0
  42. package/src/guards/basic-ed25519/service.ts +1 -1
  43. package/src/helper.ts +0 -0
  44. package/src/index.ts +3 -1
  45. package/src/middleware.ts +12 -11
  46. package/src/schemas.ts +25 -0
  47. package/src/types.ts +54 -1
  48. package/src/utils/trusted.ts +3 -2
  49. package/tests/context.ts +1 -2
  50. package/tests/dispatcher.spec.ts +15 -15
  51. package/build/modules.d.ts +0 -3
  52. package/build/modules.d.ts.map +0 -1
  53. package/build/modules.js +0 -38
  54. package/build/modules.js.map +0 -1
  55. package/src/modules.ts +0 -53
package/README.md CHANGED
@@ -1,10 +1,10 @@
1
1
  # @owlmeans/auth-common
2
2
 
3
- Predefined authentication modules, guards, and constants shared between server and client packages.
3
+ Predefined authentication entrypoints, guards, and constants shared between server and client packages.
4
4
 
5
5
  ## Overview
6
6
 
7
- - Exports standard auth module definitions (login, init, rely, dispatcher) ready to register in any app
7
+ - Exports standard auth entrypoint definitions (login, init, rely, dispatcher) ready to register in any app
8
8
  - Provides `DEFAULT_GUARD` and `GUARD_ED25519` constants for protecting routes
9
9
  - Implements the Basic ED25519 signature guard service for cryptographic request authentication
10
10
  - Headers: `BED255_NONCE_HEADER`, `BED255_TIME_HEADER` for auth challenge/response
@@ -12,35 +12,40 @@ Predefined authentication modules, guards, and constants shared between server a
12
12
  ## Installation
13
13
 
14
14
  ```bash
15
- bun add @owlmeans/auth-common
15
+ bun add @owlmeans/auth-common@^0.1.18-rc.12
16
16
  ```
17
17
 
18
18
  ## Usage
19
19
 
20
- Register the built-in auth modules and protect a route:
20
+ Register the built-in auth entrypoints and protect a route:
21
21
 
22
22
  ```typescript
23
- import { modules } from '@owlmeans/auth-common'
23
+ import { entrypoints } from '@owlmeans/auth-common'
24
24
  import { GUARD_ED25519, DEFAULT_GUARD } from '@owlmeans/auth-common'
25
25
 
26
- // Add auth modules to your app (includes /authentication, /login, /dispatcher routes)
27
- await main(context, [...modules, ...appModules])
26
+ // Add auth entrypoints to your app (includes /authentication, /login, /dispatcher routes)
27
+ await main(context, [...entrypoints, ...appEntrypoints])
28
28
  ```
29
29
 
30
30
  Protect a route with the ED25519 signature guard (re-exported via `@owlmeans/server-app`):
31
31
 
32
32
  ```typescript
33
33
  import { GUARD_ED25519 } from '@owlmeans/auth-common'
34
- import { module, guard } from '@owlmeans/server-app'
35
-
36
- const adminModule = module(route('admin', '/api/admin'), guard(GUARD_ED25519))
34
+ import { contract, protocol, typed } from '@owlmeans/entrypoint'
35
+ import { route } from '@owlmeans/route'
36
+
37
+ const adminProtocol = protocol(
38
+ route('admin', '/api/admin'),
39
+ contract(typed<AdminResponse>()),
40
+ { guards: GUARD_ED25519 },
41
+ )
37
42
  ```
38
43
 
39
44
  ## API
40
45
 
41
- ### `modules`
46
+ ### `entrypoints`
42
47
 
43
- Array of pre-built `CommonModule` instances covering the standard auth flow:
48
+ Array of pre-built `CommonEntrypoint` instances covering the standard auth flow:
44
49
  - `AUTHEN` — backend `/authentication` base route
45
50
  - `AUTHEN_INIT` — POST `/authentication/init` (allowance request)
46
51
  - `AUTHEN_AUTHEN` — POST `/authentication/authenticate` (credential submission)
@@ -66,9 +71,9 @@ BED255_CASHE_RESOURCE // resource alias for nonce cache
66
71
  ## Product-Viable Integration Notes
67
72
 
68
73
  - `DEFAULT_GUARD` protects manager routes after bearer authentication is installed by `@owlmeans/server-auth`.
69
- - Product authorization composes a custom gate inside `guard(DEFAULT_GUARD, gate(VIABLE_AUTH_GATE, [...]))` rather than using `OIDC_GATE` for Google login flows.
74
+ - Product authorization composes a custom gate in the protocol options rather than using `OIDC_GATE` for Google login flows.
70
75
  - `GUARD_ED25519` remains the service-to-service guard for internal/publisher/payment/auth-service calls.
71
- - The browser-side alias from `@owlmeans/client-auth` must match the default guard name so shared module declarations elevate consistently.
76
+ - The browser-side binding from `@owlmeans/client-auth` uses the same protocol references as the shared declarations.
72
77
 
73
78
  ## Related Packages
74
79
 
@@ -84,7 +89,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
84
89
  your project's skill store (`.agents/skills/`):
85
90
 
86
91
  ```sh
87
- npx @owlmeans/agent-skills
92
+ npx @owlmeans/agent-skills@^0.1.18-rc.20
88
93
  ```
89
94
 
90
95
  The embedded files are version-matched to this package release. Do not edit them
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "schemaVersion": 2,
3
3
  "package": "@owlmeans/auth-common",
4
- "version": "0.1.18-rc.0",
5
- "generatedAt": "2026-08-16T22:20:50.501Z",
4
+ "version": "0.1.18-rc.21",
5
+ "generatedAt": "2026-09-12T14:18:54.785Z",
6
6
  "canonicalRepo": "https://github.com/owlmeans/common",
7
7
  "entries": [
8
8
  {
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: auth-common
3
- description: How to use @owlmeans/auth-common — shared authentication guard aliases (DEFAULT_GUARD, GUARD_ED25519) and middleware shared between server and client. Auto-invoked when importing guard constants or shared auth modules.
3
+ description: How to use @owlmeans/auth-common — the auth vocabulary both sides of the wire share, covering guard aliases (DEFAULT_GUARD, GUARD_ED25519), the shared auth entrypoint list, the Ed25519 signature guard, the TRUSTED-record trust() helper, and the organization-entity resolver contract (ENTITY_RESOLVER, entityKeyOf, attachEntity). Auto-invoked when importing guard constants, the shared auth entrypoints, or entity-resolution helpers.
4
4
  user-invocable: false
5
5
  ---
6
6
  <!-- AUTO-GENERATED — do not edit. Regenerate via sync-agent-meta. -->
@@ -8,46 +8,136 @@ user-invocable: false
8
8
  # @owlmeans/auth-common
9
9
 
10
10
  **Layer:** Core
11
- **Install:** `"@owlmeans/auth-common": "^0.1.18-rc.0"` in `dependencies`
11
+ **Install:** `"@owlmeans/auth-common": "^0.1.18-rc.21"` in `dependencies`
12
+
13
+ Everything a server and a browser must agree on to talk authentication: aliases, the shared
14
+ entrypoint declarations, the signature guard, and the contract for resolving the organization
15
+ entity a token names.
12
16
 
13
17
  ## Key Exports
14
18
 
19
+ ### Aliases and constants
20
+
21
+ | Export | Value / description |
22
+ |--------|---------------------|
23
+ | `DEF_AUTH_SRV` / `DEFAULT_GUARD` | `'auth'` — the canonical auth guard alias, the same string on both sides |
24
+ | `GUARD_ED25519` | `'guard:ed25519-basic-signature'` — the Ed25519 request-signature guard |
25
+ | `TOKEN_UPDATE` | `'auth-token-refresh'` |
26
+ | `WEB_API` | `'web-auth-api'` — service alias of the auth manager's web API |
27
+ | `DISPATCHER_PATH` / `SURROGATE_PATH` | `'/dispatcher'` / `'/surrogate'` — both reserved; an application must never declare its own route at either |
28
+ | `ENTITY_RESOLVER` | `'entity-resolver'` — the organization-entity resolver's service alias |
29
+ | `ENTITY_SLUG_PATTERN` | A lowercase DNS label. Slugs compose hostnames, cluster object names and OIDC client ids, so anything needing sanitising is rejected where it is chosen |
30
+ | `RELY_PIN_PERFIX`, `RELY_TOKEN_PREFIX`, `RELY_CALL_TIMEOUT`, `RELY_ACTION_TIMEOUT` | Rely-handshake constants |
31
+ | `BED255_TIME_HEADER`, `BED255_NONCE_HEADER`, `BED255_SIG_TTL`, `BED255_CASHE_RESOURCE` | Ed25519 signature-guard headers, replay window and nonce-cache alias |
32
+ | `authApi` | Alias tree for the manager API entrypoints (`profile`, `entity`, `auth`) |
33
+
34
+ ### Entrypoints, guard and middleware
35
+
36
+ | Export | Description |
37
+ |--------|-------------|
38
+ | `authEntrypoints` | The shared auth protocol tree — `AUTHEN*`, `CAUTHEN*`, `DISPATCHER`, `DISPATCHER_SURROGATE`, `DISPATCHER_AUTHEN`. Server and client packages bind the entries they serve |
39
+ | `managerEntrypoints` | The auth-manager web API entrypoints (profile → entity slug, auth delegation) |
40
+ | `makeBasicEd25519Guard(resource, opts?)` | The `GUARD_ED25519` guard service: signs outgoing requests as a client, verifies time/nonce/signature as a server |
41
+ | `authMiddleware` | Loading-stage context middleware that attaches the guard's token to every guarded backend entrypoint's `invoke`/`call` |
42
+ | `SurrogateQuery`, `SurrogateQuerySchema` | The surrogate window's `intent` / `next` / `method` query |
43
+
44
+ ### Types
45
+
46
+ | Type | Description |
47
+ |------|-------------|
48
+ | `AuthService` | `GuardService` + `authenticate(token)`, `update(token)`, `user()`, `store<T>()` — the client-side auth manager contract |
49
+ | `AuthorizationService` | `isAllowed(permissions, token?, thr?)`, `update(token?, thr?)` |
50
+ | `TrustedRecord` | A `ConfigRecord` carrying a known signing identity's `name`, `credential` (public key) and optional `secret` |
51
+ | `AuthRequest` | An `AbstractRequest` whose `query` is an `AuthToken` |
52
+ | `AuthUIParams` | `{ type? }` — the typed login route's params |
53
+ | `OrgEntityRef` | `{ id, slug, formerSlugs?, iamKey }` |
54
+ | `EntityResolverService` | `resolve`, `byId`, `mintSlug`, `rename`, `mintName` — see below |
55
+ | `ProfileToEntityIdRequest` / `ProfileToEntityIdResponse` | The manager API body/response that maps a `profileId` to an `entitySlug` |
56
+
57
+ ### Subpath `./utils`
58
+
15
59
  | Export | Description |
16
60
  |--------|-------------|
17
- | `DEFAULT_GUARD` | Alias for the default authentication guard |
18
- | `GUARD_ED25519` | Alias for the Ed25519 signature guard |
19
- | `AUTH_API` | Alias of the auth service module group |
20
- | Auth modules | Shared module declarations registered in both server and client |
21
- | Middleware | Cross-side auth middleware helpers |
61
+ | `trust(context, resource, userName, field = 'name')` | Load a `TrustedRecord` from a config resource and return `{ user, key }`, where `key` is a signing `KeyPairModel` when the record has a `secret` and a verify-only one otherwise |
62
+ | `extractAuthToken(req, type?, onlyValue?)` | Pull the `authorization` header, optionally requiring an `AuthroizationType` prefix |
63
+ | `Config`, `Context` | The minimal context shape `trust` needs |
22
64
 
23
- ## Subpath Exports
65
+ ## The organization entity
24
66
 
25
- - `./utils` shared auth utility functions
67
+ The customer organization is an **organization entity**. Two values name it and they are not
68
+ interchangeable:
69
+
70
+ - **`entitySlug`** — renameable, human-readable, and the only organization value on the wire. It is
71
+ what a token, a URL, a query param and a form carry.
72
+ - **`entityId`** — the stable record id. It never travels; it is what database rows, permission
73
+ grants and third-party records key on, and it is why a rename costs one write.
74
+
75
+ `EntityResolverService` is the contract between the two. It is registered **only** by an
76
+ implementation that actually stores organizations (`@owlmeans/server-auth-identity` registers one);
77
+ a deployment backed by an external IAM registers none, and every consumer must treat an unresolved
78
+ entity as ordinary rather than exceptional.
79
+
80
+ ```typescript
81
+ import { attachEntity, entityKeyOf, requireEntityKey, requireEntity } from '@owlmeans/auth-common'
82
+ ```
83
+
84
+ | Helper | What it answers |
85
+ |--------|-----------------|
86
+ | `attachEntity(context, request)` | Resolve the slug on `request.auth` and set `request.entity`, canonicalizing a retired slug to the current one. A no-op when no resolver is registered; throws `AuthenFailed('entity')` when the token names an organization that will not resolve |
87
+ | `entityKeyOf(req)` | The value to store and query organization-scoped records by — `req.entity?.id`, falling back to the token's slug where no resolver exists |
88
+ | `requireEntityKey(req)` | Same, throwing `AuthorizationError` when the request carries no organization |
89
+ | `requireEntity(req)` | The full `ResolvedEntity` (`id`, `slug`, `iamKey`), throwing `AuthorizationError` when nothing resolved |
90
+
91
+ `attachEntity` must be called wherever authentication is **established** — the HTTP boundary, and
92
+ any socket that authenticates after its connection is already open. A path that authenticates
93
+ without it leaves `request.entity` empty and its handlers silently compare a slug against stored
94
+ ids.
95
+
96
+ Never build a user-facing name (a hostname, a display label) from `entityKeyOf`. Those want the
97
+ current slug, `req.entity?.slug`.
26
98
 
27
99
  ## Usage
28
100
 
29
- Use guard aliases when declaring modules so both client and server agree on the guard name:
101
+ Declare an entrypoint with a guard so both sides agree on the alias, and compose authorization as a
102
+ gate inside the same options object:
30
103
 
31
104
  ```typescript
32
- import { entrypoint, guard, gate } from '@owlmeans/entrypoint'
33
- import { route } from '@owlmeans/route'
105
+ import { contract, protocol, typed } from '@owlmeans/entrypoint'
106
+ import { route, backend } from '@owlmeans/route'
34
107
  import { DEFAULT_GUARD } from '@owlmeans/auth-common'
35
- import { OIDC_GATE } from '@owlmeans/oidc'
36
108
 
37
- entrypoint(
38
- route(manager.back.account.base, '/account'),
39
- guard(DEFAULT_GUARD, gate(OIDC_GATE, [`my-service-account-{entity}`]))
109
+ // PRODUCT_GATE is the consuming app's own gate alias, registered as a GateService on its context.
110
+ protocol(
111
+ route('api:account', '/account', backend()),
112
+ contract(typed<Account>()),
113
+ { guards: DEFAULT_GUARD, gate: { alias: PRODUCT_GATE, params: ['my-service-account-{entity}'] } },
40
114
  )
41
115
  ```
42
116
 
43
- ## Product-Viable Usage Notes
117
+ `{entity}` is a placeholder each **gate service** substitutes for itself — `@owlmeans/auth-common`
118
+ declares neither the token nor the substitution — so what it stands for depends on the gate the
119
+ alias resolves to. `@owlmeans/server-iam` substitutes `req.entity?.id`, falling back to the token's
120
+ slug, because its grants are stored against the organization entity's stable id wherever one is
121
+ resolvable. `@owlmeans/server-oidc-rp`'s gate model substitutes the token's slug only. Both write
122
+ `'-'` when neither is available. Read the gate you are wiring before writing a parameter that
123
+ depends on the value.
124
+
125
+ ## Rules
44
126
 
45
- - Manager API modules use `DEFAULT_GUARD` for bearer-token authentication and compose product authorization with `gate(VIABLE_AUTH_GATE, [...])` inside the same `guard(...)` options object.
46
- - Internal service-to-service routes still use `GUARD_ED25519`, including publisher/project command paths and auth service helper modules.
47
- - `DEFAULT_GUARD` is the guard alias shared across server and web; `@owlmeans/client-auth` exports the matching client alias.
48
- - OIDC gates are not required when OIDC is only the login/bootstrap provider. In product-viable, OIDC/Google login issues local bearer auth, and a product-specific gate checks local identity scopes.
127
+ - `DEFAULT_GUARD` is the bearer-token guard shared by server and web; `@owlmeans/client-auth` exports
128
+ the matching client-side alias as `DEFAULT_ALIAS`.
129
+ - `GUARD_ED25519` is for service-to-service calls, where the caller signs the request rather than
130
+ presenting a bearer token. Give it a Redis-backed nonce cache (`BED255_CASHE_RESOURCE`) in any
131
+ deployment that runs more than one replica, or replay protection is per-process only.
132
+ - An OIDC gate is not required when OIDC is only the login/bootstrap provider. Where the provider
133
+ issues a local bearer token, authorize with a product-specific gate against local identity scopes.
134
+ - The trust resource (`TRUSTED`, from `@owlmeans/config`) is the system's source of truth for known
135
+ signing identities — the auth service, peer services, wallet providers, supervisors.
49
136
 
50
137
  ## Depends On
51
138
 
52
- - `@owlmeans/auth` — types and errors
53
- - `@owlmeans/entrypoint` — entrypoint/guard/gate helpers
139
+ - `@owlmeans/auth` — types, errors, entrypoint aliases
140
+ - `@owlmeans/entrypoint` — `entrypoint` / `guard` / `gate`, `GuardService`, `ResolvedEntity`
141
+ - `@owlmeans/route` — route builders for the shared entrypoint list
142
+ - `@owlmeans/basic-keys` — key pairs behind `trust()` and the Ed25519 guard
143
+ - `@owlmeans/basic-ids`, `@owlmeans/context`, `@owlmeans/resource`, `@owlmeans/client-entrypoint`
package/build/consts.d.ts CHANGED
@@ -3,10 +3,29 @@ export declare const RELY_TOKEN_PREFIX = "rely-token:";
3
3
  export declare const RELY_CALL_TIMEOUT = 120;
4
4
  export declare const RELY_ACTION_TIMEOUT = 600;
5
5
  export declare const DISPATCHER_PATH = "/dispatcher";
6
+ /**
7
+ * Where the surrogate login window runs.
8
+ *
9
+ * Reserved exactly like {@link DISPATCHER_PATH}: an application must not declare a route of its
10
+ * own here, and a code generator must not produce one. It is user-visible — it is what the popup's
11
+ * address bar shows.
12
+ */
13
+ export declare const SURROGATE_PATH = "/surrogate";
6
14
  export declare const DEF_AUTH_SRV = "auth";
7
15
  export declare const DEFAULT_GUARD = "auth";
8
16
  export declare const TOKEN_UPDATE = "auth-token-refresh";
9
17
  export declare const WEB_API = "web-auth-api";
18
+ /** Service alias of the organization-entity resolver, when an implementation registers one. */
19
+ export declare const ENTITY_RESOLVER = "entity-resolver";
20
+ /**
21
+ * What an organization slug may look like: a DNS label, lowercase.
22
+ *
23
+ * The constraint is not cosmetic. The same slug is used to compose hostnames, Kubernetes object
24
+ * names and OIDC client ids, so anything that would need sanitising before it could address one of
25
+ * those is rejected at the point it is chosen instead — a slug that survives this pattern passes
26
+ * through every downstream name unchanged.
27
+ */
28
+ export declare const ENTITY_SLUG_PATTERN: RegExp;
10
29
  export declare const authApi: {
11
30
  profile: {
12
31
  base: string;
@@ -26,4 +45,13 @@ export declare const authApi: {
26
45
  delegate: string;
27
46
  };
28
47
  };
48
+ /**
49
+ * The request header an authenticated call carries, re-exported for the packages that only depend
50
+ * on this half of the vocabulary.
51
+ *
52
+ * One spelling, one home: it is declared by `@owlmeans/auth` and named here so a client-side
53
+ * package does not have to take a dependency on the whole auth package to recognise its own
54
+ * bearer on a request it is about to send.
55
+ */
56
+ export { AUTH_HEADER } from '@owlmeans/auth';
29
57
  //# sourceMappingURL=consts.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,cAAc,CAAA;AAE1C,eAAO,MAAM,iBAAiB,gBAAgB,CAAA;AAE9C,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC,eAAO,MAAM,eAAe,gBAAgB,CAAA;AAE5C,eAAO,MAAM,YAAY,SAAS,CAAA;AAElC,eAAO,MAAM,aAAa,SAAe,CAAA;AAEzC,eAAO,MAAM,YAAY,uBAAuB,CAAA;AAEhD,eAAO,MAAM,OAAO,iBAAiB,CAAA;AAErC,eAAO,MAAM,OAAO;IAClB,OAAO;QACL,IAAI;QACJ,UAAU;;IAEZ,MAAM;QACJ,IAAI;QACJ,GAAG;QACH,OAAO;YACL,IAAI;YACJ,IAAI;YACJ,IAAI;;;IAGR,IAAI;QACF,IAAI;QACJ,QAAQ;;CAEX,CAAA"}
1
+ {"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,cAAc,CAAA;AAE1C,eAAO,MAAM,iBAAiB,gBAAgB,CAAA;AAE9C,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC,eAAO,MAAM,mBAAmB,MAAM,CAAA;AAEtC,eAAO,MAAM,eAAe,gBAAgB,CAAA;AAE5C;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,eAAe,CAAA;AAE1C,eAAO,MAAM,YAAY,SAAS,CAAA;AAElC,eAAO,MAAM,aAAa,SAAe,CAAA;AAEzC,eAAO,MAAM,YAAY,uBAAuB,CAAA;AAEhD,eAAO,MAAM,OAAO,iBAAiB,CAAA;AAErC,+FAA+F;AAC/F,eAAO,MAAM,eAAe,oBAAoB,CAAA;AAEhD;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,QAA2C,CAAA;AAE3E,eAAO,MAAM,OAAO;IAClB,OAAO;QACL,IAAI;QACJ,UAAU;;IAEZ,MAAM;QACJ,IAAI;QACJ,GAAG;QACH,OAAO;YACL,IAAI;YACJ,IAAI;YACJ,IAAI;;;IAGR,IAAI;QACF,IAAI;QACJ,QAAQ;;CAEX,CAAA;AAGD;;;;;;;GAOG;AACH,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA"}
package/build/consts.js CHANGED
@@ -3,10 +3,29 @@ export const RELY_TOKEN_PREFIX = 'rely-token:';
3
3
  export const RELY_CALL_TIMEOUT = 120;
4
4
  export const RELY_ACTION_TIMEOUT = 600;
5
5
  export const DISPATCHER_PATH = '/dispatcher';
6
+ /**
7
+ * Where the surrogate login window runs.
8
+ *
9
+ * Reserved exactly like {@link DISPATCHER_PATH}: an application must not declare a route of its
10
+ * own here, and a code generator must not produce one. It is user-visible — it is what the popup's
11
+ * address bar shows.
12
+ */
13
+ export const SURROGATE_PATH = '/surrogate';
6
14
  export const DEF_AUTH_SRV = 'auth';
7
15
  export const DEFAULT_GUARD = DEF_AUTH_SRV;
8
16
  export const TOKEN_UPDATE = 'auth-token-refresh';
9
17
  export const WEB_API = 'web-auth-api';
18
+ /** Service alias of the organization-entity resolver, when an implementation registers one. */
19
+ export const ENTITY_RESOLVER = 'entity-resolver';
20
+ /**
21
+ * What an organization slug may look like: a DNS label, lowercase.
22
+ *
23
+ * The constraint is not cosmetic. The same slug is used to compose hostnames, Kubernetes object
24
+ * names and OIDC client ids, so anything that would need sanitising before it could address one of
25
+ * those is rejected at the point it is chosen instead — a slug that survives this pattern passes
26
+ * through every downstream name unchanged.
27
+ */
28
+ export const ENTITY_SLUG_PATTERN = /^[a-z0-9](?:[a-z0-9-]{1,61}[a-z0-9])?$/;
10
29
  export const authApi = {
11
30
  profile: {
12
31
  base: 'api:profile',
@@ -26,4 +45,13 @@ export const authApi = {
26
45
  delegate: 'api:auth:delegate',
27
46
  },
28
47
  };
48
+ /**
49
+ * The request header an authenticated call carries, re-exported for the packages that only depend
50
+ * on this half of the vocabulary.
51
+ *
52
+ * One spelling, one home: it is declared by `@owlmeans/auth` and named here so a client-side
53
+ * package does not have to take a dependency on the whole auth package to recognise its own
54
+ * bearer on a request it is about to send.
55
+ */
56
+ export { AUTH_HEADER } from '@owlmeans/auth';
29
57
  //# sourceMappingURL=consts.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"consts.js","sourceRoot":"","sources":["../src/consts.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,eAAe,GAAG,WAAW,CAAA;AAE1C,MAAM,CAAC,MAAM,iBAAiB,GAAG,aAAa,CAAA;AAE9C,MAAM,CAAC,MAAM,iBAAiB,GAAG,GAAG,CAAA;AAEpC,MAAM,CAAC,MAAM,mBAAmB,GAAG,GAAG,CAAA;AAEtC,MAAM,CAAC,MAAM,eAAe,GAAG,aAAa,CAAA;AAE5C,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAA;AAElC,MAAM,CAAC,MAAM,aAAa,GAAG,YAAY,CAAA;AAEzC,MAAM,CAAC,MAAM,YAAY,GAAG,oBAAoB,CAAA;AAEhD,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAA;AAErC,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,OAAO,EAAE;QACP,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE,0BAA0B;KACvC;IACD,MAAM,EAAE;QACN,IAAI,EAAE,YAAY;QAClB,GAAG,EAAE,gBAAgB;QACrB,OAAO,EAAE;YACP,IAAI,EAAE,oBAAoB;YAC1B,IAAI,EAAE,yBAAyB;YAC/B,IAAI,EAAE,yBAAyB;SAChC;KACF;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,UAAU;QAChB,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{ AbstractRequest, ResolvedEntity } from '@owlmeans/entrypoint';
2
+ import type { BasicContext } from '@owlmeans/context';
3
+ /**
4
+ * The value a handler should store and query organization-scoped records by.
5
+ *
6
+ * Prefers the entity's stable id, which is the whole point of resolving one: records keyed by it
7
+ * survive a rename untouched. Falls back to the slug on the token for deployments that register no
8
+ * resolver — there the slug IS the only identifier the system has, and refusing to serve them
9
+ * would break every installation backed by an external IAM.
10
+ *
11
+ * Never use this to compose a user-facing name (a hostname, a display label). Those want the
12
+ * current slug, `req.entity?.slug`, precisely because it can change.
13
+ */
14
+ export declare const entityKeyOf: (req: AbstractRequest) => string | undefined;
15
+ /**
16
+ * `entityKeyOf` for handlers that cannot proceed without an organization.
17
+ *
18
+ * @throws {AuthorizationError} when the request carries no organization at all.
19
+ */
20
+ export declare const requireEntityKey: (req: AbstractRequest) => string;
21
+ /**
22
+ * The full resolved entity, for handlers that need the slug or the frozen key as well as the id.
23
+ *
24
+ * @throws {AuthorizationError} when no resolver is registered or the entity did not resolve.
25
+ */
26
+ export declare const requireEntity: (req: AbstractRequest) => ResolvedEntity;
27
+ /**
28
+ * Resolve the organization a just-authenticated request acts for, and attach it.
29
+ *
30
+ * Called wherever authentication is ESTABLISHED — the HTTP boundary, and any socket that
31
+ * authenticates on its own once the connection is already open. Both need it for the same reason:
32
+ * the token names the organization by a slug that can move, while everything downstream keys on
33
+ * the record. A path that authenticates without calling this leaves `request.entity` empty, and
34
+ * its handlers quietly fall back to comparing a slug against stored ids — which surfaces as "this
35
+ * project does not exist" rather than as a missing resolution, and costs an afternoon to find.
36
+ *
37
+ * A no-op when no resolver is registered: such a deployment has no organization store, and the
38
+ * slug is the only identifier it has.
39
+ *
40
+ * @throws {AuthenFailed} when the token names an organization that cannot be resolved.
41
+ */
42
+ export declare const attachEntity: (context: BasicContext<any>, request: AbstractRequest) => Promise<ResolvedEntity | undefined>;
43
+ //# sourceMappingURL=entity.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity.d.ts","sourceRoot":"","sources":["../src/entity.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAC3E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAA;AAKrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,WAAW,QAAS,eAAe,KAAG,MAAM,GAAG,SAClB,CAAA;AAE1C;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,QAAS,eAAe,KAAG,MAOvD,CAAA;AAED;;;;GAIG;AACH,eAAO,MAAM,aAAa,QAAS,eAAe,KAAG,cAMpD,CAAA;AAED;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,YAAY,YACd,YAAY,CAAC,GAAG,CAAC,WAAW,eAAe,KACnD,OAAO,CAAC,cAAc,GAAG,SAAS,CAiBpC,CAAA"}
@@ -0,0 +1,68 @@
1
+ import { AuthenFailed, AuthorizationError, entitySlugOf } from '@owlmeans/auth';
2
+ import { ENTITY_RESOLVER } from './consts.js';
3
+ /**
4
+ * The value a handler should store and query organization-scoped records by.
5
+ *
6
+ * Prefers the entity's stable id, which is the whole point of resolving one: records keyed by it
7
+ * survive a rename untouched. Falls back to the slug on the token for deployments that register no
8
+ * resolver — there the slug IS the only identifier the system has, and refusing to serve them
9
+ * would break every installation backed by an external IAM.
10
+ *
11
+ * Never use this to compose a user-facing name (a hostname, a display label). Those want the
12
+ * current slug, `req.entity?.slug`, precisely because it can change.
13
+ */
14
+ export const entityKeyOf = (req) => req.entity?.id ?? entitySlugOf(req.auth);
15
+ /**
16
+ * `entityKeyOf` for handlers that cannot proceed without an organization.
17
+ *
18
+ * @throws {AuthorizationError} when the request carries no organization at all.
19
+ */
20
+ export const requireEntityKey = (req) => {
21
+ const key = entityKeyOf(req);
22
+ if (key == null || key === '') {
23
+ throw new AuthorizationError();
24
+ }
25
+ return key;
26
+ };
27
+ /**
28
+ * The full resolved entity, for handlers that need the slug or the frozen key as well as the id.
29
+ *
30
+ * @throws {AuthorizationError} when no resolver is registered or the entity did not resolve.
31
+ */
32
+ export const requireEntity = (req) => {
33
+ if (req.entity == null) {
34
+ throw new AuthorizationError();
35
+ }
36
+ return req.entity;
37
+ };
38
+ /**
39
+ * Resolve the organization a just-authenticated request acts for, and attach it.
40
+ *
41
+ * Called wherever authentication is ESTABLISHED — the HTTP boundary, and any socket that
42
+ * authenticates on its own once the connection is already open. Both need it for the same reason:
43
+ * the token names the organization by a slug that can move, while everything downstream keys on
44
+ * the record. A path that authenticates without calling this leaves `request.entity` empty, and
45
+ * its handlers quietly fall back to comparing a slug against stored ids — which surfaces as "this
46
+ * project does not exist" rather than as a missing resolution, and costs an afternoon to find.
47
+ *
48
+ * A no-op when no resolver is registered: such a deployment has no organization store, and the
49
+ * slug is the only identifier it has.
50
+ *
51
+ * @throws {AuthenFailed} when the token names an organization that cannot be resolved.
52
+ */
53
+ export const attachEntity = async (context, request) => {
54
+ const slug = entitySlugOf(request.auth);
55
+ if (slug == null || !context.hasService(ENTITY_RESOLVER)) {
56
+ return undefined;
57
+ }
58
+ const entity = await context.service(ENTITY_RESOLVER).resolve(slug);
59
+ if (entity == null) {
60
+ throw new AuthenFailed('entity');
61
+ }
62
+ // Canonicalize: a request that arrived under a retired slug continues under the current one, so
63
+ // nothing echoing the value back can re-publish a name the organization has dropped.
64
+ request.auth.entitySlug = entity.slug;
65
+ request.entity = entity;
66
+ return entity;
67
+ };
68
+ //# sourceMappingURL=entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity.js","sourceRoot":"","sources":["../src/entity.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAE/E,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAA;AAE7C;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,GAAoB,EAAsB,EAAE,CACtE,GAAG,CAAC,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AA;IAEvB,OAAO,MAAM,CAAA;AACf,CAAC,CAAA"}
@@ -0,0 +1,41 @@
1
+ import type { AllowanceRequest, AllowanceResponse, AuthCredentials, AuthToken } from '@owlmeans/auth';
2
+ import type { SurrogateQuery } from './schemas.js';
3
+ /** Shared authentication protocols, bound independently by server and browser packages. */
4
+ export declare const authProtocols: {
5
+ authen: import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>;
6
+ init: import("@owlmeans/entrypoint").EntrypointProtocol<{
7
+ body: AllowanceRequest;
8
+ }, AllowanceResponse>;
9
+ authenticate: import("@owlmeans/entrypoint").EntrypointProtocol<{
10
+ body: AuthCredentials;
11
+ }, AuthToken>;
12
+ rely: import("@owlmeans/entrypoint").EntrypointProtocol<{
13
+ query: Partial<AuthToken>;
14
+ }, undefined>;
15
+ client: import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>;
16
+ login: import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>;
17
+ loginDefault: import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>;
18
+ loginTyped: import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>;
19
+ flowEnter: import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>;
20
+ dispatcher: import("@owlmeans/entrypoint").EntrypointProtocol<{
21
+ query: AuthToken;
22
+ }, undefined>;
23
+ surrogate: import("@owlmeans/entrypoint").EntrypointProtocol<{
24
+ query: SurrogateQuery;
25
+ }, undefined>;
26
+ dispatcherAuthenticate: import("@owlmeans/entrypoint").EntrypointProtocol<{
27
+ body: AuthToken;
28
+ }, AuthToken>;
29
+ };
30
+ /** Shared manager authentication protocols. */
31
+ export declare const managerProtocols: {
32
+ profile: {
33
+ base: import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>;
34
+ toEntityId: import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>;
35
+ };
36
+ auth: {
37
+ base: import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>;
38
+ delegate: import("@owlmeans/entrypoint").EntrypointProtocol<import("@owlmeans/entrypoint").OpenRequest, import("@owlmeans/entrypoint").OpenValue>;
39
+ };
40
+ };
41
+ //# sourceMappingURL=entrypoints.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entrypoints.d.ts","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAA;AAMrG,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAElD,2FAA2F;AAC3F,eAAO,MAAM,aAAa;IACxB,MAAM;IACN,IAAI;;;IAEJ,YAAY;;;IAEZ,IAAI;;;IAEJ,MAAM;IACN,KAAK;IACL,YAAY;IACZ,UAAU;IACV,SAAS;IACT,UAAU;;;IAYV,SAAS;;;IAOT,sBAAsB;;;CAEvB,CAAA;AAED,+CAA+C;AAC/C,eAAO,MAAM,gBAAgB;IAC3B,OAAO;QACL,IAAI;QACJ,UAAU;;IAKZ,IAAI;QACF,IAAI;QACJ,QAAQ;;CAKX,CAAA"}
@@ -0,0 +1,46 @@
1
+ import { AUTHEN, AUTHEN_AUTHEN, AUTHEN_INIT, AUTHEN_RELY, AllowanceRequestSchema, AuthCredentialsSchema, AuthTokenSchema, CAUTHEN, CAUTHEN_AUTHEN, CAUTHEN_AUTHEN_DEFAULT, CAUTHEN_AUTHEN_TYPED, DISPATCHER, DISPATCHER_AUTHEN, DISPATCHER_SURROGATE, OptionalAuthTokenSchema, CAUTHEN_FLOW_ENTER } from '@owlmeans/auth';
2
+ // import { AppType } from '@owlmeans/context'
3
+ import { contract, openProtocol, protocol, typed } from '@owlmeans/entrypoint';
4
+ import { route, RouteMethod, frontend, backend, socket } from '@owlmeans/route';
5
+ import { DISPATCHER_PATH, SURROGATE_PATH, WEB_API, authApi } from './consts.js';
6
+ import { SurrogateQuerySchema } from './schemas.js';
7
+ /** Shared authentication protocols, bound independently by server and browser packages. */
8
+ export const authProtocols = {
9
+ authen: openProtocol(route(AUTHEN, '/authentication', backend())),
10
+ init: protocol(route(AUTHEN_INIT, '/init', backend(AUTHEN, RouteMethod.POST)), contract.request({ body: typed(AllowanceRequestSchema) }, typed())),
11
+ authenticate: protocol(route(AUTHEN_AUTHEN, '/authenticate', backend(AUTHEN, RouteMethod.POST)), contract.request({ body: typed(AuthCredentialsSchema) }, typed())),
12
+ rely: protocol(route(AUTHEN_RELY, '/rely', socket(AUTHEN)), contract.request({ query: typed(OptionalAuthTokenSchema) }, typed())),
13
+ client: openProtocol(route(CAUTHEN, '/authentication', frontend())),
14
+ login: openProtocol(route(CAUTHEN_AUTHEN, '/login', frontend(CAUTHEN))),
15
+ loginDefault: openProtocol(route(CAUTHEN_AUTHEN_DEFAULT, '/', frontend(CAUTHEN_AUTHEN, true))),
16
+ loginTyped: openProtocol(route(CAUTHEN_AUTHEN_TYPED, '/:type', frontend(CAUTHEN_AUTHEN))),
17
+ flowEnter: openProtocol(route(CAUTHEN_FLOW_ENTER, '/', frontend())),
18
+ dispatcher: protocol(route(DISPATCHER, DISPATCHER_PATH, frontend({ service: DISPATCHER })), contract.request({ query: typed(AuthTokenSchema) }, typed()), { sticky: true }),
19
+ // The login window an embedded application opens one level up.
20
+ //
21
+ // Top level and with no parent, so it renders outside every application layout — a popup must
22
+ // never show the application, with its navigation, inside itself. Sticky for the same reason the
23
+ // dispatcher is: it must attach to the client router regardless of service selection. It carries
24
+ // no `service`, unlike the dispatcher, because nothing server-side ever addresses it — the
25
+ // provider's callback goes to the dispatcher. And no guard: it is where a signed-out user lands.
26
+ surrogate: protocol(route(DISPATCHER_SURROGATE, SURROGATE_PATH, frontend()), contract.request({ query: typed(SurrogateQuerySchema) }, typed()), { sticky: true }),
27
+ // This is a helper route that representes a API endpoint of service provider that wants to authenticate
28
+ // a user with OwlMeans server-auth library.
29
+ dispatcherAuthenticate: protocol(route(DISPATCHER_AUTHEN, '/authenticate', backend(null, RouteMethod.POST)), contract.request({ body: typed(AuthTokenSchema) }, typed())),
30
+ };
31
+ /** Shared manager authentication protocols. */
32
+ export const managerProtocols = {
33
+ profile: {
34
+ base: openProtocol(route(authApi.profile.base, '/profile', backend({ service: WEB_API }))),
35
+ toEntityId: openProtocol(route(authApi.profile.toEntityId, '/to-entity-id', backend(authApi.profile.base, RouteMethod.POST))),
36
+ },
37
+ auth: {
38
+ base: openProtocol(route(authApi.auth.base, '/auth', backend({ service: WEB_API }))),
39
+ delegate: openProtocol(route(authApi.auth.delegate, '/delegate', backend(authApi.auth.base, RouteMethod.POST))),
40
+ },
41
+ };
42
+ // const skipEntrypoints = [DISPATCHER]
43
+ // export const authBackendEntrypoints = entrypoints.filter(
44
+ // module => !skipEntrypoints.includes(module.alias) && module.route.route.type === AppType.Backend
45
+ // ).map(module => module.alias)
46
+ //# sourceMappingURL=entrypoints.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entrypoints.js","sourceRoot":"","sources":["../src/entrypoints.ts"],"names":[],"mappings":"AACA,OAAO,EACL,MAAM,EAAE,aAAa,EAAE,WAAW,EAAE,WAAW,EAAE,sBAAsB,EAAE,qBAAqB,EAC9F,eAAe,EAAE,OAAO,EAAE,cAAc,EAAE,sBAAsB,EAAE,oBAAoB,EAAE,UAAU,EAClG,iBAAiB,EAAE,oBAAoB,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AAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,CAAC,EACzG,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,KAAK,CAAY,eAAe,CAAC,EAAE,EAAE,KAAK,EAAa,CAAC,CAAC;CACrF,CAAA;AAED,+CAA+C;AAC/C,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,OAAO,EAAE;QACP,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;QAC1F,UAAU,EAAE,YAAY,CAAC,KAAK,CAC9B,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,eAAe,EAC3C,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,CAC9C,CAAC;KACH;IACD,IAAI,EAAE;QACJ,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;QACpF,QAAQ,EAAE,YAAY,CAAC,KAAK,CAC5B,OAAO,CAAC,IAAI,CAAC,QAAQ,EAAE,WAAW,EAClC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,IAAI,CAAC,CAC3C,CAAC;KACH;CACF,CAAA;AAED,uCAAuC;AACvC,4DAA4D;AAC5D,qGAAqG;AACrG,gCAAgC"}
@@ -89,7 +89,7 @@ export const makeBasicEd25519Guard = (resource, opts) => {
89
89
  token: authorization,
90
90
  userId: trusted.user.id,
91
91
  profileId: trusted.user.id,
92
- entityId: trusted.user.entityId,
92
+ entitySlug: trusted.user.entitySlug,
93
93
  scopes: trusted.user.name != null ? [trusted.user.name] : [],
94
94
  type: AuthroizationType.Ed25519BasicSignature,
95
95
  source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