@owlmeans/server-auth-token 0.1.18-rc.4 → 0.1.18-rc.5
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/README.md +1 -1
- package/agent-meta/manifest.json +2 -2
- package/agent-meta/skills/server-auth-token/SKILL.md +1 -1
- package/build/coguard.d.ts +2 -2
- package/build/coguard.d.ts.map +1 -1
- package/build/coguard.js +2 -2
- package/build/coguard.js.map +1 -1
- package/package.json +11 -11
- package/src/coguard.ts +5 -5
- package/tests/coguard.spec.ts +6 -6
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ This package ships embedded agent skills under `agent-meta/`. After installing y
|
|
|
6
6
|
your project's skill store (`.agents/skills/`):
|
|
7
7
|
|
|
8
8
|
```sh
|
|
9
|
-
npx @owlmeans/agent-skills@^0.1.18-rc.
|
|
9
|
+
npx @owlmeans/agent-skills@^0.1.18-rc.17
|
|
10
10
|
```
|
|
11
11
|
|
|
12
12
|
The embedded files are version-matched to this package release. Do not edit them
|
package/agent-meta/manifest.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schemaVersion": 2,
|
|
3
3
|
"package": "@owlmeans/server-auth-token",
|
|
4
|
-
"version": "0.1.18-rc.
|
|
5
|
-
"generatedAt": "2026-09-12T12:
|
|
4
|
+
"version": "0.1.18-rc.5",
|
|
5
|
+
"generatedAt": "2026-09-12T12:59:24.922Z",
|
|
6
6
|
"canonicalRepo": "https://github.com/owlmeans/common",
|
|
7
7
|
"entries": [
|
|
8
8
|
{
|
|
@@ -8,7 +8,7 @@ user-invocable: false
|
|
|
8
8
|
# @owlmeans/server-auth-token
|
|
9
9
|
|
|
10
10
|
**Layer:** Server
|
|
11
|
-
**Install:** `"@owlmeans/server-auth-token": "^0.1.18-rc.
|
|
11
|
+
**Install:** `"@owlmeans/server-auth-token": "^0.1.18-rc.5"` in `dependencies`
|
|
12
12
|
**Contracts:** `@owlmeans/auth-token` — the record, the routes, the format helpers
|
|
13
13
|
|
|
14
14
|
## Key Exports
|
package/build/coguard.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { EntrypointTree } from '@owlmeans/entrypoint';
|
|
2
2
|
/**
|
|
3
3
|
* Let an access token authenticate every route that already has a guard.
|
|
4
4
|
*
|
|
@@ -11,5 +11,5 @@ import type { EntrypointProtocolDeclaration } from '@owlmeans/entrypoint';
|
|
|
11
11
|
* than skipped here — a child entrypoint inherits every guard its ancestors declare and cannot
|
|
12
12
|
* drop one, so the refusal has to live where the credential is inspected.
|
|
13
13
|
*/
|
|
14
|
-
export declare const withAuthTokenCoguard: <
|
|
14
|
+
export declare const withAuthTokenCoguard: <Tree extends EntrypointTree>(tree: Tree, guard?: string) => Tree;
|
|
15
15
|
//# sourceMappingURL=coguard.d.ts.map
|
package/build/coguard.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coguard.d.ts","sourceRoot":"","sources":["../src/coguard.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"coguard.d.ts","sourceRoot":"","sources":["../src/coguard.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AAE1D;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,oBAAoB,GAAI,IAAI,SAAS,cAAc,QACxD,IAAI,UAAS,MAAM,KACxB,IAID,CAAA"}
|
package/build/coguard.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { GUARD_AUTH_TOKEN } from '@owlmeans/auth-token';
|
|
2
|
-
import { decorateEntrypoint } from '@owlmeans/entrypoint';
|
|
2
|
+
import { decorateEntrypoint, mapProtocols } from '@owlmeans/entrypoint';
|
|
3
3
|
/**
|
|
4
4
|
* Let an access token authenticate every route that already has a guard.
|
|
5
5
|
*
|
|
@@ -12,7 +12,7 @@ import { decorateEntrypoint } from '@owlmeans/entrypoint';
|
|
|
12
12
|
* than skipped here — a child entrypoint inherits every guard its ancestors declare and cannot
|
|
13
13
|
* drop one, so the refusal has to live where the credential is inspected.
|
|
14
14
|
*/
|
|
15
|
-
export const withAuthTokenCoguard = (
|
|
15
|
+
export const withAuthTokenCoguard = (tree, guard = GUARD_AUTH_TOKEN) => mapProtocols(tree, declaration => {
|
|
16
16
|
if (declaration.guards.length < 1 || declaration.guards.includes(guard))
|
|
17
17
|
return declaration;
|
|
18
18
|
return decorateEntrypoint(declaration, { guards: [...declaration.guards, guard] });
|
package/build/coguard.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coguard.js","sourceRoot":"","sources":["../src/coguard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"coguard.js","sourceRoot":"","sources":["../src/coguard.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AACvD,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAA;AAGvE;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAClC,IAAU,EAAE,KAAK,GAAW,gBAAgB,EACtC,EAAE,CAAC,YAAY,CAAC,IAAI,EAAE,WAAW,CAAC,EAAE;IAC1C,IAAI,WAAW,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,IAAI,WAAW,CAAC,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,WAAW,CAAA;IAE3F,OAAO,kBAAkB,CAAC,WAAW,EAAE,EAAE,MAAM,EAAE,CAAC,GAAG,WAAW,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,CAAA;AACpF,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@owlmeans/server-auth-token",
|
|
3
|
-
"version": "0.1.18-rc.
|
|
3
|
+
"version": "0.1.18-rc.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"description": "The server half of OwlMeans access tokens — the store, the guard that verifies a presented token, the management handlers and the coguard that admits one on an existing route.",
|
|
6
6
|
"type": "module",
|
|
@@ -24,16 +24,16 @@
|
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
26
|
"@noble/hashes": "^1.5.0",
|
|
27
|
-
"@owlmeans/auth": "^0.1.18-rc.
|
|
28
|
-
"@owlmeans/auth-common": "^0.1.18-rc.
|
|
29
|
-
"@owlmeans/auth-token": "^0.1.18-rc.
|
|
30
|
-
"@owlmeans/context": "^0.1.18-rc.
|
|
31
|
-
"@owlmeans/entrypoint": "^0.1.18-rc.
|
|
32
|
-
"@owlmeans/mongo-resource": "^0.1.18-rc.
|
|
33
|
-
"@owlmeans/resource": "^0.1.18-rc.
|
|
34
|
-
"@owlmeans/server-api": "^0.1.18-rc.
|
|
35
|
-
"@owlmeans/server-auth-identity": "^0.1.18-rc.
|
|
36
|
-
"@owlmeans/server-context": "^0.1.18-rc.
|
|
27
|
+
"@owlmeans/auth": "^0.1.18-rc.14",
|
|
28
|
+
"@owlmeans/auth-common": "^0.1.18-rc.18",
|
|
29
|
+
"@owlmeans/auth-token": "^0.1.18-rc.5",
|
|
30
|
+
"@owlmeans/context": "^0.1.18-rc.13",
|
|
31
|
+
"@owlmeans/entrypoint": "^0.1.18-rc.16",
|
|
32
|
+
"@owlmeans/mongo-resource": "^0.1.18-rc.17",
|
|
33
|
+
"@owlmeans/resource": "^0.1.18-rc.14",
|
|
34
|
+
"@owlmeans/server-api": "^0.1.18-rc.22",
|
|
35
|
+
"@owlmeans/server-auth-identity": "^0.1.18-rc.18",
|
|
36
|
+
"@owlmeans/server-context": "^0.1.18-rc.17",
|
|
37
37
|
"@scure/base": "^1.1.9"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
package/src/coguard.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GUARD_AUTH_TOKEN } from '@owlmeans/auth-token'
|
|
2
|
-
import { decorateEntrypoint } from '@owlmeans/entrypoint'
|
|
3
|
-
import type {
|
|
2
|
+
import { decorateEntrypoint, mapProtocols } from '@owlmeans/entrypoint'
|
|
3
|
+
import type { EntrypointTree } from '@owlmeans/entrypoint'
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Let an access token authenticate every route that already has a guard.
|
|
@@ -14,9 +14,9 @@ import type { EntrypointProtocolDeclaration } from '@owlmeans/entrypoint'
|
|
|
14
14
|
* than skipped here — a child entrypoint inherits every guard its ancestors declare and cannot
|
|
15
15
|
* drop one, so the refusal has to live where the credential is inspected.
|
|
16
16
|
*/
|
|
17
|
-
export const withAuthTokenCoguard = <
|
|
18
|
-
|
|
19
|
-
):
|
|
17
|
+
export const withAuthTokenCoguard = <Tree extends EntrypointTree>(
|
|
18
|
+
tree: Tree, guard: string = GUARD_AUTH_TOKEN,
|
|
19
|
+
): Tree => mapProtocols(tree, declaration => {
|
|
20
20
|
if (declaration.guards.length < 1 || declaration.guards.includes(guard)) return declaration
|
|
21
21
|
|
|
22
22
|
return decorateEntrypoint(declaration, { guards: [...declaration.guards, guard] })
|
package/tests/coguard.spec.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { describe, expect, test } from 'bun:test'
|
|
2
2
|
import { GUARD_AUTH_TOKEN } from '@owlmeans/auth-token'
|
|
3
|
-
import { openProtocol } from '@owlmeans/entrypoint'
|
|
3
|
+
import { openProtocol, protocols } from '@owlmeans/entrypoint'
|
|
4
4
|
import { route } from '@owlmeans/route'
|
|
5
5
|
import { withAuthTokenCoguard } from '../src/coguard.js'
|
|
6
6
|
|
|
7
7
|
describe('@owlmeans/server-auth-token — the coguard', () => {
|
|
8
8
|
test('decorates a guarded protocol and leaves the primary guard first', () => {
|
|
9
9
|
const guarded = openProtocol(route('guarded', '/guarded'), { guards: 'auth' })
|
|
10
|
-
const [decorated] = withAuthTokenCoguard(
|
|
10
|
+
const [decorated] = protocols(withAuthTokenCoguard({ guarded }))
|
|
11
11
|
|
|
12
12
|
expect(decorated.guards).toEqual(['auth', GUARD_AUTH_TOKEN])
|
|
13
13
|
expect(guarded.guards).toEqual(['auth'])
|
|
@@ -15,20 +15,20 @@ describe('@owlmeans/server-auth-token — the coguard', () => {
|
|
|
15
15
|
|
|
16
16
|
test('leaves an unguarded protocol unchanged', () => {
|
|
17
17
|
const open = openProtocol(route('open', '/open'))
|
|
18
|
-
expect(withAuthTokenCoguard(
|
|
18
|
+
expect(protocols(withAuthTokenCoguard({ open }))[0]).toBe(open)
|
|
19
19
|
})
|
|
20
20
|
|
|
21
21
|
test('is idempotent', () => {
|
|
22
22
|
const guarded = openProtocol(route('guarded', '/guarded'), { guards: 'auth' })
|
|
23
|
-
const [once] = withAuthTokenCoguard(
|
|
24
|
-
const [twice] = withAuthTokenCoguard(
|
|
23
|
+
const [once] = protocols(withAuthTokenCoguard({ guarded }))
|
|
24
|
+
const [twice] = protocols(withAuthTokenCoguard({ once }))
|
|
25
25
|
|
|
26
26
|
expect(twice.guards).toEqual(['auth', GUARD_AUTH_TOKEN])
|
|
27
27
|
})
|
|
28
28
|
|
|
29
29
|
test('honours a custom guard alias', () => {
|
|
30
30
|
const guarded = openProtocol(route('guarded', '/guarded'), { guards: 'auth' })
|
|
31
|
-
expect(withAuthTokenCoguard(
|
|
31
|
+
expect(protocols(withAuthTokenCoguard({ guarded }, 'other-guard'))[0].guards)
|
|
32
32
|
.toEqual(['auth', 'other-guard'])
|
|
33
33
|
})
|
|
34
34
|
})
|