@madauth/server 0.4.0-beta.1 → 0.5.0-beta.2
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 +1 -1
- package/dist/bin.js +134 -44
- package/dist/{chunk-3PACOYTG.js → chunk-6SF2WNOC.js} +908 -377
- package/dist/{chunk-GA4TF7EI.js → chunk-NP75Y3IV.js} +27 -4
- package/dist/{chunk-ISJGOCF3.js → chunk-NYIEFI4B.js} +268 -55
- package/dist/{chunk-OMIX3ERC.js → chunk-O2URPWA6.js} +27 -3
- package/dist/{chunk-Y7ZSUROX.js → chunk-SISM7YUZ.js} +14 -12
- package/dist/{config-DkE_2D3-.d.ts → config-CcGlHVAN.d.ts} +16 -8
- package/dist/dynamodb.js +1 -1
- package/dist/entry/azure.d.ts +3 -3
- package/dist/entry/azure.js +3 -3
- package/dist/entry/lambda.d.ts +3 -3
- package/dist/entry/lambda.js +3 -3
- package/dist/entry/node.d.ts +3 -3
- package/dist/entry/node.js +3 -3
- package/dist/index.d.ts +22 -15
- package/dist/index.js +7 -5
- package/dist/{schema-DTeiSuQB.d.ts → schema-BTgDj1Xn.d.ts} +43 -4
- package/dist/sqlite.js +2 -2
- package/dist/standalone/azure.mjs +4384 -425
- package/dist/standalone/lambda.mjs +4383 -424
- package/dist/standalone/main.mjs +4321 -362
- package/dist/store/dynamodb.d.ts +1 -1
- package/dist/store/sqlite.d.ts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/testing.js +19 -0
- package/dist/{user-BZs84sui.d.ts → user-yoGjrw4k.d.ts} +2 -2
- package/dist/verify.d.ts +1 -1
- package/dist/{webhook-B6P50ocX.d.ts → webhook-DlmfG_kS.d.ts} +5 -2
- package/dist/webhook.d.ts +1 -1
- package/dist/webhook.js +1 -1
- package/package.json +3 -1
package/dist/store/dynamodb.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DynamoDBClient } from '@aws-sdk/client-dynamodb';
|
|
2
|
-
import { S as StoreAdapter } from '../schema-
|
|
2
|
+
import { S as StoreAdapter } from '../schema-BTgDj1Xn.js';
|
|
3
3
|
|
|
4
4
|
interface DynamoDbAdapterOptions {
|
|
5
5
|
/** The table, with the partition key `pk` and the sort key `sk` (both strings). */
|
package/dist/store/sqlite.d.ts
CHANGED
package/dist/testing.d.ts
CHANGED
package/dist/testing.js
CHANGED
|
@@ -13,8 +13,10 @@ function testUser(overrides = {}) {
|
|
|
13
13
|
name: null,
|
|
14
14
|
sessionVersion: 0,
|
|
15
15
|
lastMailAt: 0,
|
|
16
|
+
lastSmsAt: null,
|
|
16
17
|
wrongCodes: 0,
|
|
17
18
|
claims: null,
|
|
19
|
+
signedUpAt: null,
|
|
18
20
|
createdAt: 17e11,
|
|
19
21
|
...overrides
|
|
20
22
|
};
|
|
@@ -31,6 +33,9 @@ function testAccount(overrides = {}) {
|
|
|
31
33
|
email: null,
|
|
32
34
|
lastUsedStep: 0,
|
|
33
35
|
setupId: null,
|
|
36
|
+
phone: null,
|
|
37
|
+
primaryUserId: null,
|
|
38
|
+
secondFactor: null,
|
|
34
39
|
createdAt: 17e11,
|
|
35
40
|
...overrides
|
|
36
41
|
};
|
|
@@ -117,6 +122,20 @@ function storeAdapterContract(t, createAdapter) {
|
|
|
117
122
|
expect(await store.findOne("account", { key: account.key })).toEqual(account);
|
|
118
123
|
expect(await store.findOne("account", { key: unique("password:missing") })).toBe(null);
|
|
119
124
|
});
|
|
125
|
+
it("lets many records leave a unique field empty, but refuses a value that is taken", async () => {
|
|
126
|
+
const store = await createAdapter();
|
|
127
|
+
const userId = unique("usr_contract");
|
|
128
|
+
const first = testAccount({ userId, key: unique("totp:contract") });
|
|
129
|
+
const second = testAccount({ userId, key: unique("sms:contract") });
|
|
130
|
+
const primary = testAccount({ userId, primaryUserId: userId });
|
|
131
|
+
const another = testAccount({ userId, primaryUserId: userId });
|
|
132
|
+
expect(await store.create("account", first)).toBe(true);
|
|
133
|
+
expect(await store.create("account", second)).toBe(true);
|
|
134
|
+
expect(await store.create("account", primary)).toBe(true);
|
|
135
|
+
expect(await store.create("account", another)).toBe(false);
|
|
136
|
+
expect(await store.findOne("account", { primaryUserId: userId })).toEqual(primary);
|
|
137
|
+
expect(await store.findOne("account", { id: another.id })).toBe(null);
|
|
138
|
+
});
|
|
120
139
|
it("sets a field to a value and to null", async () => {
|
|
121
140
|
const store = await createAdapter();
|
|
122
141
|
const user = testUser({ name: "Ada" });
|
|
@@ -8,8 +8,8 @@ interface MadauthUser {
|
|
|
8
8
|
/** What admins attached to the user, e.g. `{ roles: ['admin'] }`. Absent without claims. */
|
|
9
9
|
claims?: Record<string, unknown>;
|
|
10
10
|
/**
|
|
11
|
-
* How this session was authenticated (RFC 8176): `pwd` (password), `google`, `otp` (the
|
|
12
|
-
* app, on its own or as the second factor), e.g. `['pwd', 'otp']`. Present on a user that comes with a session.
|
|
11
|
+
* How this session was authenticated (RFC 8176): `pwd` (password), `google`, `github`, `otp` (the
|
|
12
|
+
* authenticator app, on its own or as the second factor), e.g. `['pwd', 'otp']`. Present on a user that comes with a session.
|
|
13
13
|
*/
|
|
14
14
|
amr?: string[];
|
|
15
15
|
}
|
package/dist/verify.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Every `type` madAuth sends: `email.send_*` and `sms.send_*` hand over a message to send, `user.signing_up`
|
|
3
|
+
* asks whether someone may sign up, and the other `user.*` types tell what happened.
|
|
4
|
+
*/
|
|
5
|
+
declare const WEBHOOK_TYPES: readonly ["email.send_verification", "email.send_password_reset", "email.send_signin_link", "email.send_already_registered", "email.send_password_reset_no_password", "sms.send_code", "user.signing_up", "user.signed_up", "user.email_verified", "user.password_reset", "user.signed_in", "user.deleted", "user.claims_changed", "user.second_factor_enabled", "user.second_factor_disabled", "user.recovery_code_used"];
|
|
3
6
|
type WebhookType = (typeof WEBHOOK_TYPES)[number];
|
|
4
7
|
/** How old a call may be before receivers reject it, so a captured call can't be replayed. */
|
|
5
8
|
declare const WEBHOOK_TOLERANCE_SECONDS: number;
|
package/dist/webhook.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { a as WEBHOOK_TOLERANCE_SECONDS, b as WEBHOOK_TYPES, c as WebhookType, g as generateWebhookSecret, s as signWebhook, v as verifyWebhook } from './webhook-
|
|
1
|
+
export { a as WEBHOOK_TOLERANCE_SECONDS, b as WEBHOOK_TYPES, c as WebhookType, g as generateWebhookSecret, s as signWebhook, v as verifyWebhook } from './webhook-DlmfG_kS.js';
|
package/dist/webhook.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@madauth/server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0-beta.2",
|
|
4
4
|
"description": "madAuth server: Google, e-mail & password and authenticator-app sign-in with madAuth sessions, for Docker, AWS Lambda and Azure Functions.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "David Neuy",
|
|
@@ -88,6 +88,8 @@
|
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
90
|
"@hono/node-server": "^2.1.3",
|
|
91
|
+
"@zxcvbn-ts/core": "4.2.0",
|
|
92
|
+
"@zxcvbn-ts/language-common": "4.1.3",
|
|
91
93
|
"hono": "^4.13.12",
|
|
92
94
|
"jose": "^6.2.12"
|
|
93
95
|
},
|