@atxp/base 0.7.2 → 0.7.3

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atxp/base",
3
- "version": "0.7.2",
3
+ "version": "0.7.3",
4
4
  "description": "ATXP for Base Mini Apps",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -33,8 +33,8 @@
33
33
  "pack:dry": "npm pack --dry-run"
34
34
  },
35
35
  "dependencies": {
36
- "@atxp/client": "0.7.2",
37
- "@atxp/common": "0.7.2",
36
+ "@atxp/client": "0.7.3",
37
+ "@atxp/common": "0.7.3",
38
38
  "bignumber.js": "^9.3.0"
39
39
  },
40
40
  "peerDependencies": {
@@ -1,83 +0,0 @@
1
- /**
2
- * EIP-1271 JWT helper utilities for creating properly formatted JWTs
3
- * from EIP-1271 auth data.
4
- */
5
- // Helper function to convert to base64url that works in both Node.js and browsers
6
- function toBase64Url(data) {
7
- // Convert string to base64
8
- const base64 = typeof Buffer !== 'undefined'
9
- ? Buffer.from(data).toString('base64')
10
- : btoa(data);
11
- // Convert base64 to base64url
12
- return base64.replace(/\+/g, '-').replace(/\//g, '_').replace(/=/g, '');
13
- }
14
- /**
15
- * Convert EIP-1271 auth data to JWT format
16
- * @param authData The EIP-1271 auth data (signature will be moved to JWT signature section)
17
- * @returns JWT string in the format header.payload.signature
18
- */
19
- function createEIP1271JWT(authData) {
20
- // Create JWT header
21
- const header = {
22
- alg: 'EIP1271',
23
- typ: 'JWT'
24
- };
25
- // Create payload without signature (signature goes in JWT signature section)
26
- const payload = {
27
- sub: authData.walletAddress,
28
- iss: 'accounts.atxp.ai',
29
- aud: 'https://auth.atxp.ai',
30
- iat: authData.timestamp,
31
- exp: authData.timestamp + 3600, // 1 hour expiration
32
- msg: authData.message,
33
- ...(authData.code_challenge && { code_challenge: authData.code_challenge }),
34
- ...(authData.payment_request_id && { payment_request_id: authData.payment_request_id })
35
- };
36
- // Encode header and payload
37
- const encodedHeader = toBase64Url(JSON.stringify(header));
38
- const encodedPayload = toBase64Url(JSON.stringify(payload));
39
- // EIP-1271 signature goes in JWT signature section
40
- const encodedSignature = toBase64Url(authData.signature);
41
- // Return JWT format: header.payload.signature
42
- return `${encodedHeader}.${encodedPayload}.${encodedSignature}`;
43
- }
44
- /**
45
- * Create auth data structure from signing parameters
46
- */
47
- function createEIP1271AuthData({ walletAddress, message, signature, timestamp, nonce, codeChallenge, paymentRequestId }) {
48
- return {
49
- type: 'EIP1271_AUTH',
50
- walletAddress,
51
- message,
52
- signature,
53
- timestamp,
54
- ...(nonce && { nonce }),
55
- ...(codeChallenge && { code_challenge: codeChallenge }),
56
- ...(paymentRequestId && { payment_request_id: paymentRequestId })
57
- };
58
- }
59
- /**
60
- * Construct the standardized message format for EIP-1271 signing
61
- */
62
- function constructEIP1271Message({ walletAddress, timestamp, nonce, codeChallenge, paymentRequestId }) {
63
- const messageParts = [
64
- `PayMCP Authorization Request`,
65
- ``,
66
- `Wallet: ${walletAddress}`,
67
- `Timestamp: ${timestamp}`
68
- ];
69
- if (nonce !== undefined && nonce !== null) {
70
- messageParts.push(`Nonce: ${nonce}`);
71
- }
72
- if (codeChallenge) {
73
- messageParts.push(`Code Challenge: ${codeChallenge}`);
74
- }
75
- if (paymentRequestId) {
76
- messageParts.push(`Payment Request ID: ${paymentRequestId}`);
77
- }
78
- messageParts.push('', '', 'Sign this message to prove you control this wallet.');
79
- return messageParts.join('\n');
80
- }
81
-
82
- export { constructEIP1271Message, createEIP1271AuthData, createEIP1271JWT };
83
- //# sourceMappingURL=eip1271JwtHelper.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"eip1271JwtHelper.js","sources":["../src/eip1271JwtHelper.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;AAGG;AA6BH;AACA,SAAS,WAAW,CAAC,IAAY,EAAA;;AAE/B,IAAA,MAAM,MAAM,GAAG,OAAO,MAAM,KAAK;U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OAAO,EACP,SAAS,EACT,SAAS,EACT,KAAK,EACL,aAAa,EACb,gBAAgB,EASjB,EAAA;IACC,OAAO;AACL,QAAA,IAAI,EAAE,cAAc;QACpB,aAAa;QACb,OAAO;QACP,SAAS;QACT,SAAS;AACT,QAAA,IAAI,KAAK,IAAI,EAAE,KAAK,EAAE,CAAC;QACvB,IAAI,aAAa,IAAI,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC;QACvD,IAAI,gBAAgB,IAAI,EAAE,kBAAkB,EAAE,gBAAgB,EAAE;KACjE;AACH;AAEA;;AAEG;AACG,SAAU,uBAAuB,CAAC,EACtC,aAAa,EACb,SAAS,EACT,KAAK,EACL,aAAa,EACb,gBAAgB,EAOjB,EAAA;AACC,IAAA,MAAM,YAAY,GAAG;QACnB,CAAA,4BAAA,CAA8B;QAC9B,CAAA,CAAE;AACF,QAAA,CAAA,QAAA,EAAW,aAAa,CAAA,CAAE;AAC1B,QAAA,CAAA,WAAA,EAAc,SAAS,CAAA;KACxB;IAED,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,IAAI,EAAE;AACzC,QAAA,YAAY,CAAC,IAAI,CAAC,UAAU,KAAK,CAAA,CAAE,CAAC;IACtC;IAEA,IAAI,aAAa,EAAE;AACjB,QAAA,YAAY,CAAC,IAAI,CAAC,mBAAmB,aAAa,CAAA,CAAE,CAAC;IACvD;IAEA,IAAI,gBAAgB,EAAE;AACpB,QAAA,YAAY,CAAC,IAAI,CAAC,uBAAuB,gBAAgB,CAAA,CAAE,CAAC;IAC9D;IAEA,YAAY,CAAC,IAAI,CAAC,EAAE,EAAE,EAAE,EAAE,qDAAqD,CAAC;AAChF,IAAA,OAAO,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC;AAChC;;;;"}
@@ -1,19 +0,0 @@
1
- /**
2
- * Loads the browser-only spend permission module.
3
- * Throws an error if called in a server environment.
4
- *
5
- * Both BaseAppAccount and BaseAppPaymentMaker should only run in browser environments
6
- * since they require wallet interaction and browser APIs.
7
- */
8
- async function getSpendPermissionModule() {
9
- // Check if we're in a browser environment
10
- if (typeof window === 'undefined') {
11
- throw new Error('Spend permission operations require browser environment. ' +
12
- 'BaseAppAccount and BaseAppPaymentMaker should only be used client-side in Next.js apps.');
13
- }
14
- // Use browser version since both classes require browser environment
15
- return await import('@base-org/account/spend-permission/browser');
16
- }
17
-
18
- export { getSpendPermissionModule };
19
- //# sourceMappingURL=spendPermissionUtils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"spendPermissionUtils.js","sources":["../src/spendPermissionUtils.ts"],"sourcesContent":[null],"names":[],"mappings":"AAAA;;;;;;AAMG;AACI,eAAe,wBAAwB,GAAA;;AAE5C,IAAA,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;QACjC,MAAM,IAAI,KAAK,CACb,2DAA2D;AAC3D,YAAA,yFAAyF,CAC1F;IACH;;AAGA,IAAA,OAAO,MAAM,OAAO,4CAA4C,CAAC;AACnE;;;;"}
package/dist/storage.js DELETED
@@ -1,11 +0,0 @@
1
- import { JsonCache } from '@atxp/common';
2
- export { BrowserCache, MemoryCache } from '@atxp/common';
3
-
4
- /**
5
- * Type-safe cache wrapper for permission data
6
- */
7
- class IntermediaryCache extends JsonCache {
8
- }
9
-
10
- export { IntermediaryCache };
11
- //# sourceMappingURL=storage.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.js","sources":["../src/storage.ts"],"sourcesContent":[null],"names":[],"mappings":";;;AAcA;;AAEG;AACG,MAAO,iBAAkB,SAAQ,SAAuB,CAAA;AAAG;;;;"}