@sharadox/account-web-library 0.1.0-development.24 → 0.1.0-development.27
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 +95 -20
- package/distribution/account-activity/index.d.ts +16 -0
- package/distribution/account-activity/index.d.ts.map +1 -0
- package/distribution/account-activity/index.js +18 -0
- package/distribution/account-activity/index.js.map +1 -0
- package/distribution/account-activity/type.d.ts +15 -0
- package/distribution/account-activity/type.d.ts.map +1 -0
- package/distribution/account-activity/type.js.map +1 -0
- package/distribution/account-database/type.d.ts +57 -4
- package/distribution/account-database/type.d.ts.map +1 -1
- package/distribution/account-deletion/index.d.ts +18 -0
- package/distribution/account-deletion/index.d.ts.map +1 -0
- package/distribution/account-deletion/index.js +28 -0
- package/distribution/account-deletion/index.js.map +1 -0
- package/distribution/account-export/index.d.ts +17 -0
- package/distribution/account-export/index.d.ts.map +1 -0
- package/distribution/account-export/index.js +87 -0
- package/distribution/account-export/index.js.map +1 -0
- package/distribution/account-export/type.d.ts +40 -0
- package/distribution/account-export/type.d.ts.map +1 -0
- package/distribution/{username-change → account-export}/type.js.map +1 -1
- package/distribution/account-migration/index.d.ts.map +1 -1
- package/distribution/account-migration/index.js +110 -0
- package/distribution/account-migration/index.js.map +1 -1
- package/distribution/account-name/index.d.ts +13 -0
- package/distribution/account-name/index.d.ts.map +1 -0
- package/distribution/account-name/index.js +22 -0
- package/distribution/account-name/index.js.map +1 -0
- package/distribution/account-name/type.d.ts +9 -0
- package/distribution/account-name/type.d.ts.map +1 -0
- package/distribution/account-name/type.js +2 -0
- package/distribution/account-name/type.js.map +1 -0
- package/distribution/account-name-change/index.d.ts +15 -0
- package/distribution/account-name-change/index.d.ts.map +1 -0
- package/distribution/account-name-change/index.js +26 -0
- package/distribution/account-name-change/index.js.map +1 -0
- package/distribution/account-name-change/type.d.ts +7 -0
- package/distribution/account-name-change/type.d.ts.map +1 -0
- package/distribution/account-name-change/type.js +2 -0
- package/distribution/account-name-change/type.js.map +1 -0
- package/distribution/account-picture-change/index.d.ts +30 -0
- package/distribution/account-picture-change/index.d.ts.map +1 -0
- package/distribution/account-picture-change/index.js +70 -0
- package/distribution/account-picture-change/index.js.map +1 -0
- package/distribution/account-picture-change/type.d.ts +11 -0
- package/distribution/account-picture-change/type.d.ts.map +1 -0
- package/distribution/account-picture-change/type.js +2 -0
- package/distribution/account-picture-change/type.js.map +1 -0
- package/distribution/account-server/index.d.ts +11 -1
- package/distribution/account-server/index.d.ts.map +1 -1
- package/distribution/account-server/index.js +12 -1
- package/distribution/account-server/index.js.map +1 -1
- package/distribution/account-server/type.d.ts +2 -0
- package/distribution/account-server/type.d.ts.map +1 -1
- package/distribution/account-session-end/index.d.ts +15 -0
- package/distribution/account-session-end/index.d.ts.map +1 -0
- package/distribution/account-session-end/index.js +21 -0
- package/distribution/account-session-end/index.js.map +1 -0
- package/distribution/account-session-list/index.d.ts +16 -0
- package/distribution/account-session-list/index.d.ts.map +1 -0
- package/distribution/account-session-list/index.js +33 -0
- package/distribution/account-session-list/index.js.map +1 -0
- package/distribution/account-session-list/type.d.ts +13 -0
- package/distribution/account-session-list/type.d.ts.map +1 -0
- package/distribution/account-session-list/type.js +2 -0
- package/distribution/account-session-list/type.js.map +1 -0
- package/distribution/account-sign-in/index.d.ts +1 -1
- package/distribution/account-sign-in/index.d.ts.map +1 -1
- package/distribution/account-sign-in/index.js +4 -2
- package/distribution/account-sign-in/index.js.map +1 -1
- package/distribution/account-sign-in/type.d.ts +2 -0
- package/distribution/account-sign-in/type.d.ts.map +1 -1
- package/distribution/audit-event/index.d.ts.map +1 -1
- package/distribution/audit-event/index.js +12 -1
- package/distribution/audit-event/index.js.map +1 -1
- package/distribution/audit-event/type.d.ts +1 -0
- package/distribution/audit-event/type.d.ts.map +1 -1
- package/distribution/browser-session-read/index.d.ts.map +1 -1
- package/distribution/browser-session-read/index.js +5 -1
- package/distribution/browser-session-read/index.js.map +1 -1
- package/distribution/browser-session-read/type.d.ts +5 -1
- package/distribution/browser-session-read/type.d.ts.map +1 -1
- package/distribution/code-request/index.js +1 -1
- package/distribution/code-request/type.d.ts +1 -1
- package/distribution/code-sending/index.d.ts +14 -0
- package/distribution/code-sending/index.d.ts.map +1 -0
- package/distribution/code-sending/index.js +65 -0
- package/distribution/code-sending/index.js.map +1 -0
- package/distribution/code-sending/type.d.ts +31 -0
- package/distribution/code-sending/type.d.ts.map +1 -0
- package/distribution/code-sending/type.js +2 -0
- package/distribution/code-sending/type.js.map +1 -0
- package/distribution/contact-addition-flow/index.d.ts +31 -0
- package/distribution/contact-addition-flow/index.d.ts.map +1 -0
- package/distribution/contact-addition-flow/index.js +85 -0
- package/distribution/contact-addition-flow/index.js.map +1 -0
- package/distribution/contact-addition-flow/type.d.ts +22 -0
- package/distribution/contact-addition-flow/type.d.ts.map +1 -0
- package/distribution/contact-addition-flow/type.js +2 -0
- package/distribution/contact-addition-flow/type.js.map +1 -0
- package/distribution/database-error/index.d.ts +1 -1
- package/distribution/database-error/index.js +1 -1
- package/distribution/email-channel/index.js +1 -1
- package/distribution/identifier/index.d.ts +23 -0
- package/distribution/identifier/index.d.ts.map +1 -0
- package/distribution/identifier/index.js +32 -0
- package/distribution/identifier/index.js.map +1 -0
- package/distribution/identifier/type.d.ts +10 -0
- package/distribution/identifier/type.d.ts.map +1 -0
- package/distribution/identifier/type.js +2 -0
- package/distribution/identifier/type.js.map +1 -0
- package/distribution/identifier-availability/index.d.ts +11 -0
- package/distribution/identifier-availability/index.d.ts.map +1 -0
- package/distribution/identifier-availability/index.js +21 -0
- package/distribution/identifier-availability/index.js.map +1 -0
- package/distribution/identifier-change/index.d.ts +15 -0
- package/distribution/identifier-change/index.d.ts.map +1 -0
- package/distribution/identifier-change/index.js +43 -0
- package/distribution/identifier-change/index.js.map +1 -0
- package/distribution/identifier-change/type.d.ts +7 -0
- package/distribution/identifier-change/type.d.ts.map +1 -0
- package/distribution/identifier-change/type.js +2 -0
- package/distribution/identifier-change/type.js.map +1 -0
- package/distribution/memory-picture-storage/index.d.ts +15 -0
- package/distribution/memory-picture-storage/index.d.ts.map +1 -0
- package/distribution/memory-picture-storage/index.js +16 -0
- package/distribution/memory-picture-storage/index.js.map +1 -0
- package/distribution/one-time-code/index.d.ts +2 -2
- package/distribution/one-time-code/index.js +3 -3
- package/distribution/person-account/index.d.ts +7 -3
- package/distribution/person-account/index.d.ts.map +1 -1
- package/distribution/person-account/index.js +21 -9
- package/distribution/person-account/index.js.map +1 -1
- package/distribution/person-account/type.d.ts +5 -2
- package/distribution/person-account/type.d.ts.map +1 -1
- package/distribution/picture-key/index.d.ts +8 -0
- package/distribution/picture-key/index.d.ts.map +1 -0
- package/distribution/picture-key/index.js +10 -0
- package/distribution/picture-key/index.js.map +1 -0
- package/distribution/picture-preparation/index.d.ts +18 -0
- package/distribution/picture-preparation/index.d.ts.map +1 -0
- package/distribution/picture-preparation/index.js +86 -0
- package/distribution/picture-preparation/index.js.map +1 -0
- package/distribution/picture-preparation/type.d.ts +18 -0
- package/distribution/picture-preparation/type.d.ts.map +1 -0
- package/distribution/picture-preparation/type.js +2 -0
- package/distribution/picture-preparation/type.js.map +1 -0
- package/distribution/picture-storage/type.d.ts +11 -0
- package/distribution/picture-storage/type.d.ts.map +1 -0
- package/distribution/picture-storage/type.js +2 -0
- package/distribution/picture-storage/type.js.map +1 -0
- package/distribution/recovery-code-regeneration/index.d.ts +19 -0
- package/distribution/recovery-code-regeneration/index.d.ts.map +1 -0
- package/distribution/recovery-code-regeneration/index.js +34 -0
- package/distribution/recovery-code-regeneration/index.js.map +1 -0
- package/distribution/recovery-code-store/index.d.ts +25 -0
- package/distribution/recovery-code-store/index.d.ts.map +1 -0
- package/distribution/recovery-code-store/index.js +34 -0
- package/distribution/recovery-code-store/index.js.map +1 -0
- package/distribution/second-factor-finish/index.d.ts +12 -0
- package/distribution/second-factor-finish/index.d.ts.map +1 -0
- package/distribution/second-factor-finish/index.js +78 -0
- package/distribution/second-factor-finish/index.js.map +1 -0
- package/distribution/second-factor-finish/type.d.ts +27 -0
- package/distribution/second-factor-finish/type.d.ts.map +1 -0
- package/distribution/second-factor-finish/type.js +2 -0
- package/distribution/second-factor-finish/type.js.map +1 -0
- package/distribution/secret-encryption/index.d.ts +17 -0
- package/distribution/secret-encryption/index.d.ts.map +1 -0
- package/distribution/secret-encryption/index.js +37 -0
- package/distribution/secret-encryption/index.js.map +1 -0
- package/distribution/sign-in-finish/index.d.ts +3 -3
- package/distribution/sign-in-finish/index.d.ts.map +1 -1
- package/distribution/sign-in-finish/index.js +22 -5
- package/distribution/sign-in-finish/index.js.map +1 -1
- package/distribution/sign-in-finish/type.d.ts +8 -1
- package/distribution/sign-in-finish/type.d.ts.map +1 -1
- package/distribution/sign-in-start/index.d.ts +4 -6
- package/distribution/sign-in-start/index.d.ts.map +1 -1
- package/distribution/sign-in-start/index.js +14 -62
- package/distribution/sign-in-start/index.js.map +1 -1
- package/distribution/sign-in-start/type.d.ts +7 -0
- package/distribution/sign-in-start/type.d.ts.map +1 -1
- package/distribution/sign-up-finish/index.d.ts +4 -4
- package/distribution/sign-up-finish/index.d.ts.map +1 -1
- package/distribution/sign-up-finish/index.js +11 -6
- package/distribution/sign-up-finish/index.js.map +1 -1
- package/distribution/sign-up-finish/type.d.ts +6 -1
- package/distribution/sign-up-finish/type.d.ts.map +1 -1
- package/distribution/signed-ticket/index.d.ts +1 -1
- package/distribution/signed-ticket/index.js +1 -1
- package/distribution/step-up/index.d.ts +48 -0
- package/distribution/step-up/index.d.ts.map +1 -0
- package/distribution/step-up/index.js +83 -0
- package/distribution/step-up/index.js.map +1 -0
- package/distribution/step-up/type.d.ts +15 -0
- package/distribution/step-up/type.d.ts.map +1 -0
- package/distribution/step-up/type.js +2 -0
- package/distribution/{username → step-up}/type.js.map +1 -1
- package/distribution/test-person/index.d.ts +14 -0
- package/distribution/test-person/index.d.ts.map +1 -0
- package/distribution/test-person/index.js +20 -0
- package/distribution/test-person/index.js.map +1 -0
- package/distribution/totp/type.d.ts +1 -1
- package/distribution/totp/type.d.ts.map +1 -1
- package/distribution/totp-setup/index.d.ts +50 -0
- package/distribution/totp-setup/index.d.ts.map +1 -0
- package/distribution/totp-setup/index.js +136 -0
- package/distribution/totp-setup/index.js.map +1 -0
- package/distribution/totp-setup/type.d.ts +24 -0
- package/distribution/totp-setup/type.d.ts.map +1 -0
- package/distribution/totp-setup/type.js +2 -0
- package/distribution/totp-setup/type.js.map +1 -0
- package/package.json +4 -3
- package/distribution/username/index.d.ts +0 -23
- package/distribution/username/index.d.ts.map +0 -1
- package/distribution/username/index.js +0 -32
- package/distribution/username/index.js.map +0 -1
- package/distribution/username/type.d.ts +0 -10
- package/distribution/username/type.d.ts.map +0 -1
- package/distribution/username-availability/index.d.ts +0 -11
- package/distribution/username-availability/index.d.ts.map +0 -1
- package/distribution/username-availability/index.js +0 -21
- package/distribution/username-availability/index.js.map +0 -1
- package/distribution/username-change/index.d.ts +0 -15
- package/distribution/username-change/index.d.ts.map +0 -1
- package/distribution/username-change/index.js +0 -39
- package/distribution/username-change/index.js.map +0 -1
- package/distribution/username-change/type.d.ts +0 -7
- package/distribution/username-change/type.d.ts.map +0 -1
- /package/distribution/{username-change → account-activity}/type.js +0 -0
- /package/distribution/{username → account-export}/type.js +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/** An identifier that follows the rules (with its `key` for uniqueness), or why not. */
|
|
2
|
+
export type IdentifierCheck = {
|
|
3
|
+
valid: true;
|
|
4
|
+
identifier: string;
|
|
5
|
+
key: string;
|
|
6
|
+
} | {
|
|
7
|
+
valid: false;
|
|
8
|
+
reason: "length" | "characters";
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/identifier/type.ts"],"names":[],"mappings":"AAAA,wFAAwF;AACxF,MAAM,MAAM,eAAe,GACzB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,QAAQ,GAAG,YAAY,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/identifier/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Kysely } from "kysely";
|
|
2
|
+
import type { AccountDatabase } from "@sharadox/account-web-library/account-database/type";
|
|
3
|
+
/**
|
|
4
|
+
* Whether an identifier can be taken: `available`, `taken` (in any case: `aBc` is taken when `abc` exists) or `invalid`
|
|
5
|
+
* (outside the rules). Rate limit callers: it tells whether an account exists.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* await identifierAvailability(database, "Luis-Pires"); // "available"
|
|
9
|
+
*/
|
|
10
|
+
export declare function identifierAvailability(database: Kysely<AccountDatabase>, identifier: string): Promise<"available" | "taken" | "invalid">;
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/identifier-availability/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAG3F;;;;;;GAMG;AACH,wBAAsB,sBAAsB,CAC1C,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,EACjC,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,WAAW,GAAG,OAAO,GAAG,SAAS,CAAC,CAS5C"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { sql } from "kysely";
|
|
2
|
+
import { checkIdentifier } from "@sharadox/account-web-library/identifier";
|
|
3
|
+
/**
|
|
4
|
+
* Whether an identifier can be taken: `available`, `taken` (in any case: `aBc` is taken when `abc` exists) or `invalid`
|
|
5
|
+
* (outside the rules). Rate limit callers: it tells whether an account exists.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* await identifierAvailability(database, "Luis-Pires"); // "available"
|
|
9
|
+
*/
|
|
10
|
+
export async function identifierAvailability(database, identifier) {
|
|
11
|
+
const check = checkIdentifier(identifier);
|
|
12
|
+
if (!check.valid)
|
|
13
|
+
return "invalid";
|
|
14
|
+
const found = await database
|
|
15
|
+
.selectFrom("identifier")
|
|
16
|
+
.select("id")
|
|
17
|
+
.where(sql `lower(value)`, "=", check.key)
|
|
18
|
+
.executeTakeFirst();
|
|
19
|
+
return found ? "taken" : "available";
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/identifier-availability/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAe,MAAM,QAAQ,CAAC;AAE1C,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB,CAC1C,QAAiC,EACjC,UAAkB;IAElB,MAAM,KAAK,GAAG,eAAe,CAAC,UAAU,CAAC,CAAC;IAC1C,IAAI,CAAC,KAAK,CAAC,KAAK;QAAE,OAAO,SAAS,CAAC;IACnC,MAAM,KAAK,GAAG,MAAM,QAAQ;SACzB,UAAU,CAAC,YAAY,CAAC;SACxB,MAAM,CAAC,IAAI,CAAC;SACZ,KAAK,CAAC,GAAG,CAAQ,cAAc,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC;SAChD,gBAAgB,EAAE,CAAC;IACtB,OAAO,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,WAAW,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { Kysely } from "kysely";
|
|
2
|
+
import type { AccountDatabase } from "@sharadox/account-web-library/account-database/type";
|
|
3
|
+
import type { IdentifierChangeResult } from "@sharadox/account-web-library/identifier-change/type";
|
|
4
|
+
/**
|
|
5
|
+
* Changes an account's identifier whenever its owner wants; the old one is free for anyone at once. Accounts are
|
|
6
|
+
* referenced by id, so nothing breaks; the audit log keeps the history. Changing only the case is allowed.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* await changeIdentifier(database, { accountId, identifier: "Luis-Pires" }); // { changed: true }
|
|
10
|
+
*/
|
|
11
|
+
export declare function changeIdentifier(database: Kysely<AccountDatabase>, { accountId, identifier }: {
|
|
12
|
+
accountId: string;
|
|
13
|
+
identifier: string;
|
|
14
|
+
}): Promise<IdentifierChangeResult>;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/identifier-change/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAI3F,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AAEnG;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,EACjC,EAAE,SAAS,EAAE,UAAU,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,GACnE,OAAO,CAAC,sBAAsB,CAAC,CA4BjC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { recordAuditEvent } from "@sharadox/account-web-library/audit-event";
|
|
2
|
+
import { databaseError } from "@sharadox/account-web-library/database-error";
|
|
3
|
+
import { checkIdentifier } from "@sharadox/account-web-library/identifier";
|
|
4
|
+
/**
|
|
5
|
+
* Changes an account's identifier whenever its owner wants; the old one is free for anyone at once. Accounts are
|
|
6
|
+
* referenced by id, so nothing breaks; the audit log keeps the history. Changing only the case is allowed.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* await changeIdentifier(database, { accountId, identifier: "Luis-Pires" }); // { changed: true }
|
|
10
|
+
*/
|
|
11
|
+
export async function changeIdentifier(database, { accountId, identifier }) {
|
|
12
|
+
if (!checkIdentifier(identifier).valid)
|
|
13
|
+
return { changed: false, reason: "identifier-invalid" };
|
|
14
|
+
try {
|
|
15
|
+
return await database.transaction().execute(async (transaction) => {
|
|
16
|
+
const current = await transaction
|
|
17
|
+
.selectFrom("identifier")
|
|
18
|
+
.select("value")
|
|
19
|
+
.where("account_id", "=", accountId)
|
|
20
|
+
.forUpdate()
|
|
21
|
+
.executeTakeFirst();
|
|
22
|
+
if (!current)
|
|
23
|
+
return { changed: false, reason: "no-account" };
|
|
24
|
+
await transaction
|
|
25
|
+
.updateTable("identifier")
|
|
26
|
+
.set({ value: identifier })
|
|
27
|
+
.where("account_id", "=", accountId)
|
|
28
|
+
.execute();
|
|
29
|
+
await recordAuditEvent(transaction, {
|
|
30
|
+
accountId,
|
|
31
|
+
action: "account.identifier-changed",
|
|
32
|
+
detail: { from: current.value, to: identifier },
|
|
33
|
+
});
|
|
34
|
+
return { changed: true };
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
if (databaseError(error)?.constraint === "identifier_value_key")
|
|
39
|
+
return { changed: false, reason: "identifier-taken" };
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/identifier-change/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,M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AE,UAAU,KAAK,sBAAsB;YAC7D,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;QACxD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/identifier-change/type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,sBAAsB,GAChC;IAAE,OAAO,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,oBAAoB,GAAG,kBAAkB,GAAG,YAAY,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/identifier-change/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { PictureStorage } from "@sharadox/account-web-library/picture-storage/type";
|
|
2
|
+
/**
|
|
3
|
+
* Picture storage in memory, for tests and local runs: `files` shows what is stored.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* const storage = createMemoryPictureStorage();
|
|
7
|
+
* await setAccountPicture(database, storage, { accountId, bytes });
|
|
8
|
+
*/
|
|
9
|
+
export declare function createMemoryPictureStorage(): PictureStorage & {
|
|
10
|
+
files: Map<string, {
|
|
11
|
+
bytes: Uint8Array;
|
|
12
|
+
contentType: string;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/memory-picture-storage/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oDAAoD,CAAC;AAEzF;;;;;;GAMG;AACH,wBAAgB,0BAA0B,IAAI,cAAc,GAAG;IAC7D,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,UAAU,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAChE,CAOA"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Picture storage in memory, for tests and local runs: `files` shows what is stored.
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* const storage = createMemoryPictureStorage();
|
|
6
|
+
* await setAccountPicture(database, storage, { accountId, bytes });
|
|
7
|
+
*/
|
|
8
|
+
export function createMemoryPictureStorage() {
|
|
9
|
+
const files = new Map();
|
|
10
|
+
return {
|
|
11
|
+
files,
|
|
12
|
+
put: async (key, bytes, contentType) => void files.set(key, { bytes, contentType }),
|
|
13
|
+
remove: async (key) => void files.delete(key),
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/memory-picture-storage/index.ts"],"names":[],"mappings":"AAEA;;;;;;GAMG;AACH,MAAM,UAAU,0BAA0B;IAGxC,MAAM,KAAK,GAAG,IAAI,GAAG,EAAsD,CAAC;IAC5E,OAAO;QACL,KAAK;QACL,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,CAAC;QACnF,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,KAAK,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC;KAC9C,CAAC;AACJ,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import type { OneTimeCodeHashOptions } from "@sharadox/account-web-library/one-time-code/type";
|
|
2
2
|
/**
|
|
3
|
-
* A new one-time code: `length` digits (
|
|
3
|
+
* A new one-time code: `length` digits (6 by default, one in a million: rate limits and 5 attempts per code keep guessing hopeless), each drawn uniformly by the
|
|
4
4
|
* operating system's secure random source. Send it to the contact; store only `hashOneTimeCode`.
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
|
-
* const code = createOneTimeCode(); // "
|
|
7
|
+
* const code = createOneTimeCode(); // "047182"
|
|
8
8
|
*/
|
|
9
9
|
export declare function createOneTimeCode(length?: number): string;
|
|
10
10
|
/**
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { createHmac, randomInt, timingSafeEqual } from "node:crypto";
|
|
2
2
|
/**
|
|
3
|
-
* A new one-time code: `length` digits (
|
|
3
|
+
* A new one-time code: `length` digits (6 by default, one in a million: rate limits and 5 attempts per code keep guessing hopeless), each drawn uniformly by the
|
|
4
4
|
* operating system's secure random source. Send it to the contact; store only `hashOneTimeCode`.
|
|
5
5
|
*
|
|
6
6
|
* @example
|
|
7
|
-
* const code = createOneTimeCode(); // "
|
|
7
|
+
* const code = createOneTimeCode(); // "047182"
|
|
8
8
|
*/
|
|
9
|
-
export function createOneTimeCode(length =
|
|
9
|
+
export function createOneTimeCode(length = 6) {
|
|
10
10
|
return Array.from({ length }, () => randomInt(10)).join("");
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -3,12 +3,16 @@ import type { AccountDatabase } from "@sharadox/account-web-library/account-data
|
|
|
3
3
|
import type { PersonAccountRequest, PersonAccountResult } from "@sharadox/account-web-library/person-account/type";
|
|
4
4
|
/**
|
|
5
5
|
* Creates a person's account with the contact their one-time code just proved, as its verified sign-in contact, and
|
|
6
|
-
* records it — all or nothing. Refuses a
|
|
6
|
+
* records it — all or nothing. Refuses a name outside the rules (`checkAccountName`, stored tidied), an identifier outside the rules or taken in any case, and a contact another
|
|
7
7
|
* account has verified.
|
|
8
8
|
*
|
|
9
9
|
* @example
|
|
10
|
-
* const result = await createPersonAccount(database, {
|
|
10
|
+
* const result = await createPersonAccount(database, {
|
|
11
|
+
* name: "Luis Pires",
|
|
12
|
+
* identifier: "Luis-Pires",
|
|
13
|
+
* contact: { kind: "email", value },
|
|
14
|
+
* });
|
|
11
15
|
* if (!result.created) return explain(result.reason);
|
|
12
16
|
*/
|
|
13
|
-
export declare function createPersonAccount(database: Kysely<AccountDatabase>, {
|
|
17
|
+
export declare function createPersonAccount(database: Kysely<AccountDatabase>, { name, identifier, contact, now }: PersonAccountRequest): Promise<PersonAccountResult>;
|
|
14
18
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/person-account/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAI3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/person-account/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAI3F,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAInH;;;;;;;;;;;;GAYG;AACH,wBAAsB,mBAAmB,CACvC,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,EACjC,EAAE,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,GAAgB,EAAE,EAAE,oBAAoB,GACpE,OAAO,CAAC,mBAAmB,CAAC,CA+B9B"}
|
|
@@ -2,19 +2,27 @@ import { uuidVersion7 } from "@sharadox/web-library/identifier/uuid-version-7";
|
|
|
2
2
|
import { recordAuditEvent } from "@sharadox/account-web-library/audit-event";
|
|
3
3
|
import { normalizeContact } from "@sharadox/account-web-library/contact-kind";
|
|
4
4
|
import { databaseError } from "@sharadox/account-web-library/database-error";
|
|
5
|
-
import {
|
|
5
|
+
import { checkAccountName } from "@sharadox/account-web-library/account-name";
|
|
6
|
+
import { checkIdentifier } from "@sharadox/account-web-library/identifier";
|
|
6
7
|
/**
|
|
7
8
|
* Creates a person's account with the contact their one-time code just proved, as its verified sign-in contact, and
|
|
8
|
-
* records it — all or nothing. Refuses a
|
|
9
|
+
* records it — all or nothing. Refuses a name outside the rules (`checkAccountName`, stored tidied), an identifier outside the rules or taken in any case, and a contact another
|
|
9
10
|
* account has verified.
|
|
10
11
|
*
|
|
11
12
|
* @example
|
|
12
|
-
* const result = await createPersonAccount(database, {
|
|
13
|
+
* const result = await createPersonAccount(database, {
|
|
14
|
+
* name: "Luis Pires",
|
|
15
|
+
* identifier: "Luis-Pires",
|
|
16
|
+
* contact: { kind: "email", value },
|
|
17
|
+
* });
|
|
13
18
|
* if (!result.created) return explain(result.reason);
|
|
14
19
|
*/
|
|
15
|
-
export async function createPersonAccount(database, {
|
|
16
|
-
|
|
17
|
-
|
|
20
|
+
export async function createPersonAccount(database, { name, identifier, contact, now = Date.now() }) {
|
|
21
|
+
const named = checkAccountName(name);
|
|
22
|
+
if (!named.valid)
|
|
23
|
+
return { created: false, reason: "name-invalid" };
|
|
24
|
+
if (!checkIdentifier(identifier).valid)
|
|
25
|
+
return { created: false, reason: "identifier-invalid" };
|
|
18
26
|
const { kind, value } = normalizeContact(contact);
|
|
19
27
|
const at = new Date(now);
|
|
20
28
|
const accountId = uuidVersion7({ now });
|
|
@@ -23,7 +31,11 @@ export async function createPersonAccount(database, { username, contact, now = D
|
|
|
23
31
|
await database.transaction().execute(async (transaction) => {
|
|
24
32
|
await transaction
|
|
25
33
|
.insertInto("account")
|
|
26
|
-
.values({ id: accountId, kind: "person",
|
|
34
|
+
.values({ id: accountId, kind: "person", name: named.name, owner_id: null, created_at: at, last_active_at: at })
|
|
35
|
+
.execute();
|
|
36
|
+
await transaction
|
|
37
|
+
.insertInto("identifier")
|
|
38
|
+
.values({ id: uuidVersion7({ now }), value: identifier, account_id: accountId, created_at: at })
|
|
27
39
|
.execute();
|
|
28
40
|
await transaction
|
|
29
41
|
.insertInto("contact")
|
|
@@ -34,8 +46,8 @@ export async function createPersonAccount(database, { username, contact, now = D
|
|
|
34
46
|
}
|
|
35
47
|
catch (error) {
|
|
36
48
|
const constraint = databaseError(error)?.constraint;
|
|
37
|
-
if (constraint === "
|
|
38
|
-
return { created: false, reason: "
|
|
49
|
+
if (constraint === "identifier_value_key")
|
|
50
|
+
return { created: false, reason: "identifier-taken" };
|
|
39
51
|
if (constraint === "contact_verified")
|
|
40
52
|
return { created: false, reason: "contact-taken" };
|
|
41
53
|
throw error;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/person-account/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAE7E,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/person-account/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAE/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAE7E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,0CAA0C,CAAC;AAE3E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,QAAiC,EACjC,EAAE,IAAI,EA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AC;YACb,MAAM,WAAW;iBACd,UAAU,CAAC,SAAS,CAAC;iBACrB,MAAM,CAAC,EAAE,EAAE,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,EAAE,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC;iBAC9F,OAAO,EAAE,CAAC;YACb,MAAM,gBAAgB,CAAC,WAAW,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,iBAAiB,EAAE,MAAM,EAAE,EAAE,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,CAAC;QAC5G,CAAC,CAAC,CAAC;IACL,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,UAAU,GAAG,aAAa,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;QACpD,IAAI,UAAU,KAAK,sBAAsB;YAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,kBAAkB,EAAE,CAAC;QACjG,IAAI,UAAU,KAAK,kBAAkB;YAAE,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,eAAe,EAAE,CAAC;QAC1F,MAAM,KAAK,CAAC;IACd,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC;AACjD,CAAC"}
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { Contact } from "@sharadox/account-web-library/contact-kind/type";
|
|
2
2
|
export interface PersonAccountRequest {
|
|
3
|
-
|
|
3
|
+
/** What the account shows (`checkAccountName`). */
|
|
4
|
+
name: string;
|
|
5
|
+
/** Without the `@` (`checkIdentifier`). */
|
|
6
|
+
identifier: string;
|
|
4
7
|
/** Already proved by a one-time code: it is stored verified. */
|
|
5
8
|
contact: Contact;
|
|
6
9
|
/** Milliseconds since 1970 (now by default). */
|
|
@@ -12,6 +15,6 @@ export type PersonAccountResult = {
|
|
|
12
15
|
contactId: string;
|
|
13
16
|
} | {
|
|
14
17
|
created: false;
|
|
15
|
-
reason: "
|
|
18
|
+
reason: "name-invalid" | "identifier-invalid" | "identifier-taken" | "contact-taken";
|
|
16
19
|
};
|
|
17
20
|
//# sourceMappingURL=type.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/person-account/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iDAAiD,CAAC;AAE/E,MAAM,WAAW,oBAAoB;IACnC,
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/person-account/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iDAAiD,CAAC;AAE/E,MAAM,WAAW,oBAAoB;IACnC,mDAAmD;IACnD,IAAI,EAAE,MAAM,CAAC;IACb,2CAA2C;IAC3C,UAAU,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,OAAO,EAAE,OAAO,CAAC;IACjB,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,mBAAmB,GAC3B;IAAE,OAAO,EAAE,IAAI,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GACvD;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,cAAc,GAAG,oBAAoB,GAAG,kBAAkB,GAAG,eAAe,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The storage key of an account picture's file: `account-picture/<id>.webp` (every picture is stored as WebP).
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* pictureKey("0198f5a2-…"); // "account-picture/0198f5a2-….webp"
|
|
6
|
+
*/
|
|
7
|
+
export declare function pictureKey(pictureId: string): string;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/picture-key/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAEpD"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The storage key of an account picture's file: `account-picture/<id>.webp` (every picture is stored as WebP).
|
|
3
|
+
*
|
|
4
|
+
* @example
|
|
5
|
+
* pictureKey("0198f5a2-…"); // "account-picture/0198f5a2-….webp"
|
|
6
|
+
*/
|
|
7
|
+
export function pictureKey(pictureId) {
|
|
8
|
+
return `account-picture/${pictureId}.webp`;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/picture-key/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CAAC,SAAiB;IAC1C,OAAO,mBAAmB,SAAS,OAAO,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { PreparedPicture } from "@sharadox/account-web-library/picture-preparation/type";
|
|
2
|
+
/** The largest file accepted: 5 MB. */
|
|
3
|
+
export declare const PICTURE_MAXIMUM_BYTES: number;
|
|
4
|
+
/** The widest and tallest picture accepted, in pixels. */
|
|
5
|
+
export declare const PICTURE_MAXIMUM_DIMENSION = 4096;
|
|
6
|
+
/**
|
|
7
|
+
* Checks an uploaded picture and makes the file to store: always WebP, at most 1024 pixels on its longer side,
|
|
8
|
+
* rotated as the photo says, with every piece of metadata (a photo's location, camera, comments) dropped. A GIF
|
|
9
|
+
* keeps its animation. An SVG is drawn into an image, so no script or link in it can ever run. Refuses files over
|
|
10
|
+
* 5 MB or 4096 pixels, files far bigger than their picture needs (something else is hidden in them), and SVGs that
|
|
11
|
+
* load anything from outside themselves.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* const picture = await preparePicture(new Uint8Array(await file.arrayBuffer()));
|
|
15
|
+
* if (!picture.valid) return explain(picture.reason);
|
|
16
|
+
*/
|
|
17
|
+
export declare function preparePicture(bytes: Uint8Array): Promise<PreparedPicture>;
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/picture-preparation/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wDAAwD,CAAC;AAE9F,uCAAuC;AACvC,eAAO,MAAM,qBAAqB,QAAkB,CAAC;AACrD,0DAA0D;AAC1D,eAAO,MAAM,yBAAyB,OAAO,CAAC;AA+B9C;;;;;;;;;;GAUG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,eAAe,CAAC,CA8BhF"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import sharp from "sharp";
|
|
2
|
+
/** The largest file accepted: 5 MB. */
|
|
3
|
+
export const PICTURE_MAXIMUM_BYTES = 5 * 1024 * 1024;
|
|
4
|
+
/** The widest and tallest picture accepted, in pixels. */
|
|
5
|
+
export const PICTURE_MAXIMUM_DIMENSION = 4096;
|
|
6
|
+
/** Stored pictures are at most this many pixels on their longer side. */
|
|
7
|
+
const STORED_DIMENSION = 1024;
|
|
8
|
+
/** Slack for headers, color profiles and palettes when judging whether a file is bigger than its picture. */
|
|
9
|
+
const OVERHEAD_BYTES = 64 * 1024;
|
|
10
|
+
const startsWith = (bytes, text, offset = 0) => Buffer.from(bytes.subarray(offset, offset + text.length)).toString("latin1") === text;
|
|
11
|
+
function kind(bytes) {
|
|
12
|
+
if (bytes[0] === 0xff && bytes[1] === 0xd8 && bytes[2] === 0xff)
|
|
13
|
+
return "raster";
|
|
14
|
+
if (startsWith(bytes, "\x89PNG\r\n\x1a\n") || startsWith(bytes, "GIF8"))
|
|
15
|
+
return "raster";
|
|
16
|
+
if (startsWith(bytes, "RIFF") && startsWith(bytes, "WEBP", 8))
|
|
17
|
+
return "raster";
|
|
18
|
+
if (startsWith(bytes, "ftypavi", 4))
|
|
19
|
+
return "raster";
|
|
20
|
+
const text = new TextDecoder()
|
|
21
|
+
.decode(bytes.subarray(0, 1024))
|
|
22
|
+
.replace(/^\uFEFF/u, "")
|
|
23
|
+
.trimStart();
|
|
24
|
+
if ((text.startsWith("<?xml") || text.startsWith("<svg")) && text.includes("<svg"))
|
|
25
|
+
return "svg";
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
/** References an SVG may make: only to itself (`#id`) or to pictures inside it (`data:image/…`). */
|
|
29
|
+
function unsafeSvg(text) {
|
|
30
|
+
if (/<!(DOCTYPE|ENTITY)/i.test(text))
|
|
31
|
+
return true;
|
|
32
|
+
if (/@import|url\(\s*['"]?(?!#|data:image\/)/i.test(text))
|
|
33
|
+
return true;
|
|
34
|
+
for (const [, value] of text.matchAll(/(?:href|src)\s*=\s*["']([^"']*)["']/gi))
|
|
35
|
+
if (!value.startsWith("#") && !/^data:image\/(png|jpeg|gif|webp);/i.test(value))
|
|
36
|
+
return true;
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Checks an uploaded picture and makes the file to store: always WebP, at most 1024 pixels on its longer side,
|
|
41
|
+
* rotated as the photo says, with every piece of metadata (a photo's location, camera, comments) dropped. A GIF
|
|
42
|
+
* keeps its animation. An SVG is drawn into an image, so no script or link in it can ever run. Refuses files over
|
|
43
|
+
* 5 MB or 4096 pixels, files far bigger than their picture needs (something else is hidden in them), and SVGs that
|
|
44
|
+
* load anything from outside themselves.
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* const picture = await preparePicture(new Uint8Array(await file.arrayBuffer()));
|
|
48
|
+
* if (!picture.valid) return explain(picture.reason);
|
|
49
|
+
*/
|
|
50
|
+
export async function preparePicture(bytes) {
|
|
51
|
+
if (bytes.length > PICTURE_MAXIMUM_BYTES)
|
|
52
|
+
return { valid: false, reason: "size" };
|
|
53
|
+
const type = kind(bytes);
|
|
54
|
+
if (!type)
|
|
55
|
+
return { valid: false, reason: "type" };
|
|
56
|
+
if (type === "svg" && unsafeSvg(new TextDecoder().decode(bytes)))
|
|
57
|
+
return { valid: false, reason: "unsafe" };
|
|
58
|
+
const options = { animated: true, limitInputPixels: PICTURE_MAXIMUM_DIMENSION ** 2 * 4 };
|
|
59
|
+
let metadata;
|
|
60
|
+
try {
|
|
61
|
+
metadata = await sharp(bytes, options).metadata();
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return { valid: false, reason: "type" };
|
|
65
|
+
}
|
|
66
|
+
const width = metadata.width;
|
|
67
|
+
const height = metadata.pageHeight ?? metadata.height;
|
|
68
|
+
if (width > PICTURE_MAXIMUM_DIMENSION || height > PICTURE_MAXIMUM_DIMENSION)
|
|
69
|
+
return { valid: false, reason: "dimensions" };
|
|
70
|
+
if (type === "raster" && bytes.length > width * height * (metadata.pages ?? 1) * 4 + OVERHEAD_BYTES)
|
|
71
|
+
return { valid: false, reason: "suspicious" };
|
|
72
|
+
// An SVG is drawn large enough for its longer side to fill the stored size, however small it says it is.
|
|
73
|
+
const density = type === "svg" ? Math.min(2400, (72 * STORED_DIMENSION) / Math.max(width, height)) : undefined;
|
|
74
|
+
try {
|
|
75
|
+
const { data, info } = await sharp(bytes, { ...options, ...(density ? { density } : {}) })
|
|
76
|
+
.rotate()
|
|
77
|
+
.resize({ width: STORED_DIMENSION, height: STORED_DIMENSION, fit: "inside", withoutEnlargement: !density })
|
|
78
|
+
.webp({ quality: 85 })
|
|
79
|
+
.toBuffer({ resolveWithObject: true });
|
|
80
|
+
return { valid: true, bytes: new Uint8Array(data), width: info.width, height: info.pageHeight ?? info.height };
|
|
81
|
+
}
|
|
82
|
+
catch {
|
|
83
|
+
return { valid: false, reason: "type" };
|
|
84
|
+
}
|
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IAAI,EAAE,GAAG,MAAM,KAAK,CAAC,KAAK,EAAE,EAAE,GAAG,OAAO,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;aACvF,MAAM,EAAE;aACR,MAAM,CAAC,EAAE,KAAK,EAAE,gBAAgB,EAAE,MAAM,EAAE,gBAAgB,EAAE,GAAG,EAAE,QAAQ,EAAE,kBAAkB,EAAE,CAAC,OAAO,EAAE,CAAC;aAC1G,IAAI,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;aACrB,QAAQ,CAAC,EAAE,iBAAiB,EAAE,IAAI,EAAE,CAAC,CAAC;QACzC,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,UAAU,CAAC,IAAI,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;IACjH,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;IAC1C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/** A picture ready to store (always WebP), or why the file was refused. */
|
|
2
|
+
export type PreparedPicture = {
|
|
3
|
+
valid: true;
|
|
4
|
+
bytes: Uint8Array;
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
} | {
|
|
8
|
+
valid: false;
|
|
9
|
+
/**
|
|
10
|
+
* - `size`: over 5 MB;
|
|
11
|
+
* - `type`: not a JPEG, PNG, GIF, WebP, AVIF or SVG, or broken;
|
|
12
|
+
* - `dimensions`: wider or taller than 4096 pixels;
|
|
13
|
+
* - `suspicious`: far more bytes than its picture needs (something else is hidden in it);
|
|
14
|
+
* - `unsafe`: an SVG that loads something from outside itself or declares entities.
|
|
15
|
+
*/
|
|
16
|
+
reason: "size" | "type" | "dimensions" | "suspicious" | "unsafe";
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/picture-preparation/type.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,MAAM,MAAM,eAAe,GACvB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,KAAK,EAAE,UAAU,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACjE;IACE,KAAK,EAAE,KAAK,CAAC;IACb;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,YAAY,GAAG,YAAY,GAAG,QAAQ,CAAC;CAClE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/picture-preparation/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where picture files live (object storage such as S3): the database keeps only each picture's id and size. The
|
|
3
|
+
* application gives an implementation; tests use `createMemoryPictureStorage`.
|
|
4
|
+
*/
|
|
5
|
+
export interface PictureStorage {
|
|
6
|
+
/** Stores a file under `key`, replacing any file there. */
|
|
7
|
+
put(key: string, bytes: Uint8Array, contentType: string): Promise<void>;
|
|
8
|
+
/** Deletes the file under `key`; a missing file is not an error. */
|
|
9
|
+
remove(key: string): Promise<void>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/picture-storage/type.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,2DAA2D;IAC3D,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxE,oEAAoE;IACpE,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/picture-storage/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { AccountServer } from "@sharadox/account-web-library/account-server/type";
|
|
2
|
+
/**
|
|
3
|
+
* Makes 10 new recovery codes, voiding the old ones, for an account with two-factor on. Show them once. Ask for a
|
|
4
|
+
* fresh code first (step-up).
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const result = await regenerateRecoveryCodes(server, { accountId });
|
|
8
|
+
* if (result.status === "made") show(result.recoveryCodes);
|
|
9
|
+
*/
|
|
10
|
+
export declare function regenerateRecoveryCodes(server: AccountServer, { accountId, now }: {
|
|
11
|
+
accountId: string;
|
|
12
|
+
now?: number;
|
|
13
|
+
}): Promise<{
|
|
14
|
+
status: "made";
|
|
15
|
+
recoveryCodes: string[];
|
|
16
|
+
} | {
|
|
17
|
+
status: "second-factor-off";
|
|
18
|
+
}>;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/recovery-code-regeneration/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAKvF;;;;;;;GAOG;AACH,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,aAAa,EACrB,EAAE,SAAS,EAAE,GAAgB,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACnE,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG;IAAE,MAAM,EAAE,mBAAmB,CAAA;CAAE,CAAC,CAmBxF"}
|