@passkeykit/server 2.0.2 → 2.1.0
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 +17 -6
- package/dist/esm/index.js +0 -4
- package/dist/esm/stores.js +2 -4
- package/dist/esm/types.js +2 -2
- package/dist/index.d.ts +0 -4
- package/dist/index.js +0 -4
- package/dist/stores.d.ts +2 -4
- package/dist/stores.js +2 -4
- package/dist/types.d.ts +5 -5
- package/dist/types.js +2 -2
- package/package.json +10 -2
package/README.md
CHANGED
|
@@ -10,9 +10,19 @@ Handles challenge generation, attestation/assertion verification, and includes s
|
|
|
10
10
|
## Install
|
|
11
11
|
|
|
12
12
|
```bash
|
|
13
|
-
npm install @passkeykit/server
|
|
13
|
+
npm install @passkeykit/server @simplewebauthn/server
|
|
14
14
|
```
|
|
15
15
|
|
|
16
|
+
> `@simplewebauthn/server` is a **peer dependency** — you control the version. This keeps the package itself lightweight while giving you full WebAuthn verification.
|
|
17
|
+
>
|
|
18
|
+
> **Password-only?** If you only need `hashPassword` / `verifyPassword`, import from the subpath — no WebAuthn dependency required:
|
|
19
|
+
> ```bash
|
|
20
|
+
> npm install @passkeykit/server
|
|
21
|
+
> ```
|
|
22
|
+
> ```typescript
|
|
23
|
+
> import { hashPassword, verifyPassword } from '@passkeykit/server/password';
|
|
24
|
+
> ```
|
|
25
|
+
|
|
16
26
|
## Quick Start
|
|
17
27
|
|
|
18
28
|
### Stateless (Serverless / Vercel / Cloudflare)
|
|
@@ -217,11 +227,12 @@ interface PasskeyServerConfig {
|
|
|
217
227
|
|
|
218
228
|
## Exports
|
|
219
229
|
|
|
220
|
-
| Import Path | Contents |
|
|
221
|
-
|
|
222
|
-
| `@passkeykit/server` | `PasskeyServer`, stores, password hashing, types |
|
|
223
|
-
| `@passkeykit/server/
|
|
224
|
-
| `@passkeykit/server/
|
|
230
|
+
| Import Path | Contents | Requires |
|
|
231
|
+
|-------------|----------|----------|
|
|
232
|
+
| `@passkeykit/server` | `PasskeyServer`, stores, password hashing, types | `@simplewebauthn/server` |
|
|
233
|
+
| `@passkeykit/server/password` | `hashPassword()`, `verifyPassword()`, `needsRehash()` — scrypt | None (pure JS) |
|
|
234
|
+
| `@passkeykit/server/express` | `createExpressRoutes()` — ready-made Express router | `express` |
|
|
235
|
+
| `@passkeykit/server/argon2` | `hashPassword()`, `verifyPassword()` — native argon2id | `argon2` |
|
|
225
236
|
|
|
226
237
|
## Client Pairing
|
|
227
238
|
|
package/dist/esm/index.js
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
* Server-side WebAuthn passkey verification with challenge-response pattern
|
|
5
5
|
* and scrypt password hashing (pure JS, works everywhere).
|
|
6
6
|
*
|
|
7
|
-
* @ai_context This is the core auth library used across all dnldev apps.
|
|
8
|
-
* Challenge generation and verification MUST happen server-side.
|
|
9
|
-
* Client never sees raw challenges — only attestation/assertion responses.
|
|
10
|
-
*
|
|
11
7
|
* Two modes:
|
|
12
8
|
* - **Stateless** (default): No server-side state. Set `encryptionKey` in config.
|
|
13
9
|
* - **Stateful**: Provide a `challengeStore` (memory, file, Redis, etc).
|
package/dist/esm/stores.js
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Built-in store implementations for common backends.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* For single-server apps (like MovieBox, MediaBox), FileStore works great.
|
|
4
|
+
* For production with multiple server instances, implement the ChallengeStore
|
|
5
|
+
* and CredentialStore interfaces with a shared backend (Redis, database, etc).
|
|
7
6
|
*/
|
|
8
7
|
import { readFileSync, writeFileSync, mkdirSync, existsSync } from 'fs';
|
|
9
8
|
import { dirname } from 'path';
|
|
@@ -54,7 +53,6 @@ export class MemoryCredentialStore {
|
|
|
54
53
|
* File-based challenge store. Challenges are stored in a JSON file.
|
|
55
54
|
* Auto-cleans expired challenges on every operation.
|
|
56
55
|
*
|
|
57
|
-
* @ai_context Used by MovieBox/MediaBox which store auth in auth.json.
|
|
58
56
|
* Not suitable for multi-process servers (race conditions on file writes).
|
|
59
57
|
*/
|
|
60
58
|
export class FileChallengeStore {
|
package/dist/esm/types.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type definitions for @passkeykit/server
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* These types define the storage interface abstraction.
|
|
5
5
|
* Apps provide their own ChallengeStore and CredentialStore implementations
|
|
6
|
-
* so the library works with any backend (Firestore, file JSON, SQLite, etc).
|
|
6
|
+
* so the library works with any backend (Firestore, file JSON, SQLite, Redis, etc).
|
|
7
7
|
*/
|
|
8
8
|
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -4,10 +4,6 @@
|
|
|
4
4
|
* Server-side WebAuthn passkey verification with challenge-response pattern
|
|
5
5
|
* and scrypt password hashing (pure JS, works everywhere).
|
|
6
6
|
*
|
|
7
|
-
* @ai_context This is the core auth library used across all dnldev apps.
|
|
8
|
-
* Challenge generation and verification MUST happen server-side.
|
|
9
|
-
* Client never sees raw challenges — only attestation/assertion responses.
|
|
10
|
-
*
|
|
11
7
|
* Two modes:
|
|
12
8
|
* - **Stateless** (default): No server-side state. Set `encryptionKey` in config.
|
|
13
9
|
* - **Stateful**: Provide a `challengeStore` (memory, file, Redis, etc).
|
package/dist/index.js
CHANGED
|
@@ -5,10 +5,6 @@
|
|
|
5
5
|
* Server-side WebAuthn passkey verification with challenge-response pattern
|
|
6
6
|
* and scrypt password hashing (pure JS, works everywhere).
|
|
7
7
|
*
|
|
8
|
-
* @ai_context This is the core auth library used across all dnldev apps.
|
|
9
|
-
* Challenge generation and verification MUST happen server-side.
|
|
10
|
-
* Client never sees raw challenges — only attestation/assertion responses.
|
|
11
|
-
*
|
|
12
8
|
* Two modes:
|
|
13
9
|
* - **Stateless** (default): No server-side state. Set `encryptionKey` in config.
|
|
14
10
|
* - **Stateful**: Provide a `challengeStore` (memory, file, Redis, etc).
|
package/dist/stores.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Built-in store implementations for common backends.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* For single-server apps (like MovieBox, MediaBox), FileStore works great.
|
|
4
|
+
* For production with multiple server instances, implement the ChallengeStore
|
|
5
|
+
* and CredentialStore interfaces with a shared backend (Redis, database, etc).
|
|
7
6
|
*/
|
|
8
7
|
import type { ChallengeStore, CredentialStore, StoredChallenge, StoredCredential } from './types.js';
|
|
9
8
|
export declare class MemoryChallengeStore implements ChallengeStore {
|
|
@@ -23,7 +22,6 @@ export declare class MemoryCredentialStore implements CredentialStore {
|
|
|
23
22
|
* File-based challenge store. Challenges are stored in a JSON file.
|
|
24
23
|
* Auto-cleans expired challenges on every operation.
|
|
25
24
|
*
|
|
26
|
-
* @ai_context Used by MovieBox/MediaBox which store auth in auth.json.
|
|
27
25
|
* Not suitable for multi-process servers (race conditions on file writes).
|
|
28
26
|
*/
|
|
29
27
|
export declare class FileChallengeStore implements ChallengeStore {
|
package/dist/stores.js
CHANGED
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Built-in store implementations for common backends.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
* For single-server apps (like MovieBox, MediaBox), FileStore works great.
|
|
5
|
+
* For production with multiple server instances, implement the ChallengeStore
|
|
6
|
+
* and CredentialStore interfaces with a shared backend (Redis, database, etc).
|
|
8
7
|
*/
|
|
9
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
9
|
exports.FileCredentialStore = exports.FileChallengeStore = exports.MemoryCredentialStore = exports.MemoryChallengeStore = void 0;
|
|
@@ -59,7 +58,6 @@ exports.MemoryCredentialStore = MemoryCredentialStore;
|
|
|
59
58
|
* File-based challenge store. Challenges are stored in a JSON file.
|
|
60
59
|
* Auto-cleans expired challenges on every operation.
|
|
61
60
|
*
|
|
62
|
-
* @ai_context Used by MovieBox/MediaBox which store auth in auth.json.
|
|
63
61
|
* Not suitable for multi-process servers (race conditions on file writes).
|
|
64
62
|
*/
|
|
65
63
|
class FileChallengeStore {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Type definitions for @passkeykit/server
|
|
3
3
|
*
|
|
4
|
-
*
|
|
4
|
+
* These types define the storage interface abstraction.
|
|
5
5
|
* Apps provide their own ChallengeStore and CredentialStore implementations
|
|
6
|
-
* so the library works with any backend (Firestore, file JSON, SQLite, etc).
|
|
6
|
+
* so the library works with any backend (Firestore, file JSON, SQLite, Redis, etc).
|
|
7
7
|
*/
|
|
8
8
|
import type { AuthenticatorTransportFuture } from '@simplewebauthn/server';
|
|
9
9
|
/** Configuration for PasskeyServer */
|
|
10
10
|
export interface PasskeyServerConfig {
|
|
11
|
-
/** Relying Party name shown to users (e.g. "
|
|
11
|
+
/** Relying Party name shown to users (e.g. "My App") */
|
|
12
12
|
rpName: string;
|
|
13
|
-
/** Relying Party ID — must be a valid domain (e.g. "
|
|
13
|
+
/** Relying Party ID — must be a valid domain (e.g. "auth.example.com") */
|
|
14
14
|
rpId: string;
|
|
15
|
-
/** Allowed origins for WebAuthn (e.g. ["https://
|
|
15
|
+
/** Allowed origins for WebAuthn (e.g. ["https://example.com"]) */
|
|
16
16
|
allowedOrigins: string[];
|
|
17
17
|
/**
|
|
18
18
|
* Challenge store implementation (stateful mode).
|
package/dist/types.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
/**
|
|
3
3
|
* Type definitions for @passkeykit/server
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* These types define the storage interface abstraction.
|
|
6
6
|
* Apps provide their own ChallengeStore and CredentialStore implementations
|
|
7
|
-
* so the library works with any backend (Firestore, file JSON, SQLite, etc).
|
|
7
|
+
* so the library works with any backend (Firestore, file JSON, SQLite, Redis, etc).
|
|
8
8
|
*/
|
|
9
9
|
Object.defineProperty(exports, "__esModule", { value: true });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@passkeykit/server",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"description": "Server-side WebAuthn passkey verification — stateless or stateful, pure JS, works on serverless",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -11,6 +11,11 @@
|
|
|
11
11
|
"require": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts"
|
|
13
13
|
},
|
|
14
|
+
"./password": {
|
|
15
|
+
"import": "./dist/esm/password.js",
|
|
16
|
+
"require": "./dist/password.js",
|
|
17
|
+
"types": "./dist/password.d.ts"
|
|
18
|
+
},
|
|
14
19
|
"./express": {
|
|
15
20
|
"import": "./dist/esm/express-routes.js",
|
|
16
21
|
"require": "./dist/express-routes.js",
|
|
@@ -49,14 +54,17 @@
|
|
|
49
54
|
],
|
|
50
55
|
"license": "MIT",
|
|
51
56
|
"dependencies": {
|
|
52
|
-
"@simplewebauthn/server": "^13.1.1",
|
|
53
57
|
"@noble/hashes": "^1.7.0"
|
|
54
58
|
},
|
|
55
59
|
"peerDependencies": {
|
|
60
|
+
"@simplewebauthn/server": "^13.0.0",
|
|
56
61
|
"express": "^4.0.0 || ^5.0.0",
|
|
57
62
|
"argon2": "^0.41.0"
|
|
58
63
|
},
|
|
59
64
|
"peerDependenciesMeta": {
|
|
65
|
+
"@simplewebauthn/server": {
|
|
66
|
+
"optional": false
|
|
67
|
+
},
|
|
60
68
|
"express": {
|
|
61
69
|
"optional": true
|
|
62
70
|
},
|