w3pk 0.10.4 → 0.10.5
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/README.md +0 -49
- package/dist/index.d.mts +8 -106
- package/dist/index.d.ts +8 -106
- package/dist/index.js +33 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +33 -60
- package/dist/index.mjs.map +1 -1
- package/docs/API_REFERENCE.md +8 -207
- package/docs/BROWSER_COMPATIBILITY.md +15 -2
- package/docs/INTEGRATION_GUIDELINES.md +25 -303
- package/docs/SECURITY.md +0 -136
- package/docs/notes/old-computer.md +99 -0
- package/package.json +25 -52
- package/dist/inspect/browser.d.mts +0 -106
- package/dist/inspect/browser.d.ts +0 -106
- package/dist/inspect/browser.js +0 -194
- package/dist/inspect/browser.js.map +0 -1
- package/dist/inspect/browser.mjs +0 -173
- package/dist/inspect/browser.mjs.map +0 -1
- package/dist/inspect/index.d.mts +0 -1
- package/dist/inspect/index.d.ts +0 -1
- package/dist/inspect/index.js +0 -196
- package/dist/inspect/index.js.map +0 -1
- package/dist/inspect/index.mjs +0 -173
- package/dist/inspect/index.mjs.map +0 -1
- package/dist/inspect/node.d.mts +0 -112
- package/dist/inspect/node.d.ts +0 -112
- package/dist/inspect/node.js +0 -287
- package/dist/inspect/node.js.map +0 -1
- package/dist/inspect/node.mjs +0 -251
- package/dist/inspect/node.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -59,7 +59,6 @@ const endpoints = await w3pk.getEndpoints(1)
|
|
|
59
59
|
- EIP-7951 PRIMARY mode (P-256 passkey signing)
|
|
60
60
|
- Build verification (IPFS CID hashing + DAO-maintained onchain registry)
|
|
61
61
|
- Three-layer backup & recovery (passkey sync, encrypted backups, social recovery)
|
|
62
|
-
- AI-powered host app inspection
|
|
63
62
|
|
|
64
63
|
## API
|
|
65
64
|
|
|
@@ -428,53 +427,6 @@ console.log('Onchain CID:', onchainCid)
|
|
|
428
427
|
console.log('Verified:', isValid ? '✅' : '❌')
|
|
429
428
|
```
|
|
430
429
|
|
|
431
|
-
### Security Inspection
|
|
432
|
-
|
|
433
|
-
> **⚠️ Privacy Notice:** This optional feature sends application source code to an external API (Rukh) for AI analysis. User IP address will be visible to the API server.
|
|
434
|
-
|
|
435
|
-
Analyze web3 applications to understand their transaction and signing methods:
|
|
436
|
-
|
|
437
|
-
**Browser (analyze current page):**
|
|
438
|
-
```typescript
|
|
439
|
-
import { inspect, inspectNow } from 'w3pk'
|
|
440
|
-
|
|
441
|
-
// Full inspection with custom options
|
|
442
|
-
const result = await inspect({
|
|
443
|
-
appUrl: 'https://example.com',
|
|
444
|
-
rukhUrl: 'https://rukh.w3hc.org',
|
|
445
|
-
model: 'anthropic',
|
|
446
|
-
focusMode: 'transactions'
|
|
447
|
-
})
|
|
448
|
-
console.log(result.report)
|
|
449
|
-
|
|
450
|
-
// Quick console inspection
|
|
451
|
-
await inspectNow() // Logs report directly to console
|
|
452
|
-
```
|
|
453
|
-
|
|
454
|
-
**Note:** Inspection API calls are sponsored by the [W3HC (Web3 Hackers Collective)](https://w3hc.org).
|
|
455
|
-
|
|
456
|
-
**Node.js (analyze local files):**
|
|
457
|
-
```typescript
|
|
458
|
-
import { inspect, gatherCode } from 'w3pk/inspect/node'
|
|
459
|
-
|
|
460
|
-
// Generate security report via Rukh API
|
|
461
|
-
const report = await inspect(
|
|
462
|
-
'../my-dapp', // App path
|
|
463
|
-
'https://rukh.w3hc.org', // Rukh API URL
|
|
464
|
-
'w3pk', // Context
|
|
465
|
-
'anthropic', // Model
|
|
466
|
-
'transactions' // Focus mode
|
|
467
|
-
)
|
|
468
|
-
|
|
469
|
-
// Or just gather code for analysis
|
|
470
|
-
const result = await gatherCode({
|
|
471
|
-
appPath: '../my-dapp',
|
|
472
|
-
focusMode: 'transactions',
|
|
473
|
-
maxFileSizeKB: 500
|
|
474
|
-
})
|
|
475
|
-
console.log(`Analyzed ${result.includedFiles.length} files`)
|
|
476
|
-
```
|
|
477
|
-
|
|
478
430
|
## Security & Verification
|
|
479
431
|
|
|
480
432
|
### Onchain Build Registry
|
|
@@ -493,7 +445,6 @@ Host applications should verify their installed W3PK build against this registry
|
|
|
493
445
|
- [Integration Guidelines](./docs/INTEGRATION_GUIDELINES.md)
|
|
494
446
|
- [API Reference](./docs/API_REFERENCE.md)
|
|
495
447
|
- [Build Verification](./docs/BUILD_VERIFICATION.md)
|
|
496
|
-
- [Security Inspection](./docs/INSPECTION.md)
|
|
497
448
|
- [EIP-7951](./docs/EIP-7951.md)
|
|
498
449
|
- [Security Architecture](./docs/SECURITY.md)
|
|
499
450
|
- [Post-Quantum Cryptography](./docs/POST_QUANTUM.md) - Quantum-safe migration roadmap
|
package/dist/index.d.mts
CHANGED
|
@@ -537,6 +537,13 @@ interface Web3PasskeyConfig {
|
|
|
537
537
|
* Requires: snarkjs, circomlibjs
|
|
538
538
|
*/
|
|
539
539
|
zkProofs?: ZKProofConfig;
|
|
540
|
+
/**
|
|
541
|
+
* WebAuthn user verification for login, registration and signing
|
|
542
|
+
* (default: 'required'). With 'preferred', authenticators that can skip
|
|
543
|
+
* the biometric/PIN check (security keys, unlocked password managers)
|
|
544
|
+
* sign in with one click. PRF-derived secrets always require it.
|
|
545
|
+
*/
|
|
546
|
+
userVerification?: 'required' | 'preferred';
|
|
540
547
|
}
|
|
541
548
|
|
|
542
549
|
/**
|
|
@@ -2230,111 +2237,6 @@ declare function getChainById(chainId: number, options?: ChainlistOptions): Prom
|
|
|
2230
2237
|
*/
|
|
2231
2238
|
declare function clearCache(): void;
|
|
2232
2239
|
|
|
2233
|
-
/**
|
|
2234
|
-
* Browser Inspection Module
|
|
2235
|
-
*
|
|
2236
|
-
* Provides client-side code inspection capabilities for analyzing running web3 applications.
|
|
2237
|
-
* Fetches JavaScript sources from the current page and analyzes transaction/signing patterns
|
|
2238
|
-
* to generate security reports via the Rukh API.
|
|
2239
|
-
*
|
|
2240
|
-
* This module is designed to be used directly in the browser console or embedded in
|
|
2241
|
-
* web applications to help end-users understand the security posture of the apps they use.
|
|
2242
|
-
*
|
|
2243
|
-
* @module inspect/browser
|
|
2244
|
-
*/
|
|
2245
|
-
/**
|
|
2246
|
-
* Configuration options for browser-based application inspection
|
|
2247
|
-
*/
|
|
2248
|
-
interface BrowserInspectOptions {
|
|
2249
|
-
/**
|
|
2250
|
-
* The origin/URL of the app to inspect
|
|
2251
|
-
* @default window.location.origin
|
|
2252
|
-
*/
|
|
2253
|
-
appUrl?: string;
|
|
2254
|
-
/**
|
|
2255
|
-
* Rukh API endpoint
|
|
2256
|
-
* @default 'https://rukh.w3hc.org'
|
|
2257
|
-
*/
|
|
2258
|
-
rukhUrl?: string;
|
|
2259
|
-
/**
|
|
2260
|
-
* Context to use for analysis
|
|
2261
|
-
* @default 'w3pk'
|
|
2262
|
-
*/
|
|
2263
|
-
context?: string;
|
|
2264
|
-
/**
|
|
2265
|
-
* AI model to use
|
|
2266
|
-
* @default 'anthropic'
|
|
2267
|
-
*/
|
|
2268
|
-
model?: "anthropic" | "mistral" | "openai";
|
|
2269
|
-
/**
|
|
2270
|
-
* Focus mode for analysis
|
|
2271
|
-
* @default 'transactions'
|
|
2272
|
-
*/
|
|
2273
|
-
focusMode?: "transactions" | "all";
|
|
2274
|
-
/**
|
|
2275
|
-
* Maximum total size in KB for all collected code (prevents exceeding API token limits)
|
|
2276
|
-
* @default 100
|
|
2277
|
-
*/
|
|
2278
|
-
maxTotalSizeKB?: number;
|
|
2279
|
-
}
|
|
2280
|
-
/**
|
|
2281
|
-
* Result of a browser-based inspection
|
|
2282
|
-
*/
|
|
2283
|
-
interface BrowserInspectResult {
|
|
2284
|
-
/**
|
|
2285
|
-
* The security report markdown generated by Rukh API
|
|
2286
|
-
*/
|
|
2287
|
-
report: string;
|
|
2288
|
-
/**
|
|
2289
|
-
* List of JavaScript file paths that were analyzed
|
|
2290
|
-
*/
|
|
2291
|
-
analyzedFiles: string[];
|
|
2292
|
-
/**
|
|
2293
|
-
* The application URL that was inspected
|
|
2294
|
-
*/
|
|
2295
|
-
appUrl: string;
|
|
2296
|
-
}
|
|
2297
|
-
/**
|
|
2298
|
-
* Inspects the currently running web application and returns a security report
|
|
2299
|
-
*
|
|
2300
|
-
* This function can be called by end-users in their browser console to analyze
|
|
2301
|
-
* the security of the web application they're currently using.
|
|
2302
|
-
*
|
|
2303
|
-
* @param options - Configuration options
|
|
2304
|
-
* @returns A security report analyzing transaction and signing methods
|
|
2305
|
-
*
|
|
2306
|
-
* @example
|
|
2307
|
-
* ```typescript
|
|
2308
|
-
* // In browser console or app code:
|
|
2309
|
-
* import { inspect } from 'w3pk';
|
|
2310
|
-
*
|
|
2311
|
-
* const report = await inspect();
|
|
2312
|
-
* console.log(report.report);
|
|
2313
|
-
* ```
|
|
2314
|
-
*
|
|
2315
|
-
* @example
|
|
2316
|
-
* ```typescript
|
|
2317
|
-
* // With custom options:
|
|
2318
|
-
* const report = await inspect({
|
|
2319
|
-
* appUrl: 'https://w3pk.w3hc.org',
|
|
2320
|
-
* model: 'anthropic',
|
|
2321
|
-
* focusMode: 'transactions'
|
|
2322
|
-
* });
|
|
2323
|
-
* ```
|
|
2324
|
-
*/
|
|
2325
|
-
declare function inspect(options?: BrowserInspectOptions): Promise<BrowserInspectResult>;
|
|
2326
|
-
/**
|
|
2327
|
-
* Quick inspection helper that logs the report to console
|
|
2328
|
-
* Perfect for use in browser DevTools console
|
|
2329
|
-
*
|
|
2330
|
-
* @example
|
|
2331
|
-
* ```javascript
|
|
2332
|
-
* // In browser console:
|
|
2333
|
-
* await w3pk.inspectNow()
|
|
2334
|
-
* ```
|
|
2335
|
-
*/
|
|
2336
|
-
declare function inspectNow(options?: BrowserInspectOptions): Promise<void>;
|
|
2337
|
-
|
|
2338
2240
|
interface MLKemKeypair {
|
|
2339
2241
|
publicKey: Uint8Array;
|
|
2340
2242
|
privateKey: Uint8Array;
|
|
@@ -2437,4 +2339,4 @@ declare function mlkemDecryptWithKey(payload: EncryptedPayload, privateKey: stri
|
|
|
2437
2339
|
|
|
2438
2340
|
declare function createWeb3Passkey(config?: Web3PasskeyConfig): Web3Passkey;
|
|
2439
2341
|
|
|
2440
|
-
export { ApiError, AuthenticationError, type BackupMethod, type BackupStatus,
|
|
2342
|
+
export { ApiError, AuthenticationError, type BackupMethod, type BackupStatus, CryptoError, DEFAULT_MODE, DEFAULT_TAG, type DeviceInfo, type EIP1193Provider, type EIP7702Authorization, type EncryptedBackupInfo, type EncryptedPayload, type Guardian, type GuardianInvite, type MLKemKeypair, type PasskeySelectionResult, type PrfSecret, PrfUnsupportedError, type QRBackupOptions, type RecoveryProgress, type RecoveryScenario, type RecoveryShare, RecoverySimulator, RegistrationError, type SecurityScore, type SignAuthorizationParams, type SimulationResult, type SiweMessage, type SocialRecoveryConfig, SocialRecoveryManager, type StealthAddressConfig, StealthAddressModule, type StealthAddressResult, type StealthKeys, StorageError, SyncBootstrapError, type SyncBootstrapReason, type SyncCapabilities, SyncRequiredError, type SyncStatus, type SyncVault, type UserInfo, WalletError, type WalletInfo, WalletMissingError, Web3Passkey, type Web3PasskeyConfig, Web3PasskeyError, arrayBufferToBase64Url, assertEthereumAddress, assertMnemonic, assertUsername, authenticateWithPasskey, base64ToArrayBuffer, base64UrlDecode, base64UrlToArrayBuffer, canControlStealthAddress, checkStealthAddress, clearCache, computeStealthPrivateKey, createSiweMessage, createWalletFromMnemonic, createWeb3Passkey, createWeb3Passkey as default, deriveAddressFromP256PublicKey, deriveIndexFromOriginModeAndTag, deriveMLKemKeypair, deriveStealthKeys, deriveWalletFromMnemonic, detectWalletProvider, encodeEIP7702AuthorizationMessage, extractRS, generateBIP39Wallet, generateSiweNonce, generateStealthAddress, getAllChains, getAllTopics, getChainById, getCurrentBuildHash, getCurrentOrigin, getDefaultProvider, getEndpoints, getExplainer, getOriginSpecificAddress, getPackageVersion, getW3pkBuildHash, hashEIP7702AuthorizationMessage, isStrongPassword, mlkemDecrypt, mlkemDecryptWithKey, mlkemEncrypt, mlkemEncryptWithKey, normalizeOrigin, parseSiweMessage, promptPasskeySelection, requestExternalWalletAuthorization, safeAtob, safeBtoa, searchExplainers, supportsEIP7702Authorization, validateEthereumAddress, validateMnemonic, validateSiweMessage, validateUsername, verifyBuildHash, verifyEIP7702Authorization, verifySiweSignature };
|
package/dist/index.d.ts
CHANGED
|
@@ -537,6 +537,13 @@ interface Web3PasskeyConfig {
|
|
|
537
537
|
* Requires: snarkjs, circomlibjs
|
|
538
538
|
*/
|
|
539
539
|
zkProofs?: ZKProofConfig;
|
|
540
|
+
/**
|
|
541
|
+
* WebAuthn user verification for login, registration and signing
|
|
542
|
+
* (default: 'required'). With 'preferred', authenticators that can skip
|
|
543
|
+
* the biometric/PIN check (security keys, unlocked password managers)
|
|
544
|
+
* sign in with one click. PRF-derived secrets always require it.
|
|
545
|
+
*/
|
|
546
|
+
userVerification?: 'required' | 'preferred';
|
|
540
547
|
}
|
|
541
548
|
|
|
542
549
|
/**
|
|
@@ -2230,111 +2237,6 @@ declare function getChainById(chainId: number, options?: ChainlistOptions): Prom
|
|
|
2230
2237
|
*/
|
|
2231
2238
|
declare function clearCache(): void;
|
|
2232
2239
|
|
|
2233
|
-
/**
|
|
2234
|
-
* Browser Inspection Module
|
|
2235
|
-
*
|
|
2236
|
-
* Provides client-side code inspection capabilities for analyzing running web3 applications.
|
|
2237
|
-
* Fetches JavaScript sources from the current page and analyzes transaction/signing patterns
|
|
2238
|
-
* to generate security reports via the Rukh API.
|
|
2239
|
-
*
|
|
2240
|
-
* This module is designed to be used directly in the browser console or embedded in
|
|
2241
|
-
* web applications to help end-users understand the security posture of the apps they use.
|
|
2242
|
-
*
|
|
2243
|
-
* @module inspect/browser
|
|
2244
|
-
*/
|
|
2245
|
-
/**
|
|
2246
|
-
* Configuration options for browser-based application inspection
|
|
2247
|
-
*/
|
|
2248
|
-
interface BrowserInspectOptions {
|
|
2249
|
-
/**
|
|
2250
|
-
* The origin/URL of the app to inspect
|
|
2251
|
-
* @default window.location.origin
|
|
2252
|
-
*/
|
|
2253
|
-
appUrl?: string;
|
|
2254
|
-
/**
|
|
2255
|
-
* Rukh API endpoint
|
|
2256
|
-
* @default 'https://rukh.w3hc.org'
|
|
2257
|
-
*/
|
|
2258
|
-
rukhUrl?: string;
|
|
2259
|
-
/**
|
|
2260
|
-
* Context to use for analysis
|
|
2261
|
-
* @default 'w3pk'
|
|
2262
|
-
*/
|
|
2263
|
-
context?: string;
|
|
2264
|
-
/**
|
|
2265
|
-
* AI model to use
|
|
2266
|
-
* @default 'anthropic'
|
|
2267
|
-
*/
|
|
2268
|
-
model?: "anthropic" | "mistral" | "openai";
|
|
2269
|
-
/**
|
|
2270
|
-
* Focus mode for analysis
|
|
2271
|
-
* @default 'transactions'
|
|
2272
|
-
*/
|
|
2273
|
-
focusMode?: "transactions" | "all";
|
|
2274
|
-
/**
|
|
2275
|
-
* Maximum total size in KB for all collected code (prevents exceeding API token limits)
|
|
2276
|
-
* @default 100
|
|
2277
|
-
*/
|
|
2278
|
-
maxTotalSizeKB?: number;
|
|
2279
|
-
}
|
|
2280
|
-
/**
|
|
2281
|
-
* Result of a browser-based inspection
|
|
2282
|
-
*/
|
|
2283
|
-
interface BrowserInspectResult {
|
|
2284
|
-
/**
|
|
2285
|
-
* The security report markdown generated by Rukh API
|
|
2286
|
-
*/
|
|
2287
|
-
report: string;
|
|
2288
|
-
/**
|
|
2289
|
-
* List of JavaScript file paths that were analyzed
|
|
2290
|
-
*/
|
|
2291
|
-
analyzedFiles: string[];
|
|
2292
|
-
/**
|
|
2293
|
-
* The application URL that was inspected
|
|
2294
|
-
*/
|
|
2295
|
-
appUrl: string;
|
|
2296
|
-
}
|
|
2297
|
-
/**
|
|
2298
|
-
* Inspects the currently running web application and returns a security report
|
|
2299
|
-
*
|
|
2300
|
-
* This function can be called by end-users in their browser console to analyze
|
|
2301
|
-
* the security of the web application they're currently using.
|
|
2302
|
-
*
|
|
2303
|
-
* @param options - Configuration options
|
|
2304
|
-
* @returns A security report analyzing transaction and signing methods
|
|
2305
|
-
*
|
|
2306
|
-
* @example
|
|
2307
|
-
* ```typescript
|
|
2308
|
-
* // In browser console or app code:
|
|
2309
|
-
* import { inspect } from 'w3pk';
|
|
2310
|
-
*
|
|
2311
|
-
* const report = await inspect();
|
|
2312
|
-
* console.log(report.report);
|
|
2313
|
-
* ```
|
|
2314
|
-
*
|
|
2315
|
-
* @example
|
|
2316
|
-
* ```typescript
|
|
2317
|
-
* // With custom options:
|
|
2318
|
-
* const report = await inspect({
|
|
2319
|
-
* appUrl: 'https://w3pk.w3hc.org',
|
|
2320
|
-
* model: 'anthropic',
|
|
2321
|
-
* focusMode: 'transactions'
|
|
2322
|
-
* });
|
|
2323
|
-
* ```
|
|
2324
|
-
*/
|
|
2325
|
-
declare function inspect(options?: BrowserInspectOptions): Promise<BrowserInspectResult>;
|
|
2326
|
-
/**
|
|
2327
|
-
* Quick inspection helper that logs the report to console
|
|
2328
|
-
* Perfect for use in browser DevTools console
|
|
2329
|
-
*
|
|
2330
|
-
* @example
|
|
2331
|
-
* ```javascript
|
|
2332
|
-
* // In browser console:
|
|
2333
|
-
* await w3pk.inspectNow()
|
|
2334
|
-
* ```
|
|
2335
|
-
*/
|
|
2336
|
-
declare function inspectNow(options?: BrowserInspectOptions): Promise<void>;
|
|
2337
|
-
|
|
2338
2240
|
interface MLKemKeypair {
|
|
2339
2241
|
publicKey: Uint8Array;
|
|
2340
2242
|
privateKey: Uint8Array;
|
|
@@ -2437,4 +2339,4 @@ declare function mlkemDecryptWithKey(payload: EncryptedPayload, privateKey: stri
|
|
|
2437
2339
|
|
|
2438
2340
|
declare function createWeb3Passkey(config?: Web3PasskeyConfig): Web3Passkey;
|
|
2439
2341
|
|
|
2440
|
-
export { ApiError, AuthenticationError, type BackupMethod, type BackupStatus,
|
|
2342
|
+
export { ApiError, AuthenticationError, type BackupMethod, type BackupStatus, CryptoError, DEFAULT_MODE, DEFAULT_TAG, type DeviceInfo, type EIP1193Provider, type EIP7702Authorization, type EncryptedBackupInfo, type EncryptedPayload, type Guardian, type GuardianInvite, type MLKemKeypair, type PasskeySelectionResult, type PrfSecret, PrfUnsupportedError, type QRBackupOptions, type RecoveryProgress, type RecoveryScenario, type RecoveryShare, RecoverySimulator, RegistrationError, type SecurityScore, type SignAuthorizationParams, type SimulationResult, type SiweMessage, type SocialRecoveryConfig, SocialRecoveryManager, type StealthAddressConfig, StealthAddressModule, type StealthAddressResult, type StealthKeys, StorageError, SyncBootstrapError, type SyncBootstrapReason, type SyncCapabilities, SyncRequiredError, type SyncStatus, type SyncVault, type UserInfo, WalletError, type WalletInfo, WalletMissingError, Web3Passkey, type Web3PasskeyConfig, Web3PasskeyError, arrayBufferToBase64Url, assertEthereumAddress, assertMnemonic, assertUsername, authenticateWithPasskey, base64ToArrayBuffer, base64UrlDecode, base64UrlToArrayBuffer, canControlStealthAddress, checkStealthAddress, clearCache, computeStealthPrivateKey, createSiweMessage, createWalletFromMnemonic, createWeb3Passkey, createWeb3Passkey as default, deriveAddressFromP256PublicKey, deriveIndexFromOriginModeAndTag, deriveMLKemKeypair, deriveStealthKeys, deriveWalletFromMnemonic, detectWalletProvider, encodeEIP7702AuthorizationMessage, extractRS, generateBIP39Wallet, generateSiweNonce, generateStealthAddress, getAllChains, getAllTopics, getChainById, getCurrentBuildHash, getCurrentOrigin, getDefaultProvider, getEndpoints, getExplainer, getOriginSpecificAddress, getPackageVersion, getW3pkBuildHash, hashEIP7702AuthorizationMessage, isStrongPassword, mlkemDecrypt, mlkemDecryptWithKey, mlkemEncrypt, mlkemEncryptWithKey, normalizeOrigin, parseSiweMessage, promptPasskeySelection, requestExternalWalletAuthorization, safeAtob, safeBtoa, searchExplainers, supportsEIP7702Authorization, validateEthereumAddress, validateMnemonic, validateSiweMessage, validateUsername, verifyBuildHash, verifyEIP7702Authorization, verifySiweSignature };
|