@agent-score/commerce 2.4.0 → 2.6.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 +19 -17
- package/dist/challenge/index.d.mts +31 -3
- package/dist/challenge/index.d.ts +31 -3
- package/dist/challenge/index.js +25 -9
- package/dist/challenge/index.js.map +1 -1
- package/dist/challenge/index.mjs +25 -9
- package/dist/challenge/index.mjs.map +1 -1
- package/dist/{checkout-B-MIzYzW.d.ts → checkout-C4RD7M0Z.d.ts} +117 -13
- package/dist/{checkout-Bn7ZKIBD.d.mts → checkout-CzB9f_jf.d.mts} +117 -13
- package/dist/core.d.mts +40 -7
- package/dist/core.d.ts +40 -7
- package/dist/core.js +52 -27
- package/dist/core.js.map +1 -1
- package/dist/core.mjs +52 -27
- package/dist/core.mjs.map +1 -1
- package/dist/discovery/index.d.mts +33 -3
- package/dist/discovery/index.d.ts +33 -3
- package/dist/discovery/index.js +50 -16
- package/dist/discovery/index.js.map +1 -1
- package/dist/discovery/index.mjs +49 -16
- package/dist/discovery/index.mjs.map +1 -1
- package/dist/gate-D2RP6bZg.d.ts +307 -0
- package/dist/gate-GCXy4FHI.d.mts +307 -0
- package/dist/identity/express.d.mts +28 -1
- package/dist/identity/express.d.ts +28 -1
- package/dist/identity/express.js +714 -31
- package/dist/identity/express.js.map +1 -1
- package/dist/identity/express.mjs +710 -30
- package/dist/identity/express.mjs.map +1 -1
- package/dist/identity/fastify.d.mts +14 -2
- package/dist/identity/fastify.d.ts +14 -2
- package/dist/identity/fastify.js +727 -31
- package/dist/identity/fastify.js.map +1 -1
- package/dist/identity/fastify.mjs +723 -30
- package/dist/identity/fastify.mjs.map +1 -1
- package/dist/identity/hono.d.mts +28 -1
- package/dist/identity/hono.d.ts +28 -1
- package/dist/identity/hono.js +696 -33
- package/dist/identity/hono.js.map +1 -1
- package/dist/identity/hono.mjs +692 -32
- package/dist/identity/hono.mjs.map +1 -1
- package/dist/identity/nextjs.d.mts +5 -0
- package/dist/identity/nextjs.d.ts +5 -0
- package/dist/identity/nextjs.js +695 -30
- package/dist/identity/nextjs.js.map +1 -1
- package/dist/identity/nextjs.mjs +691 -29
- package/dist/identity/nextjs.mjs.map +1 -1
- package/dist/identity/policy.d.mts +21 -2
- package/dist/identity/policy.d.ts +21 -2
- package/dist/identity/policy.js +22 -1
- package/dist/identity/policy.js.map +1 -1
- package/dist/identity/policy.mjs +21 -1
- package/dist/identity/policy.mjs.map +1 -1
- package/dist/identity/web.d.mts +26 -1
- package/dist/identity/web.d.ts +26 -1
- package/dist/identity/web.js +695 -30
- package/dist/identity/web.js.map +1 -1
- package/dist/identity/web.mjs +691 -29
- package/dist/identity/web.mjs.map +1 -1
- package/dist/index.d.mts +165 -4
- package/dist/index.d.ts +165 -4
- package/dist/index.js +3103 -534
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3086 -545
- package/dist/index.mjs.map +1 -1
- package/dist/payment/index.d.mts +1 -1
- package/dist/payment/index.d.ts +1 -1
- package/dist/payment/index.js +10 -2
- package/dist/payment/index.js.map +1 -1
- package/dist/payment/index.mjs +10 -2
- package/dist/payment/index.mjs.map +1 -1
- package/dist/stripe-multichain/index.js +1614 -266
- package/dist/stripe-multichain/index.js.map +1 -1
- package/dist/stripe-multichain/index.mjs +1614 -266
- package/dist/stripe-multichain/index.mjs.map +1 -1
- package/dist/types-D1slMt0H.d.mts +137 -0
- package/dist/types-D1slMt0H.d.ts +137 -0
- package/dist/{wwwauthenticate-CVaGUMjU.d.mts → wwwauthenticate-Dgm-_af9.d.mts} +11 -1
- package/dist/{wwwauthenticate-CVaGUMjU.d.ts → wwwauthenticate-Dgm-_af9.d.ts} +11 -1
- package/package.json +26 -21
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
import { d as AipGateOptions, o as buildAipErrorBody, V as VerifiedAit } from '../gate-D2RP6bZg.js';
|
|
1
2
|
import { AgentScoreCoreOptions, AgentIdentity, DenialReason, CreateSessionOnMissing, AssessResult, FailOpenInfraReason, GateQuotaInfo, SignerVerdict } from '../core.js';
|
|
2
3
|
import { Request, Response, NextFunction } from 'express';
|
|
4
|
+
import '../types-D1slMt0H.js';
|
|
5
|
+
import 'jose';
|
|
6
|
+
import '@agent-score/sdk';
|
|
3
7
|
import '../signer-3FAit11j.js';
|
|
4
8
|
|
|
5
9
|
interface AgentScoreGateOptions extends Omit<AgentScoreCoreOptions, 'createSessionOnMissing'> {
|
|
@@ -60,5 +64,28 @@ declare function getSignerVerdict(req: Request): SignerVerdict | undefined;
|
|
|
60
64
|
* unauthenticated and the handler emits a 402 with all rails; settle legs
|
|
61
65
|
* trigger the full gate. */
|
|
62
66
|
declare function conditionalAgentscoreGate(options: AgentScoreGateOptions): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
67
|
+
interface AipGateExpressOptions extends AipGateOptions {
|
|
68
|
+
/** Custom denial responder. Defaults to a 401/403 `application/problem+json` body. */
|
|
69
|
+
onDenied?: (req: Request, res: Response, body: ReturnType<typeof buildAipErrorBody>) => void;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Express middleware that requires a valid AIT on every request it guards.
|
|
73
|
+
*
|
|
74
|
+
* ```ts
|
|
75
|
+
* import { JwksCache } from '@agent-score/commerce';
|
|
76
|
+
* import { aipGate, getVerifiedAit } from '@agent-score/commerce/identity/express';
|
|
77
|
+
*
|
|
78
|
+
* const jwks = new JwksCache({ trustedIssuers: ['https://issuer.example'] }); // AgentScore always trusted
|
|
79
|
+
* app.post('/checkout', aipGate({ jwks }), (req, res) => {
|
|
80
|
+
* const ait = getVerifiedAit(req)!;
|
|
81
|
+
* res.json({ buyer: ait.payload.identity?.email });
|
|
82
|
+
* });
|
|
83
|
+
* ```
|
|
84
|
+
*/
|
|
85
|
+
declare function aipGate(options: AipGateExpressOptions): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
86
|
+
/** Wrap {@link aipGate} so it only runs when an `Agent-Identity` header is present. */
|
|
87
|
+
declare function conditionalAipGate(options: AipGateExpressOptions): (req: Request, res: Response, next: NextFunction) => Promise<void>;
|
|
88
|
+
/** Read the verified AIT attached to an Express request by {@link aipGate}. */
|
|
89
|
+
declare function getVerifiedAit(req: Request): VerifiedAit | undefined;
|
|
63
90
|
|
|
64
|
-
export { agentscoreGate, captureWallet, conditionalAgentscoreGate, getAgentScoreData, getGateDegradedState, getGateQuotaInfo, getSignerVerdict };
|
|
91
|
+
export { type AipGateExpressOptions, agentscoreGate, aipGate, captureWallet, conditionalAgentscoreGate, conditionalAipGate, getAgentScoreData, getGateDegradedState, getGateQuotaInfo, getSignerVerdict, getVerifiedAit };
|