@veridex/sdk 1.0.0-beta.21 → 1.0.0-beta.22

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": "@veridex/sdk",
3
- "version": "1.0.0-beta.21",
3
+ "version": "1.0.0-beta.22",
4
4
  "description": "Veridex Protocol SDK - Client library for Passkey-based cross-chain authentication",
5
5
  "author": "Veridex Protocol <team@veridex.network>",
6
6
  "license": "MIT",
@@ -18,6 +18,7 @@
18
18
  "sideEffects": false,
19
19
  "files": [
20
20
  "dist",
21
+ "scripts",
21
22
  "README.md",
22
23
  "CHANGELOG.md",
23
24
  "LICENSE"
@@ -95,6 +96,7 @@
95
96
  }
96
97
  },
97
98
  "scripts": {
99
+ "postinstall": "node scripts/patch-noble-curves.js",
98
100
  "build": "tsup",
99
101
  "dev": "tsup --watch",
100
102
  "test": "vitest run",
@@ -102,13 +104,15 @@
102
104
  "test:coverage": "vitest run --coverage",
103
105
  "lint": "eslint src/**/*.ts",
104
106
  "format": "prettier --write src/**/*.ts",
105
- "prepublishOnly": "npm run build && npm run test",
107
+ "prepublishOnly": "bun run build",
106
108
  "release:public": "cd ../.. && git subtree push --prefix=packages/sdk sdk-public main"
107
109
  },
108
110
  "dependencies": {
109
- "@aptos-labs/ts-sdk": "^5.2.0",
111
+ "@aptos-labs/ts-sdk": "^6.0.0",
112
+ "@noble/curves": "^1.9.0",
110
113
  "@mysten/bcs": "1.9.2",
111
114
  "@mysten/sui": "^1.0.0",
115
+ "@noble/hashes": "^1.5.0",
112
116
  "@simplewebauthn/browser": "^9.0.1",
113
117
  "@solana/spl-token": "^0.4.6",
114
118
  "@solana/web3.js": "^1.95.4",
@@ -0,0 +1,78 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Patches @noble/curves to add nist.js export.
4
+ *
5
+ * @aptos-labs/ts-sdk imports from '@noble/curves/nist.js' but
6
+ * @noble/curves@1.2.0 doesn't export it. This script:
7
+ * 1. Creates nist.js (CJS) and esm/nist.js (ESM) shim files
8
+ * 2. Adds ./nist.js and ./nist to the package.json exports map
9
+ */
10
+ const fs = require('fs');
11
+ const path = require('path');
12
+
13
+ function findNobleDir() {
14
+ // Walk up from this script to find node_modules/@noble/curves
15
+ let dir = __dirname;
16
+ for (let i = 0; i < 10; i++) {
17
+ const candidate = path.join(dir, 'node_modules', '@noble', 'curves');
18
+ if (fs.existsSync(path.join(candidate, 'package.json'))) {
19
+ return candidate;
20
+ }
21
+ dir = path.dirname(dir);
22
+ }
23
+ return null;
24
+ }
25
+
26
+ const nobleDir = findNobleDir();
27
+ if (!nobleDir) {
28
+ console.log('[patch-noble-curves] @noble/curves not found, skipping');
29
+ process.exit(0);
30
+ }
31
+
32
+ const pkgPath = path.join(nobleDir, 'package.json');
33
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf8'));
34
+
35
+ // Check if already patched
36
+ if (pkg.exports && pkg.exports['./nist.js']) {
37
+ console.log('[patch-noble-curves] Already patched, skipping');
38
+ process.exit(0);
39
+ }
40
+
41
+ // Create CJS shim
42
+ const cjsShim = `"use strict";
43
+ Object.defineProperty(exports, "__esModule", { value: true });
44
+ const p256_1 = require("./p256");
45
+ const p384_1 = require("./p384");
46
+ const p521_1 = require("./p521");
47
+ exports.p256 = p256_1.p256;
48
+ exports.p384 = p384_1.p384;
49
+ exports.p521 = p521_1.p521;
50
+ `;
51
+ fs.writeFileSync(path.join(nobleDir, 'nist.js'), cjsShim);
52
+
53
+ // Create ESM shim if esm dir exists
54
+ const esmDir = path.join(nobleDir, 'esm');
55
+ if (fs.existsSync(esmDir)) {
56
+ const esmShim = `export { p256 } from './p256.js';
57
+ export { p384 } from './p384.js';
58
+ export { p521 } from './p521.js';
59
+ `;
60
+ fs.writeFileSync(path.join(esmDir, 'nist.js'), esmShim);
61
+ }
62
+
63
+ // Patch exports
64
+ if (pkg.exports) {
65
+ pkg.exports['./nist.js'] = {
66
+ types: './p256.d.ts',
67
+ import: './esm/nist.js',
68
+ default: './nist.js'
69
+ };
70
+ pkg.exports['./nist'] = {
71
+ types: './p256.d.ts',
72
+ import: './esm/nist.js',
73
+ default: './nist.js'
74
+ };
75
+ fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + '\n');
76
+ }
77
+
78
+ console.log('[patch-noble-curves] Patched @noble/curves with nist.js exports');