@shielded-x402/shared-types 0.1.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/dist/crypto-spec.d.ts +15 -0
- package/dist/crypto-spec.d.ts.map +1 -0
- package/dist/crypto-spec.js +14 -0
- package/dist/crypto-spec.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +50 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/dist/x402.d.ts +7 -0
- package/dist/x402.d.ts.map +1 -0
- package/dist/x402.js +7 -0
- package/dist/x402.js.map +1 -0
- package/package.json +25 -0
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const CRYPTO_SPEC: {
|
|
2
|
+
readonly version: "v0.1.0";
|
|
3
|
+
readonly hashFunction: "keccak256";
|
|
4
|
+
readonly merkleTreeDepth: 32;
|
|
5
|
+
readonly noteEncoding: "abi-packed-v1";
|
|
6
|
+
readonly nullifierDerivation: "keccak256(nullifierSecret, noteCommitment)";
|
|
7
|
+
readonly merchantCommitmentDerivation: "keccak256(payAmount, merchantRho, merchantPkHash)";
|
|
8
|
+
readonly changeCommitmentDerivation: "keccak256(changeAmount, changeRho, changePkHash)";
|
|
9
|
+
readonly challengeDomainSeparator: "shielded-x402:v1:challenge";
|
|
10
|
+
readonly commitmentDomainSeparator: "shielded-x402:v1:commitment";
|
|
11
|
+
readonly outputDomainSeparator: "shielded-x402:v1:output";
|
|
12
|
+
readonly nullifierDomainSeparator: "shielded-x402:v1:nullifier";
|
|
13
|
+
};
|
|
14
|
+
export type CryptoSpec = typeof CRYPTO_SPEC;
|
|
15
|
+
//# sourceMappingURL=crypto-spec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-spec.d.ts","sourceRoot":"","sources":["../src/crypto-spec.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,WAAW;;;;;;;;;;;;CAYd,CAAC;AAEX,MAAM,MAAM,UAAU,GAAG,OAAO,WAAW,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const CRYPTO_SPEC = {
|
|
2
|
+
version: 'v0.1.0',
|
|
3
|
+
hashFunction: 'keccak256',
|
|
4
|
+
merkleTreeDepth: 32,
|
|
5
|
+
noteEncoding: 'abi-packed-v1',
|
|
6
|
+
nullifierDerivation: 'keccak256(nullifierSecret, noteCommitment)',
|
|
7
|
+
merchantCommitmentDerivation: 'keccak256(payAmount, merchantRho, merchantPkHash)',
|
|
8
|
+
changeCommitmentDerivation: 'keccak256(changeAmount, changeRho, changePkHash)',
|
|
9
|
+
challengeDomainSeparator: 'shielded-x402:v1:challenge',
|
|
10
|
+
commitmentDomainSeparator: 'shielded-x402:v1:commitment',
|
|
11
|
+
outputDomainSeparator: 'shielded-x402:v1:output',
|
|
12
|
+
nullifierDomainSeparator: 'shielded-x402:v1:nullifier'
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=crypto-spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"crypto-spec.js","sourceRoot":"","sources":["../src/crypto-spec.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,OAAO,EAAE,QAAQ;IACjB,YAAY,EAAE,WAAW;IACzB,eAAe,EAAE,EAAE;IACnB,YAAY,EAAE,eAAe;IAC7B,mBAAmB,EAAE,4CAA4C;IACjE,4BAA4B,EAAE,mDAAmD;IACjF,0BAA0B,EAAE,kDAAkD;IAC9E,wBAAwB,EAAE,4BAA4B;IACtD,yBAAyB,EAAE,6BAA6B;IACxD,qBAAqB,EAAE,yBAAyB;IAChD,wBAAwB,EAAE,4BAA4B;CAC9C,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,WAAW,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
export type Hex = `0x${string}`;
|
|
2
|
+
export interface ShieldedNote {
|
|
3
|
+
amount: bigint;
|
|
4
|
+
rho: Hex;
|
|
5
|
+
pkHash: Hex;
|
|
6
|
+
commitment: Hex;
|
|
7
|
+
leafIndex: number;
|
|
8
|
+
}
|
|
9
|
+
export interface SpendPublicInputs {
|
|
10
|
+
nullifier: Hex;
|
|
11
|
+
root: Hex;
|
|
12
|
+
merchantCommitment: Hex;
|
|
13
|
+
changeCommitment: Hex;
|
|
14
|
+
challengeHash: Hex;
|
|
15
|
+
amount: bigint;
|
|
16
|
+
}
|
|
17
|
+
export interface ShieldedPaymentResponse {
|
|
18
|
+
proof: Hex;
|
|
19
|
+
publicInputs: Hex[];
|
|
20
|
+
nullifier: Hex;
|
|
21
|
+
root: Hex;
|
|
22
|
+
merchantCommitment: Hex;
|
|
23
|
+
changeCommitment: Hex;
|
|
24
|
+
challengeHash: Hex;
|
|
25
|
+
encryptedReceipt: Hex;
|
|
26
|
+
txHint?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface PaymentRequirement {
|
|
29
|
+
rail: 'shielded-usdc';
|
|
30
|
+
amount: string;
|
|
31
|
+
challengeNonce: string;
|
|
32
|
+
challengeExpiry: string;
|
|
33
|
+
merchantPubKey: Hex;
|
|
34
|
+
verifyingContract: Hex;
|
|
35
|
+
}
|
|
36
|
+
export interface AgentRecord {
|
|
37
|
+
did: string;
|
|
38
|
+
endpoint: string;
|
|
39
|
+
encryptionPubKey: Hex;
|
|
40
|
+
capabilities: string[];
|
|
41
|
+
supportedRails: string[];
|
|
42
|
+
signature: Hex;
|
|
43
|
+
}
|
|
44
|
+
export interface ReputationSignal {
|
|
45
|
+
successfulSettlements: number;
|
|
46
|
+
disputes: number;
|
|
47
|
+
uptime: number;
|
|
48
|
+
attestationRefs: string[];
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,GAAG,GAAG,KAAK,MAAM,EAAE,CAAC;AAEhC,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,GAAG,CAAC;IACT,MAAM,EAAE,GAAG,CAAC;IACZ,UAAU,EAAE,GAAG,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,iBAAiB;IAChC,SAAS,EAAE,GAAG,CAAC;IACf,IAAI,EAAE,GAAG,CAAC;IACV,kBAAkB,EAAE,GAAG,CAAC;IACxB,gBAAgB,EAAE,GAAG,CAAC;IACtB,aAAa,EAAE,GAAG,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,uBAAuB;IACtC,KAAK,EAAE,GAAG,CAAC;IACX,YAAY,EAAE,GAAG,EAAE,CAAC;IACpB,SAAS,EAAE,GAAG,CAAC;IACf,IAAI,EAAE,GAAG,CAAC;IACV,kBAAkB,EAAE,GAAG,CAAC;IACxB,gBAAgB,EAAE,GAAG,CAAC;IACtB,aAAa,EAAE,GAAG,CAAC;IACnB,gBAAgB,EAAE,GAAG,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,eAAe,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,MAAM,CAAC;IACvB,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,GAAG,CAAC;IACpB,iBAAiB,EAAE,GAAG,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,gBAAgB,EAAE,GAAG,CAAC;IACtB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,cAAc,EAAE,MAAM,EAAE,CAAC;IACzB,SAAS,EAAE,GAAG,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,eAAe,EAAE,MAAM,EAAE,CAAC;CAC3B"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|
package/dist/x402.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const X402_HEADERS: {
|
|
2
|
+
readonly paymentResponse: "PAYMENT-RESPONSE";
|
|
3
|
+
readonly paymentSignature: "PAYMENT-SIGNATURE";
|
|
4
|
+
readonly challengeNonce: "X-CHALLENGE-NONCE";
|
|
5
|
+
readonly paymentRequirement: "x-payment-requirement";
|
|
6
|
+
};
|
|
7
|
+
//# sourceMappingURL=x402.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x402.d.ts","sourceRoot":"","sources":["../src/x402.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY;;;;;CAKf,CAAC"}
|
package/dist/x402.js
ADDED
package/dist/x402.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"x402.js","sourceRoot":"","sources":["../src/x402.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,eAAe,EAAE,kBAAkB;IACnC,gBAAgB,EAAE,mBAAmB;IACrC,cAAc,EAAE,mBAAmB;IACnC,kBAAkB,EAAE,uBAAuB;CACnC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@shielded-x402/shared-types",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": {
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
}
|
|
12
|
+
},
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"publishConfig": {
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"build": "tsc -p tsconfig.json",
|
|
21
|
+
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
22
|
+
"test": "vitest run",
|
|
23
|
+
"lint": "tsc -p tsconfig.json --noEmit"
|
|
24
|
+
}
|
|
25
|
+
}
|