@le-space/orbitdb-identity-provider-webauthn-did 0.0.1 → 0.2.1
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 +133 -340
- package/package.json +41 -9
- package/src/index.js +82 -453
- package/src/keystore/encryption.js +579 -0
- package/src/keystore/index.js +6 -0
- package/src/keystore/provider.js +555 -0
- package/src/keystore-encryption.js +6 -0
- package/src/varsig/assertion.js +205 -0
- package/src/varsig/credential.js +144 -0
- package/src/varsig/domain.js +11 -0
- package/src/varsig/identity.js +161 -0
- package/src/varsig/index.js +6 -0
- package/src/varsig/provider.js +78 -0
- package/src/varsig/storage.js +46 -0
- package/src/varsig/utils.js +43 -0
- package/src/verification.js +273 -0
- package/src/webauthn/provider.js +542 -0
- package/verification.js +1 -0
package/README.md
CHANGED
|
@@ -1,380 +1,173 @@
|
|
|
1
|
-
# OrbitDB WebAuthn
|
|
1
|
+
# OrbitDB WebAuthn Identity Providers
|
|
2
2
|
|
|
3
3
|
[](https://github.com/le-space/orbitdb-identity-provider-webauthn-did/actions/workflows/test.yml) [](https://github.com/le-space/orbitdb-identity-provider-webauthn-did/actions/workflows/ci-cd.yml)
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
⚠️ **Security**: Experimental release. No formal audit. Use only after your own review.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
and biometric authentication via Passkey.
|
|
7
|
+
Two WebAuthn-based OrbitDB identity providers:
|
|
9
8
|
|
|
10
|
-
|
|
9
|
+
- **WebAuthn-Varsig**: No insecure OrbitDB keystore at all. Each entry is signed by WebAuthn (varsig envelope), so keys never leave the authenticator, one Passkey (WebAuthn) prompt per write.
|
|
11
10
|
|
|
12
|
-
-
|
|
13
|
-
- 🚫 **Private keys never leave hardware** - Keys are generated and stored in secure elements
|
|
14
|
-
- 🌐 **Cross-platform compatibility** - Works across modern browsers and platforms
|
|
15
|
-
- 📱 **Biometric authentication** - Seamless user experience with fingerprint, face recognition, or PIN
|
|
16
|
-
- 🔒 **Quantum-resistant** - P-256 elliptic curve cryptography with hardware backing
|
|
17
|
-
- 🆔 **DID-based identity** - Generates deterministic DIDs based on WebAuthn credentials
|
|
11
|
+
- **Keystore-based DID**: Generates an Ed25519/secp256k1 keystore keypair for OrbitDB signing in browser memory. When `encryptKeystore` is enabled, the private key is encrypted with AES-GCM and only rehydrated in memory after a WebAuthn unlock (PRF, largeBlob, or hmac-secret).
|
|
18
12
|
|
|
19
|
-
|
|
13
|
+
**Recommendation (security-first):**
|
|
20
14
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## Basic Usage
|
|
26
|
-
|
|
27
|
-
```javascript
|
|
28
|
-
import { createOrbitDB, Identities, IPFSAccessController } from '@orbitdb/core'
|
|
29
|
-
import { createHelia } from 'helia'
|
|
30
|
-
import {
|
|
31
|
-
WebAuthnDIDProvider,
|
|
32
|
-
OrbitDBWebAuthnIdentityProviderFunction,
|
|
33
|
-
registerWebAuthnProvider,
|
|
34
|
-
checkWebAuthnSupport,
|
|
35
|
-
storeWebAuthnCredential,
|
|
36
|
-
loadWebAuthnCredential
|
|
37
|
-
} from 'orbitdb-identity-provider-webauthn-did'
|
|
38
|
-
|
|
39
|
-
// Check WebAuthn support
|
|
40
|
-
const support = await checkWebAuthnSupport()
|
|
41
|
-
if (!support.supported) {
|
|
42
|
-
console.error('WebAuthn not supported:', support.message)
|
|
43
|
-
return
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Create or load WebAuthn credential
|
|
47
|
-
let credential = loadWebAuthnCredential()
|
|
48
|
-
|
|
49
|
-
if (!credential) {
|
|
50
|
-
// Create new WebAuthn credential (triggers biometric prompt)
|
|
51
|
-
credential = await WebAuthnDIDProvider.createCredential({
|
|
52
|
-
userId: 'alice@example.com',
|
|
53
|
-
displayName: 'Alice Smith'
|
|
54
|
-
})
|
|
55
|
-
|
|
56
|
-
// Store credential for future use
|
|
57
|
-
storeWebAuthnCredential(credential)
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// Register the WebAuthn provider
|
|
61
|
-
registerWebAuthnProvider()
|
|
62
|
-
|
|
63
|
-
// Create identities instance
|
|
64
|
-
const identities = await Identities()
|
|
65
|
-
|
|
66
|
-
// Create WebAuthn identity
|
|
67
|
-
const identity = await identities.createIdentity({
|
|
68
|
-
provider: OrbitDBWebAuthnIdentityProviderFunction({ webauthnCredential: credential })
|
|
69
|
-
})
|
|
70
|
-
|
|
71
|
-
// Create IPFS instance - see OrbitDB Liftoff example for full libp2p configuration:
|
|
72
|
-
// https://github.com/orbitdb/orbitdb/tree/main/examples/liftoff
|
|
73
|
-
const ipfs = await createHelia()
|
|
74
|
-
|
|
75
|
-
// Create OrbitDB instance with WebAuthn identity
|
|
76
|
-
const orbitdb = await createOrbitDB({
|
|
77
|
-
ipfs,
|
|
78
|
-
identities,
|
|
79
|
-
identity
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
// Create a database - will require biometric authentication for each write
|
|
83
|
-
const db = await orbitdb.open('my-secure-database', {
|
|
84
|
-
type: 'keyvalue',
|
|
85
|
-
accessController: IPFSAccessController({
|
|
86
|
-
write: [identity.id] // Only this WebAuthn identity can write
|
|
87
|
-
})
|
|
88
|
-
})
|
|
89
|
-
|
|
90
|
-
// Adding data will trigger biometric prompt
|
|
91
|
-
await db.put('greeting', 'Hello, secure world!')
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
## Advanced Configuration
|
|
15
|
+
- **Best security:** Varsig provider (hardware-backed key for every write).
|
|
16
|
+
- **Best balance:** Keystore provider with WebAuthn-encrypted keystore (fewer prompts, faster writes, key material in memory during session).
|
|
95
17
|
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
For an example libp2p configuration. See the [OrbitDB Liftoff example](https://github.com/orbitdb/liftoff) for example libp2p setup including:
|
|
99
|
-
|
|
100
|
-
### Credential Creation Options
|
|
101
|
-
|
|
102
|
-
```javascript
|
|
103
|
-
const credential = await WebAuthnDIDProvider.createCredential({
|
|
104
|
-
userId: 'unique-user-identifier',
|
|
105
|
-
displayName: 'User Display Name',
|
|
106
|
-
domain: 'your-app-domain.com', // Defaults to current hostname
|
|
107
|
-
timeout: 60000 // Authentication timeout in milliseconds
|
|
108
|
-
})
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Identity Provider Configuration
|
|
112
|
-
|
|
113
|
-
```javascript
|
|
114
|
-
// Manual identity provider setup
|
|
115
|
-
import { OrbitDBWebAuthnIdentityProviderFunction } from 'orbitdb-identity-provider-webauthn-did'
|
|
116
|
-
|
|
117
|
-
const identityProvider = OrbitDBWebAuthnIdentityProviderFunction({
|
|
118
|
-
webauthnCredential: credential
|
|
119
|
-
})
|
|
120
|
-
|
|
121
|
-
const orbitdb = await createOrbitDB({
|
|
122
|
-
identity: {
|
|
123
|
-
provider: identityProvider
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
```
|
|
18
|
+
Note: WebAuthn varsig support in this repo relies on our forked `@le-space/iso-*` packages of [Hugo Dias iso-repo](https://github.com/hugomrdias/iso-repo/) (notably `@le-space/iso-did` and `@le-space/iso-webauthn-varsig`) to align with the updated varsig flow.
|
|
127
19
|
|
|
128
|
-
## WebAuthn Support Detection
|
|
129
20
|
|
|
130
|
-
|
|
21
|
+
## Install
|
|
131
22
|
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
// Comprehensive support check
|
|
136
|
-
const support = await checkWebAuthnSupport()
|
|
137
|
-
console.log({
|
|
138
|
-
supported: support.supported,
|
|
139
|
-
platformAuthenticator: support.platformAuthenticator,
|
|
140
|
-
message: support.message
|
|
141
|
-
})
|
|
142
|
-
|
|
143
|
-
// Quick checks
|
|
144
|
-
const isSupported = WebAuthnDIDProvider.isSupported()
|
|
145
|
-
const hasBiometric = await WebAuthnDIDProvider.isPlatformAuthenticatorAvailable()
|
|
23
|
+
```bash
|
|
24
|
+
npm install orbitdb-identity-provider-webauthn-did
|
|
146
25
|
```
|
|
147
26
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
| Browser | Version | Face ID | Touch ID | Windows Hello |
|
|
151
|
-
|---------|---------|---------|----------|---------------|
|
|
152
|
-
| Chrome | 67+ | ✅ | ✅ | ✅ |
|
|
153
|
-
| Firefox | 60+ | ✅ | ✅ | ✅ |
|
|
154
|
-
| Safari | 14+ | ✅ | ✅ | ✅ |
|
|
155
|
-
| Edge | 18+ | ✅ | ✅ | ✅ |
|
|
156
|
-
|
|
157
|
-
## Platform Support
|
|
27
|
+
Note: `@orbitdb/core` is patched (via `patch-package`) to support Ed25519 keystore keys.
|
|
158
28
|
|
|
159
|
-
|
|
160
|
-
- **iOS**: Face ID, Touch ID
|
|
161
|
-
- **Windows**: Windows Hello (face, fingerprint, PIN)
|
|
162
|
-
- **Android**: Fingerprint, face unlock, screen lock
|
|
163
|
-
- **Linux**: FIDO2 security keys, fingerprint readers
|
|
164
|
-
|
|
165
|
-
## Credential Storage Utilities
|
|
166
|
-
|
|
167
|
-
The library provides utility functions for properly storing and loading WebAuthn credentials:
|
|
168
|
-
|
|
169
|
-
### Using the Built-in Utilities:
|
|
29
|
+
## Memory Keystore Quick Start
|
|
170
30
|
|
|
171
31
|
```javascript
|
|
172
|
-
import {
|
|
173
|
-
storeWebAuthnCredential,
|
|
174
|
-
loadWebAuthnCredential,
|
|
175
|
-
clearWebAuthnCredential
|
|
176
|
-
} from 'orbitdb-identity-provider-webauthn-did'
|
|
177
|
-
|
|
178
|
-
// Store credential (handles Uint8Array serialization automatically)
|
|
179
|
-
storeWebAuthnCredential(credential)
|
|
180
|
-
|
|
181
|
-
// Load credential (handles Uint8Array deserialization automatically)
|
|
182
|
-
const credential = loadWebAuthnCredential()
|
|
32
|
+
import { WebAuthnDIDProvider, OrbitDBWebAuthnIdentityProviderFunction } from 'orbitdb-identity-provider-webauthn-did';
|
|
183
33
|
|
|
184
|
-
|
|
185
|
-
|
|
34
|
+
const credential = await WebAuthnDIDProvider.createCredential({
|
|
35
|
+
userId: 'alice@example.com',
|
|
36
|
+
displayName: 'Alice'
|
|
37
|
+
});
|
|
186
38
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
39
|
+
const identity = await identities.createIdentity({
|
|
40
|
+
provider: OrbitDBWebAuthnIdentityProviderFunction({ webauthnCredential: credential })
|
|
41
|
+
});
|
|
190
42
|
```
|
|
191
43
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
## Security Considerations
|
|
195
|
-
|
|
196
|
-
### Private Key Security
|
|
197
|
-
|
|
198
|
-
- Private keys are generated within the secure hardware element
|
|
199
|
-
- Keys cannot be extracted, cloned, or compromised through software attacks
|
|
200
|
-
- Each authentication requires user presence and verification
|
|
201
|
-
|
|
202
|
-
### DID Generation
|
|
203
|
-
|
|
204
|
-
- DIDs are deterministically generated from the WebAuthn public key
|
|
205
|
-
- Same credential always produces the same DID
|
|
206
|
-
- Format: `did:webauthn:{32-char-hex-identifier}`
|
|
207
|
-
|
|
208
|
-
### Authentication Flow
|
|
209
|
-
|
|
210
|
-
1. User attempts database operation
|
|
211
|
-
2. WebAuthn prompt appears
|
|
212
|
-
3. User provides authentication
|
|
213
|
-
4. Hardware element signs the operation
|
|
214
|
-
5. OrbitDB verifies the signature
|
|
215
|
-
|
|
216
|
-
## Error Handling
|
|
217
|
-
|
|
218
|
-
The library provides detailed error handling for common WebAuthn scenarios:
|
|
44
|
+
### Hardware Secured - Varsig Quick Start
|
|
219
45
|
|
|
220
46
|
```javascript
|
|
221
|
-
|
|
222
|
-
const credential = await WebAuthnDIDProvider.createCredential()
|
|
223
|
-
} catch (error) {
|
|
224
|
-
switch (error.message) {
|
|
225
|
-
case 'Biometric authentication was cancelled or failed':
|
|
226
|
-
// User cancelled or biometric failed
|
|
227
|
-
break
|
|
228
|
-
case 'WebAuthn is not supported on this device':
|
|
229
|
-
// Device/browser doesn't support WebAuthn
|
|
230
|
-
break
|
|
231
|
-
case 'A credential with this ID already exists':
|
|
232
|
-
// Credential already registered for this user
|
|
233
|
-
break
|
|
234
|
-
default:
|
|
235
|
-
console.error('WebAuthn error:', error.message)
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
```
|
|
239
|
-
|
|
240
|
-
## Development
|
|
47
|
+
import { WebAuthnVarsigProvider, createWebAuthnVarsigIdentity } from 'orbitdb-identity-provider-webauthn-did';
|
|
241
48
|
|
|
242
|
-
|
|
49
|
+
const credential = await WebAuthnVarsigProvider.createCredential({
|
|
50
|
+
userId: 'alice@example.com',
|
|
51
|
+
displayName: 'Alice'
|
|
52
|
+
});
|
|
243
53
|
|
|
244
|
-
|
|
245
|
-
npm run build
|
|
54
|
+
const identity = await createWebAuthnVarsigIdentity({ credential });
|
|
246
55
|
```
|
|
247
56
|
|
|
248
|
-
### Testing
|
|
249
57
|
|
|
250
|
-
|
|
251
|
-
|
|
58
|
+
### Keystore-based DID (WebAuthn + OrbitDB keystore)
|
|
59
|
+
|
|
60
|
+
```mermaid
|
|
61
|
+
sequenceDiagram
|
|
62
|
+
autonumber
|
|
63
|
+
participant User
|
|
64
|
+
participant App
|
|
65
|
+
participant WebAuthn
|
|
66
|
+
participant Auth as Authenticator
|
|
67
|
+
participant KS as OrbitDB Keystore
|
|
68
|
+
participant Enc as KeystoreEncryption
|
|
69
|
+
participant DB as OrbitDB
|
|
70
|
+
|
|
71
|
+
User->>App: Create credential
|
|
72
|
+
App->>WebAuthn: create()
|
|
73
|
+
WebAuthn->>Auth: Create passkey
|
|
74
|
+
Auth-->>WebAuthn: Attestation
|
|
75
|
+
WebAuthn-->>App: Credential
|
|
76
|
+
|
|
77
|
+
App->>KS: getKey()/createKey(Ed25519)
|
|
78
|
+
KS-->>App: Keystore keypair
|
|
79
|
+
|
|
80
|
+
opt encryptKeystore=true
|
|
81
|
+
App->>Enc: generateSecretKey()
|
|
82
|
+
Enc-->>App: sk
|
|
83
|
+
App->>Enc: encrypt keystore private key (AES-GCM)
|
|
84
|
+
alt prf
|
|
85
|
+
App->>WebAuthn: get() with PRF
|
|
86
|
+
WebAuthn->>Auth: User verification
|
|
87
|
+
Auth-->>WebAuthn: PRF output
|
|
88
|
+
WebAuthn-->>App: PRF bytes
|
|
89
|
+
App->>Enc: wrap sk with PRF
|
|
90
|
+
else largeBlob
|
|
91
|
+
App->>WebAuthn: get() with largeBlob write
|
|
92
|
+
WebAuthn->>Auth: User verification
|
|
93
|
+
Auth-->>WebAuthn: Store sk in largeBlob
|
|
94
|
+
WebAuthn-->>App: largeBlob stored
|
|
95
|
+
else hmac-secret
|
|
96
|
+
App->>WebAuthn: get() with hmac-secret
|
|
97
|
+
WebAuthn->>Auth: User verification
|
|
98
|
+
Auth-->>WebAuthn: HMAC output
|
|
99
|
+
WebAuthn-->>App: HMAC bytes
|
|
100
|
+
App->>Enc: wrap sk with HMAC
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
App->>DB: db.put()
|
|
105
|
+
DB->>KS: sign entry with keystore key
|
|
106
|
+
KS-->>DB: Entry signature
|
|
107
|
+
|
|
108
|
+
Note over App,KS: Keystore private key is stored encrypted at rest.
|
|
252
109
|
```
|
|
253
110
|
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
- `registerWebAuthnProvider()` - Register provider with OrbitDB
|
|
293
|
-
- `checkWebAuthnSupport()` - Comprehensive support detection
|
|
294
|
-
- `OrbitDBWebAuthnIdentityProviderFunction(options)` - Provider factory function
|
|
295
|
-
- `storeWebAuthnCredential(credential, key?)` - Store credential to localStorage with proper serialization
|
|
296
|
-
- `loadWebAuthnCredential(key?)` - Load credential from localStorage with proper deserialization
|
|
297
|
-
- `clearWebAuthnCredential(key?)` - Clear stored credential from localStorage
|
|
111
|
+
### Varsig (no keystore)
|
|
112
|
+
|
|
113
|
+
```mermaid
|
|
114
|
+
sequenceDiagram
|
|
115
|
+
autonumber
|
|
116
|
+
participant User
|
|
117
|
+
participant App
|
|
118
|
+
participant WebAuthn
|
|
119
|
+
participant Auth as Authenticator
|
|
120
|
+
participant Var as Varsig Provider
|
|
121
|
+
participant DB as OrbitDB
|
|
122
|
+
|
|
123
|
+
User->>App: Create credential
|
|
124
|
+
App->>WebAuthn: create()
|
|
125
|
+
WebAuthn->>Auth: Create passkey
|
|
126
|
+
Auth-->>WebAuthn: Attestation
|
|
127
|
+
WebAuthn-->>App: Credential
|
|
128
|
+
|
|
129
|
+
User->>App: Create varsig identity
|
|
130
|
+
App->>Var: createIdentity()
|
|
131
|
+
Var->>WebAuthn: get()
|
|
132
|
+
WebAuthn->>Auth: User verification
|
|
133
|
+
Auth-->>WebAuthn: Assertion
|
|
134
|
+
WebAuthn-->>Var: Assertion
|
|
135
|
+
Var->>Var: encode varsig envelope
|
|
136
|
+
Var-->>App: Identity
|
|
137
|
+
|
|
138
|
+
User->>App: Add entry
|
|
139
|
+
App->>DB: db.put()
|
|
140
|
+
DB->>Var: signIdentity(payload)
|
|
141
|
+
Var->>WebAuthn: get()
|
|
142
|
+
WebAuthn->>Auth: User verification
|
|
143
|
+
Auth-->>WebAuthn: Assertion
|
|
144
|
+
WebAuthn-->>Var: Assertion
|
|
145
|
+
Var->>Var: encode varsig envelope
|
|
146
|
+
Var-->>DB: Varsig signature
|
|
147
|
+
```
|
|
298
148
|
|
|
299
149
|
## Examples
|
|
300
150
|
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
-
|
|
304
|
-
-
|
|
305
|
-
- Error handling scenarios
|
|
306
|
-
- Integration with OrbitDB databases
|
|
307
|
-
|
|
308
|
-
## Reference Documentation
|
|
309
|
-
|
|
310
|
-
### Core Technologies
|
|
311
|
-
|
|
312
|
-
#### OrbitDB
|
|
313
|
-
- [OrbitDB Documentation](https://orbitdb.org/docs/) - Peer-to-peer database for the decentralized web
|
|
314
|
-
- [OrbitDB GitHub](https://github.com/orbitdb/orbitdb) - Source code and examples
|
|
315
|
-
- [OrbitDB Liftoff Example](https://github.com/orbitdb/orbitdb/tree/main/examples/liftoff) - Complete setup guide
|
|
316
|
-
|
|
317
|
-
#### IPFS & Helia
|
|
318
|
-
- [Helia Documentation](https://helia.io/) - Lean, modular, and modern implementation of IPFS for JavaScript
|
|
319
|
-
- [Helia GitHub](https://github.com/ipfs/helia) - Source code and examples
|
|
320
|
-
- [IPFS Documentation](https://docs.ipfs.tech/) - InterPlanetary File System docs
|
|
321
|
-
|
|
322
|
-
#### libp2p
|
|
323
|
-
- [libp2p Documentation](https://docs.libp2p.io/) - Modular network stack for peer-to-peer applications
|
|
324
|
-
- [libp2p JavaScript](https://github.com/libp2p/js-libp2p) - JavaScript implementation
|
|
325
|
-
- [libp2p Browser Examples](https://github.com/libp2p/js-libp2p/tree/main/examples) - Browser-specific configurations
|
|
326
|
-
|
|
327
|
-
### WebAuthn & Authentication
|
|
151
|
+
Svelte demos:
|
|
152
|
+
- `examples/webauthn-todo-demo/` - WebAuthn DID (no keystore signing; identity-only).
|
|
153
|
+
- `examples/ed25519-encrypted-keystore-demo/` - Ed25519 keystore DID; keystore encrypted at rest with WebAuthn (PRF when available, otherwise largeBlob/hmac-secret).
|
|
154
|
+
- `examples/webauthn-varsig-demo/` - Varsig provider with passkey signing for each entry. Live demo: https://dweb.link/ipfs/bafybeib6tpwiby7pik67ufb3lxpr3j4by2l7r3ov3zzk6hjbzjzgsvckhy
|
|
328
155
|
|
|
329
|
-
|
|
330
|
-
-
|
|
331
|
-
-
|
|
332
|
-
-
|
|
156
|
+
Scripted examples:
|
|
157
|
+
- `examples/ed25519-keystore-did-example.js` - Keystore DID flow.
|
|
158
|
+
- `examples/encrypted-keystore-example.js` - Keystore encryption flow.
|
|
159
|
+
- `examples/simple-encryption-integration.js` - Keystore + database content encryption.
|
|
333
160
|
|
|
334
|
-
|
|
335
|
-
-
|
|
336
|
-
- [Apple Passkeys](https://developer.apple.com/passkeys/) - iOS/macOS passkey implementation
|
|
337
|
-
- [Google Passkeys](https://developers.google.com/identity/passkeys) - Android/Chrome passkey support
|
|
338
|
-
- [Microsoft Passkeys](https://docs.microsoft.com/en-us/microsoft-edge/web-platform/passkeys) - Windows Hello integration
|
|
161
|
+
Mermaid sequences for scripts:
|
|
162
|
+
- `docs/EXAMPLE-SEQUENCES.md`
|
|
339
163
|
|
|
340
|
-
|
|
164
|
+
## Documentation
|
|
341
165
|
|
|
342
|
-
|
|
343
|
-
-
|
|
344
|
-
-
|
|
345
|
-
-
|
|
346
|
-
|
|
347
|
-
##### YubiKey WebAuthn
|
|
348
|
-
- [YubiKey WebAuthn Guide](https://developers.yubico.com/WebAuthn/) - Complete WebAuthn implementation guide
|
|
349
|
-
- [YubiKey Developer Program](https://developers.yubico.com/) - SDKs, libraries, and documentation
|
|
350
|
-
- [YubiKey WebAuthn Examples](https://github.com/Yubico/java-webauthn-server) - Server-side WebAuthn implementation
|
|
351
|
-
- [YubiKey JavaScript Library](https://github.com/Yubico/yubikit-web) - Web integration tools
|
|
352
|
-
|
|
353
|
-
#### Browser Compatibility
|
|
354
|
-
- [Can I Use WebAuthn](https://caniuse.com/webauthn) - Browser support matrix
|
|
355
|
-
- [WebAuthn Awesome List](https://github.com/herrjemand/awesome-webauthn) - Curated WebAuthn resources
|
|
356
|
-
- [FIDO Alliance](https://fidoalliance.org/) - Industry standards and certification
|
|
357
|
-
|
|
358
|
-
### Cryptography & DIDs
|
|
359
|
-
|
|
360
|
-
#### Decentralized Identifiers (DIDs)
|
|
361
|
-
- [DID W3C Specification](https://w3c.github.io/did-core/) - Official DID standard
|
|
362
|
-
- [DID Method Registry](https://w3c.github.io/did-spec-registries/) - Registered DID methods
|
|
363
|
-
- [DID Primer](https://github.com/WebOfTrustInfo/rwot5-boston/blob/master/topics-and-advance-readings/did-primer.md) - Introduction to DIDs
|
|
364
|
-
|
|
365
|
-
#### P-256 Elliptic Curve Cryptography
|
|
366
|
-
- [RFC 6090 - ECC Algorithms](https://tools.ietf.org/html/rfc6090) - Fundamental ECC operations
|
|
367
|
-
- [NIST P-256 Curve](https://csrc.nist.gov/csrc/media/events/workshop-on-elliptic-curve-cryptography-standards/documents/papers/session6-adalier-mehmet.pdf) - Technical specifications
|
|
368
|
-
- [WebCrypto API](https://developer.mozilla.org/en-US/docs/Web/API/Web_Crypto_API) - Browser cryptography APIs
|
|
369
|
-
|
|
370
|
-
## Contributing
|
|
371
|
-
|
|
372
|
-
Contributions are welcome! Please ensure all tests pass and follow the existing code style.
|
|
166
|
+
- `docs/USAGE-GUIDE.md`
|
|
167
|
+
- `docs/ED25519-KEYSTORE-DID.md`
|
|
168
|
+
- `docs/WEBAUTHN-ENCRYPTED-KEYSTORE-INTEGRATION.md`
|
|
169
|
+
- `docs/WEBAUTHN-DID-AND-ORBITDB-IDENTITY.md`
|
|
373
170
|
|
|
374
171
|
## License
|
|
375
172
|
|
|
376
|
-
MIT
|
|
377
|
-
|
|
378
|
-
## Security Disclosures
|
|
379
|
-
|
|
380
|
-
For security vulnerabilities, please email security@le-space.de instead of using the issue tracker.
|
|
173
|
+
MIT. See `LICENSE`.
|
package/package.json
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@le-space/orbitdb-identity-provider-webauthn-did",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "WebAuthn-based DID identity provider for OrbitDB for hardware-secured wallets and biometric Passkey authentication",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./src/index.js",
|
|
9
|
+
"./verification": "./verification.js"
|
|
10
|
+
},
|
|
7
11
|
"scripts": {
|
|
8
|
-
"
|
|
12
|
+
"postinstall": "patch-package",
|
|
13
|
+
"test": "npm run test:all",
|
|
9
14
|
"test:all": "playwright test",
|
|
10
15
|
"test:headed": "playwright test tests/webauthn-focused.test.js --headed --project=chromium",
|
|
11
16
|
"test:ui": "playwright test --ui",
|
|
12
17
|
"test:focused": "playwright test tests/webauthn-focused.test.js --project=chromium --reporter=line",
|
|
13
18
|
"test:unit": "playwright test tests/webauthn-unit.test.js",
|
|
14
19
|
"test:integration": "playwright test tests/webauthn-integration.test.js",
|
|
15
|
-
"test:
|
|
16
|
-
"test:
|
|
17
|
-
"test:
|
|
20
|
+
"test:verification": "playwright test tests/webauthn-verification.test.js --project=chromium",
|
|
21
|
+
"test:ci": "playwright test tests/webauthn-verification.test.js --project=chromium --reporter=github",
|
|
22
|
+
"test:logging": "DEBUG='orbitdb-identity-provider-webauthn-did*' playwright test tests/webauthn-logging-e2e.test.js --project=chromium --reporter=line",
|
|
23
|
+
"test:varsig-e2e": "playwright test tests/webauthn-varsig-e2e.test.js --project=chromium --reporter=line",
|
|
24
|
+
"test:encrypted-keystore": "USE_ENCRYPTED_DEMO=true playwright test tests/ed25519-encrypted-keystore-e2e.test.js --project=chromium --reporter=line",
|
|
25
|
+
"test:encrypted-keystore-headed": "USE_ENCRYPTED_DEMO=true playwright test tests/ed25519-encrypted-keystore-e2e.test.js --headed --project=chromium",
|
|
18
26
|
"test:full-flow": "npm run demo:setup && npm run test:focused",
|
|
19
27
|
"lint": "eslint src/ tests/",
|
|
20
28
|
"lint:fix": "eslint src/ tests/ --fix",
|
|
@@ -43,17 +51,27 @@
|
|
|
43
51
|
"license": "MIT",
|
|
44
52
|
"repository": {
|
|
45
53
|
"type": "git",
|
|
46
|
-
"url": "git+https://github.com/
|
|
54
|
+
"url": "git+https://github.com/le-space/orbitdb-identity-provider-webauthn-did.git"
|
|
47
55
|
},
|
|
48
56
|
"bugs": {
|
|
49
|
-
"url": "https://github.com/
|
|
57
|
+
"url": "https://github.com/le-space.de/orbitdb-identity-provider-webauthn-did/issues"
|
|
50
58
|
},
|
|
51
|
-
"homepage": "https://github.com/
|
|
59
|
+
"homepage": "https://github.com/le-space/orbitdb-identity-provider-webauthn-did#readme",
|
|
52
60
|
"peerDependencies": {
|
|
53
61
|
"@orbitdb/core": "^3.0.0"
|
|
54
62
|
},
|
|
55
63
|
"dependencies": {
|
|
64
|
+
"@ipld/dag-cbor": "^9.2.5",
|
|
65
|
+
"@libp2p/logger": "^5.1.5",
|
|
66
|
+
"@libp2p/crypto": "^5.1.8",
|
|
67
|
+
"@simplewebauthn/browser": "^13.0.0",
|
|
56
68
|
"cbor-web": "^9.0.1",
|
|
69
|
+
"iso-base": "npm:@le-space/iso-base",
|
|
70
|
+
"iso-did": "npm:@le-space/iso-did@2.1.2",
|
|
71
|
+
"iso-passkeys": "npm:@le-space/iso-passkeys",
|
|
72
|
+
"iso-web": "^2.1.0",
|
|
73
|
+
"iso-webauthn-varsig": "npm:@le-space/iso-webauthn-varsig",
|
|
74
|
+
"multiformats": "^13.0.0",
|
|
57
75
|
"vite-plugin-node-polyfills": "^0.24.0"
|
|
58
76
|
},
|
|
59
77
|
"devDependencies": {
|
|
@@ -63,7 +81,8 @@
|
|
|
63
81
|
"eslint": "^9.0.0",
|
|
64
82
|
"helia": "^5.0.0",
|
|
65
83
|
"libp2p": "^2.0.0",
|
|
66
|
-
"mocha": "^10.0.0"
|
|
84
|
+
"mocha": "^10.0.0",
|
|
85
|
+
"patch-package": "^8.0.1"
|
|
67
86
|
},
|
|
68
87
|
"engines": {
|
|
69
88
|
"node": ">=18.0.0"
|
|
@@ -73,10 +92,23 @@
|
|
|
73
92
|
},
|
|
74
93
|
"files": [
|
|
75
94
|
"src/",
|
|
95
|
+
"verification.js",
|
|
76
96
|
"README.md",
|
|
77
97
|
"LICENSE",
|
|
78
98
|
"package.json"
|
|
79
99
|
],
|
|
100
|
+
"pnpm": {
|
|
101
|
+
"overrides": {
|
|
102
|
+
"iso-base": "npm:@le-space/iso-base",
|
|
103
|
+
"iso-did": "npm:@le-space/iso-did@2.1.2",
|
|
104
|
+
"iso-webauthn-varsig": "npm:@le-space/iso-webauthn-varsig"
|
|
105
|
+
},
|
|
106
|
+
"onlyBuiltDependencies": [
|
|
107
|
+
"@ipshipyard/node-datachannel",
|
|
108
|
+
"classic-level",
|
|
109
|
+
"esbuild"
|
|
110
|
+
]
|
|
111
|
+
},
|
|
80
112
|
"publishConfig": {
|
|
81
113
|
"access": "public"
|
|
82
114
|
}
|