@sharadox/account-web-library 0.1.0-development.3 → 0.1.0-development.30
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 +267 -8
- 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-ban/index.d.ts +67 -0
- package/distribution/account-ban/index.d.ts.map +1 -0
- package/distribution/account-ban/index.js +233 -0
- package/distribution/account-ban/index.js.map +1 -0
- package/distribution/account-ban/type.d.ts +44 -0
- package/distribution/account-ban/type.d.ts.map +1 -0
- package/distribution/account-ban/type.js +2 -0
- package/distribution/account-ban/type.js.map +1 -0
- package/distribution/account-database/type.d.ts +264 -0
- package/distribution/account-database/type.d.ts.map +1 -0
- package/distribution/account-database/type.js +2 -0
- package/distribution/account-database/type.js.map +1 -0
- package/distribution/account-deletion/index.d.ts +21 -0
- package/distribution/account-deletion/index.d.ts.map +1 -0
- package/distribution/account-deletion/index.js +66 -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/account-export/type.js +2 -0
- package/distribution/account-export/type.js.map +1 -0
- package/distribution/account-inactivity/index.d.ts +25 -0
- package/distribution/account-inactivity/index.d.ts.map +1 -0
- package/distribution/account-inactivity/index.js +100 -0
- package/distribution/account-inactivity/index.js.map +1 -0
- package/distribution/account-migration/index.d.ts +18 -0
- package/distribution/account-migration/index.d.ts.map +1 -0
- package/distribution/account-migration/index.js +376 -0
- package/distribution/account-migration/index.js.map +1 -0
- 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-notice/index.d.ts +15 -0
- package/distribution/account-notice/index.d.ts.map +1 -0
- package/distribution/account-notice/index.js +41 -0
- package/distribution/account-notice/index.js.map +1 -0
- package/distribution/account-permission/index.d.ts +14 -0
- package/distribution/account-permission/index.d.ts.map +1 -0
- package/distribution/account-permission/index.js +91 -0
- package/distribution/account-permission/index.js.map +1 -0
- package/distribution/account-permission/type.d.ts +12 -0
- package/distribution/account-permission/type.d.ts.map +1 -0
- package/distribution/account-permission/type.js +2 -0
- package/distribution/account-permission/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 +25 -0
- package/distribution/account-server/index.d.ts.map +1 -0
- package/distribution/account-server/index.js +34 -0
- package/distribution/account-server/index.js.map +1 -0
- package/distribution/account-server/type.d.ts +30 -0
- package/distribution/account-server/type.d.ts.map +1 -0
- package/distribution/account-server/type.js +2 -0
- package/distribution/account-server/type.js.map +1 -0
- 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-session-revocation/index.d.ts +14 -0
- package/distribution/account-session-revocation/index.d.ts.map +1 -0
- package/distribution/account-session-revocation/index.js +25 -0
- package/distribution/account-session-revocation/index.js.map +1 -0
- package/distribution/account-sign-in/index.d.ts +15 -0
- package/distribution/account-sign-in/index.d.ts.map +1 -0
- package/distribution/account-sign-in/index.js +78 -0
- package/distribution/account-sign-in/index.js.map +1 -0
- package/distribution/account-sign-in/type.d.ts +22 -0
- package/distribution/account-sign-in/type.d.ts.map +1 -0
- package/distribution/account-sign-in/type.js +2 -0
- package/distribution/account-sign-in/type.js.map +1 -0
- package/distribution/account-sign-out/index.d.ts +16 -0
- package/distribution/account-sign-out/index.d.ts.map +1 -0
- package/distribution/account-sign-out/index.js +34 -0
- package/distribution/account-sign-out/index.js.map +1 -0
- package/distribution/application-sync/index.d.ts +14 -0
- package/distribution/application-sync/index.d.ts.map +1 -0
- package/distribution/application-sync/index.js +96 -0
- package/distribution/application-sync/index.js.map +1 -0
- package/distribution/application-sync/type.d.ts +29 -0
- package/distribution/application-sync/type.d.ts.map +1 -0
- package/distribution/application-sync/type.js +2 -0
- package/distribution/application-sync/type.js.map +1 -0
- package/distribution/audit-event/index.d.ts +12 -0
- package/distribution/audit-event/index.d.ts.map +1 -0
- package/distribution/audit-event/index.js +36 -0
- package/distribution/audit-event/index.js.map +1 -0
- package/distribution/audit-event/type.d.ts +16 -0
- package/distribution/audit-event/type.d.ts.map +1 -0
- package/distribution/audit-event/type.js +2 -0
- package/distribution/audit-event/type.js.map +1 -0
- package/distribution/banned-contact/index.d.ts +34 -0
- package/distribution/banned-contact/index.d.ts.map +1 -0
- package/distribution/banned-contact/index.js +52 -0
- package/distribution/banned-contact/index.js.map +1 -0
- package/distribution/browser-session-read/index.d.ts +17 -0
- package/distribution/browser-session-read/index.d.ts.map +1 -0
- package/distribution/browser-session-read/index.js +52 -0
- package/distribution/browser-session-read/index.js.map +1 -0
- package/distribution/browser-session-read/type.d.ts +18 -0
- package/distribution/browser-session-read/type.d.ts.map +1 -0
- package/distribution/browser-session-read/type.js +2 -0
- package/distribution/browser-session-read/type.js.map +1 -0
- package/distribution/challenge-issue/index.d.ts +13 -0
- package/distribution/challenge-issue/index.d.ts.map +1 -0
- package/distribution/challenge-issue/index.js +18 -0
- package/distribution/challenge-issue/index.js.map +1 -0
- package/distribution/code-request/index.d.ts +16 -0
- package/distribution/code-request/index.d.ts.map +1 -0
- package/distribution/code-request/index.js +52 -0
- package/distribution/code-request/index.js.map +1 -0
- package/distribution/code-request/type.d.ts +25 -0
- package/distribution/code-request/type.d.ts.map +1 -0
- package/distribution/code-request/type.js +2 -0
- package/distribution/code-request/type.js.map +1 -0
- package/distribution/code-request-prune/index.d.ts +13 -0
- package/distribution/code-request-prune/index.d.ts.map +1 -0
- package/distribution/code-request-prune/index.js +12 -0
- package/distribution/code-request-prune/index.js.map +1 -0
- 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/code-verification/index.d.ts +14 -0
- package/distribution/code-verification/index.d.ts.map +1 -0
- package/distribution/code-verification/index.js +43 -0
- package/distribution/code-verification/index.js.map +1 -0
- package/distribution/code-verification/type.d.ts +22 -0
- package/distribution/code-verification/type.d.ts.map +1 -0
- package/distribution/code-verification/type.js +2 -0
- package/distribution/code-verification/type.js.map +1 -0
- package/distribution/contact-addition/index.d.ts +13 -0
- package/distribution/contact-addition/index.d.ts.map +1 -0
- package/distribution/contact-addition/index.js +48 -0
- package/distribution/contact-addition/index.js.map +1 -0
- package/distribution/contact-addition/type.d.ts +15 -0
- package/distribution/contact-addition/type.d.ts.map +1 -0
- package/distribution/contact-addition/type.js +2 -0
- package/distribution/contact-addition/type.js.map +1 -0
- package/distribution/contact-addition-flow/index.d.ts +32 -0
- package/distribution/contact-addition-flow/index.d.ts.map +1 -0
- package/distribution/contact-addition-flow/index.js +96 -0
- package/distribution/contact-addition-flow/index.js.map +1 -0
- package/distribution/contact-addition-flow/type.d.ts +25 -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/contact-channel/type.d.ts +44 -0
- package/distribution/contact-channel/type.d.ts.map +1 -0
- package/distribution/contact-channel/type.js +2 -0
- package/distribution/contact-channel/type.js.map +1 -0
- package/distribution/contact-kind/index.d.ts +12 -0
- package/distribution/contact-kind/index.d.ts.map +1 -0
- package/distribution/contact-kind/index.js +18 -0
- package/distribution/contact-kind/index.js.map +1 -0
- package/distribution/contact-kind/type.d.ts +6 -0
- package/distribution/contact-kind/type.d.ts.map +1 -0
- package/distribution/contact-kind/type.js +2 -0
- package/distribution/contact-kind/type.js.map +1 -0
- package/distribution/contact-lookup/index.d.ts +16 -0
- package/distribution/contact-lookup/index.d.ts.map +1 -0
- package/distribution/contact-lookup/index.js +20 -0
- package/distribution/contact-lookup/index.js.map +1 -0
- package/distribution/contact-removal/index.d.ts +19 -0
- package/distribution/contact-removal/index.d.ts.map +1 -0
- package/distribution/contact-removal/index.js +35 -0
- package/distribution/contact-removal/index.js.map +1 -0
- package/distribution/contact-verification/index.d.ts +20 -0
- package/distribution/contact-verification/index.d.ts.map +1 -0
- package/distribution/contact-verification/index.js +37 -0
- package/distribution/contact-verification/index.js.map +1 -0
- package/distribution/database-error/index.d.ts +12 -0
- package/distribution/database-error/index.d.ts.map +1 -0
- package/distribution/database-error/index.js +14 -0
- package/distribution/database-error/index.js.map +1 -0
- package/distribution/email-channel/index.d.ts +13 -0
- package/distribution/email-channel/index.d.ts.map +1 -0
- package/distribution/email-channel/index.js +168 -0
- package/distribution/email-channel/index.js.map +1 -0
- package/distribution/email-channel/type.d.ts +17 -0
- package/distribution/email-channel/type.d.ts.map +1 -0
- package/distribution/email-channel/type.js +2 -0
- package/distribution/email-channel/type.js.map +1 -0
- 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 +18 -0
- package/distribution/person-account/index.d.ts.map +1 -0
- package/distribution/person-account/index.js +65 -0
- package/distribution/person-account/index.js.map +1 -0
- package/distribution/person-account/type.d.ts +22 -0
- package/distribution/person-account/type.d.ts.map +1 -0
- package/distribution/person-account/type.js +2 -0
- package/distribution/person-account/type.js.map +1 -0
- 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/role-grant/index.d.ts +38 -0
- package/distribution/role-grant/index.d.ts.map +1 -0
- package/distribution/role-grant/index.js +142 -0
- package/distribution/role-grant/index.js.map +1 -0
- package/distribution/role-grant/type.d.ts +40 -0
- package/distribution/role-grant/type.d.ts.map +1 -0
- package/distribution/role-grant/type.js +2 -0
- package/distribution/role-grant/type.js.map +1 -0
- package/distribution/rule-sync/index.d.ts +28 -0
- package/distribution/rule-sync/index.d.ts.map +1 -0
- package/distribution/rule-sync/index.js +80 -0
- package/distribution/rule-sync/index.js.map +1 -0
- package/distribution/rule-sync/type.d.ts +17 -0
- package/distribution/rule-sync/type.d.ts.map +1 -0
- package/distribution/rule-sync/type.js +2 -0
- package/distribution/rule-sync/type.js.map +1 -0
- package/distribution/second-factor-finish/index.d.ts +13 -0
- package/distribution/second-factor-finish/index.d.ts.map +1 -0
- package/distribution/second-factor-finish/index.js +83 -0
- package/distribution/second-factor-finish/index.js.map +1 -0
- package/distribution/second-factor-finish/type.d.ts +30 -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-derivation/index.d.ts +10 -0
- package/distribution/secret-derivation/index.d.ts.map +1 -0
- package/distribution/secret-derivation/index.js +15 -0
- package/distribution/secret-derivation/index.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/session-prune/index.d.ts +17 -0
- package/distribution/session-prune/index.d.ts.map +1 -0
- package/distribution/session-prune/index.js +30 -0
- package/distribution/session-prune/index.js.map +1 -0
- package/distribution/session-token/index.d.ts +19 -0
- package/distribution/session-token/index.d.ts.map +1 -0
- package/distribution/session-token/index.js +22 -0
- package/distribution/session-token/index.js.map +1 -0
- package/distribution/sign-in-finish/index.d.ts +12 -0
- package/distribution/sign-in-finish/index.d.ts.map +1 -0
- package/distribution/sign-in-finish/index.js +64 -0
- package/distribution/sign-in-finish/index.js.map +1 -0
- package/distribution/sign-in-finish/type.d.ts +41 -0
- package/distribution/sign-in-finish/type.d.ts.map +1 -0
- package/distribution/sign-in-finish/type.js +2 -0
- package/distribution/sign-in-finish/type.js.map +1 -0
- package/distribution/sign-in-start/index.d.ts +17 -0
- package/distribution/sign-in-start/index.d.ts.map +1 -0
- package/distribution/sign-in-start/index.js +45 -0
- package/distribution/sign-in-start/index.js.map +1 -0
- package/distribution/sign-in-start/type.d.ts +34 -0
- package/distribution/sign-in-start/type.d.ts.map +1 -0
- package/distribution/sign-in-start/type.js +2 -0
- package/distribution/sign-in-start/type.js.map +1 -0
- package/distribution/sign-up-finish/index.d.ts +13 -0
- package/distribution/sign-up-finish/index.d.ts.map +1 -0
- package/distribution/sign-up-finish/index.js +38 -0
- package/distribution/sign-up-finish/index.js.map +1 -0
- package/distribution/sign-up-finish/type.d.ts +28 -0
- package/distribution/sign-up-finish/type.d.ts.map +1 -0
- package/distribution/sign-up-finish/type.js +2 -0
- package/distribution/sign-up-finish/type.js.map +1 -0
- package/distribution/signed-ticket/index.d.ts +19 -0
- package/distribution/signed-ticket/index.d.ts.map +1 -0
- package/distribution/signed-ticket/index.js +35 -0
- package/distribution/signed-ticket/index.js.map +1 -0
- package/distribution/signed-ticket/type.d.ts +16 -0
- package/distribution/signed-ticket/type.d.ts.map +1 -0
- package/distribution/signed-ticket/type.js +2 -0
- package/distribution/signed-ticket/type.js.map +1 -0
- 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-database/index.d.ts +13 -0
- package/distribution/test-database/index.d.ts.map +1 -0
- package/distribution/test-database/index.js +17 -0
- package/distribution/test-database/index.js.map +1 -0
- 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/test-server/index.d.ts +10 -0
- package/distribution/test-server/index.d.ts.map +1 -0
- package/distribution/test-server/index.js +16 -0
- package/distribution/test-server/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 +9 -2
- 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 → account-activity}/type.js +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/sign-in-finish/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AAEnG,MAAM,WAAW,YAAY;IAC3B,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,+BAA+B;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,oFAAoF;IACpF,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,KAAK,OAAO,GAAG,OAAO,CAAC,sBAAsB,EAAE;IAAE,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;AAE3E,MAAM,MAAM,kBAAkB,GAC1B;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE;AAC3D,uHAAuH;GACrH;IAAE,MAAM,EAAE,eAAe,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AAC7C,mGAAmG;GACjG;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACrC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,GACtC;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,YAAY,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/sign-in-finish/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { AccountServer } from "@sharadox/account-web-library/account-server/type";
|
|
2
|
+
import type { SignInStart, SignInStartResult } from "@sharadox/account-web-library/sign-in-start/type";
|
|
3
|
+
/**
|
|
4
|
+
* The first step of signing in (and of signing up: they are the same): a code to the contact. In order, each check
|
|
5
|
+
* cheaper than what it protects:
|
|
6
|
+
* 1. a single-use proof of work;
|
|
7
|
+
* 2. a valid contact with a channel;
|
|
8
|
+
* 3. `sendCode`: rate limits, the channel's spending cap, then a new code sent by `deliver` after answering.
|
|
9
|
+
* A browser already signed in to the account with that verified contact gets `signed-in` instead, and nothing is sent.
|
|
10
|
+
* Otherwise the answer never depends on whether an account exists, so nobody can probe for accounts.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const result = await startSignIn(server, { contact, solution, address: clientAddress(request), language });
|
|
14
|
+
* if (result.status === "sent") after(result.deliver);
|
|
15
|
+
*/
|
|
16
|
+
export declare function startSignIn(server: AccountServer, { contact, solution, address, language, token, now }: SignInStart): Promise<SignInStartResult>;
|
|
17
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/sign-in-start/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAOvF,OAAO,KAAK,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,kDAAkD,CAAC;AAEvG;;;;;;;;;;;;GAYG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,aAAa,EACrB,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAgB,EAAE,EAAE,WAAW,GAC7E,OAAO,CAAC,iBAAiB,CAAC,CAqB5B"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { redeemSolution } from "@sharadox/protection-web-library/solution-redemption";
|
|
2
|
+
import { readBrowserSession } from "@sharadox/account-web-library/browser-session-read";
|
|
3
|
+
import { sendCode } from "@sharadox/account-web-library/code-sending";
|
|
4
|
+
import { findAccountByContact } from "@sharadox/account-web-library/contact-lookup";
|
|
5
|
+
import { normalizeContact } from "@sharadox/account-web-library/contact-kind";
|
|
6
|
+
import { deriveSecret } from "@sharadox/account-web-library/secret-derivation";
|
|
7
|
+
/**
|
|
8
|
+
* The first step of signing in (and of signing up: they are the same): a code to the contact. In order, each check
|
|
9
|
+
* cheaper than what it protects:
|
|
10
|
+
* 1. a single-use proof of work;
|
|
11
|
+
* 2. a valid contact with a channel;
|
|
12
|
+
* 3. `sendCode`: rate limits, the channel's spending cap, then a new code sent by `deliver` after answering.
|
|
13
|
+
* A browser already signed in to the account with that verified contact gets `signed-in` instead, and nothing is sent.
|
|
14
|
+
* Otherwise the answer never depends on whether an account exists, so nobody can probe for accounts.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* const result = await startSignIn(server, { contact, solution, address: clientAddress(request), language });
|
|
18
|
+
* if (result.status === "sent") after(result.deliver);
|
|
19
|
+
*/
|
|
20
|
+
export async function startSignIn(server, { contact, solution, address, language, token, now = Date.now() }) {
|
|
21
|
+
const proof = await redeemSolution(server.database, solution, {
|
|
22
|
+
secret: deriveSecret(server.secret, "proof-of-work"),
|
|
23
|
+
now,
|
|
24
|
+
});
|
|
25
|
+
if (!proof.valid)
|
|
26
|
+
return { status: "refused", reason: "proof" };
|
|
27
|
+
let normalized;
|
|
28
|
+
try {
|
|
29
|
+
normalized = normalizeContact(contact);
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return { status: "refused", reason: "contact" };
|
|
33
|
+
}
|
|
34
|
+
const channel = server.channels.find(({ kind }) => kind === normalized.kind);
|
|
35
|
+
if (!channel)
|
|
36
|
+
return { status: "refused", reason: "contact" };
|
|
37
|
+
if (token) {
|
|
38
|
+
const owner = await findAccountByContact(server.database, normalized);
|
|
39
|
+
const browser = owner && (await readBrowserSession(server.database, { token, now }));
|
|
40
|
+
if (owner && browser?.accounts.some(({ accountId }) => accountId === owner.accountId))
|
|
41
|
+
return { status: "signed-in", accountId: owner.accountId };
|
|
42
|
+
}
|
|
43
|
+
return sendCode(server, { purpose: "sign-in", contact: normalized, channel, address, language, now });
|
|
44
|
+
}
|
|
45
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/sign-in-start/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,sDAAsD,CAAC;AAEtF,OAAO,EAAE,kBAAkB,EAAE,MAAM,oDAAoD,CAAC;AACxF,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AACtE,OAAO,EAAE,oBAAoB,EAAE,MAAM,8CAA8C,CAAC;AACpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,4CAA4C,CAAC;AAE9E,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAG/E;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW,CAC/B,MAAqB,EACrB,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO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WAAW,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;IAC/D,CAAC;IACD,OAAO,QAAQ,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,CAAC;AACxG,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { Solution } from "@sharadox/protection-web-library/proof-of-work/type";
|
|
2
|
+
import type { Contact } from "@sharadox/account-web-library/contact-kind/type";
|
|
3
|
+
export interface SignInStart {
|
|
4
|
+
contact: Contact;
|
|
5
|
+
/** The browser's answer to `issueChallenge`. */
|
|
6
|
+
solution: Solution;
|
|
7
|
+
/** The client's IP address (web-library's `clientAddress`). */
|
|
8
|
+
address: string;
|
|
9
|
+
/** For the code's message. */
|
|
10
|
+
language: string;
|
|
11
|
+
/** The browser's session cookie, if any: a contact of an account already signed in there gets no code. */
|
|
12
|
+
token?: string | undefined;
|
|
13
|
+
/** Milliseconds since 1970 (now by default). */
|
|
14
|
+
now?: number;
|
|
15
|
+
}
|
|
16
|
+
export type SignInStartResult = {
|
|
17
|
+
status: "sent";
|
|
18
|
+
requestId: string;
|
|
19
|
+
/** Sends the code: call it after answering (Next.js `after()`), so the answer's timing reveals nothing. */
|
|
20
|
+
deliver: () => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
/** The browser is already signed in to the account with this verified contact: nothing was sent. */
|
|
23
|
+
| {
|
|
24
|
+
status: "signed-in";
|
|
25
|
+
accountId: string;
|
|
26
|
+
} | {
|
|
27
|
+
status: "refused";
|
|
28
|
+
reason: "proof" | "contact" | "unavailable";
|
|
29
|
+
} | {
|
|
30
|
+
status: "refused";
|
|
31
|
+
reason: "rate-limit";
|
|
32
|
+
retryAfterSeconds: number;
|
|
33
|
+
};
|
|
34
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/sign-in-start/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qDAAqD,CAAC;AACpF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iDAAiD,CAAC;AAE/E,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,gDAAgD;IAChD,QAAQ,EAAE,QAAQ,CAAC;IACnB,+DAA+D;IAC/D,OAAO,EAAE,MAAM,CAAC;IAChB,8BAA8B;IAC9B,QAAQ,EAAE,MAAM,CAAC;IACjB,0GAA0G;IAC1G,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,iBAAiB,GACzB;IACE,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,2GAA2G;IAC3G,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9B;AACH,oGAAoG;GAClG;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,GAC1C;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,OAAO,GAAG,SAAS,GAAG,aAAa,CAAA;CAAE,GAClE;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,YAAY,CAAC;IAAC,iBAAiB,EAAE,MAAM,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/sign-in-start/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { AccountServer } from "@sharadox/account-web-library/account-server/type";
|
|
2
|
+
import type { SignUpFinish, SignUpFinishResult } from "@sharadox/account-web-library/sign-up-finish/type";
|
|
3
|
+
/**
|
|
4
|
+
* The last step for a new person: the name and identifier they chose, with the ticket proving their contact. Creates the
|
|
5
|
+
* account with that contact verified and signs it in. A refused name or identifier can be tried again with the same
|
|
6
|
+
* ticket while it lasts; a ticket can't make two accounts (the contact is then taken). A contact of a deleted account
|
|
7
|
+
* banned from the account system (or everywhere) can't sign up again while that ban lasts.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* const result = await finishSignUp(server, { ticket, name, identifier, token: cookie });
|
|
11
|
+
*/
|
|
12
|
+
export declare function finishSignUp(server: AccountServer, { ticket, name, identifier, token, userAgent, language, now }: SignUpFinish): Promise<SignUpFinishResult>;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/sign-up-finish/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAKvF,OAAO,KAAK,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,mDAAmD,CAAC;AAE1G;;;;;;;;GAQG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,aAAa,EACrB,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,KAAK,EAAE,SAAgB,EAAE,QAAQ,EAAE,GAAgB,EAAE,EAAE,YAAY,GAC9F,OAAO,CAAC,kBAAkB,CAAC,CAoB7B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { signIn } from "@sharadox/account-web-library/account-sign-in";
|
|
2
|
+
import { contactBanned } from "@sharadox/account-web-library/banned-contact";
|
|
3
|
+
import { createPersonAccount } from "@sharadox/account-web-library/person-account";
|
|
4
|
+
import { deriveSecret } from "@sharadox/account-web-library/secret-derivation";
|
|
5
|
+
import { readTicket } from "@sharadox/account-web-library/signed-ticket";
|
|
6
|
+
/**
|
|
7
|
+
* The last step for a new person: the name and identifier they chose, with the ticket proving their contact. Creates the
|
|
8
|
+
* account with that contact verified and signs it in. A refused name or identifier can be tried again with the same
|
|
9
|
+
* ticket while it lasts; a ticket can't make two accounts (the contact is then taken). A contact of a deleted account
|
|
10
|
+
* banned from the account system (or everywhere) can't sign up again while that ban lasts.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const result = await finishSignUp(server, { ticket, name, identifier, token: cookie });
|
|
14
|
+
*/
|
|
15
|
+
export async function finishSignUp(server, { ticket, name, identifier, token, userAgent = null, language, now = Date.now() }) {
|
|
16
|
+
const reading = readTicket(ticket, {
|
|
17
|
+
secret: deriveSecret(server.secret, "sign-up-ticket"),
|
|
18
|
+
purpose: "sign-up",
|
|
19
|
+
now,
|
|
20
|
+
});
|
|
21
|
+
if (!reading.valid)
|
|
22
|
+
return { status: "refused", reason: "ticket" };
|
|
23
|
+
const pepper = deriveSecret(server.secret, "banned-contact");
|
|
24
|
+
if (await contactBanned(server.database, { contact: reading.data.contact, pepper, application: "account", now }))
|
|
25
|
+
return { status: "refused", reason: "contact-banned" };
|
|
26
|
+
const created = await createPersonAccount(server.database, {
|
|
27
|
+
name,
|
|
28
|
+
identifier,
|
|
29
|
+
contact: reading.data.contact,
|
|
30
|
+
...(language ? { language } : {}),
|
|
31
|
+
now,
|
|
32
|
+
});
|
|
33
|
+
if (!created.created)
|
|
34
|
+
return { status: "refused", reason: created.reason };
|
|
35
|
+
const session = await signIn(server.database, { accountId: created.accountId, token, userAgent, now });
|
|
36
|
+
return { status: "signed-in", accountId: created.accountId, token: session.token };
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/sign-up-finish/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,+CAA+C,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,MAAM,8CAA8C,CAAC;AAG7E,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,C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EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC;IAC3E,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;IACvG,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,KAAK,EAAE,CAAC;AACrF,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PersonAccountResult } from "@sharadox/account-web-library/person-account/type";
|
|
2
|
+
export interface SignUpFinish {
|
|
3
|
+
/** From `finishSignIn`'s `sign-up` answer. */
|
|
4
|
+
ticket: string;
|
|
5
|
+
/** What the account shows, 1 to 50 characters (`checkAccountName`). */
|
|
6
|
+
name: string;
|
|
7
|
+
/** Without the `@`. */
|
|
8
|
+
identifier: string;
|
|
9
|
+
/** The browser's current session cookie, if any. */
|
|
10
|
+
token: string | undefined;
|
|
11
|
+
/** The person's language (`pt-PT`), for the notices the account will get. */
|
|
12
|
+
language?: string;
|
|
13
|
+
/** The browser's User-Agent, for the list of devices. */
|
|
14
|
+
userAgent?: string | null;
|
|
15
|
+
/** Milliseconds since 1970 (now by default). */
|
|
16
|
+
now?: number;
|
|
17
|
+
}
|
|
18
|
+
export type SignUpFinishResult = {
|
|
19
|
+
status: "signed-in";
|
|
20
|
+
accountId: string;
|
|
21
|
+
token: string;
|
|
22
|
+
} | {
|
|
23
|
+
status: "refused";
|
|
24
|
+
reason: "ticket" | "contact-banned" | Extract<PersonAccountResult, {
|
|
25
|
+
created: false;
|
|
26
|
+
}>["reason"];
|
|
27
|
+
};
|
|
28
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/sign-up-finish/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mDAAmD,CAAC;AAE7F,MAAM,WAAW,YAAY;IAC3B,8CAA8C;IAC9C,MAAM,EAAE,MAAM,CAAC;IACf,uEAAuE;IACvE,IAAI,EAAE,MAAM,CAAC;IACb,uBAAuB;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,oDAAoD;IACpD,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,6EAA6E;IAC7E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC1B,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,kBAAkB,GAC1B;IAAE,MAAM,EAAE,WAAW,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GACzD;IACE,MAAM,EAAE,SAAS,CAAC;IAClB,MAAM,EAAE,QAAQ,GAAG,gBAAgB,GAAG,OAAO,CAAC,mBAAmB,EAAE;QAAE,OAAO,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC,QAAQ,CAAC,CAAC;CAClG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/sign-up-finish/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { TicketOptions, TicketReading } from "@sharadox/account-web-library/signed-ticket/type";
|
|
2
|
+
/**
|
|
3
|
+
* A short-lived, signed ticket carrying data between two steps (a proved contact from the code step to the
|
|
4
|
+
* identifier step) without storing anything: the data can be read, but not changed or used for another purpose.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const ticket = createTicket({ contact }, { secret, purpose: "sign-up", lifetimeSeconds: 900 });
|
|
8
|
+
*/
|
|
9
|
+
export declare function createTicket(data: unknown, { secret, purpose, lifetimeSeconds, now }: TicketOptions & {
|
|
10
|
+
lifetimeSeconds: number;
|
|
11
|
+
}): string;
|
|
12
|
+
/**
|
|
13
|
+
* The data of a ticket made by `createTicket`, if it is intact, for this purpose, and not expired.
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* const reading = readTicket<{ contact: Contact }>(ticket, { secret, purpose: "sign-up" });
|
|
17
|
+
*/
|
|
18
|
+
export declare function readTicket<Data>(ticket: string, { secret, purpose, now }: TicketOptions): TicketReading<Data>;
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/signed-ticket/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,kDAAkD,CAAC;AAIrG;;;;;;GAMG;AACH,wBAAgB,YAAY,CAC1B,IAAI,EAAE,OAAO,EACb,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,EAAE,GAAgB,EAAE,EAAE,aAAa,GAAG;IAAE,eAAe,EAAE,MAAM,CAAA;CAAE,GAClG,MAAM,CAKR;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAC7B,MAAM,EAAE,MAAM,EACd,EAAE,MAAM,EAAE,OAAO,EAAE,GAAgB,EAAE,EAAE,aAAa,GACnD,aAAa,CAAC,IAAI,CAAC,CAerB"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { createHmac, timingSafeEqual } from "node:crypto";
|
|
2
|
+
const sign = (secret, body) => createHmac("sha256", secret).update(body).digest("base64url");
|
|
3
|
+
/**
|
|
4
|
+
* A short-lived, signed ticket carrying data between two steps (a proved contact from the code step to the
|
|
5
|
+
* identifier step) without storing anything: the data can be read, but not changed or used for another purpose.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const ticket = createTicket({ contact }, { secret, purpose: "sign-up", lifetimeSeconds: 900 });
|
|
9
|
+
*/
|
|
10
|
+
export function createTicket(data, { secret, purpose, lifetimeSeconds, now = Date.now() }) {
|
|
11
|
+
const body = Buffer.from(JSON.stringify({ data, purpose, expiresAt: now + lifetimeSeconds * 1000 })).toString("base64url");
|
|
12
|
+
return `${body}.${sign(secret, body)}`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* The data of a ticket made by `createTicket`, if it is intact, for this purpose, and not expired.
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* const reading = readTicket<{ contact: Contact }>(ticket, { secret, purpose: "sign-up" });
|
|
19
|
+
*/
|
|
20
|
+
export function readTicket(ticket, { secret, purpose, now = Date.now() }) {
|
|
21
|
+
const [body, signature, ...rest] = ticket.split(".");
|
|
22
|
+
if (!body || !signature || rest.length > 0)
|
|
23
|
+
return { valid: false, reason: "signature" };
|
|
24
|
+
const expected = Buffer.from(sign(secret, body));
|
|
25
|
+
const given = Buffer.from(signature);
|
|
26
|
+
if (expected.length !== given.length || !timingSafeEqual(expected, given))
|
|
27
|
+
return { valid: false, reason: "signature" };
|
|
28
|
+
const content = JSON.parse(Buffer.from(body, "base64url").toString());
|
|
29
|
+
if (content.purpose !== purpose)
|
|
30
|
+
return { valid: false, reason: "signature" };
|
|
31
|
+
if (content.expiresAt <= now)
|
|
32
|
+
return { valid: false, reason: "expired" };
|
|
33
|
+
return { valid: true, data: content.data };
|
|
34
|
+
}
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/signed-ticket/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG1D,MAAM,IAAI,GAAG,CAAC,MAAc,EAAE,IAAY,EAAE,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,MAAM,CAA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AO,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,QAAQ,EAAE,CAInE,CAAC;IACF,IAAI,OAAO,CAAC,OAAO,KAAK,OAAO;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC;IAC9E,IAAI,OAAO,CAAC,SAAS,IAAI,GAAG;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IACzE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,CAAC;AAC7C,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export interface TicketOptions {
|
|
2
|
+
/** At least 32 characters, server only. */
|
|
3
|
+
secret: string;
|
|
4
|
+
/** What the ticket is for: a ticket for one purpose is refused for any other. */
|
|
5
|
+
purpose: string;
|
|
6
|
+
/** Milliseconds since 1970 (now by default). */
|
|
7
|
+
now?: number;
|
|
8
|
+
}
|
|
9
|
+
export type TicketReading<Data> = {
|
|
10
|
+
valid: true;
|
|
11
|
+
data: Data;
|
|
12
|
+
} | {
|
|
13
|
+
valid: false;
|
|
14
|
+
reason: "signature" | "expired";
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/signed-ticket/type.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,aAAa;IAC5B,2CAA2C;IAC3C,MAAM,EAAE,MAAM,CAAC;IACf,iFAAiF;IACjF,OAAO,EAAE,MAAM,CAAC;IAChB,gDAAgD;IAChD,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,MAAM,aAAa,CAAC,IAAI,IAAI;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,IAAI,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,WAAW,GAAG,SAAS,CAAA;CAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/signed-ticket/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Kysely } from "kysely";
|
|
2
|
+
import type { AccountDatabase } from "@sharadox/account-web-library/account-database/type";
|
|
3
|
+
import type { AccountServer } from "@sharadox/account-web-library/account-server/type";
|
|
4
|
+
import type { StepUpFinish, StepUpStart } from "@sharadox/account-web-library/step-up/type";
|
|
5
|
+
/** How long a step-up lasts: 10 minutes. */
|
|
6
|
+
export declare const STEP_UP_SECONDS = 600;
|
|
7
|
+
/**
|
|
8
|
+
* Before a sensitive change (a contact, two-factor, recovery codes, keys, deletion), sends a fresh code to one of the
|
|
9
|
+
* account's own verified contacts, through `sendCode` (rate limits and spending caps).
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* const result = await startStepUp(server, { accountId, contactId, address, language });
|
|
13
|
+
* if (result.status === "sent") after(result.deliver);
|
|
14
|
+
*/
|
|
15
|
+
export declare function startStepUp(server: AccountServer, { accountId, contactId, address, language, now, }: {
|
|
16
|
+
accountId: string;
|
|
17
|
+
contactId: string;
|
|
18
|
+
address: string;
|
|
19
|
+
language: string;
|
|
20
|
+
now?: number;
|
|
21
|
+
}): Promise<StepUpStart>;
|
|
22
|
+
/**
|
|
23
|
+
* Checks the step-up code and marks this browser's session of the account as confirmed for 10 minutes
|
|
24
|
+
* (`hasFreshStepUp`).
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* const result = await finishStepUp(server, { accountId, requestId, code, token: cookie });
|
|
28
|
+
*/
|
|
29
|
+
export declare function finishStepUp(server: AccountServer, { accountId, requestId, code, token, now, }: {
|
|
30
|
+
accountId: string;
|
|
31
|
+
requestId: string;
|
|
32
|
+
code: string;
|
|
33
|
+
token: string | undefined;
|
|
34
|
+
now?: number;
|
|
35
|
+
}): Promise<StepUpFinish>;
|
|
36
|
+
/**
|
|
37
|
+
* Whether the account confirmed it is them on this browser in the last 10 minutes: check it before every sensitive
|
|
38
|
+
* change, and ask for a step-up when it is false.
|
|
39
|
+
*
|
|
40
|
+
* @example
|
|
41
|
+
* if (!(await hasFreshStepUp(database, { accountId, token: cookie }))) return askForStepUp();
|
|
42
|
+
*/
|
|
43
|
+
export declare function hasFreshStepUp(database: Kysely<AccountDatabase>, { accountId, token, now }: {
|
|
44
|
+
accountId: string;
|
|
45
|
+
token: string | undefined;
|
|
46
|
+
now?: number;
|
|
47
|
+
}): Promise<boolean>;
|
|
48
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/step-up/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAC3F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,mDAAmD,CAAC;AAMvF,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,4CAA4C,CAAC;AAE5F,4CAA4C;AAC5C,eAAO,MAAM,eAAe,MAAM,CAAC;AAEnC;;;;;;;GAOG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,aAAa,EACrB,EACE,SAAS,EACT,SAAS,EACT,OAAO,EACP,QAAQ,EACR,GAAgB,GACjB,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3F,OAAO,CAAC,WAAW,CAAC,CAWtB;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,aAAa,EACrB,EACE,SAAS,EACT,SAAS,EACT,IAAI,EACJ,KAAK,EACL,GAAgB,GACjB,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACjG,OAAO,CAAC,YAAY,CAAC,CAmBvB;AAkBD;;;;;;GAMG;AACH,wBAAsB,cAAc,CAClC,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,EACjC,EAAE,SAAS,EAAE,KAAK,EAAE,GAAgB,EAAE,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,GACrG,OAAO,CAAC,OAAO,CAAC,CAGlB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { recordAuditEvent } from "@sharadox/account-web-library/audit-event";
|
|
2
|
+
import { sendCode } from "@sharadox/account-web-library/code-sending";
|
|
3
|
+
import { verifyCode } from "@sharadox/account-web-library/code-verification";
|
|
4
|
+
import { deriveSecret } from "@sharadox/account-web-library/secret-derivation";
|
|
5
|
+
import { hashSessionToken } from "@sharadox/account-web-library/session-token";
|
|
6
|
+
/** How long a step-up lasts: 10 minutes. */
|
|
7
|
+
export const STEP_UP_SECONDS = 600;
|
|
8
|
+
/**
|
|
9
|
+
* Before a sensitive change (a contact, two-factor, recovery codes, keys, deletion), sends a fresh code to one of the
|
|
10
|
+
* account's own verified contacts, through `sendCode` (rate limits and spending caps).
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* const result = await startStepUp(server, { accountId, contactId, address, language });
|
|
14
|
+
* if (result.status === "sent") after(result.deliver);
|
|
15
|
+
*/
|
|
16
|
+
export async function startStepUp(server, { accountId, contactId, address, language, now = Date.now(), }) {
|
|
17
|
+
const contact = await server.database
|
|
18
|
+
.selectFrom("contact")
|
|
19
|
+
.select(["kind", "value"])
|
|
20
|
+
.where("id", "=", contactId)
|
|
21
|
+
.where("account_id", "=", accountId)
|
|
22
|
+
.where("verified_at", "is not", null)
|
|
23
|
+
.executeTakeFirst();
|
|
24
|
+
const channel = contact && server.channels.find(({ kind }) => kind === contact.kind);
|
|
25
|
+
if (!contact || !channel)
|
|
26
|
+
return { status: "refused", reason: "contact" };
|
|
27
|
+
return sendCode(server, { purpose: "step-up", contact, channel, accountId, address, language, now });
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Checks the step-up code and marks this browser's session of the account as confirmed for 10 minutes
|
|
31
|
+
* (`hasFreshStepUp`).
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* const result = await finishStepUp(server, { accountId, requestId, code, token: cookie });
|
|
35
|
+
*/
|
|
36
|
+
export async function finishStepUp(server, { accountId, requestId, code, token, now = Date.now(), }) {
|
|
37
|
+
const verification = await verifyCode(server.database, {
|
|
38
|
+
requestId,
|
|
39
|
+
code,
|
|
40
|
+
purpose: "step-up",
|
|
41
|
+
pepper: deriveSecret(server.secret, "one-time-code"),
|
|
42
|
+
now,
|
|
43
|
+
});
|
|
44
|
+
if (!verification.valid)
|
|
45
|
+
return { status: "refused", reason: verification.reason };
|
|
46
|
+
if (verification.accountId !== accountId)
|
|
47
|
+
return { status: "refused", reason: "unknown" };
|
|
48
|
+
const session = await sessionOf(server.database, { accountId, token, now });
|
|
49
|
+
if (!session)
|
|
50
|
+
return { status: "refused", reason: "session" };
|
|
51
|
+
await server.database
|
|
52
|
+
.updateTable("account_session")
|
|
53
|
+
.set({ step_up_at: new Date(now) })
|
|
54
|
+
.where("id", "=", session.id)
|
|
55
|
+
.execute();
|
|
56
|
+
await recordAuditEvent(server.database, { accountId, action: "session.stepped-up", now });
|
|
57
|
+
return { status: "confirmed" };
|
|
58
|
+
}
|
|
59
|
+
/** The account's live session on the browser holding `token`. */
|
|
60
|
+
async function sessionOf(database, { accountId, token, now }) {
|
|
61
|
+
if (!token)
|
|
62
|
+
return undefined;
|
|
63
|
+
return database
|
|
64
|
+
.selectFrom("account_session")
|
|
65
|
+
.innerJoin("browser_session", "browser_session.id", "account_session.browser_session_id")
|
|
66
|
+
.select(["account_session.id", "account_session.step_up_at"])
|
|
67
|
+
.where("browser_session.token_hash", "=", hashSessionToken(token))
|
|
68
|
+
.where("account_session.account_id", "=", accountId)
|
|
69
|
+
.where("account_session.expires_at", ">", new Date(now))
|
|
70
|
+
.executeTakeFirst();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Whether the account confirmed it is them on this browser in the last 10 minutes: check it before every sensitive
|
|
74
|
+
* change, and ask for a step-up when it is false.
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* if (!(await hasFreshStepUp(database, { accountId, token: cookie }))) return askForStepUp();
|
|
78
|
+
*/
|
|
79
|
+
export async function hasFreshStepUp(database, { accountId, token, now = Date.now() }) {
|
|
80
|
+
const session = await sessionOf(database, { accountId, token, now });
|
|
81
|
+
return !!session?.step_up_at && now - session.step_up_at.getTime() <= STEP_UP_SECONDS * 1000;
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/step-up/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,2CAA2C,CAAC;AAC7E,OAAO,EAAE,QAAQ,EAAE,MAAM,4CAA4C,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,iDAAiD,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,iDAAiD,CAAC;AAC/E,OAAO,EAAE,gBAAgB,EAAE,MAAM,6CAA6C,CAAC;AAG/E,4CAA4C;AAC5C,MAAM,CAAC,MA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C;SACxF,MAAM,CAAC,CAAC,oBAAoB,EAAE,4BAA4B,CAAC,CAAC;SAC5D,KAAK,CAAC,4BAA4B,EAAE,GAAG,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC;SACjE,KAAK,CAAC,4BAA4B,EAAE,GAAG,EAAE,SAAS,CAAC;SACnD,KAAK,CAAC,4BAA4B,EAAE,GAAG,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,CAAC;SACvD,gBAAgB,EAAE,CAAC;AACxB,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,QAAiC,EACjC,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,EAAkE;IAEtG,MAAM,OAAO,GAAG,MAAM,SAAS,CAAC,QAAQ,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,CAAC;IACrE,OAAO,CAAC,CAAC,OAAO,EAAE,UAAU,IAAI,GAAG,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,eAAe,GAAG,IAAI,CAAC;AAC/F,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { CodeSendingResult } from "@sharadox/account-web-library/code-sending/type";
|
|
2
|
+
import type { CodeVerificationResult } from "@sharadox/account-web-library/code-verification/type";
|
|
3
|
+
export type StepUpStart = CodeSendingResult | {
|
|
4
|
+
status: "refused";
|
|
5
|
+
reason: "contact";
|
|
6
|
+
};
|
|
7
|
+
export type StepUpFinish = {
|
|
8
|
+
status: "confirmed";
|
|
9
|
+
} | {
|
|
10
|
+
status: "refused";
|
|
11
|
+
reason: Extract<CodeVerificationResult, {
|
|
12
|
+
valid: false;
|
|
13
|
+
}>["reason"] | "session";
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=type.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../source/step-up/type.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iDAAiD,CAAC;AACzF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,sDAAsD,CAAC;AAEnG,MAAM,MAAM,WAAW,GAAG,iBAAiB,GAAG;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,SAAS,CAAA;CAAE,CAAC;AAEvF,MAAM,MAAM,YAAY,GACpB;IAAE,MAAM,EAAE,WAAW,CAAA;CAAE,GACvB;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,OAAO,CAAC,sBAAsB,EAAE;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,CAAC,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAA;CAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/
|
|
1
|
+
{"version":3,"file":"type.js","sourceRoot":"","sources":["../../source/step-up/type.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { MemoryDatabase } from "@sharadox/database-web-library/memory-database/type";
|
|
2
|
+
import type { AccountDatabase } from "@sharadox/account-web-library/account-database/type";
|
|
3
|
+
/**
|
|
4
|
+
* A migrated account database in memory, for this library's tests (and applications' own): Postgres 18 through
|
|
5
|
+
* PGlite, so every constraint and trigger runs as in production.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const memory = await createTestAccountDatabase();
|
|
9
|
+
* // … test …
|
|
10
|
+
* await memory.close();
|
|
11
|
+
*/
|
|
12
|
+
export declare function createTestAccountDatabase(): Promise<MemoryDatabase<AccountDatabase>>;
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/test-database/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AAC1F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAG3F;;;;;;;;GAQG;AACH,wBAAsB,yBAAyB,IAAI,OAAO,CAAC,cAAc,CAAC,eAAe,CAAC,CAAC,CAI1F"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createMemoryDatabase } from "@sharadox/database-web-library/memory-database";
|
|
2
|
+
import { migrateAccount } from "@sharadox/account-web-library/account-migration";
|
|
3
|
+
/**
|
|
4
|
+
* A migrated account database in memory, for this library's tests (and applications' own): Postgres 18 through
|
|
5
|
+
* PGlite, so every constraint and trigger runs as in production.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const memory = await createTestAccountDatabase();
|
|
9
|
+
* // … test …
|
|
10
|
+
* await memory.close();
|
|
11
|
+
*/
|
|
12
|
+
export async function createTestAccountDatabase() {
|
|
13
|
+
const memory = await createMemoryDatabase();
|
|
14
|
+
await migrateAccount(memory.database);
|
|
15
|
+
return memory;
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/test-database/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,gDAAgD,CAAC;AAGtF,OAAO,EAAE,cAAc,EAAE,MAAM,iDAAiD,CAAC;AAEjF;;;;;;;;GAQG;AACH,MAAM,CAAC,KAAK,UAAU,yBAAyB;IAC7C,MAAM,MAAM,GAAG,MAAM,oBAAoB,EAAmB,CAAC;IAC7D,MAAM,cAAc,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;IACtC,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Kysely } from "kysely";
|
|
2
|
+
import type { AccountDatabase } from "@sharadox/account-web-library/account-database/type";
|
|
3
|
+
/**
|
|
4
|
+
* For tests: a person named after their identifier, with `<identifier>@example.com` verified. Returns the account
|
|
5
|
+
* and contact ids.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* const { accountId } = await createTestPerson(memory.database, "ana");
|
|
9
|
+
*/
|
|
10
|
+
export declare function createTestPerson(database: Kysely<AccountDatabase>, identifier: string, now?: number): Promise<{
|
|
11
|
+
accountId: string;
|
|
12
|
+
contactId: string;
|
|
13
|
+
}>;
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/test-person/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qDAAqD,CAAC;AAG3F;;;;;;GAMG;AACH,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,CAAC,eAAe,CAAC,EACjC,UAAU,EAAE,MAAM,EAClB,GAAG,CAAC,EAAE,MAAM,GACX,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CASnD"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { createPersonAccount } from "@sharadox/account-web-library/person-account";
|
|
2
|
+
/**
|
|
3
|
+
* For tests: a person named after their identifier, with `<identifier>@example.com` verified. Returns the account
|
|
4
|
+
* and contact ids.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const { accountId } = await createTestPerson(memory.database, "ana");
|
|
8
|
+
*/
|
|
9
|
+
export async function createTestPerson(database, identifier, now) {
|
|
10
|
+
const result = await createPersonAccount(database, {
|
|
11
|
+
name: identifier,
|
|
12
|
+
identifier,
|
|
13
|
+
contact: { kind: "email", value: `${identifier.toLowerCase()}@example.com` },
|
|
14
|
+
...(now === undefined ? {} : { now }),
|
|
15
|
+
});
|
|
16
|
+
if (!result.created)
|
|
17
|
+
throw new Error(`test person "${identifier}" not created: ${result.reason}`);
|
|
18
|
+
return { accountId: result.accountId, contactId: result.contactId };
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../source/test-person/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8CAA8C,CAAC;AAEnF;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,QAAiC,EACjC,UAAkB,EAClB,GAAY;IAEZ,MAAM,MAAM,GAAG,MAAM,mBAAmB,CAAC,QAAQ,EAAE;QACjD,IAAI,EAAE,UAAU;QAChB,UAAU;QACV,OAAO,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,UAAU,CAAC,WAAW,EAAE,cAAc,EAAE;QAC5E,GAAG,CAAC,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC;KACtC,CAAC,CAAC;IACH,IAAI,CAAC,MAAM,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,gBAAgB,UAAU,kBAAkB,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAClG,OAAO,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,CAAC;AACtE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { MemoryDatabase } from "@sharadox/database-web-library/memory-database/type";
|
|
2
|
+
import type { AccountServerDatabase } from "@sharadox/account-web-library/account-database/type";
|
|
3
|
+
/**
|
|
4
|
+
* A migrated account server database (account and protection tables) in memory, for tests of the sign-in flow.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* const memory = await createTestServerDatabase();
|
|
8
|
+
*/
|
|
9
|
+
export declare function createTestServerDatabase(): Promise<MemoryDatabase<AccountServerDatabase>>;
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../source/test-server/index.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qDAAqD,CAAC;AAE1F,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,qDAAqD,CAAC;AAGjG;;;;;GAKG;AACH,wBAAsB,wBAAwB,IAAI,OAAO,CAAC,cAAc,CAAC,qBAAqB,CAAC,CAAC,CAK/F"}
|