@reventlessdev/reventless-registration 0.0.0-stage → 1.0.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +50 -2
- package/package.json +38 -3
- package/rescript.json +28 -0
- package/src/ContactVerification.res +106 -0
- package/src/ContactVerification.res.mjs +60 -0
- package/src/ContactVerification_Guards.res +180 -0
- package/src/ContactVerification_Guards.res.mjs +97 -0
- package/src/Registration/ContactAddressId.res +6 -0
- package/src/Registration/ContactAddressId.res.mjs +29 -0
- package/src/Registration/InboundTranslation/CompleteRegistration.res +35 -0
- package/src/Registration/InboundTranslation/CompleteRegistration.res.mjs +58 -0
- package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res +40 -0
- package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res.mjs +67 -0
- package/src/Registration/InboundTranslation/SignUp.res +35 -0
- package/src/Registration/InboundTranslation/SignUp.res.mjs +57 -0
- package/src/Registration/InboundTranslation/SignUp_Translation.res +40 -0
- package/src/Registration/InboundTranslation/SignUp_Translation.res.mjs +66 -0
- package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res +34 -0
- package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res.mjs +61 -0
- package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res +46 -0
- package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res.mjs +99 -0
- package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res +51 -0
- package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res.mjs +80 -0
- package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res +113 -0
- package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res.mjs +160 -0
- package/src/Registration/StateChange/RegistrationPolicy.res +58 -0
- package/src/Registration/StateChange/RegistrationPolicy.res.mjs +86 -0
- package/src/Registration/StateChange/RegistrationPolicy_Decision.res +43 -0
- package/src/Registration/StateChange/RegistrationPolicy_Decision.res.mjs +88 -0
- package/src/Registration/StateChange/Registrations.res +157 -0
- package/src/Registration/StateChange/Registrations.res.mjs +224 -0
- package/src/Registration/StateChange/Registrations_Decision.res +281 -0
- package/src/Registration/StateChange/Registrations_Decision.res.mjs +541 -0
- package/src/Registration/StateViewStream/RegistrationWindows.res +30 -0
- package/src/Registration/StateViewStream/RegistrationWindows.res.mjs +80 -0
- package/src/Registration/StateViewStream/RegistrationWindows_Projection.res +7 -0
- package/src/Registration/StateViewStream/RegistrationWindows_Projection.res.mjs +38 -0
- package/src/RegistrationChallenge.res +20 -0
- package/src/RegistrationChallenge.res.mjs +45 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// How long a registration's code holds, by why it was sent. A sign-up is acted
|
|
2
|
+
// on by the person who just asked, so a day is plenty; an invitation waits in the
|
|
3
|
+
// mailbox of someone who did not ask, so it holds a week. The rest of the policy
|
|
4
|
+
// is the email one. Kept beside the copied challenge rules rather than in them,
|
|
5
|
+
// so the copy stays a copy.
|
|
6
|
+
|
|
7
|
+
/** A week to act on an invitation. */
|
|
8
|
+
let invitationTtl: Reventless.Duration.t = 604800
|
|
9
|
+
|
|
10
|
+
let policyFor = (purpose: ContactVerification.purpose): ContactVerification.policy =>
|
|
11
|
+
switch purpose {
|
|
12
|
+
| Invitation => {...ContactVerification.emailPolicy, tokenTtl: invitationTtl}
|
|
13
|
+
| Registration | ContactChange | Recovery | Custom(_) => ContactVerification.emailPolicy
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** A registration someone was invited to, or one the person asked for. */
|
|
17
|
+
let purposeFor = (~invited: bool): ContactVerification.purpose =>
|
|
18
|
+
invited ? Invitation : Registration
|
|
19
|
+
|
|
20
|
+
let purposeOf = (~invitedBy: option<string>) => purposeFor(~invited=invitedBy->Option.isSome)
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
|
+
|
|
3
|
+
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
4
|
+
import * as ContactVerification$ReventlessRegistration from "./ContactVerification.res.mjs";
|
|
5
|
+
|
|
6
|
+
function policyFor(purpose) {
|
|
7
|
+
if (typeof purpose !== "object" && purpose === "Invitation") {
|
|
8
|
+
return {
|
|
9
|
+
tokenTtl: 604800,
|
|
10
|
+
maxAttempts: ContactVerification$ReventlessRegistration.emailPolicy.maxAttempts,
|
|
11
|
+
resendCooldown: ContactVerification$ReventlessRegistration.emailPolicy.resendCooldown,
|
|
12
|
+
proofLength: ContactVerification$ReventlessRegistration.emailPolicy.proofLength,
|
|
13
|
+
proofAlphabet: ContactVerification$ReventlessRegistration.emailPolicy.proofAlphabet
|
|
14
|
+
};
|
|
15
|
+
} else {
|
|
16
|
+
return ContactVerification$ReventlessRegistration.emailPolicy;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
function purposeFor(invited) {
|
|
21
|
+
if (invited) {
|
|
22
|
+
return "Invitation";
|
|
23
|
+
} else {
|
|
24
|
+
return "Registration";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function purposeOf(invitedBy) {
|
|
29
|
+
let invited = Stdlib_Option.isSome(invitedBy);
|
|
30
|
+
if (invited) {
|
|
31
|
+
return "Invitation";
|
|
32
|
+
} else {
|
|
33
|
+
return "Registration";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
let invitationTtl = 604800;
|
|
38
|
+
|
|
39
|
+
export {
|
|
40
|
+
invitationTtl,
|
|
41
|
+
policyFor,
|
|
42
|
+
purposeFor,
|
|
43
|
+
purposeOf,
|
|
44
|
+
}
|
|
45
|
+
/* No side effect */
|