@kya-os/mcp-i-runtime 1.2.1 → 1.2.4
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/.turbo/turbo-build.log +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/proof/generator.d.ts +7 -1
- package/dist/proof/generator.d.ts.map +1 -1
- package/dist/proof/generator.js +10 -1
- package/dist/proof/generator.js.map +1 -1
- package/dist/services/auth-type-satisfies.d.ts +41 -0
- package/dist/services/auth-type-satisfies.d.ts.map +1 -1
- package/dist/services/auth-type-satisfies.js +53 -0
- package/dist/services/auth-type-satisfies.js.map +1 -1
- package/dist/services/proof-verifier.d.ts +29 -12
- package/dist/services/proof-verifier.d.ts.map +1 -1
- package/dist/services/proof-verifier.js +50 -17
- package/dist/services/proof-verifier.js.map +1 -1
- package/dist/services/tool-context-builder.d.ts.map +1 -1
- package/dist/services/tool-context-builder.js +13 -0
- package/dist/services/tool-context-builder.js.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +2 -0
- package/src/proof/__tests__/proof-generator.test.ts +65 -0
- package/src/proof/generator.ts +12 -1
- package/src/services/__tests__/auth-type-satisfies.test.ts +62 -1
- package/src/services/__tests__/proof-verifier.test.ts +182 -0
- package/src/services/__tests__/tool-context-builder-authtype.test.ts +75 -0
- package/src/services/auth-type-satisfies.ts +55 -0
- package/src/services/proof-verifier.ts +52 -17
- package/src/services/tool-context-builder.ts +22 -1
|
@@ -21,7 +21,11 @@ import {
|
|
|
21
21
|
ConsentOnlyModeError,
|
|
22
22
|
CredentialAuthModeError,
|
|
23
23
|
} from "./provider-resolver.js";
|
|
24
|
-
import {
|
|
24
|
+
import {
|
|
25
|
+
authTypeSatisfies,
|
|
26
|
+
isUnsatisfiableAuthType,
|
|
27
|
+
MINTABLE_AUTH_TYPES,
|
|
28
|
+
} from "./auth-type-satisfies.js";
|
|
25
29
|
|
|
26
30
|
export interface ToolContextBuilderConfig {
|
|
27
31
|
/** IDP token resolver for resolving tokens from User DID */
|
|
@@ -187,6 +191,23 @@ export class ToolContextBuilder {
|
|
|
187
191
|
delegationAuthorizationType: delegationAuthorizationType ?? null,
|
|
188
192
|
}
|
|
189
193
|
);
|
|
194
|
+
|
|
195
|
+
// Distinguish "re-authenticate and this resolves" from "no mint can
|
|
196
|
+
// ever satisfy this, so the user is in an infinite loop". Without
|
|
197
|
+
// this, an unsatisfiable requirement is indistinguishable from a
|
|
198
|
+
// normal re-challenge in the logs and presents as an inexplicable
|
|
199
|
+
// auth loop. Diagnostic only — the decision above is unchanged.
|
|
200
|
+
if (isUnsatisfiableAuthType(requiredAuthType)) {
|
|
201
|
+
this.config.logger(
|
|
202
|
+
"[ToolContextBuilder] MISCONFIGURATION: tool requires an authorization type no delegation mint can produce - this tool will re-challenge forever",
|
|
203
|
+
{
|
|
204
|
+
toolName,
|
|
205
|
+
requiredAuthType,
|
|
206
|
+
mintableAuthTypes: [...MINTABLE_AUTH_TYPES],
|
|
207
|
+
hint: "Set the tool's authorization.type to one of the mintable types, or add mint support for the required type.",
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
190
211
|
}
|
|
191
212
|
|
|
192
213
|
// No (satisfying) delegation token - throw OAuthRequiredError to trigger auth flow
|