@gjermundgaraba/clankerauth-sdk 0.28.0 → 0.29.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/README.md +1 -1
- package/dist/request-policy.js +2 -2
- package/dist/resource.js +1 -1
- package/dist/testing.d.ts +12 -9
- package/dist/testing.js +6 -2
- package/dist/verify.d.ts +1 -1
- package/dist/verify.js +1 -1
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -17,7 +17,7 @@ vp add effect
|
|
|
17
17
|
The `/session` and `/effect-actions` entry points also need effect-actions, an optional peer. Install this range: the SDK's declarations are built against it, and under `skipLibCheck` they silently degrade to `any` with another.
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
vp add @gjermundgaraba/effect-actions@^0.
|
|
20
|
+
vp add @gjermundgaraba/effect-actions@^0.20.0
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
## Entry points
|
package/dist/request-policy.js
CHANGED
|
@@ -47,8 +47,8 @@ export const make = (options) => {
|
|
|
47
47
|
const request = yield* HttpServerRequest.HttpServerRequest;
|
|
48
48
|
const permitted = allows({
|
|
49
49
|
target: request.originalUrl,
|
|
50
|
-
host: request.headers
|
|
51
|
-
origin: request.headers
|
|
50
|
+
host: request.headers["host"],
|
|
51
|
+
origin: request.headers["origin"],
|
|
52
52
|
});
|
|
53
53
|
return permitted ? yield* httpEffect : forbidden;
|
|
54
54
|
})),
|
package/dist/resource.js
CHANGED
|
@@ -152,7 +152,7 @@ export const make = (authentication, declaration) => {
|
|
|
152
152
|
const noteHost = Effect.gen(function* () {
|
|
153
153
|
if (yield* Ref.get(warned))
|
|
154
154
|
return;
|
|
155
|
-
const reached = (yield* HttpServerRequest.HttpServerRequest).headers
|
|
155
|
+
const reached = (yield* HttpServerRequest.HttpServerRequest).headers["host"];
|
|
156
156
|
if (reached === undefined || reached === host)
|
|
157
157
|
return;
|
|
158
158
|
yield* Ref.set(warned, true);
|
package/dist/testing.d.ts
CHANGED
|
@@ -1,18 +1,21 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* Claims set on a signed token. Each one overrides this issuer's default; one set to `undefined`
|
|
3
|
+
* is left out.
|
|
4
|
+
*/
|
|
2
5
|
export interface TokenClaims {
|
|
3
|
-
readonly iss?: string;
|
|
4
|
-
readonly sub?: string;
|
|
5
|
-
readonly aud?: string | Array<string
|
|
6
|
-
readonly iat?: number;
|
|
6
|
+
readonly iss?: string | undefined;
|
|
7
|
+
readonly sub?: string | undefined;
|
|
8
|
+
readonly aud?: string | Array<string> | undefined;
|
|
9
|
+
readonly iat?: number | undefined;
|
|
7
10
|
/** Epoch seconds. Default: five minutes from now. */
|
|
8
|
-
readonly exp?: number;
|
|
11
|
+
readonly exp?: number | undefined;
|
|
9
12
|
/** Space-separated, as the wire carries it. */
|
|
10
|
-
readonly scope?: string;
|
|
11
|
-
readonly client_id?: string;
|
|
13
|
+
readonly scope?: string | undefined;
|
|
14
|
+
readonly client_id?: string | undefined;
|
|
12
15
|
/** Proof of possession, for checking that a sender-constrained token is refused. */
|
|
13
16
|
readonly cnf?: {
|
|
14
17
|
readonly jkt: string;
|
|
15
|
-
};
|
|
18
|
+
} | undefined;
|
|
16
19
|
}
|
|
17
20
|
export interface FakeIssuerOptions {
|
|
18
21
|
/** The resource identifier tokens are minted for: an application's public origin root. */
|
package/dist/testing.js
CHANGED
|
@@ -69,7 +69,8 @@ export const startFakeIssuer = async (options) => {
|
|
|
69
69
|
issuer,
|
|
70
70
|
sign: (claims = {}, typ = "at+jwt") => {
|
|
71
71
|
const now = Math.floor(Date.now() / 1000);
|
|
72
|
-
|
|
72
|
+
const payload = {};
|
|
73
|
+
for (const [name, value] of Object.entries({
|
|
73
74
|
iss: issuer,
|
|
74
75
|
sub: subject,
|
|
75
76
|
aud: options.resource,
|
|
@@ -78,7 +79,10 @@ export const startFakeIssuer = async (options) => {
|
|
|
78
79
|
client_id: "fixture",
|
|
79
80
|
scope: options.scopes.join(" "),
|
|
80
81
|
...claims,
|
|
81
|
-
})
|
|
82
|
+
}))
|
|
83
|
+
if (value !== undefined)
|
|
84
|
+
payload[name] = value;
|
|
85
|
+
return new SignJWT(payload)
|
|
82
86
|
.setProtectedHeader({ alg: "EdDSA", kid: "fixture", typ })
|
|
83
87
|
.sign(pair.privateKey);
|
|
84
88
|
},
|
package/dist/verify.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface Options {
|
|
|
33
33
|
readonly store: Store;
|
|
34
34
|
readonly requiredScopes?: readonly string[];
|
|
35
35
|
/** `false` refuses API keys without reading the issuer's key list; only OAuth access tokens are accepted. */
|
|
36
|
-
readonly apiKeys?: boolean;
|
|
36
|
+
readonly apiKeys?: boolean | undefined;
|
|
37
37
|
}
|
|
38
38
|
export interface Verifier {
|
|
39
39
|
readonly verifyToken: (token: string) => Effect.Effect<Principal, AuthenticationError>;
|
package/dist/verify.js
CHANGED
|
@@ -135,7 +135,7 @@ export const make = Effect.fn("Verifier.make")(function* (options) {
|
|
|
135
135
|
});
|
|
136
136
|
const verifyJwt = Effect.fn("Verifier.jwt")(function* (token) {
|
|
137
137
|
const payload = yield* verifySigned(token, "at+jwt");
|
|
138
|
-
if (payload
|
|
138
|
+
if (payload["cnf"] !== undefined)
|
|
139
139
|
return yield* unauthorized();
|
|
140
140
|
const claims = yield* Schema.decodeUnknownEffect(Claims)(payload).pipe(Effect.mapError(unauthorized));
|
|
141
141
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gjermundgaraba/clankerauth-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "Effect-native clankerauth access-token and offline API-key verification, with optional effect-actions integration",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -52,19 +52,19 @@
|
|
|
52
52
|
"proper-lockfile": "4.1.2"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@effect/vitest": "4.0.
|
|
56
|
-
"@gjermundgaraba/effect-actions": "0.
|
|
55
|
+
"@effect/vitest": "4.0.6",
|
|
56
|
+
"@gjermundgaraba/effect-actions": "0.20.0",
|
|
57
57
|
"@modelcontextprotocol/client": "2.3.1",
|
|
58
58
|
"@types/node": "26.6.5",
|
|
59
59
|
"@types/proper-lockfile": "4.1.4",
|
|
60
|
-
"effect": "4.0.
|
|
60
|
+
"effect": "4.0.6",
|
|
61
61
|
"typescript": "7.0.2",
|
|
62
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@1.
|
|
63
|
-
"vite-plus": "1.
|
|
62
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.4.0",
|
|
63
|
+
"vite-plus": "1.4.0",
|
|
64
64
|
"vitest": "5.0.5"
|
|
65
65
|
},
|
|
66
66
|
"peerDependencies": {
|
|
67
|
-
"@gjermundgaraba/effect-actions": "^0.
|
|
67
|
+
"@gjermundgaraba/effect-actions": "^0.20.0",
|
|
68
68
|
"effect": "~4.0.4"
|
|
69
69
|
},
|
|
70
70
|
"peerDependenciesMeta": {
|