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/docs/SECURITY.md
CHANGED
|
@@ -3614,142 +3614,6 @@ console.log('Write this down:', mnemonic)
|
|
|
3614
3614
|
- **MetaMask:** Attacker needs password. Weak passwords can be brute-forced. Strong passwords with vault encryption are resistant.
|
|
3615
3615
|
- **Hardware Wallet:** Private keys in secure element. Cannot be extracted even with physical access (except advanced hardware attacks).
|
|
3616
3616
|
|
|
3617
|
-
## Security Inspection Tools
|
|
3618
|
-
|
|
3619
|
-
w3pk includes built-in security inspection capabilities to help developers and end-users analyze web3 applications and understand their transaction and signing methods.
|
|
3620
|
-
|
|
3621
|
-
### Why Inspection Matters
|
|
3622
|
-
|
|
3623
|
-
Many users interact with web3 applications without fully understanding:
|
|
3624
|
-
- What transactions the app can initiate
|
|
3625
|
-
- Which signing methods are used
|
|
3626
|
-
- How their private keys or wallets are being accessed
|
|
3627
|
-
- What permissions they're granting
|
|
3628
|
-
|
|
3629
|
-
The w3pk inspection tools provide **transparency** by analyzing application code and generating detailed security reports.
|
|
3630
|
-
|
|
3631
|
-
### Browser-Based Inspection
|
|
3632
|
-
|
|
3633
|
-
End-users can inspect any web3 application directly from their browser console:
|
|
3634
|
-
|
|
3635
|
-
```typescript
|
|
3636
|
-
import { inspectNow } from 'w3pk'
|
|
3637
|
-
|
|
3638
|
-
// Run inspection and view report in console
|
|
3639
|
-
await inspectNow()
|
|
3640
|
-
```
|
|
3641
|
-
|
|
3642
|
-
**What it does:**
|
|
3643
|
-
- Fetches all JavaScript files from the current page
|
|
3644
|
-
- Extracts transaction and signing-related code snippets
|
|
3645
|
-
- Sends code to Rukh API for AI-powered analysis
|
|
3646
|
-
- Generates a security report listing all methods
|
|
3647
|
-
|
|
3648
|
-
**Use cases:**
|
|
3649
|
-
- End-users auditing dApps before connecting wallets
|
|
3650
|
-
- Security researchers analyzing application behavior
|
|
3651
|
-
- Developers verifying their own implementations
|
|
3652
|
-
|
|
3653
|
-
### Node.js-Based Inspection
|
|
3654
|
-
|
|
3655
|
-
Developers can scan local application files during development or in CI/CD:
|
|
3656
|
-
|
|
3657
|
-
```typescript
|
|
3658
|
-
import { inspect } from 'w3pk/inspect/node'
|
|
3659
|
-
|
|
3660
|
-
const report = await inspect(
|
|
3661
|
-
'../my-dapp',
|
|
3662
|
-
'https://rukh.w3hc.org',
|
|
3663
|
-
'w3pk',
|
|
3664
|
-
'anthropic',
|
|
3665
|
-
'transactions'
|
|
3666
|
-
)
|
|
3667
|
-
```
|
|
3668
|
-
|
|
3669
|
-
**What it does:**
|
|
3670
|
-
- Recursively scans application source files
|
|
3671
|
-
- Filters for transaction-relevant code
|
|
3672
|
-
- Generates comprehensive markdown documentation
|
|
3673
|
-
- Sends to Rukh API for security analysis
|
|
3674
|
-
|
|
3675
|
-
**Use cases:**
|
|
3676
|
-
- Pre-deployment security audits
|
|
3677
|
-
- CI/CD security checks
|
|
3678
|
-
- Documentation generation
|
|
3679
|
-
- Code review assistance
|
|
3680
|
-
|
|
3681
|
-
### Focus Modes
|
|
3682
|
-
|
|
3683
|
-
Both browser and Node.js inspection support focus modes:
|
|
3684
|
-
|
|
3685
|
-
**`transactions` mode (default):**
|
|
3686
|
-
- Only analyzes transaction and signing code
|
|
3687
|
-
- Filters for keywords: `signMessage`, `sendTransaction`, `Contract`, `authorization`, etc.
|
|
3688
|
-
- Faster analysis, more focused reports
|
|
3689
|
-
- Recommended for security audits
|
|
3690
|
-
|
|
3691
|
-
**`all` mode:**
|
|
3692
|
-
- Analyzes all application code
|
|
3693
|
-
- Comprehensive but slower
|
|
3694
|
-
- May include irrelevant code in report
|
|
3695
|
-
- Use for complete application analysis
|
|
3696
|
-
|
|
3697
|
-
### Privacy and Security
|
|
3698
|
-
|
|
3699
|
-
**Data handling:**
|
|
3700
|
-
- Code is sent to Rukh API for analysis
|
|
3701
|
-
- Rukh uses AI models (Anthropic Claude, Mistral, OpenAI)
|
|
3702
|
-
- No code is stored permanently by default
|
|
3703
|
-
- Reports are generated on-demand
|
|
3704
|
-
- API calls are sponsored by the [W3HC (Web3 Hackers Collective)](https://w3hc.org)
|
|
3705
|
-
|
|
3706
|
-
**Recommendations:**
|
|
3707
|
-
- Use self-hosted Rukh instance for sensitive code
|
|
3708
|
-
- Review reports before sharing externally
|
|
3709
|
-
- Inspection tools are read-only (no modifications)
|
|
3710
|
-
- Browser inspection requires CORS-enabled scripts
|
|
3711
|
-
|
|
3712
|
-
### Integration with Development Workflow
|
|
3713
|
-
|
|
3714
|
-
```bash
|
|
3715
|
-
# Add to package.json scripts
|
|
3716
|
-
{
|
|
3717
|
-
"scripts": {
|
|
3718
|
-
"security:inspect": "tsx scripts/inspect.ts"
|
|
3719
|
-
}
|
|
3720
|
-
}
|
|
3721
|
-
```
|
|
3722
|
-
|
|
3723
|
-
```typescript
|
|
3724
|
-
// scripts/inspect.ts
|
|
3725
|
-
import { inspect } from 'w3pk/inspect/node'
|
|
3726
|
-
import fs from 'fs/promises'
|
|
3727
|
-
|
|
3728
|
-
const report = await inspect(
|
|
3729
|
-
process.cwd(),
|
|
3730
|
-
'https://rukh.w3hc.org',
|
|
3731
|
-
'w3pk',
|
|
3732
|
-
'anthropic',
|
|
3733
|
-
'transactions'
|
|
3734
|
-
)
|
|
3735
|
-
|
|
3736
|
-
await fs.writeFile('SECURITY_REPORT.md', report)
|
|
3737
|
-
console.log('✅ Security report generated')
|
|
3738
|
-
```
|
|
3739
|
-
|
|
3740
|
-
### Empowering End-Users
|
|
3741
|
-
|
|
3742
|
-
The browser inspection tools are designed for non-technical users:
|
|
3743
|
-
|
|
3744
|
-
```javascript
|
|
3745
|
-
// Users can run this in any browser console
|
|
3746
|
-
await w3pk.inspectNow()
|
|
3747
|
-
```
|
|
3748
|
-
|
|
3749
|
-
This democratizes security analysis and helps users make informed decisions about which dApps to trust.
|
|
3750
|
-
|
|
3751
|
-
---
|
|
3752
|
-
|
|
3753
3617
|
## Post-Quantum Cryptography
|
|
3754
3618
|
|
|
3755
3619
|
w3pk is preparing for the future quantum computing threat. While quantum computers capable of breaking current cryptography (ECDSA, secp256k1) are estimated to be **10-15 years away**, we have a comprehensive migration roadmap in place.
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Passkey access from old computers
|
|
3
|
+
description: Spec for letting people on old computers register and log in to w3pk-based apps such as Genji, with a single click where their authenticator allows it.
|
|
4
|
+
date: 2026-10-26
|
|
5
|
+
locale: en_US
|
|
6
|
+
author: Julien Béranger
|
|
7
|
+
model: Claude Opus 5.5
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Goal
|
|
11
|
+
|
|
12
|
+
People on old computers can create a w3pk wallet and log in. Where their authenticator allows it, signing in takes one click with no biometric prompt.
|
|
13
|
+
|
|
14
|
+
Sites like [GitHub](https://github.com/) and [npm](https://www.npmjs.com/) feel lighter because of two things. First, they don't always request [user verification](https://www.w3.org/TR/webauthn-3/#user-verification) (UV). Second, many of their users keep passkeys in password managers like [1Password](https://1password.com/) or [Bitwarden](https://bitwarden.com/), which count an unlocked vault as verified. The site never controls whether a prompt appears. The [authenticator](https://www.w3.org/TR/webauthn-3/#authenticator) does.
|
|
15
|
+
|
|
16
|
+
## Why old computers fail today
|
|
17
|
+
|
|
18
|
+
An old computer without a fingerprint reader can still use passkeys. [macOS](https://developer.apple.com/passkeys/) falls back to the login password. [Windows Hello](https://learn.microsoft.com/en-us/windows/security/identity-protection/hello-for-business/) falls back to a PIN. [Google Password Manager](https://passwords.google/) falls back to its own PIN.
|
|
19
|
+
|
|
20
|
+
The real blocker is in [`src/auth/register.ts`](../../src/auth/register.ts). Registration sets [`authenticatorAttachment: "platform"`](https://www.w3.org/TR/webauthn-3/#enumdef-authenticatorattachment), which rejects machines without a built-in authenticator: older Windows, [Linux](https://en.wikipedia.org/wiki/Linux), or computers without a [TPM](https://en.wikipedia.org/wiki/Trusted_Platform_Module). It also shuts out what they could use instead:
|
|
21
|
+
|
|
22
|
+
- a phone, through a QR code ([hybrid transport](https://www.w3.org/TR/webauthn-3/#dom-authenticatortransport-hybrid))
|
|
23
|
+
- a USB or NFC [security key](https://en.wikipedia.org/wiki/Security_token)
|
|
24
|
+
- a password manager
|
|
25
|
+
|
|
26
|
+
Browsers without the [Web Authentication API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Authentication_API) can't be helped by any passkey option. A password-encrypted wallet for them is out of scope here.
|
|
27
|
+
|
|
28
|
+
## Changes in w3pk
|
|
29
|
+
|
|
30
|
+
### 1. Allow any authenticator at registration
|
|
31
|
+
|
|
32
|
+
Remove `authenticatorAttachment: "platform"` from `authenticatorSelection` in [`src/auth/register.ts`](../../src/auth/register.ts). Keep `residentKey: "required"`, so that login without a username still works.
|
|
33
|
+
|
|
34
|
+
### 2. Add a `userVerification` setting
|
|
35
|
+
|
|
36
|
+
Add the setting to `Web3PasskeyConfig` in [`src/core/config.ts`](../../src/core/config.ts):
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
/**
|
|
40
|
+
* WebAuthn user verification for login, registration and signing
|
|
41
|
+
* (default: 'required'). With 'preferred', authenticators that can skip
|
|
42
|
+
* the biometric/PIN check (security keys, unlocked password managers)
|
|
43
|
+
* sign in with one click. PRF-derived secrets always require it.
|
|
44
|
+
*/
|
|
45
|
+
userVerification?: 'required' | 'preferred';
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Pass it through to:
|
|
49
|
+
|
|
50
|
+
- `authenticatorSelection.userVerification` in [`src/auth/register.ts`](../../src/auth/register.ts)
|
|
51
|
+
- the login assertion in [`src/auth/authenticate.ts`](../../src/auth/authenticate.ts)
|
|
52
|
+
- the signing assertion in [`src/core/sdk.ts`](../../src/core/sdk.ts) (`userVerification: 'required'` near the WebAuthn signature request)
|
|
53
|
+
|
|
54
|
+
The default stays `'required'`, so apps that don't set it behave as before.
|
|
55
|
+
|
|
56
|
+
### 3. Keep PRF calls verified
|
|
57
|
+
|
|
58
|
+
The [PRF extension](https://www.w3.org/TR/webauthn-3/#prf-extension) is built on the [CTAP2](https://fidoalliance.org/specifications/) `hmac-secret` extension, which keeps two separate secrets per credential: one for verified assertions and one for unverified ones. An unverified assertion can therefore return a *different* PRF output, which would silently derive a different session key or sync secret.
|
|
59
|
+
|
|
60
|
+
- [`src/auth/prf.ts`](../../src/auth/prf.ts) and [`src/auth/sync-auth.ts`](../../src/auth/sync-auth.ts) always pass `userVerification: "required"`, whatever the config says.
|
|
61
|
+
- In [`src/auth/authenticate.ts`](../../src/auth/authenticate.ts) and [`src/auth/register.ts`](../../src/auth/register.ts), read the [UV flag](https://www.w3.org/TR/webauthn-3/#authdata-flags-uv) (bit 2 of `authenticatorData[32]`). If UV is not set, drop `prfOutput`. The session then falls back to the in-memory path that already handles authenticators without PRF.
|
|
62
|
+
|
|
63
|
+
### 4. Tests and docs
|
|
64
|
+
|
|
65
|
+
- Unit tests:
|
|
66
|
+
- the registration options no longer contain `authenticatorAttachment`
|
|
67
|
+
- `userVerification` reaches login, registration and signing
|
|
68
|
+
- PRF calls stay `required` when the config says `'preferred'`
|
|
69
|
+
- `prfOutput` is ignored when the UV flag is clear
|
|
70
|
+
- Document the option in [`docs/API_REFERENCE.md`](../API_REFERENCE.md) and [`docs/INTEGRATION_GUIDELINES.md`](../INTEGRATION_GUIDELINES.md), and the wider authenticator support in [`docs/BROWSER_COMPATIBILITY.md`](../BROWSER_COMPATIBILITY.md).
|
|
71
|
+
- Add a `CHANGELOG.md` entry.
|
|
72
|
+
|
|
73
|
+
## Changes in Genji
|
|
74
|
+
|
|
75
|
+
[Genji](https://github.com/w3hc/genji) needs these changes once a w3pk release ships the option:
|
|
76
|
+
|
|
77
|
+
- **Opt in.** Bump `w3pk` and pass `userVerification: 'preferred'` to `createWeb3Passkey` in `src/context/W3PK.tsx`.
|
|
78
|
+
- **Fix the wording.** In `src/translations/index.ts`, rewrite the security text that promises a fingerprint is always required (the "derived using a WebAuthn signature, which requires your biometric authentication" paragraph). Also adjust the session texts that say each visit asks for biometric/PIN. Lines that say "biometric or PIN" can stay, since that is still true on most devices.
|
|
79
|
+
- **No sign-up gate to fix.** `isPlatformAuthenticatorAvailable()` in `src/utils/browserDetection.ts` is not called anywhere, so nothing blocks registration on the Genji side. Leave it unused, or use it only to show a hint ("No built-in authenticator found: use your phone or a security key").
|
|
80
|
+
|
|
81
|
+
## Out of scope: the wallet key is not tied to verification
|
|
82
|
+
|
|
83
|
+
`deriveEncryptionKeyFromWebAuthn()` in [`src/wallet/crypto.ts`](../../src/wallet/crypto.ts) derives the wallet's [AES-GCM](https://en.wikipedia.org/wiki/Galois/Counter_Mode) key from `credentialId` and `publicKey`. Both are stored in the browser and neither is secret. So the stored wallet is protected by app logic, not by the biometric or PIN check, and loosening user verification doesn't weaken it any further.
|
|
84
|
+
|
|
85
|
+
The real fix is to encrypt the wallet under the PRF secret. That needs its own issue in w3pk.
|
|
86
|
+
|
|
87
|
+
## Done when
|
|
88
|
+
|
|
89
|
+
- [ ] A computer with no built-in authenticator can register through a phone (QR code) or a security key.
|
|
90
|
+
- [ ] With `userVerification: 'preferred'`, a security key or an unlocked password manager logs in with one click.
|
|
91
|
+
- [ ] PRF-derived session and sync keys are identical before and after the change for verified logins.
|
|
92
|
+
- [ ] An unverified login gets an in-memory session, never a different persistent session key.
|
|
93
|
+
- [ ] Genji uses the option, and its copy no longer promises a fingerprint check.
|
|
94
|
+
|
|
95
|
+
## Further reading
|
|
96
|
+
|
|
97
|
+
- [Web Authentication Level 3](https://www.w3.org/TR/webauthn-3/)
|
|
98
|
+
- [Passkeys developer guide](https://passkeys.dev/)
|
|
99
|
+
- [FIDO Alliance specifications](https://fidoalliance.org/specifications/)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "w3pk",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.5",
|
|
4
4
|
"description": "WebAuthn SDK for passwordless authentication, encrypted wallets, ERC-5564 stealth addresses, and zero-knowledge proofs",
|
|
5
5
|
"author": "Julien Béranger",
|
|
6
6
|
"license": "GPL-3.0",
|
|
@@ -63,16 +63,6 @@
|
|
|
63
63
|
"types": "./dist/chainlist/index.d.ts",
|
|
64
64
|
"import": "./dist/chainlist/index.mjs",
|
|
65
65
|
"require": "./dist/chainlist/index.js"
|
|
66
|
-
},
|
|
67
|
-
"./inspect": {
|
|
68
|
-
"types": "./dist/inspect/index.d.ts",
|
|
69
|
-
"import": "./dist/inspect/index.mjs",
|
|
70
|
-
"require": "./dist/inspect/index.js"
|
|
71
|
-
},
|
|
72
|
-
"./inspect/node": {
|
|
73
|
-
"types": "./dist/inspect/node.d.ts",
|
|
74
|
-
"import": "./dist/inspect/node.mjs",
|
|
75
|
-
"require": "./dist/inspect/node.js"
|
|
76
66
|
}
|
|
77
67
|
},
|
|
78
68
|
"sideEffects": false,
|
|
@@ -83,33 +73,6 @@
|
|
|
83
73
|
"docs/",
|
|
84
74
|
"scripts/compute-build-hash.mjs"
|
|
85
75
|
],
|
|
86
|
-
"scripts": {
|
|
87
|
-
"build": "tsup",
|
|
88
|
-
"build:zk": "npm run build && npm run compile:circuits",
|
|
89
|
-
"compile:circuits": "node scripts/compile-circuits.js",
|
|
90
|
-
"dev": "tsup --watch",
|
|
91
|
-
"test": "tsx test/test.ts && tsx test/comprehensive.test.ts && tsx test/backup.test.ts && tsx test/social-recovery.test.ts && tsx test/recovery-education.test.ts && tsx test/zk/zk.test.ts && tsx test/nft-ownership.test.ts && tsx test/chainlist.test.ts && tsx test/eip7702.test.ts && tsx test/external-wallet.test.ts && tsx test/erc5564.test.ts && tsx test/zk/key-stretching.test.ts && tsx test/username-encoding.test.ts && tsx test/username-validation.test.ts && tsx test/origin-derivation.test.ts && tsx test/build-hash.test.ts && tsx test/credential-checking.test.ts && tsx test/webauthn-native.test.ts && tsx test/persistent-session.test.ts && tsx test/local-storage.test.ts && tsx test/sign-message.test.ts && tsx test/siwe.test.ts && tsx test/requirereauth.test.ts && tsx test/eip7951.test.ts && tsx test/send-transaction.test.ts && tsx test/eip1193-provider.test.ts && tsx test/mlkem.test.ts && tsx test/login-missing-wallet.test.ts && tsx test/backup-status.test.ts && tsx test/eviction-risk.test.ts && tsx test/fresh-device-sync.test.ts && tsx test/prf-secret.test.ts && tsx test/prf-sync.test.ts",
|
|
92
|
-
"test:basic": "tsx test/test.ts",
|
|
93
|
-
"test:comprehensive": "tsx test/comprehensive.test.ts",
|
|
94
|
-
"test:backup": "tsx test/backup.test.ts",
|
|
95
|
-
"test:social-recovery": "tsx test/social-recovery.test.ts",
|
|
96
|
-
"test:education": "tsx test/recovery-education.test.ts",
|
|
97
|
-
"test:username": "tsx test/username-encoding.test.ts && tsx test/username-validation.test.ts",
|
|
98
|
-
"test:recovery": "tsx test/backup.test.ts && tsx test/social-recovery.test.ts && tsx test/recovery-education.test.ts",
|
|
99
|
-
"test:zk": "tsx test/zk/zk.test.ts",
|
|
100
|
-
"test:nft": "tsx test/nft-ownership.test.ts",
|
|
101
|
-
"test:chainlist": "tsx test/chainlist.test.ts",
|
|
102
|
-
"test:eip7702": "tsx test/eip7702.test.ts",
|
|
103
|
-
"test:external-wallet": "tsx test/external-wallet.test.ts",
|
|
104
|
-
"test:eip7951": "tsx test/eip7951.test.ts",
|
|
105
|
-
"test:erc5564": "tsx test/erc5564.test.ts",
|
|
106
|
-
"test:sign-message": "tsx test/sign-message.test.ts",
|
|
107
|
-
"test:siwe": "tsx test/siwe.test.ts",
|
|
108
|
-
"prepublishOnly": "pnpm build",
|
|
109
|
-
"build:hash": "node scripts/compute-build-hash.mjs",
|
|
110
|
-
"html": "lsof -ti:3000 | xargs kill -9 2>/dev/null || true && tsup && npx serve . -l 3000 & sleep 5 && open http://localhost:3000/standalone/checker.html"
|
|
111
|
-
},
|
|
112
|
-
"packageManager": "pnpm@10.6.4",
|
|
113
76
|
"devDependencies": {
|
|
114
77
|
"@types/node": "^25.9.2",
|
|
115
78
|
"@types/qrcode": "^1.5.5",
|
|
@@ -134,19 +97,29 @@
|
|
|
134
97
|
"@noble/hashes": "^2.2.0",
|
|
135
98
|
"mlkem": "^2.7.0"
|
|
136
99
|
},
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
100
|
+
"scripts": {
|
|
101
|
+
"build": "tsup",
|
|
102
|
+
"build:zk": "npm run build && npm run compile:circuits",
|
|
103
|
+
"compile:circuits": "node scripts/compile-circuits.js",
|
|
104
|
+
"dev": "tsup --watch",
|
|
105
|
+
"test": "tsx test/test.ts && tsx test/comprehensive.test.ts && tsx test/backup.test.ts && tsx test/social-recovery.test.ts && tsx test/recovery-education.test.ts && tsx test/zk/zk.test.ts && tsx test/nft-ownership.test.ts && tsx test/chainlist.test.ts && tsx test/eip7702.test.ts && tsx test/external-wallet.test.ts && tsx test/erc5564.test.ts && tsx test/zk/key-stretching.test.ts && tsx test/username-encoding.test.ts && tsx test/username-validation.test.ts && tsx test/origin-derivation.test.ts && tsx test/build-hash.test.ts && tsx test/credential-checking.test.ts && tsx test/webauthn-native.test.ts && tsx test/persistent-session.test.ts && tsx test/local-storage.test.ts && tsx test/sign-message.test.ts && tsx test/siwe.test.ts && tsx test/requirereauth.test.ts && tsx test/eip7951.test.ts && tsx test/send-transaction.test.ts && tsx test/eip1193-provider.test.ts && tsx test/mlkem.test.ts && tsx test/login-missing-wallet.test.ts && tsx test/backup-status.test.ts && tsx test/eviction-risk.test.ts && tsx test/fresh-device-sync.test.ts && tsx test/prf-secret.test.ts && tsx test/prf-sync.test.ts && tsx test/user-verification.test.ts",
|
|
106
|
+
"test:basic": "tsx test/test.ts",
|
|
107
|
+
"test:comprehensive": "tsx test/comprehensive.test.ts",
|
|
108
|
+
"test:backup": "tsx test/backup.test.ts",
|
|
109
|
+
"test:social-recovery": "tsx test/social-recovery.test.ts",
|
|
110
|
+
"test:education": "tsx test/recovery-education.test.ts",
|
|
111
|
+
"test:username": "tsx test/username-encoding.test.ts && tsx test/username-validation.test.ts",
|
|
112
|
+
"test:recovery": "tsx test/backup.test.ts && tsx test/social-recovery.test.ts && tsx test/recovery-education.test.ts",
|
|
113
|
+
"test:zk": "tsx test/zk/zk.test.ts",
|
|
114
|
+
"test:nft": "tsx test/nft-ownership.test.ts",
|
|
115
|
+
"test:chainlist": "tsx test/chainlist.test.ts",
|
|
116
|
+
"test:eip7702": "tsx test/eip7702.test.ts",
|
|
117
|
+
"test:external-wallet": "tsx test/external-wallet.test.ts",
|
|
118
|
+
"test:eip7951": "tsx test/eip7951.test.ts",
|
|
119
|
+
"test:erc5564": "tsx test/erc5564.test.ts",
|
|
120
|
+
"test:sign-message": "tsx test/sign-message.test.ts",
|
|
121
|
+
"test:siwe": "tsx test/siwe.test.ts",
|
|
122
|
+
"build:hash": "node scripts/compute-build-hash.mjs",
|
|
123
|
+
"html": "lsof -ti:3000 | xargs kill -9 2>/dev/null || true && tsup && npx serve . -l 3000 & sleep 5 && open http://localhost:3000/standalone/checker.html"
|
|
151
124
|
}
|
|
152
125
|
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser Inspection Module
|
|
3
|
-
*
|
|
4
|
-
* Provides client-side code inspection capabilities for analyzing running web3 applications.
|
|
5
|
-
* Fetches JavaScript sources from the current page and analyzes transaction/signing patterns
|
|
6
|
-
* to generate security reports via the Rukh API.
|
|
7
|
-
*
|
|
8
|
-
* This module is designed to be used directly in the browser console or embedded in
|
|
9
|
-
* web applications to help end-users understand the security posture of the apps they use.
|
|
10
|
-
*
|
|
11
|
-
* @module inspect/browser
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Configuration options for browser-based application inspection
|
|
15
|
-
*/
|
|
16
|
-
interface BrowserInspectOptions {
|
|
17
|
-
/**
|
|
18
|
-
* The origin/URL of the app to inspect
|
|
19
|
-
* @default window.location.origin
|
|
20
|
-
*/
|
|
21
|
-
appUrl?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Rukh API endpoint
|
|
24
|
-
* @default 'https://rukh.w3hc.org'
|
|
25
|
-
*/
|
|
26
|
-
rukhUrl?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Context to use for analysis
|
|
29
|
-
* @default 'w3pk'
|
|
30
|
-
*/
|
|
31
|
-
context?: string;
|
|
32
|
-
/**
|
|
33
|
-
* AI model to use
|
|
34
|
-
* @default 'anthropic'
|
|
35
|
-
*/
|
|
36
|
-
model?: "anthropic" | "mistral" | "openai";
|
|
37
|
-
/**
|
|
38
|
-
* Focus mode for analysis
|
|
39
|
-
* @default 'transactions'
|
|
40
|
-
*/
|
|
41
|
-
focusMode?: "transactions" | "all";
|
|
42
|
-
/**
|
|
43
|
-
* Maximum total size in KB for all collected code (prevents exceeding API token limits)
|
|
44
|
-
* @default 100
|
|
45
|
-
*/
|
|
46
|
-
maxTotalSizeKB?: number;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Result of a browser-based inspection
|
|
50
|
-
*/
|
|
51
|
-
interface BrowserInspectResult {
|
|
52
|
-
/**
|
|
53
|
-
* The security report markdown generated by Rukh API
|
|
54
|
-
*/
|
|
55
|
-
report: string;
|
|
56
|
-
/**
|
|
57
|
-
* List of JavaScript file paths that were analyzed
|
|
58
|
-
*/
|
|
59
|
-
analyzedFiles: string[];
|
|
60
|
-
/**
|
|
61
|
-
* The application URL that was inspected
|
|
62
|
-
*/
|
|
63
|
-
appUrl: string;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Inspects the currently running web application and returns a security report
|
|
67
|
-
*
|
|
68
|
-
* This function can be called by end-users in their browser console to analyze
|
|
69
|
-
* the security of the web application they're currently using.
|
|
70
|
-
*
|
|
71
|
-
* @param options - Configuration options
|
|
72
|
-
* @returns A security report analyzing transaction and signing methods
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```typescript
|
|
76
|
-
* // In browser console or app code:
|
|
77
|
-
* import { inspect } from 'w3pk';
|
|
78
|
-
*
|
|
79
|
-
* const report = await inspect();
|
|
80
|
-
* console.log(report.report);
|
|
81
|
-
* ```
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```typescript
|
|
85
|
-
* // With custom options:
|
|
86
|
-
* const report = await inspect({
|
|
87
|
-
* appUrl: 'https://w3pk.w3hc.org',
|
|
88
|
-
* model: 'anthropic',
|
|
89
|
-
* focusMode: 'transactions'
|
|
90
|
-
* });
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
declare function inspect(options?: BrowserInspectOptions): Promise<BrowserInspectResult>;
|
|
94
|
-
/**
|
|
95
|
-
* Quick inspection helper that logs the report to console
|
|
96
|
-
* Perfect for use in browser DevTools console
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```javascript
|
|
100
|
-
* // In browser console:
|
|
101
|
-
* await w3pk.inspectNow()
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
declare function inspectNow(options?: BrowserInspectOptions): Promise<void>;
|
|
105
|
-
|
|
106
|
-
export { type BrowserInspectOptions, type BrowserInspectResult, inspect, inspectNow };
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Browser Inspection Module
|
|
3
|
-
*
|
|
4
|
-
* Provides client-side code inspection capabilities for analyzing running web3 applications.
|
|
5
|
-
* Fetches JavaScript sources from the current page and analyzes transaction/signing patterns
|
|
6
|
-
* to generate security reports via the Rukh API.
|
|
7
|
-
*
|
|
8
|
-
* This module is designed to be used directly in the browser console or embedded in
|
|
9
|
-
* web applications to help end-users understand the security posture of the apps they use.
|
|
10
|
-
*
|
|
11
|
-
* @module inspect/browser
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* Configuration options for browser-based application inspection
|
|
15
|
-
*/
|
|
16
|
-
interface BrowserInspectOptions {
|
|
17
|
-
/**
|
|
18
|
-
* The origin/URL of the app to inspect
|
|
19
|
-
* @default window.location.origin
|
|
20
|
-
*/
|
|
21
|
-
appUrl?: string;
|
|
22
|
-
/**
|
|
23
|
-
* Rukh API endpoint
|
|
24
|
-
* @default 'https://rukh.w3hc.org'
|
|
25
|
-
*/
|
|
26
|
-
rukhUrl?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Context to use for analysis
|
|
29
|
-
* @default 'w3pk'
|
|
30
|
-
*/
|
|
31
|
-
context?: string;
|
|
32
|
-
/**
|
|
33
|
-
* AI model to use
|
|
34
|
-
* @default 'anthropic'
|
|
35
|
-
*/
|
|
36
|
-
model?: "anthropic" | "mistral" | "openai";
|
|
37
|
-
/**
|
|
38
|
-
* Focus mode for analysis
|
|
39
|
-
* @default 'transactions'
|
|
40
|
-
*/
|
|
41
|
-
focusMode?: "transactions" | "all";
|
|
42
|
-
/**
|
|
43
|
-
* Maximum total size in KB for all collected code (prevents exceeding API token limits)
|
|
44
|
-
* @default 100
|
|
45
|
-
*/
|
|
46
|
-
maxTotalSizeKB?: number;
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Result of a browser-based inspection
|
|
50
|
-
*/
|
|
51
|
-
interface BrowserInspectResult {
|
|
52
|
-
/**
|
|
53
|
-
* The security report markdown generated by Rukh API
|
|
54
|
-
*/
|
|
55
|
-
report: string;
|
|
56
|
-
/**
|
|
57
|
-
* List of JavaScript file paths that were analyzed
|
|
58
|
-
*/
|
|
59
|
-
analyzedFiles: string[];
|
|
60
|
-
/**
|
|
61
|
-
* The application URL that was inspected
|
|
62
|
-
*/
|
|
63
|
-
appUrl: string;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Inspects the currently running web application and returns a security report
|
|
67
|
-
*
|
|
68
|
-
* This function can be called by end-users in their browser console to analyze
|
|
69
|
-
* the security of the web application they're currently using.
|
|
70
|
-
*
|
|
71
|
-
* @param options - Configuration options
|
|
72
|
-
* @returns A security report analyzing transaction and signing methods
|
|
73
|
-
*
|
|
74
|
-
* @example
|
|
75
|
-
* ```typescript
|
|
76
|
-
* // In browser console or app code:
|
|
77
|
-
* import { inspect } from 'w3pk';
|
|
78
|
-
*
|
|
79
|
-
* const report = await inspect();
|
|
80
|
-
* console.log(report.report);
|
|
81
|
-
* ```
|
|
82
|
-
*
|
|
83
|
-
* @example
|
|
84
|
-
* ```typescript
|
|
85
|
-
* // With custom options:
|
|
86
|
-
* const report = await inspect({
|
|
87
|
-
* appUrl: 'https://w3pk.w3hc.org',
|
|
88
|
-
* model: 'anthropic',
|
|
89
|
-
* focusMode: 'transactions'
|
|
90
|
-
* });
|
|
91
|
-
* ```
|
|
92
|
-
*/
|
|
93
|
-
declare function inspect(options?: BrowserInspectOptions): Promise<BrowserInspectResult>;
|
|
94
|
-
/**
|
|
95
|
-
* Quick inspection helper that logs the report to console
|
|
96
|
-
* Perfect for use in browser DevTools console
|
|
97
|
-
*
|
|
98
|
-
* @example
|
|
99
|
-
* ```javascript
|
|
100
|
-
* // In browser console:
|
|
101
|
-
* await w3pk.inspectNow()
|
|
102
|
-
* ```
|
|
103
|
-
*/
|
|
104
|
-
declare function inspectNow(options?: BrowserInspectOptions): Promise<void>;
|
|
105
|
-
|
|
106
|
-
export { type BrowserInspectOptions, type BrowserInspectResult, inspect, inspectNow };
|