@kya-os/checkpoint-shared 1.4.0 → 1.5.1
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/CHANGELOG.md +41 -0
- package/dist/beacon-types/index.d.mts +448 -432
- package/dist/beacon-types/index.d.mts.map +1 -0
- package/dist/beacon-types/index.d.ts +448 -432
- package/dist/beacon-types/index.d.ts.map +1 -0
- package/dist/beacon-types/index.js +286 -182
- package/dist/beacon-types/index.mjs +284 -180
- package/dist/beacon-types/index.mjs.map +1 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.mts +5 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.mts.map +1 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.ts +5 -0
- package/dist/browser-posture-cookie-Dmq9Brf_.d.ts.map +1 -0
- package/dist/browser-posture-cookie.d.mts +2 -0
- package/dist/browser-posture-cookie.d.ts +2 -0
- package/dist/browser-posture-cookie.js +1 -0
- package/dist/browser-posture-cookie.mjs +2 -0
- package/dist/browser-posture-cookie.mjs.map +1 -0
- package/dist/browser-posture-report.d.mts +48 -44
- package/dist/browser-posture-report.d.mts.map +1 -0
- package/dist/browser-posture-report.d.ts +48 -44
- package/dist/browser-posture-report.d.ts.map +1 -0
- package/dist/browser-posture-report.js +1 -1
- package/dist/browser-posture-report.mjs +2 -1
- package/dist/browser-posture-report.mjs.map +1 -0
- package/dist/browser-posture.d.mts +82 -75
- package/dist/browser-posture.d.mts.map +1 -0
- package/dist/browser-posture.d.ts +82 -75
- package/dist/browser-posture.d.ts.map +1 -0
- package/dist/browser-posture.js +167 -18993
- package/dist/browser-posture.mjs +166 -18990
- package/dist/browser-posture.mjs.map +1 -0
- package/dist/browser.d.mts +323 -316
- package/dist/browser.d.mts.map +1 -0
- package/dist/browser.d.ts +323 -316
- package/dist/browser.d.ts.map +1 -0
- package/dist/browser.js +1 -1
- package/dist/browser.mjs +2 -1
- package/dist/browser.mjs.map +1 -0
- package/dist/canonical-signer/index.d.mts +38 -33
- package/dist/canonical-signer/index.d.mts.map +1 -0
- package/dist/canonical-signer/index.d.ts +38 -33
- package/dist/canonical-signer/index.d.ts.map +1 -0
- package/dist/canonical-signer/index.js +411 -181
- package/dist/canonical-signer/index.mjs +383 -175
- package/dist/canonical-signer/index.mjs.map +1 -0
- package/dist/clearance.d.mts +30 -0
- package/dist/clearance.d.mts.map +1 -0
- package/dist/clearance.d.ts +30 -0
- package/dist/clearance.d.ts.map +1 -0
- package/dist/clearance.js +120 -0
- package/dist/clearance.mjs +112 -0
- package/dist/clearance.mjs.map +1 -0
- package/dist/client-ip-1y2iXAYW.js +237 -0
- package/dist/client-ip-HOfe6ucV.mjs +215 -0
- package/dist/client-ip-HOfe6ucV.mjs.map +1 -0
- package/dist/deploy/index.d.mts +339 -339
- package/dist/deploy/index.d.mts.map +1 -0
- package/dist/deploy/index.d.ts +339 -339
- package/dist/deploy/index.d.ts.map +1 -0
- package/dist/deploy/index.js +505 -413
- package/dist/deploy/index.mjs +504 -410
- package/dist/deploy/index.mjs.map +1 -0
- package/dist/errors/index.d.mts +101 -101
- package/dist/errors/index.d.mts.map +1 -0
- package/dist/errors/index.d.ts +101 -101
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +341 -314
- package/dist/errors/index.mjs +340 -311
- package/dist/errors/index.mjs.map +1 -0
- package/dist/external-jr_S4iSS.d.mts +4187 -0
- package/dist/external-jr_S4iSS.d.mts.map +1 -0
- package/dist/external-jr_S4iSS.d.ts +4187 -0
- package/dist/external-jr_S4iSS.d.ts.map +1 -0
- package/dist/gateway/index.d.mts +138 -132
- package/dist/gateway/index.d.mts.map +1 -0
- package/dist/gateway/index.d.ts +138 -132
- package/dist/gateway/index.d.ts.map +1 -0
- package/dist/gateway/index.js +117 -81
- package/dist/gateway/index.mjs +116 -78
- package/dist/gateway/index.mjs.map +1 -0
- package/dist/gateway-client-ip.d.mts +59 -0
- package/dist/gateway-client-ip.d.mts.map +1 -0
- package/dist/gateway-client-ip.d.ts +59 -0
- package/dist/gateway-client-ip.d.ts.map +1 -0
- package/dist/gateway-client-ip.js +149 -0
- package/dist/gateway-client-ip.mjs +139 -0
- package/dist/gateway-client-ip.mjs.map +1 -0
- package/dist/index.d.mts +14901 -14246
- package/dist/index.d.mts.map +1 -0
- package/dist/index.d.ts +14901 -14246
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15180 -31025
- package/dist/index.mjs +15065 -30942
- package/dist/index.mjs.map +1 -0
- package/dist/mcpi/agentshield-api/index.d.mts +45 -44
- package/dist/mcpi/agentshield-api/index.d.mts.map +1 -0
- package/dist/mcpi/agentshield-api/index.d.ts +45 -44
- package/dist/mcpi/agentshield-api/index.d.ts.map +1 -0
- package/dist/mcpi/agentshield-api/index.js +0 -2
- package/dist/mcpi/agentshield-api/index.mjs +1 -1
- package/dist/mcpi/approval-grant/index.d.mts +63 -61
- package/dist/mcpi/approval-grant/index.d.mts.map +1 -0
- package/dist/mcpi/approval-grant/index.d.ts +63 -61
- package/dist/mcpi/approval-grant/index.d.ts.map +1 -0
- package/dist/mcpi/approval-grant/index.js +220 -140
- package/dist/mcpi/approval-grant/index.mjs +219 -137
- package/dist/mcpi/approval-grant/index.mjs.map +1 -0
- package/dist/mcpi/dashboard-config/index.d.mts +2323 -2318
- package/dist/mcpi/dashboard-config/index.d.mts.map +1 -0
- package/dist/mcpi/dashboard-config/index.d.ts +2323 -2318
- package/dist/mcpi/dashboard-config/index.d.ts.map +1 -0
- package/dist/mcpi/dashboard-config/index.js +605 -458
- package/dist/mcpi/dashboard-config/index.mjs +604 -455
- package/dist/mcpi/dashboard-config/index.mjs.map +1 -0
- package/dist/mcpi/multibase-ed25519.d.mts +10 -8
- package/dist/mcpi/multibase-ed25519.d.mts.map +1 -0
- package/dist/mcpi/multibase-ed25519.d.ts +10 -8
- package/dist/mcpi/multibase-ed25519.d.ts.map +1 -0
- package/dist/mcpi/multibase-ed25519.js +182 -106
- package/dist/mcpi/multibase-ed25519.mjs +181 -103
- package/dist/mcpi/multibase-ed25519.mjs.map +1 -0
- package/dist/patterns-CkRVOdtV.js +243 -0
- package/dist/patterns-DzkGy_qk.mjs +173 -0
- package/dist/patterns-DzkGy_qk.mjs.map +1 -0
- package/dist/project-verification-key-C3L5rd8a.js +41 -0
- package/dist/project-verification-key-CgSVX9_m.mjs +37 -0
- package/dist/project-verification-key-CgSVX9_m.mjs.map +1 -0
- package/dist/rolldown-runtime-iY2fYEqi.mjs +19 -0
- package/dist/schemas-BmjNLAE7.js +5677 -0
- package/dist/schemas-DxY-dk9y.mjs +5511 -0
- package/dist/schemas-DxY-dk9y.mjs.map +1 -0
- package/dist/signals/index.d.mts +125 -115
- package/dist/signals/index.d.mts.map +1 -0
- package/dist/signals/index.d.ts +125 -115
- package/dist/signals/index.d.ts.map +1 -0
- package/dist/signals/index.js +1693 -1536
- package/dist/signals/index.mjs +1692 -1533
- package/dist/signals/index.mjs.map +1 -0
- package/dist/test-fixtures/index.d.mts +124 -119
- package/dist/test-fixtures/index.d.mts.map +1 -0
- package/dist/test-fixtures/index.d.ts +124 -119
- package/dist/test-fixtures/index.d.ts.map +1 -0
- package/dist/test-fixtures/index.js +460 -228
- package/dist/test-fixtures/index.mjs +459 -225
- package/dist/test-fixtures/index.mjs.map +1 -0
- package/dist/tool-protection/index.d.mts +343 -343
- package/dist/tool-protection/index.d.mts.map +1 -0
- package/dist/tool-protection/index.d.ts +343 -343
- package/dist/tool-protection/index.d.ts.map +1 -0
- package/dist/tool-protection/index.js +366 -285
- package/dist/tool-protection/index.mjs +365 -282
- package/dist/tool-protection/index.mjs.map +1 -0
- package/fixtures/bot-signal-resolution.json +142 -0
- package/fixtures/browser-posture-claims.json +421 -0
- package/fixtures/browser-posture-headers.json +46 -0
- package/fixtures/detection/reason-codes.json +10 -1
- package/fixtures/kya-http/challenge.delegation.fetcher-200.json +9 -3
- package/fixtures/kya-http/challenge.delegation.full.json +9 -3
- package/fixtures/kya-http/challenge.delegation.minimal.json +9 -3
- package/fixtures/kya-http/error-codes.json +7 -2
- package/package.json +20 -6
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/mcpi/agentshield-api/index.d.ts
|
|
2
|
+
export interface ToolCallContext {
|
|
3
|
+
tool: string;
|
|
4
|
+
args: Record<string, unknown>;
|
|
5
|
+
result?: unknown;
|
|
6
|
+
scopeId: string;
|
|
7
|
+
userIdentifier?: string;
|
|
7
8
|
}
|
|
8
|
-
interface ConsentEventContext {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
export interface ConsentEventContext {
|
|
10
|
+
eventType: 'consent:page_viewed' | 'consent:approved' | 'consent:delegation_created' | 'consent:credential_required' | 'auth:credential_success' | 'auth:credential_failed' | 'auth:oauth_success' | 'auth:oauth_failed';
|
|
11
|
+
timestamp: number;
|
|
12
|
+
sessionId: string;
|
|
13
|
+
userDid?: string;
|
|
14
|
+
agentDid: string;
|
|
15
|
+
targetTools: string[];
|
|
16
|
+
scopes: string[];
|
|
17
|
+
delegationId?: string;
|
|
18
|
+
projectId: string;
|
|
19
|
+
termsAccepted?: boolean;
|
|
20
|
+
credentialStatus?: 'present' | 'required' | 'obtained';
|
|
21
|
+
oauthIdentity?: {
|
|
22
|
+
provider: string;
|
|
23
|
+
identifier: string;
|
|
24
|
+
};
|
|
24
25
|
}
|
|
25
|
-
type BouncerOutcome = 'success' | 'failed' | 'blocked' | 'error';
|
|
26
|
-
interface DelegationCredential {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
export type BouncerOutcome = 'success' | 'failed' | 'blocked' | 'error';
|
|
27
|
+
export interface DelegationCredential {
|
|
28
|
+
agent_did: string;
|
|
29
|
+
user_did: string;
|
|
30
|
+
user_id?: string;
|
|
31
|
+
user_identifier?: string;
|
|
32
|
+
scopes: string[];
|
|
33
|
+
constraints?: Record<string, unknown>;
|
|
34
|
+
issued_at: number;
|
|
35
|
+
created_at: number;
|
|
36
|
+
credential_jwt?: string;
|
|
37
|
+
authorization: {
|
|
38
|
+
type: 'oauth' | 'oauth2' | 'password' | 'credential' | 'webauthn' | 'siwe' | 'none';
|
|
39
|
+
provider?: string;
|
|
40
|
+
credentialType?: string;
|
|
41
|
+
rpId?: string;
|
|
42
|
+
userVerification?: 'required' | 'preferred' | 'discouraged';
|
|
43
|
+
chainId?: number;
|
|
44
|
+
domain?: string;
|
|
45
|
+
};
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
//#endregion
|
|
48
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/mcpi/agentshield-api/index.ts"],"mappings":";iBAyBiB;EACf;EACA,MAAM;EACN;EACA;EACA;;iBAUe;EACf;EASA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;IACE;IACA;;;YAOQ;iBAQK;EACf;EACA;EACA;EACA;EACA;EACA,cAAc;EACd;EACA;EACA;EACA;IAGE;IACA;IACA;IAEA;IACA;IAEA;IACA"}
|
|
@@ -1,47 +1,48 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/mcpi/agentshield-api/index.d.ts
|
|
2
|
+
export interface ToolCallContext {
|
|
3
|
+
tool: string;
|
|
4
|
+
args: Record<string, unknown>;
|
|
5
|
+
result?: unknown;
|
|
6
|
+
scopeId: string;
|
|
7
|
+
userIdentifier?: string;
|
|
7
8
|
}
|
|
8
|
-
interface ConsentEventContext {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
9
|
+
export interface ConsentEventContext {
|
|
10
|
+
eventType: 'consent:page_viewed' | 'consent:approved' | 'consent:delegation_created' | 'consent:credential_required' | 'auth:credential_success' | 'auth:credential_failed' | 'auth:oauth_success' | 'auth:oauth_failed';
|
|
11
|
+
timestamp: number;
|
|
12
|
+
sessionId: string;
|
|
13
|
+
userDid?: string;
|
|
14
|
+
agentDid: string;
|
|
15
|
+
targetTools: string[];
|
|
16
|
+
scopes: string[];
|
|
17
|
+
delegationId?: string;
|
|
18
|
+
projectId: string;
|
|
19
|
+
termsAccepted?: boolean;
|
|
20
|
+
credentialStatus?: 'present' | 'required' | 'obtained';
|
|
21
|
+
oauthIdentity?: {
|
|
22
|
+
provider: string;
|
|
23
|
+
identifier: string;
|
|
24
|
+
};
|
|
24
25
|
}
|
|
25
|
-
type BouncerOutcome = 'success' | 'failed' | 'blocked' | 'error';
|
|
26
|
-
interface DelegationCredential {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
26
|
+
export type BouncerOutcome = 'success' | 'failed' | 'blocked' | 'error';
|
|
27
|
+
export interface DelegationCredential {
|
|
28
|
+
agent_did: string;
|
|
29
|
+
user_did: string;
|
|
30
|
+
user_id?: string;
|
|
31
|
+
user_identifier?: string;
|
|
32
|
+
scopes: string[];
|
|
33
|
+
constraints?: Record<string, unknown>;
|
|
34
|
+
issued_at: number;
|
|
35
|
+
created_at: number;
|
|
36
|
+
credential_jwt?: string;
|
|
37
|
+
authorization: {
|
|
38
|
+
type: 'oauth' | 'oauth2' | 'password' | 'credential' | 'webauthn' | 'siwe' | 'none';
|
|
39
|
+
provider?: string;
|
|
40
|
+
credentialType?: string;
|
|
41
|
+
rpId?: string;
|
|
42
|
+
userVerification?: 'required' | 'preferred' | 'discouraged';
|
|
43
|
+
chainId?: number;
|
|
44
|
+
domain?: string;
|
|
45
|
+
};
|
|
45
46
|
}
|
|
46
|
-
|
|
47
|
-
|
|
47
|
+
//#endregion
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/mcpi/agentshield-api/index.ts"],"mappings":";iBAyBiB;EACf;EACA,MAAM;EACN;EACA;EACA;;iBAUe;EACf;EASA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;IACE;IACA;;;YAOQ;iBAQK;EACf;EACA;EACA;EACA;EACA;EACA,cAAc;EACd;EACA;EACA;EACA;IAGE;IACA;IACA;IAEA;IACA;IAEA;IACA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export { };
|
|
@@ -1,79 +1,81 @@
|
|
|
1
|
-
import { JWK } from
|
|
2
|
-
|
|
1
|
+
import { JWK } from "jose";
|
|
2
|
+
//#region src/mcpi/approval-grant/nonce.d.ts
|
|
3
3
|
interface ApprovalNonceStore {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
issue(requestHash: string, ttlSec?: number): string;
|
|
5
|
+
current(requestHash: string): string | null;
|
|
6
|
+
tryConsume(requestHash: string): boolean;
|
|
7
7
|
}
|
|
8
|
-
declare class InMemoryApprovalNonceStore implements ApprovalNonceStore {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export declare class InMemoryApprovalNonceStore implements ApprovalNonceStore {
|
|
9
|
+
private readonly issued;
|
|
10
|
+
issue(requestHash: string, ttlSec?: number): string;
|
|
11
|
+
current(requestHash: string): string | null;
|
|
12
|
+
tryConsume(requestHash: string): boolean;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
declare const
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/mcpi/approval-grant/grant.d.ts
|
|
16
|
+
export declare const APPROVAL_GRANT_TYP = "approval-grant+jwt";
|
|
17
|
+
export declare const APPROVAL_GRANT_MAX_LIFETIME_SEC = 300;
|
|
17
18
|
interface Ed25519PublicJWK {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
kty: 'OKP';
|
|
20
|
+
crv: 'Ed25519';
|
|
21
|
+
x: string;
|
|
21
22
|
}
|
|
22
23
|
interface ApprovalGrantMeta {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
approvalRequestId: string;
|
|
25
|
+
approverDid: string;
|
|
26
|
+
agentDid: string;
|
|
27
|
+
requestHash: string;
|
|
28
|
+
audience: string;
|
|
29
|
+
decision: 'approve' | 'deny';
|
|
30
|
+
nonce: string;
|
|
31
|
+
created: number;
|
|
32
|
+
expires: number;
|
|
33
|
+
amr?: string[];
|
|
34
|
+
delegationRef?: string;
|
|
34
35
|
}
|
|
35
36
|
interface SignedApprovalGrant {
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
jws: string;
|
|
38
|
+
meta: ApprovalGrantMeta;
|
|
38
39
|
}
|
|
39
40
|
interface ApprovalGrantExpectation {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
requestHash: string;
|
|
42
|
+
audience: string;
|
|
43
|
+
nonce: string;
|
|
44
|
+
agentDid: string;
|
|
45
|
+
now?: number;
|
|
46
|
+
maxLifetimeSec?: number;
|
|
46
47
|
}
|
|
47
48
|
type ApproverKeyResolver = (did: string) => Promise<Ed25519PublicJWK | null>;
|
|
48
49
|
interface ApprovalGrantVerification {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
valid: boolean;
|
|
51
|
+
reason?: string;
|
|
52
|
+
approverDid?: string;
|
|
52
53
|
}
|
|
53
|
-
declare function signApprovalGrant(meta: ApprovalGrantMeta, privateKeyJwk: JWK): Promise<SignedApprovalGrant>;
|
|
54
|
-
declare function verifyApprovalGrant(opts: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
export declare function signApprovalGrant(meta: ApprovalGrantMeta, privateKeyJwk: JWK): Promise<SignedApprovalGrant>;
|
|
55
|
+
export declare function verifyApprovalGrant(opts: {
|
|
56
|
+
grant: SignedApprovalGrant;
|
|
57
|
+
expected: ApprovalGrantExpectation;
|
|
58
|
+
resolveKey: ApproverKeyResolver;
|
|
58
59
|
}): Promise<ApprovalGrantVerification>;
|
|
59
60
|
interface SignedQuorumResult {
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
satisfied: boolean;
|
|
62
|
+
reason?: string;
|
|
62
63
|
}
|
|
63
|
-
declare function verifySignedApprovalQuorum(opts: {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
export declare function verifySignedApprovalQuorum(opts: {
|
|
65
|
+
grants: SignedApprovalGrant[];
|
|
66
|
+
expected: {
|
|
67
|
+
requestHash: string;
|
|
68
|
+
audience: string;
|
|
69
|
+
agentDid: string;
|
|
70
|
+
now?: number;
|
|
71
|
+
};
|
|
72
|
+
quorum: {
|
|
73
|
+
n: number;
|
|
74
|
+
approvers: string[];
|
|
75
|
+
};
|
|
76
|
+
resolveKey: ApproverKeyResolver;
|
|
77
|
+
nonceStore: ApprovalNonceStore;
|
|
77
78
|
}): Promise<SignedQuorumResult>;
|
|
78
|
-
|
|
79
|
-
export {
|
|
79
|
+
//#endregion
|
|
80
|
+
export type { ApprovalGrantExpectation, ApprovalGrantMeta, ApprovalGrantVerification, ApprovalNonceStore, ApproverKeyResolver, Ed25519PublicJWK, SignedApprovalGrant, SignedQuorumResult };
|
|
81
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../../src/mcpi/approval-grant/nonce.ts","../../../src/mcpi/approval-grant/grant.ts"],"mappings":";;UAmBiB;EAOf,MAAM,qBAAqB;EAE3B,QAAQ;EAWR,WAAW;;qBAQA,sCAAsC;mBAChC;EAKjB,MAAM,qBAAqB;EAc3B,QAAQ;EAMR,WAAW;;;;qBCtCA;qBACA;UAEI;EACf;EACA;EACA;;UAIe;EACf;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA,MAAM;;UAGS;EACf;EACA;EACA;EACA;EACA;EACA;;KAGU,uBAAuB,gBAAgB,QAAQ;UAE1C;EACf;EACA;EACA;;wBAIoB,kBACpB,MAAM,mBACN,eAAe,MACd,QAAQ;wBAsCW,oBAAoB;EACxC,OAAO;EACP,UAAU;EACV,YAAY;IACV,QAAQ;UAsEK;EACf;EACA;;wBASoB,2BAA2B;EAC/C,QAAQ;EACR;IAAY;IAAqB;IAAkB;IAAkB;;EACrE;IAAU;IAAW;;EACrB,YAAY;EACZ,YAAY;IACV,QAAQ"}
|
|
@@ -1,79 +1,81 @@
|
|
|
1
|
-
import { JWK } from
|
|
2
|
-
|
|
1
|
+
import { JWK } from "jose";
|
|
2
|
+
//#region src/mcpi/approval-grant/nonce.d.ts
|
|
3
3
|
interface ApprovalNonceStore {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
issue(requestHash: string, ttlSec?: number): string;
|
|
5
|
+
current(requestHash: string): string | null;
|
|
6
|
+
tryConsume(requestHash: string): boolean;
|
|
7
7
|
}
|
|
8
|
-
declare class InMemoryApprovalNonceStore implements ApprovalNonceStore {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
8
|
+
export declare class InMemoryApprovalNonceStore implements ApprovalNonceStore {
|
|
9
|
+
private readonly issued;
|
|
10
|
+
issue(requestHash: string, ttlSec?: number): string;
|
|
11
|
+
current(requestHash: string): string | null;
|
|
12
|
+
tryConsume(requestHash: string): boolean;
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
declare const
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/mcpi/approval-grant/grant.d.ts
|
|
16
|
+
export declare const APPROVAL_GRANT_TYP = "approval-grant+jwt";
|
|
17
|
+
export declare const APPROVAL_GRANT_MAX_LIFETIME_SEC = 300;
|
|
17
18
|
interface Ed25519PublicJWK {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
kty: 'OKP';
|
|
20
|
+
crv: 'Ed25519';
|
|
21
|
+
x: string;
|
|
21
22
|
}
|
|
22
23
|
interface ApprovalGrantMeta {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
approvalRequestId: string;
|
|
25
|
+
approverDid: string;
|
|
26
|
+
agentDid: string;
|
|
27
|
+
requestHash: string;
|
|
28
|
+
audience: string;
|
|
29
|
+
decision: 'approve' | 'deny';
|
|
30
|
+
nonce: string;
|
|
31
|
+
created: number;
|
|
32
|
+
expires: number;
|
|
33
|
+
amr?: string[];
|
|
34
|
+
delegationRef?: string;
|
|
34
35
|
}
|
|
35
36
|
interface SignedApprovalGrant {
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
jws: string;
|
|
38
|
+
meta: ApprovalGrantMeta;
|
|
38
39
|
}
|
|
39
40
|
interface ApprovalGrantExpectation {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
requestHash: string;
|
|
42
|
+
audience: string;
|
|
43
|
+
nonce: string;
|
|
44
|
+
agentDid: string;
|
|
45
|
+
now?: number;
|
|
46
|
+
maxLifetimeSec?: number;
|
|
46
47
|
}
|
|
47
48
|
type ApproverKeyResolver = (did: string) => Promise<Ed25519PublicJWK | null>;
|
|
48
49
|
interface ApprovalGrantVerification {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
50
|
+
valid: boolean;
|
|
51
|
+
reason?: string;
|
|
52
|
+
approverDid?: string;
|
|
52
53
|
}
|
|
53
|
-
declare function signApprovalGrant(meta: ApprovalGrantMeta, privateKeyJwk: JWK): Promise<SignedApprovalGrant>;
|
|
54
|
-
declare function verifyApprovalGrant(opts: {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
54
|
+
export declare function signApprovalGrant(meta: ApprovalGrantMeta, privateKeyJwk: JWK): Promise<SignedApprovalGrant>;
|
|
55
|
+
export declare function verifyApprovalGrant(opts: {
|
|
56
|
+
grant: SignedApprovalGrant;
|
|
57
|
+
expected: ApprovalGrantExpectation;
|
|
58
|
+
resolveKey: ApproverKeyResolver;
|
|
58
59
|
}): Promise<ApprovalGrantVerification>;
|
|
59
60
|
interface SignedQuorumResult {
|
|
60
|
-
|
|
61
|
-
|
|
61
|
+
satisfied: boolean;
|
|
62
|
+
reason?: string;
|
|
62
63
|
}
|
|
63
|
-
declare function verifySignedApprovalQuorum(opts: {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
export declare function verifySignedApprovalQuorum(opts: {
|
|
65
|
+
grants: SignedApprovalGrant[];
|
|
66
|
+
expected: {
|
|
67
|
+
requestHash: string;
|
|
68
|
+
audience: string;
|
|
69
|
+
agentDid: string;
|
|
70
|
+
now?: number;
|
|
71
|
+
};
|
|
72
|
+
quorum: {
|
|
73
|
+
n: number;
|
|
74
|
+
approvers: string[];
|
|
75
|
+
};
|
|
76
|
+
resolveKey: ApproverKeyResolver;
|
|
77
|
+
nonceStore: ApprovalNonceStore;
|
|
77
78
|
}): Promise<SignedQuorumResult>;
|
|
78
|
-
|
|
79
|
-
export {
|
|
79
|
+
//#endregion
|
|
80
|
+
export type { ApprovalGrantExpectation, ApprovalGrantMeta, ApprovalGrantVerification, ApprovalNonceStore, ApproverKeyResolver, Ed25519PublicJWK, SignedApprovalGrant, SignedQuorumResult };
|
|
81
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","names":[],"sources":["../../../src/mcpi/approval-grant/nonce.ts","../../../src/mcpi/approval-grant/grant.ts"],"mappings":";;UAmBiB;EAOf,MAAM,qBAAqB;EAE3B,QAAQ;EAWR,WAAW;;qBAQA,sCAAsC;mBAChC;EAKjB,MAAM,qBAAqB;EAc3B,QAAQ;EAMR,WAAW;;;;qBCtCA;qBACA;UAEI;EACf;EACA;EACA;;UAIe;EACf;EACA;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;UAGe;EACf;EACA,MAAM;;UAGS;EACf;EACA;EACA;EACA;EACA;EACA;;KAGU,uBAAuB,gBAAgB,QAAQ;UAE1C;EACf;EACA;EACA;;wBAIoB,kBACpB,MAAM,mBACN,eAAe,MACd,QAAQ;wBAsCW,oBAAoB;EACxC,OAAO;EACP,UAAU;EACV,YAAY;IACV,QAAQ;UAsEK;EACf;EACA;;wBASoB,2BAA2B;EAC/C,QAAQ;EACR;IAAY;IAAqB;IAAkB;IAAkB;;EACrE;IAAU;IAAW;;EACrB,YAAY;EACZ,YAAY;IACV,QAAQ"}
|