mirror of
https://github.com/luxwallet/sdk.git
synced 2026-10-30 19:32:37 +00:00
Unified Lux Wallet shared core as a pnpm workspace. Umbrella @luxwallet/sdk re-exports independent modules; connect/SIWx stays in luxwallet/connect (depended on, not duplicated). Packages (packages/): - @luxwallet/chains REAL chain registry, one source of truth, emits chains.json for native. Seeds Lux C (96369/96368/96370), Zoo (200200/200201), Hanzo (36963/36964), Sparkle Pony (36911/36910), Pars (494949/7071) as EVM; X/P/Q/Z Lux families as non-EVM entries (builderStatus todo). - @luxwallet/rpc REAL gateway client: https://<gateway>/v1/rpc/<chainId>, default api.hanzo.ai + brand/per-chain override (getBootnodeRpcUrl semantics). - @luxwallet/crypto facade over luxfi/crypto C core (WASM/UniFFI). Exact CryptoBackend interface + FIPS sizes; impl stubbed (throws 'not yet bound'). NOT @noble/post-quantum. LLM.md documents WASM bind + the on-chain ML-DSA precompile wire format + shared KAT vectors. - @luxwallet/keyring account model + keystore. Keyring store + BIP-44 paths + AccountID framing REAL; crypto calls stubbed via @luxwallet/crypto. - @luxwallet/tx EVM unsigned EIP-1559 builder REAL (viem); P/X/UTXO/SVM typed stubs with builderStatus + LLM.md citing Lux tx types. - @luxwallet/sdk thin umbrella barrel (+ subpath exports). TS project references (tsc --build), vitest per package, react-native + browser/default export conditions. verify-clean gate: no @noble PQ, no GPL, crypto facade dependency-free. pnpm -r typecheck: 6/6 pass. pnpm -r test: 44 pass. pnpm verify: OK.
72 lines
2.2 KiB
JavaScript
72 lines
2.2 KiB
JavaScript
#!/usr/bin/env node
|
|
/**
|
|
* verify-clean — license + dependency hygiene gate.
|
|
*
|
|
* 1. @luxwallet/crypto MUST NOT depend on @noble/post-quantum (or any
|
|
* pure-JS PQ lib). PQ crypto comes from luxfi/crypto (WASM/native) so
|
|
* wallet bytes are bit-identical to chain bytes. See crypto/LLM.md.
|
|
* 2. No package may pull a GPL/AGPL dependency (copyleft is incompatible
|
|
* with our MIT distribution).
|
|
*
|
|
* Pure Node, no deps. Exits non-zero on any violation.
|
|
*/
|
|
import { readFileSync, readdirSync } from "node:fs";
|
|
import { join, dirname } from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
|
|
const root = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
const pkgsDir = join(root, "packages");
|
|
|
|
/** Banned dependency names anywhere in any package.json. */
|
|
const BANNED_DEPS = ["@noble/post-quantum"];
|
|
/** Banned crypto-lib names specifically inside @luxwallet/crypto. */
|
|
const BANNED_IN_CRYPTO = ["@noble/post-quantum", "@noble/curves", "@noble/hashes", "noble-post-quantum"];
|
|
|
|
const errors = [];
|
|
|
|
function depsOf(pkg) {
|
|
return {
|
|
...(pkg.dependencies ?? {}),
|
|
...(pkg.devDependencies ?? {}),
|
|
...(pkg.peerDependencies ?? {}),
|
|
...(pkg.optionalDependencies ?? {}),
|
|
};
|
|
}
|
|
|
|
for (const name of readdirSync(pkgsDir)) {
|
|
const pkgPath = join(pkgsDir, name, "package.json");
|
|
let pkg;
|
|
try {
|
|
pkg = JSON.parse(readFileSync(pkgPath, "utf8"));
|
|
} catch {
|
|
continue;
|
|
}
|
|
const deps = depsOf(pkg);
|
|
|
|
for (const banned of BANNED_DEPS) {
|
|
if (banned in deps) {
|
|
errors.push(`${pkg.name}: forbidden dependency ${banned}`);
|
|
}
|
|
}
|
|
|
|
if (pkg.name === "@luxwallet/crypto") {
|
|
for (const banned of BANNED_IN_CRYPTO) {
|
|
if (banned in deps) {
|
|
errors.push(`${pkg.name}: must not import ${banned} (use luxfi/crypto WASM/native)`);
|
|
}
|
|
}
|
|
// crypto is a zero-runtime-dependency facade.
|
|
const runtime = Object.keys(pkg.dependencies ?? {});
|
|
if (runtime.length > 0) {
|
|
errors.push(`${pkg.name}: expected zero runtime deps, found ${runtime.join(", ")}`);
|
|
}
|
|
}
|
|
}
|
|
|
|
if (errors.length > 0) {
|
|
console.error("verify-clean FAILED:");
|
|
for (const e of errors) console.error(" - " + e);
|
|
process.exit(1);
|
|
}
|
|
console.log("verify-clean OK: no @noble PQ, no GPL, crypto facade is dependency-free.");
|