@reventlessdev/reventless-registration 1.0.0-alpha.20 → 1.0.0-alpha.21

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.
Files changed (21) hide show
  1. package/package.json +3 -3
  2. package/src/Registration/InboundTranslation/CompleteRegistration.res +2 -2
  3. package/src/Registration/InboundTranslation/CompleteRegistration.res.mjs +2 -2
  4. package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res +1 -1
  5. package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res.mjs +1 -1
  6. package/src/Registration/InboundTranslation/SignUp.res +3 -3
  7. package/src/Registration/InboundTranslation/SignUp.res.mjs +4 -3
  8. package/src/Registration/InboundTranslation/SignUp_Translation.res +5 -5
  9. package/src/Registration/InboundTranslation/SignUp_Translation.res.mjs +4 -4
  10. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res +5 -5
  11. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res.mjs +5 -5
  12. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res +8 -8
  13. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res.mjs +12 -12
  14. package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res +12 -12
  15. package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res.mjs +11 -11
  16. package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res +18 -18
  17. package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res.mjs +30 -30
  18. package/src/Registration/StateChange/Registrations.res +44 -44
  19. package/src/Registration/StateChange/Registrations.res.mjs +42 -42
  20. package/src/Registration/StateChange/Registrations_Decision.res +34 -34
  21. package/src/Registration/StateChange/Registrations_Decision.res.mjs +33 -33
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reventlessdev/reventless-registration",
3
- "version": "1.0.0-alpha.20",
3
+ "version": "1.0.0-alpha.21",
4
4
  "description": "Self-registration as a library of slices: a person with no account proves control of an address and ends up with one, admitted per role as the app declares",
5
5
  "license": "Apache-2.0",
