mppx 0.21.1 → 0.21.2
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 +13 -0
- package/dist/Errors.d.ts +55 -0
- package/dist/Errors.js +48 -0
- package/dist/Html.d.ts +1 -1
- package/dist/Html.js +2 -2
- package/dist/Method.d.ts +1 -1
- package/dist/cli/cli.js +138 -138
- package/dist/cli/internal.js +1 -1
- package/dist/cli/plugins/evm.js +1 -1
- package/dist/cli/plugins/index.js +13 -13
- package/dist/cli/plugins/x402.js +1 -1
- package/dist/cli/utils.d.ts +2 -45
- package/dist/cli/utils.js +2 -79
- package/dist/cli/validate/index.js +5 -2
- package/dist/cli/validate/payment.d.ts +1 -1
- package/dist/cli/validate/payment.js +3 -3
- package/dist/cli/validate/print.d.ts +12 -0
- package/dist/cli/validate/print.js +35 -0
- package/dist/client/core.d.ts +6 -0
- package/dist/client/core.js +6 -0
- package/dist/client/index.d.ts +2 -8
- package/dist/client/index.js +2 -6
- package/dist/client/internal/protocols/Shared.js +1 -1
- package/dist/client/internal/protocols/X402.js +3 -3
- package/dist/evm/client/Charge.js +1 -1
- package/dist/evm/index.d.ts +1 -1
- package/dist/evm/server/Charge.js +1 -1
- package/dist/integrations/x402/Evm.js +1 -1
- package/dist/integrations/x402/Negotiator.js +1 -1
- package/dist/internal/AcceptPayment.js +1 -1
- package/dist/internal/CredentialExpiry.js +1 -1
- package/dist/{mcp/internal/Credential.d.ts → internal/McpCredential.d.ts} +2 -2
- package/dist/{mcp/internal/Credential.js → internal/McpCredential.js} +2 -2
- package/dist/{server/internal → internal}/challengeMeta.js +1 -1
- package/dist/{server/internal → internal}/html/config.d.ts +2 -2
- package/dist/internal/pc.d.ts +46 -0
- package/dist/internal/pc.js +80 -0
- package/dist/internal/version.d.ts +2 -2
- package/dist/internal/version.js +1 -1
- package/dist/{x402 → internal/x402}/Header.js +1 -1
- package/dist/{x402 → internal/x402}/Siwx.d.ts +2 -2
- package/dist/{x402 → internal/x402}/Siwx.js +2 -2
- package/dist/{x402 → internal/x402}/Types.d.ts +1 -1
- package/dist/{x402 → internal/x402}/Types.js +1 -1
- package/dist/mcp/server/index.d.ts +1 -1
- package/dist/mcp/server/index.js +1 -1
- package/dist/server/Mppx.d.ts +1 -1
- package/dist/server/Mppx.js +6 -6
- package/dist/server/Transport.d.ts +2 -2
- package/dist/server/Transport.js +4 -4
- package/dist/server/index.d.ts +1 -8
- package/dist/server/index.js +1 -8
- package/dist/{mcp/server/Transport.d.ts → server/internal/mcpSdk.d.ts} +2 -2
- package/dist/{mcp/server/Transport.js → server/internal/mcpSdk.js} +3 -3
- package/dist/stripe/server/Charge.d.ts +1 -1
- package/dist/stripe/server/internal/html.gen.js +1 -1
- package/dist/tempo/Methods.d.ts +3 -0
- package/dist/tempo/Methods.js +3 -1
- package/dist/tempo/client/Charge.js +1 -1
- package/dist/tempo/client/Methods.d.ts +3 -0
- package/dist/tempo/client/index.d.ts +3 -0
- package/dist/tempo/client/index.js +1 -0
- package/dist/tempo/internal/configurable-account.d.ts +26 -0
- package/dist/tempo/internal/configurable-account.js +77 -0
- package/dist/tempo/internal/signature.d.ts +15 -0
- package/dist/tempo/internal/signature.js +43 -0
- package/dist/tempo/server/Charge.d.ts +1 -1
- package/dist/tempo/server/Charge.js +1 -1
- package/dist/tempo/server/Methods.d.ts +139 -4
- package/dist/tempo/server/internal/html.gen.js +1 -1
- package/dist/tempo/session/client/ChannelOps.d.ts +29 -0
- package/dist/tempo/session/client/ChannelOps.js +108 -3
- package/dist/tempo/session/client/CredentialState.d.ts +6 -0
- package/dist/tempo/session/client/CredentialState.js +29 -4
- package/dist/tempo/session/client/Session.d.ts +3 -0
- package/dist/tempo/session/client/SessionManager.js +4 -0
- package/dist/tempo/session/precompile/Chain.d.ts +35 -1
- package/dist/tempo/session/precompile/Chain.js +52 -0
- package/dist/tempo/session/precompile/Voucher.d.ts +46 -5
- package/dist/tempo/session/precompile/Voucher.js +78 -29
- package/dist/tempo/session/precompile/escrow.abi.d.ts +79 -0
- package/dist/tempo/session/precompile/escrow.abi.js +38 -0
- package/dist/tempo/session/server/ChannelStore.d.ts +27 -0
- package/dist/tempo/session/server/ChannelStore.js +24 -3
- package/dist/tempo/session/server/CredentialVerification.d.ts +7 -1
- package/dist/tempo/session/server/CredentialVerification.js +91 -12
- package/dist/tempo/session/server/RequestState.d.ts +2 -0
- package/dist/tempo/session/server/RequestState.js +1 -0
- package/dist/tempo/session/server/Session.d.ts +11 -0
- package/dist/tempo/session/server/Session.js +10 -2
- package/dist/tempo/session/server/SponsorshipLimit.d.ts +11 -3
- package/dist/tempo/session/server/SponsorshipLimit.js +36 -4
- package/dist/tempo/subscription/KeyAuthorization.js +6 -2
- package/dist/{cli/validate → validation}/challenge.d.ts +1 -1
- package/dist/{cli/validate → validation}/challenge.js +4 -4
- package/dist/validation/core.d.ts +29 -2
- package/dist/validation/core.js +41 -10
- package/dist/{cli/validate → validation}/helpers.d.ts +0 -10
- package/dist/{cli/validate → validation}/helpers.js +1 -35
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +1 -1
- package/dist/x402/Assets.d.ts +1 -1
- package/dist/x402/client/Exact.d.ts +1 -1
- package/dist/x402/client/Exact.js +2 -2
- package/dist/x402/index.d.ts +4 -4
- package/dist/x402/index.js +4 -4
- package/dist/x402/internal/RouteBinding.d.ts +1 -1
- package/dist/x402/mcp.js +2 -2
- package/dist/x402/server/EvmCharge.d.ts +2 -2
- package/dist/x402/server/EvmCharge.js +4 -4
- package/dist/x402/server/Facilitator.d.ts +1 -1
- package/dist/x402/server/Facilitator.js +1 -1
- package/package.json +13 -1
- /package/dist/{server/internal → internal}/challengeMeta.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/compose.main.gen.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/compose.main.gen.js +0 -0
- /package/dist/{server/internal → internal}/html/config.js +0 -0
- /package/dist/{server/internal → internal}/html/constants.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/constants.js +0 -0
- /package/dist/{server/internal → internal}/html/serviceWorker.client.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/serviceWorker.client.js +0 -0
- /package/dist/{server/internal → internal}/html/serviceWorker.gen.d.ts +0 -0
- /package/dist/{server/internal → internal}/html/serviceWorker.gen.js +0 -0
- /package/dist/{x402/internal → internal/x402}/ChallengeBrand.d.ts +0 -0
- /package/dist/{x402/internal → internal/x402}/ChallengeBrand.js +0 -0
- /package/dist/{x402 → internal/x402}/Header.d.ts +0 -0
- /package/dist/{cli/validate → validation}/discovery.d.ts +0 -0
- /package/dist/{cli/validate → validation}/discovery.js +0 -0
- /package/dist/{cli/validate → validation}/messages.d.ts +0 -0
- /package/dist/{cli/validate → validation}/messages.js +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/** The secp256k1 curve order. */
|
|
2
|
+
const secp256k1Order = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;
|
|
3
|
+
/** The P256 curve order. */
|
|
4
|
+
const p256Order = 0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551n;
|
|
5
|
+
/** Half the secp256k1 curve order. */
|
|
6
|
+
const secp256k1HalfOrder = 0x7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0n;
|
|
7
|
+
/** Half the P256 curve order. */
|
|
8
|
+
const p256HalfOrder = 0x7fffffff800000007fffffffffffffffde737d56d38bcf4279dce5617e3192a8n;
|
|
9
|
+
/**
|
|
10
|
+
* Returns whether a primitive signature's `s` is at most half its curve order. Tempo rejects
|
|
11
|
+
* secp256k1, P256 and WebAuthn signatures with a higher `s`, so a signature that verifies
|
|
12
|
+
* off-chain without this check may never settle. Other envelope types return `true`.
|
|
13
|
+
*/
|
|
14
|
+
export function isLowS(envelope) {
|
|
15
|
+
if (envelope.type === 'secp256k1')
|
|
16
|
+
return envelope.signature.s <= secp256k1HalfOrder;
|
|
17
|
+
if (envelope.type === 'p256' || envelope.type === 'webAuthn')
|
|
18
|
+
return envelope.signature.s <= p256HalfOrder;
|
|
19
|
+
return true;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Returns a primitive signature with `s` at most half its curve order: a high `s` becomes the
|
|
23
|
+
* equivalent `n - s` (flipping the secp256k1 recovery parity), including each owner approval of a configurable
|
|
24
|
+
* account signature. Signers such as KMS or HSM backends
|
|
25
|
+
* may return either form; Tempo accepts only the low one. Other envelope types are returned as is.
|
|
26
|
+
*/
|
|
27
|
+
export function toLowS(envelope) {
|
|
28
|
+
if (envelope.type === 'configurable')
|
|
29
|
+
return { ...envelope, signatures: envelope.signatures.map((approval) => toLowS(approval)) };
|
|
30
|
+
if (isLowS(envelope))
|
|
31
|
+
return envelope;
|
|
32
|
+
if (envelope.type === 'secp256k1') {
|
|
33
|
+
const { r, s, yParity } = envelope.signature;
|
|
34
|
+
return { ...envelope, signature: { r, s: secp256k1Order - s, yParity: yParity === 0 ? 1 : 0 } };
|
|
35
|
+
}
|
|
36
|
+
if (envelope.type === 'p256' || envelope.type === 'webAuthn')
|
|
37
|
+
return {
|
|
38
|
+
...envelope,
|
|
39
|
+
signature: { ...envelope.signature, s: p256Order - envelope.signature.s },
|
|
40
|
+
};
|
|
41
|
+
return envelope;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=signature.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Transaction } from 'viem/tempo';
|
|
2
|
+
import type * as Html from '../../internal/html/config.ts';
|
|
2
3
|
import type { LooseOmit, NoExtraKeys } from '../../internal/types.js';
|
|
3
4
|
import * as Method from '../../Method.js';
|
|
4
|
-
import type * as Html from '../../server/internal/html/config.ts';
|
|
5
5
|
import * as Store from '../../Store.js';
|
|
6
6
|
import * as Client from '../../viem/Client.js';
|
|
7
7
|
import * as Account from '../internal/account.js';
|
|
@@ -6,9 +6,9 @@ import { Abis, Actions, Transaction } from 'viem/tempo';
|
|
|
6
6
|
import { tempo as tempo_chain } from 'viem/tempo/chains';
|
|
7
7
|
import { BroadcastOutcomeUnknownError, CredentialReplayedError, PaymentError, PaymentExpiredError, VerificationFailedError, } from '../../Errors.js';
|
|
8
8
|
import * as Expires from '../../Expires.js';
|
|
9
|
+
import * as ChallengeMeta from '../../internal/challengeMeta.js';
|
|
9
10
|
import * as CredentialExpiry from '../../internal/CredentialExpiry.js';
|
|
10
11
|
import * as Method from '../../Method.js';
|
|
11
|
-
import * as ChallengeMeta from '../../server/internal/challengeMeta.js';
|
|
12
12
|
import * as Store from '../../Store.js';
|
|
13
13
|
import * as Client from '../../viem/Client.js';
|
|
14
14
|
import * as Attribution from '../Attribution.js';
|