6
6
  "files": [
@@ -13,9 +13,9 @@
13
13
  "dependencies": {
14
14
  "sury": "11.0.0",
15
15
  "sury-ppx": "11.0.0",
16
+ "@reventlessdev/reventless-spec": "3.0.0-alpha.194",
16
17
  "@reventlessdev/reventless-ppx": "1.0.0-alpha.111",
17
- "@reventlessdev/reventless-infra": "3.0.0-alpha.223",
18
- "@reventlessdev/reventless-spec": "3.0.0-alpha.194"
18
+ "@reventlessdev/reventless-infra": "3.0.0-alpha.223"
19
19
  },
20
20
  "devDependencies": {
21
21
  "rescript": "12.3.1"
@@ -15,7 +15,7 @@
15
15
 
16
16
  @schema
17
17
  type externalInput = {
18
- email: string,
18
+ @sensitive email: string,
19
19
  @sensitive proof: string,
20
20
  @sensitive password: string,
21
21
  }
@@ -23,7 +23,7 @@ type externalInput = {
23
23
  @schema
24
24
  type command =
25
25
  | SubmitRegistrationProof({
26
- email: ContactAddressId.t,
26
+ emailId: ContactAddressId.t,
27
27
  proofHash: string,
28
28
  presentedAt: Reventless.DateTime.t,
29
29
  })
@@ -7,14 +7,14 @@ import * as Sensitive$Reventless from "@reventlessdev/reventless-spec/src/compon
7
7
  import * as ContactAddressId$ReventlessRegistration from "../ContactAddressId.res.mjs";
8
8
 
9
9
  let externalInputSchema = Sury.$schema(s => ({
10
- email: s.m(Sury.string),
10
+ email: s.m(Sensitive$Reventless.string),
11
11
  proof: s.m(Sensitive$Reventless.string),
12
12
  password: s.m(Sensitive$Reventless.string)
13
13
  }));
14
14
 
15
15
  let commandSchema = Sury.$schema(s => ({
16
16
  TAG: "SubmitRegistrationProof",
17
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
17
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
18
18
  proofHash: s.m(Sury.string),
19
19
  presentedAt: s.m(DateTime$Reventless.schema)
20
20
  }));
@@ -32,7 +32,7 @@ let translate = async (
32
32
  (
33
33
  id->ContactAddressId.toString,
34
34
  SubmitRegistrationProof({
35
- email: id,
35
+ emailId: id,
36
36
  proofHash,
37
37
  presentedAt: Date.make()->Date.toISOString->Reventless.DateTime.unsafe,
38
38
  }),
@@ -42,7 +42,7 @@ async function translate(input, capabilities, param) {
42
42
  ContactAddressId$ReventlessRegistration.toString(id),
43
43
  {
44
44
  TAG: "SubmitRegistrationProof",
45
- email: id,
45
+ emailId: id,
46
46
  proofHash: proofHash,
47
47
  presentedAt: new Date().toISOString()
48
48
  }
@@ -18,13 +18,13 @@
18
18
  /** `role` may be left out where exactly one role is open to visitors; with
19
19
  several, a sign-up has to say which. */
20
20
  @schema
21
- type externalInput = {email: string, role?: string}
21
+ type externalInput = {@sensitive email: string, role?: string}
22
22
 
23
23
  @schema
24
24
  type command =
25
25
  | Register({
26
- email: ContactAddressId.t,
27
- @pii({subject: "email"}) address: Reventless.Email.t,
26
+ emailId: ContactAddressId.t,
27
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
28
28
  role: Reventless.Role.name,
29
29
  requestedAt: Reventless.DateTime.t,
30
30
  })
@@ -6,17 +6,18 @@ import * as Role$Reventless from "@reventlessdev/reventless-spec/src/types/Role.
6
6
  import * as Email$Reventless from "@reventlessdev/reventless-spec/src/semantic/Email.res.mjs";
7
7
  import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
8
8
  import * as DateTime$Reventless from "@reventlessdev/reventless-spec/src/semantic/DateTime.res.mjs";
9
+ import * as Sensitive$Reventless from "@reventlessdev/reventless-spec/src/components/Sensitive.res.mjs";
9
10
  import * as ContactAddressId$ReventlessRegistration from "../ContactAddressId.res.mjs";
10
11
 
11
12
  let externalInputSchema = Sury.$schema(s => ({
12
- email: s.m(Sury.string),
13
+ email: s.m(Sensitive$Reventless.string),
13
14
  role: s.m(Sury.$option(Sury.string))
14
15
  }));
15
16
 
16
17
  let commandSchema = Sury.$schema(s => ({
17
18
  TAG: "Register",
18
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
19
- address: s.m(Pii$Reventless.mark("email", undefined, Email$Reventless.schema)),
19
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
20
+ email: s.m(Pii$Reventless.mark("emailId", undefined, Email$Reventless.schema)),
20
21
  role: s.m(Role$Reventless.nameSchema),
21
22
  requestedAt: s.m(DateTime$Reventless.schema)
22
23
  }));
@@ -20,7 +20,7 @@ module Make = (App: Reventless.Admission.Declaration) => {
20
20
  ) =>
21
21
  switch (Reventless.Email.fromString(input.email->String.trim), input.role) {
22
22
  | (Error(_), _) => Error("not an email address")
23
- | (Ok(email), role) =>
23
+ | (Ok(typed), role) =>
24
24
  switch role
25
25
  ->Option.map(String.trim)
26
26
  ->Option.filter(r => r != "")
@@ -28,8 +28,8 @@ module Make = (App: Reventless.Admission.Declaration) => {
28
28
  ->Option.orElse(defaultRole(App.table)) {
29
29
  | None => Error("say which role to sign up for")
30
30
  | Some(role) =>
31
- let address = email->ContactAddressId.normalize
32
- switch ContactAddressId.fingerprint(capabilities.secrets, address) {
31
+ let email = typed->ContactAddressId.normalize
32
+ switch ContactAddressId.fingerprint(capabilities.secrets, email) {
33
33
  | Error(why) => Error(why)
34
34
  | Ok(id) =>
35
35
  // The envelope id is the fingerprint too: an id is stored beside the
@@ -38,8 +38,8 @@ module Make = (App: Reventless.Admission.Declaration) => {
38
38
  (
39
39
  id->ContactAddressId.toString,
40
40
  Register({
41
- email: id,
42
- address,
41
+ emailId: id,
42
+ email,
43
43
  role,
44
44
  requestedAt: Date.make()->Date.toISOString->Reventless.DateTime.unsafe,
45
45
  }),
@@ -32,8 +32,8 @@ function Make(App) {
32
32
  _0: "say which role to sign up for"
33
33
  };
34
34
  }
35
- let address = ContactAddressId$ReventlessRegistration.normalize(match._0);
36
- let why = ContactAddressId$ReventlessRegistration.fingerprint(capabilities.secrets, address);
35
+ let email = ContactAddressId$ReventlessRegistration.normalize(match._0);
36
+ let why = ContactAddressId$ReventlessRegistration.fingerprint(capabilities.secrets, email);
37
37
  if (why.TAG !== "Ok") {
38
38
  return {
39
39
  TAG: "Error",
@@ -47,8 +47,8 @@ function Make(App) {
47
47
  ContactAddressId$ReventlessRegistration.toString(id),
48
48
  {
49
49
  TAG: "Register",
50
- email: id,
51
- address: address,
50
+ emailId: id,
51
+ email: email,
52
52
  role: role,
53
53
  requestedAt: new Date().toISOString()
54
54
  }
@@ -15,22 +15,22 @@
15
15
  @schema
16
16
  type consumedEvent =
17
17
  | RegistrationProofAccepted({
18
- email: string,
19
- @pii({subject: "email"}) address: Reventless.Email.t,
18
+ emailId: string,
19
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
20
20
  roles: array<Reventless.Role.name>,
21
21
  proofHash: string,
22
22
  })
23
23
 
24
24
  @schema
25
25
  type outboundItem = {
26
- email: string,
27
- @pii({subject: "email"}) address: Reventless.Email.t,
26
+ emailId: string,
27
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
28
28
  roles: array<Reventless.Role.name>,
29
29
  proofHash: string,
30
30
  }
31
31
 
32
32
  @schema
33
- type inboundCommand = RecordRegistrationCompleted({email: ContactAddressId.t})
33
+ type inboundCommand = RecordRegistrationCompleted({emailId: ContactAddressId.t})
34
34
 
35
35
  // For a provider that is down. The password is put back before each retry, so a
36
36
  // retry finds it; once the budget is spent, it expires.
@@ -9,22 +9,22 @@ import * as ContactAddressId$ReventlessRegistration from "../ContactAddressId.re
9
9
 
10
10
  let consumedEventSchema = Sury.$schema(s => ({
11
11
  TAG: "RegistrationProofAccepted",
12
- email: s.m(Sury.string),
13
- address: s.m(Pii$Reventless.marked("email", undefined, Email$Reventless.schema)),
12
+ emailId: s.m(DcbTag$Reventless.string),
13
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
14
14
  roles: s.m(Sury.array(Role$Reventless.nameSchema)),
15
15
  proofHash: s.m(Sury.string)
16
16
  }));
17
17
 
18
18
  let outboundItemSchema = Sury.$schema(s => ({
19
- email: s.m(Sury.string),
20
- address: s.m(Pii$Reventless.mark("email", undefined, Email$Reventless.schema)),
19
+ emailId: s.m(Sury.string),
20
+ email: s.m(Pii$Reventless.mark("emailId", undefined, Email$Reventless.schema)),
21
21
  roles: s.m(Sury.array(Role$Reventless.nameSchema)),
22
22
  proofHash: s.m(Sury.string)
23
23
  }));
24
24
 
25
25
  let inboundCommandSchema = Sury.$schema(s => ({
26
26
  TAG: "RecordRegistrationCompleted",
27
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
27
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
28
28
  }));
29
29
 
30
30
  let sourceNames = [];
@@ -9,16 +9,16 @@ let retryTtl = 600
9
9
 
10
10
  let collect = (event, ~sourceId as _) =>
11
11
  switch event {
12
- | RegistrationProofAccepted({email, address: Value(address), roles, proofHash}) => [
13
- (`${email}:${proofHash}`, {email, address, roles, proofHash}),
12
+ | RegistrationProofAccepted({emailId, email: Value(email), roles, proofHash}) => [
13
+ (`${emailId}:${proofHash}`, {emailId, email, roles, proofHash}),
14
14
  ]
15
15
  // An address that was erased or forgotten has nobody left to write to.
16
16
  | _ => []
17
17
  }
18
18
 
19
- // `email` is already the ledger's id for the address: no key is needed to say so.
20
- let completed = (email: string) => Ok(
21
- Some((email, RecordRegistrationCompleted({email: ContactAddressId.makeFromString(email)}))),
19
+ // `emailId` is already the ledger's id for the address: no key is needed to say so.
20
+ let completed = (emailId: string) => Ok(
21
+ Some((emailId, RecordRegistrationCompleted({emailId: ContactAddressId.makeFromString(emailId)}))),
22
22
  )
23
23
 
24
24
  let translate = async (_id, item: outboundItem, ~capabilities: Reventless.Capabilities.t) =>
@@ -29,14 +29,14 @@ let translate = async (_id, item: outboundItem, ~capabilities: Reventless.Capabi
29
29
  | Ok(None) => Error("the password expired before the account was made")
30
30
  | Ok(Some(password)) =>
31
31
  switch await capabilities.identityProvider.createPrincipal(
32
- ~contact=ToEmail(item.address),
32
+ ~contact=ToEmail(item.email),
33
33
  ~credential=Password(password),
34
34
  ~groups=groupsOf(item.roles),
35
35
  ) {
36
- | Ok(_) => completed(item.email)
36
+ | Ok(_) => completed(item.emailId)
37
37
  // The provider already holds this address — an account declared before
38
38
  // registration existed, say. It is as registered as one made here.
39
- | Error(Conflict) => completed(item.email)
39
+ | Error(Conflict) => completed(item.emailId)
40
40
  | Error(Unavailable(why)) =>
41
41
  // Put back so the retry finds it. Failing that, the retry reports the
42
42
  // password gone, which is true.
@@ -9,10 +9,10 @@ function groupsOf(roles) {
9
9
  }
10
10
 
11
11
  function collect(event, param) {
12
- let address = event.address;
13
12
  let email = event.email;
14
- if (typeof address !== "object") {
15
- if (address === "Erased") {
13
+ let emailId = event.emailId;
14
+ if (typeof email !== "object") {
15
+ if (email === "Erased") {
16
16
  return [];
17
17
  } else {
18
18
  return [];
@@ -20,24 +20,24 @@ function collect(event, param) {
20
20
  }
21
21
  let proofHash = event.proofHash;
22
22
  return [[
23
- email + `:` + proofHash,
23
+ emailId + `:` + proofHash,
24
24
  {
25
- email: email,
26
- address: address._0,
25
+ emailId: emailId,
26
+ email: email._0,
27
27
  roles: event.roles,
28
28
  proofHash: proofHash
29
29
  }
30
30
  ]];
31
31
  }
32
32
 
33
- function completed(email) {
33
+ function completed(emailId) {
34
34
  return {
35
35
  TAG: "Ok",
36
36
  _0: [
37
- email,
37
+ emailId,
38
38
  {
39
39
  TAG: "RecordRegistrationCompleted",
40
- email: ContactAddressId$ReventlessRegistration.makeFromString(email)
40
+ emailId: ContactAddressId$ReventlessRegistration.makeFromString(emailId)
41
41
  }
42
42
  ]
43
43
  };
@@ -60,17 +60,17 @@ async function translate(_id, item, capabilities) {
60
60
  }
61
61
  let match = await capabilities.identityProvider.createPrincipal({
62
62
  TAG: "ToEmail",
63
- _0: item.address
63
+ _0: item.email
64
64
  }, {
65
65
  TAG: "Password",
66
66
  _0: password
67
67
  }, item.roles.map(Role$Reventless.groupOf));
68
68
  if (match.TAG === "Ok") {
69
- return completed(item.email);
69
+ return completed(item.emailId);
70
70
  }
71
71
  let why = match._0;
72
72
  if (typeof why !== "object") {
73
- return completed(item.email);
73
+ return completed(item.emailId);
74
74
  }
75
75
  if (why.TAG !== "Unavailable") {
76
76
  return {
@@ -19,38 +19,38 @@
19
19
  @schema
20
20
  type consumedEvent =
21
21
  | RegistrationRequested({
22
- email: string,
23
- @pii({subject: "email"}) address: Reventless.Email.t,
22
+ emailId: string,
23
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
24
24
  requestedAt: Reventless.DateTime.t,
25
25
  })
26
26
  | RegistrationAttemptedOnTakenAddress({
27
- email: string,
28
- @pii({subject: "email"}) address: Reventless.Email.t,
27
+ emailId: string,
28
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
29
29
  attemptedAt: Reventless.DateTime.t,
30
30
  })
31
31
  | RegistrationInvited({
32
- email: string,
33
- @pii({subject: "email"}) address: Reventless.Email.t,
32
+ emailId: string,
33
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
34
34
  roles: array<string>,
35
35
  invitedBy: string,
36
36
  invitedAt: Reventless.DateTime.t,
37
37
  })
38
38
  | RegistrationChallengeReissued({
39
- email: string,
40
- @pii({subject: "email"}) address: Reventless.Email.t,
39
+ emailId: string,
40
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
41
41
  reissuedAt: Reventless.DateTime.t,
42
42
  invitedBy?: string,
43
43
  })
44
44
 
45
- // `email` is the ledger's id for the address, `address` the address the mail goes to.
45
+ // `emailId` is the ledger's id for the address, `email` the address the mail goes to.
46
46
 
47
47
  /** `invited` words the secret as an invitation; it is left out for a sign-up
48
48
  and for the notice. `roles` names what the invitation grants, where the
49
49
  event said: a reissued code does not. */
50
50
  @schema
51
51
  type outboundItem = {
52
- email: string,
53
- @pii({subject: "email"}) address: Reventless.Email.t,
52
+ emailId: string,
53
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
54
54
  alreadyRegistered: bool,
55
55
  invited?: bool,
56
56
  roles?: array<string>,
@@ -59,7 +59,7 @@ type outboundItem = {
59
59
  @schema
60
60
  type inboundCommand =
61
61
  | IssueRegistrationChallenge({
62
- email: ContactAddressId.t,
62
+ emailId: ContactAddressId.t,
63
63
  proofHash: string,
64
64
  issuedAt: Reventless.DateTime.t,
65
65
  })
@@ -10,36 +10,36 @@ import * as ContactAddressId$ReventlessRegistration from "../ContactAddressId.re
10
10
  let consumedEventSchema = Sury.union([
11
11
  Sury.$schema(s => ({
12
12
  TAG: "RegistrationRequested",
13
- email: s.m(Sury.string),
14
- address: s.m(Pii$Reventless.marked("email", undefined, Email$Reventless.schema)),
13
+ emailId: s.m(DcbTag$Reventless.string),
14
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
15
15
  requestedAt: s.m(DateTime$Reventless.schema)
16
16
  })),
17
17
  Sury.$schema(s => ({
18
18
  TAG: "RegistrationAttemptedOnTakenAddress",
19
- email: s.m(Sury.string),
20
- address: s.m(Pii$Reventless.marked("email", undefined, Email$Reventless.schema)),
19
+ emailId: s.m(DcbTag$Reventless.string),
20
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
21
21
  attemptedAt: s.m(DateTime$Reventless.schema)
22
22
  })),
23
23
  Sury.$schema(s => ({
24
24
  TAG: "RegistrationInvited",
25
- email: s.m(Sury.string),
26
- address: s.m(Pii$Reventless.marked("email", undefined, Email$Reventless.schema)),
25
+ emailId: s.m(DcbTag$Reventless.string),
26
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
27
27
  roles: s.m(Sury.array(Sury.string)),
28
28
  invitedBy: s.m(Sury.string),
29
29
  invitedAt: s.m(DateTime$Reventless.schema)
30
30
  })),
31
31
  Sury.$schema(s => ({
32
32
  TAG: "RegistrationChallengeReissued",
33
- email: s.m(Sury.string),
34
- address: s.m(Pii$Reventless.marked("email", undefined, Email$Reventless.schema)),
33
+ emailId: s.m(DcbTag$Reventless.string),
34
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
35
35
  reissuedAt: s.m(DateTime$Reventless.schema),
36
36
  invitedBy: s.m(Sury.$option(Sury.string))
37
37
  }))
38
38
  ]);
39
39
 
40
40
  let outboundItemSchema = Sury.$schema(s => ({
41
- email: s.m(Sury.string),
42
- address: s.m(Pii$Reventless.mark("email", undefined, Email$Reventless.schema)),
41
+ emailId: s.m(Sury.string),
42
+ email: s.m(Pii$Reventless.mark("emailId", undefined, Email$Reventless.schema)),
43
43
  alreadyRegistered: s.m(Sury.boolean),
44
44
  invited: s.m(Sury.$option(Sury.boolean)),
45
45
  roles: s.m(Sury.$option(Sury.array(Sury.string)))
@@ -47,7 +47,7 @@ let outboundItemSchema = Sury.$schema(s => ({
47
47
 
48
48
  let inboundCommandSchema = Sury.$schema(s => ({
49
49
  TAG: "IssueRegistrationChallenge",
50
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
50
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
51
51
  proofHash: s.m(Sury.string),
52
52
  issuedAt: s.m(DateTime$Reventless.schema)
53
53
  }));
@@ -4,28 +4,28 @@
4
4
  // or a code reissued, is new work rather than work already done.
5
5
  let collect = (event, ~sourceId as _) =>
6
6
  switch event {
7
- | RegistrationRequested({email, address: Value(address), requestedAt}) => [
7
+ | RegistrationRequested({emailId, email: Value(email), requestedAt}) => [
8
8
  (
9
- `${email}:${requestedAt->Reventless.DateTime.toString}`,
10
- {email, address, alreadyRegistered: false},
9
+ `${emailId}:${requestedAt->Reventless.DateTime.toString}`,
10
+ {emailId, email, alreadyRegistered: false},
11
11
  ),
12
12
  ]
13
- | RegistrationInvited({email, address: Value(address), roles, invitedAt}) => [
13
+ | RegistrationInvited({emailId, email: Value(email), roles, invitedAt}) => [
14
14
  (
15
- `${email}:invited:${invitedAt->Reventless.DateTime.toString}`,
16
- {email, address, alreadyRegistered: false, invited: true, roles},
15
+ `${emailId}:invited:${invitedAt->Reventless.DateTime.toString}`,
16
+ {emailId, email, alreadyRegistered: false, invited: true, roles},
17
17
  ),
18
18
  ]
19
- | RegistrationChallengeReissued({email, address: Value(address), reissuedAt, ?invitedBy}) => [
19
+ | RegistrationChallengeReissued({emailId, email: Value(email), reissuedAt, ?invitedBy}) => [
20
20
  (
21
- `${email}:reissued:${reissuedAt->Reventless.DateTime.toString}`,
22
- {email, address, alreadyRegistered: false, invited: invitedBy->Option.isSome},
21
+ `${emailId}:reissued:${reissuedAt->Reventless.DateTime.toString}`,
22
+ {emailId, email, alreadyRegistered: false, invited: invitedBy->Option.isSome},
23
23
  ),
24
24
  ]
25
- | RegistrationAttemptedOnTakenAddress({email, address: Value(address), attemptedAt}) => [
25
+ | RegistrationAttemptedOnTakenAddress({emailId, email: Value(email), attemptedAt}) => [
26
26
  (
27
- `${email}:taken:${attemptedAt->Reventless.DateTime.toString}`,
28
- {email, address, alreadyRegistered: true},
27
+ `${emailId}:taken:${attemptedAt->Reventless.DateTime.toString}`,
28
+ {emailId, email, alreadyRegistered: true},
29
29
  ),
30
30
  ]
31
31
  // An address that was erased or forgotten has nobody left to write to.
@@ -59,8 +59,8 @@ let invitationBody = (~token, ~roles=?) =>
59
59
 
60
60
  let noticeBody = "Someone asked to register an account with this address, which already has one. If it was you, sign in instead. If it was not, there is nothing to do: no account was changed."
61
61
 
62
- let send = (capabilities: Reventless.Capabilities.t, ~address, ~subject, ~body) =>
63
- capabilities.messaging.send(~recipient=ToEmail(address), ~message={subject, body})
62
+ let send = (capabilities: Reventless.Capabilities.t, ~email, ~subject, ~body) =>
63
+ capabilities.messaging.send(~recipient=ToEmail(email), ~message={subject, body})
64
64
 
65
65
  /**
66
66
  Draw a secret, send it, and open a challenge against its hash — sending first,
@@ -70,7 +70,7 @@ let translate = async (_id, item: outboundItem, ~capabilities: Reventless.Capabi
70
70
  if item.alreadyRegistered {
71
71
  switch await send(
72
72
  capabilities,
73
- ~address=item.address,
73
+ ~email=item.email,
74
74
  ~subject="Someone tried to register with your address",
75
75
  ~body=noticeBody,
76
76
  ) {
@@ -91,16 +91,16 @@ let translate = async (_id, item: outboundItem, ~capabilities: Reventless.Capabi
91
91
  | Ok(proofHash) =>
92
92
  switch await send(
93
93
  capabilities,
94
- ~address=item.address,
94
+ ~email=item.email,
95
95
  ~subject=invited ? "You are invited to create an account" : "Finish your registration",
96
96
  ~body=invited ? invitationBody(~token, ~roles=?item.roles) : challengeBody(~token),
97
97
  ) {
98
98
  | Ok(_) =>
99
99
  Ok(
100
100
  Some((
101
- item.email,
101
+ item.emailId,
102
102
  IssueRegistrationChallenge({
103
- email: ContactAddressId.makeFromString(item.email),
103
+ emailId: ContactAddressId.makeFromString(item.emailId),
104
104
  proofHash,
105
105
  issuedAt: Date.make()->Date.toISOString->Reventless.DateTime.unsafe,
106
106
  }),