@reventlessdev/reventless-registration 1.0.0-alpha.2 → 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 (23) hide show
  1. package/package.json +4 -4
  2. package/src/Registration/ContactAddressId.res +27 -3
  3. package/src/Registration/ContactAddressId.res.mjs +26 -2
  4. package/src/Registration/InboundTranslation/CompleteRegistration.res +2 -2
  5. package/src/Registration/InboundTranslation/CompleteRegistration.res.mjs +2 -2
  6. package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res +9 -6
  7. package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res.mjs +16 -9
  8. package/src/Registration/InboundTranslation/SignUp.res +3 -2
  9. package/src/Registration/InboundTranslation/SignUp.res.mjs +6 -2
  10. package/src/Registration/InboundTranslation/SignUp_Translation.res +24 -13
  11. package/src/Registration/InboundTranslation/SignUp_Translation.res.mjs +13 -4
  12. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res +9 -3
  13. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res.mjs +7 -3
  14. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res +10 -7
  15. package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res.mjs +17 -8
  16. package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res +27 -6
  17. package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res.mjs +13 -6
  18. package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res +19 -17
  19. package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res.mjs +73 -33
  20. package/src/Registration/StateChange/Registrations.res +58 -27
  21. package/src/Registration/StateChange/Registrations.res.mjs +58 -28
  22. package/src/Registration/StateChange/Registrations_Decision.res +67 -26
  23. package/src/Registration/StateChange/Registrations_Decision.res.mjs +91 -42
@@ -4,27 +4,32 @@
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, requestedAt}) => [
8
- (`${email}:${requestedAt->Reventless.DateTime.toString}`, {email, alreadyRegistered: false}),
7
+ | RegistrationRequested({emailId, email: Value(email), requestedAt}) => [
8
+ (
9
+ `${emailId}:${requestedAt->Reventless.DateTime.toString}`,
10
+ {emailId, email, alreadyRegistered: false},
11
+ ),
9
12
  ]
10
- | RegistrationInvited({email, roles, invitedAt}) => [
13
+ | RegistrationInvited({emailId, email: Value(email), roles, invitedAt}) => [
11
14
  (
12
- `${email}:invited:${invitedAt->Reventless.DateTime.toString}`,
13
- {email, alreadyRegistered: false, invited: true, roles},
15
+ `${emailId}:invited:${invitedAt->Reventless.DateTime.toString}`,
16
+ {emailId, email, alreadyRegistered: false, invited: true, roles},
14
17
  ),
15
18
  ]
16
- | RegistrationChallengeReissued({email, reissuedAt, ?invitedBy}) => [
19
+ | RegistrationChallengeReissued({emailId, email: Value(email), reissuedAt, ?invitedBy}) => [
17
20
  (
18
- `${email}:reissued:${reissuedAt->Reventless.DateTime.toString}`,
19
- {email, alreadyRegistered: false, invited: invitedBy->Option.isSome},
21
+ `${emailId}:reissued:${reissuedAt->Reventless.DateTime.toString}`,
22
+ {emailId, email, alreadyRegistered: false, invited: invitedBy->Option.isSome},
20
23
  ),
21
24
  ]
22
- | RegistrationAttemptedOnTakenAddress({email, attemptedAt}) => [
25
+ | RegistrationAttemptedOnTakenAddress({emailId, email: Value(email), attemptedAt}) => [
23
26
  (
24
- `${email}:taken:${attemptedAt->Reventless.DateTime.toString}`,
25
- {email, alreadyRegistered: true},
27
+ `${emailId}:taken:${attemptedAt->Reventless.DateTime.toString}`,
28
+ {emailId, email, alreadyRegistered: true},
26
29
  ),
27
30
  ]
31
+ // An address that was erased or forgotten has nobody left to write to.
32
+ | _ => []
28
33
  }
29
34
 
30
35
  let expiresIn = (~invited) =>
@@ -55,10 +60,7 @@ let invitationBody = (~token, ~roles=?) =>
55
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."
56
61
 
57
62
  let send = (capabilities: Reventless.Capabilities.t, ~email, ~subject, ~body) =>
58
- capabilities.messaging.send(
59
- ~recipient=ToEmail(Reventless.Email.unsafe(email)),
60
- ~message={subject, body},
61
- )
63
+ capabilities.messaging.send(~recipient=ToEmail(email), ~message={subject, body})
62
64
 
63
65
  /**
64
66
  Draw a secret, send it, and open a challenge against its hash — sending first,
@@ -96,9 +98,9 @@ let translate = async (_id, item: outboundItem, ~capabilities: Reventless.Capabi
96
98
  | Ok(_) =>
97
99
  Ok(
98
100
  Some((
99
- item.email,
101
+ item.emailId,
100
102
  IssueRegistrationChallenge({
101
- email: ContactAddressId.makeFromString(item.email),
103
+ emailId: ContactAddressId.makeFromString(item.emailId),
102
104
  proofHash,
103
105
  issuedAt: Date.make()->Date.toISOString->Reventless.DateTime.unsafe,
104
106
  }),
@@ -10,43 +10,83 @@ function collect(event, param) {
10
10
  switch (event.TAG) {
11
11
  case "RegistrationRequested" :
12
12
  let email = event.email;
13
- return [[
14
- email + `:` + event.requestedAt,
15
- {
16
- email: email,
17
- alreadyRegistered: false
18
- }
19
- ]];
13
+ let emailId = event.emailId;
14
+ if (typeof email !== "object") {
15
+ if (email === "Erased") {
16
+ return [];
17
+ } else {
18
+ return [];
19
+ }
20
+ } else {
21
+ return [[
22
+ emailId + `:` + event.requestedAt,
23
+ {
24
+ emailId: emailId,
25
+ email: email._0,
26
+ alreadyRegistered: false
27
+ }
28
+ ]];
29
+ }
20
30
  case "RegistrationAttemptedOnTakenAddress" :
21
31
  let email$1 = event.email;
22
- return [[
23
- email$1 + `:taken:` + event.attemptedAt,
24
- {
25
- email: email$1,
26
- alreadyRegistered: true
27
- }
28
- ]];
32
+ let emailId$1 = event.emailId;
33
+ if (typeof email$1 !== "object") {
34
+ if (email$1 === "Erased") {
35
+ return [];
36
+ } else {
37
+ return [];
38
+ }
39
+ } else {
40
+ return [[
41
+ emailId$1 + `:taken:` + event.attemptedAt,
42
+ {
43
+ emailId: emailId$1,
44
+ email: email$1._0,
45
+ alreadyRegistered: true
46
+ }
47
+ ]];
48
+ }
29
49
  case "RegistrationInvited" :
30
50
  let email$2 = event.email;
31
- return [[
32
- email$2 + `:invited:` + event.invitedAt,
33
- {
34
- email: email$2,
35
- alreadyRegistered: false,
36
- invited: true,
37
- roles: event.roles
38
- }
39
- ]];
51
+ let emailId$2 = event.emailId;
52
+ if (typeof email$2 !== "object") {
53
+ if (email$2 === "Erased") {
54
+ return [];
55
+ } else {
56
+ return [];
57
+ }
58
+ } else {
59
+ return [[
60
+ emailId$2 + `:invited:` + event.invitedAt,
61
+ {
62
+ emailId: emailId$2,
63
+ email: email$2._0,
64
+ alreadyRegistered: false,
65
+ invited: true,
66
+ roles: event.roles
67
+ }
68
+ ]];
69
+ }
40
70
  case "RegistrationChallengeReissued" :
41
71
  let email$3 = event.email;
42
- return [[
43
- email$3 + `:reissued:` + event.reissuedAt,
44
- {
45
- email: email$3,
46
- alreadyRegistered: false,
47
- invited: Stdlib_Option.isSome(event.invitedBy)
48
- }
49
- ]];
72
+ let emailId$3 = event.emailId;
73
+ if (typeof email$3 !== "object") {
74
+ if (email$3 === "Erased") {
75
+ return [];
76
+ } else {
77
+ return [];
78
+ }
79
+ } else {
80
+ return [[
81
+ emailId$3 + `:reissued:` + event.reissuedAt,
82
+ {
83
+ emailId: emailId$3,
84
+ email: email$3._0,
85
+ alreadyRegistered: false,
86
+ invited: Stdlib_Option.isSome(event.invitedBy)
87
+ }
88
+ ]];
89
+ }
50
90
  }
51
91
  }
52
92
 
@@ -119,10 +159,10 @@ async function translate(_id, item, capabilities) {
119
159
  return {
120
160
  TAG: "Ok",
121
161
  _0: [
122
- item.email,
162
+ item.emailId,
123
163
  {
124
164
  TAG: "IssueRegistrationChallenge",
125
- email: ContactAddressId$ReventlessRegistration.makeFromString(item.email),
165
+ emailId: ContactAddressId$ReventlessRegistration.makeFromString(item.emailId),
126
166
  proofHash: proofHash._0,
127
167
  issuedAt: new Date().toISOString()
128
168
  }
@@ -15,6 +15,12 @@
15
15
  // translations in this chapter: they stamp the time a request arrived, and they
16
16
  // hash a presented proof so its plaintext never reaches this slice or the log.
17
17
  //
18
+ // **The address is not the key.** `emailId` is the address's keyed fingerprint
19
+ // (`ContactAddressId`), which is what tags and partitions the ledger; an index key
20
+ // cannot be erased. The address itself rides in `email`, on the events that must
21
+ // reach the person and on the commands that start a claim, so it lives only where
22
+ // a payload field can be encrypted or erased.
23
+ //
18
24
  // **Its answers do not tell an anonymous caller anything.** A closed policy, a
19
25
  // pending registration and an address already registered all leave the door
20
26
  // answering the same way; only what is sent to the address differs.
@@ -34,35 +40,45 @@ type consumedEvent =
34
40
  role: @s.matches(Reventless.DcbTag.mark(Reventless.Role.nameSchema)) Reventless.Role.name,
35
41
  })
36
42
  | RegistrationRequested({
37
- email: ContactAddressId.t,
43
+ emailId: ContactAddressId.t,
44
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
38
45
  roles: array<string>,
39
46
  requestedAt: Reventless.DateTime.t,
40
47
  })
41
- | RegistrationExpired({email: ContactAddressId.t})
48
+ | RegistrationExpired({emailId: ContactAddressId.t})
42
49
  | RegistrationInvited({
43
- email: ContactAddressId.t,
50
+ emailId: ContactAddressId.t,
51
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
44
52
  roles: array<string>,
45
53
  invitedBy: string,
46
54
  invitedAt: Reventless.DateTime.t,
47
55
  })
48
56
  | RegistrationChallengeReissued({
49
- email: ContactAddressId.t,
57
+ emailId: ContactAddressId.t,
58
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
50
59
  reissuedAt: Reventless.DateTime.t,
51
60
  invitedBy?: string,
52
61
  })
53
- | RegistrationWithdrawn({email: ContactAddressId.t, withdrawnAt: Reventless.DateTime.t})
62
+ | RegistrationWithdrawn({emailId: ContactAddressId.t, withdrawnAt: Reventless.DateTime.t})
54
63
  | RegistrationAttemptedOnTakenAddress({
55
- email: ContactAddressId.t,
64
+ emailId: ContactAddressId.t,
65
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
56
66
  attemptedAt: Reventless.DateTime.t,
57
67
  })
58
68
  | RegistrationChallengeIssued({
59
- email: ContactAddressId.t,
69
+ emailId: ContactAddressId.t,
60
70
  proofHash: string,
61
71
  issuedAt: Reventless.DateTime.t,
62
72
  })
63
- | RegistrationProofAccepted({email: ContactAddressId.t, roles: array<string>, proofHash: string})
64
- | RegistrationProofRefused({email: ContactAddressId.t, reason: string})
65
- | RegistrationCompleted({email: ContactAddressId.t})
73
+ | RegistrationProofAccepted({
74
+ emailId: ContactAddressId.t,
75
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
76
+ roles: array<string>,
77
+ proofHash: string,
78
+ })
79
+ | RegistrationProofRefused({emailId: ContactAddressId.t, reason: string})
80
+ | RegistrationCompleted({emailId: ContactAddressId.t})
81
+ | RegistrationReleased({emailId: ContactAddressId.t, releasedAt: Reventless.DateTime.t})
66
82
 
67
83
  // `Register` names the role asked for, and the policy is read by it. The
68
84
  // registration records the roles it grants as
@@ -77,29 +93,31 @@ type consumedEvent =
77
93
  type command =
78
94
  | @noApi
79
95
  Register({
80
- email: ContactAddressId.t,
96
+ emailId: ContactAddressId.t,
97
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
81
98
  role: @s.matches(Reventless.DcbTag.mark(Reventless.Role.nameSchema)) Reventless.Role.name,
82
99
  requestedAt: Reventless.DateTime.t,
83
100
  })
84
101
  | @noApi
85
102
  IssueRegistrationChallenge({
86
- email: ContactAddressId.t,
103
+ emailId: ContactAddressId.t,
87
104
  proofHash: string,
88
105
  issuedAt: Reventless.DateTime.t,
89
106
  })
90
107
  | @noApi
91
108
  SubmitRegistrationProof({
92
- email: ContactAddressId.t,
109
+ emailId: ContactAddressId.t,
93
110
  proofHash: string,
94
111
  presentedAt: Reventless.DateTime.t,
95
112
  })
96
- | @noApi RecordRegistrationCompleted({email: ContactAddressId.t})
113
+ | @noApi RecordRegistrationCompleted({emailId: ContactAddressId.t})
97
114
  // A signed-in inviter claims the address for someone else, as the roles the
98
115
  // app declares by invitation. No door here reaches it: a plugin that provides
99
116
  // invitations marks its door `Invite` and checks the inviter before relaying.
100
117
  | @noApi
101
118
  Invite({
102
- email: ContactAddressId.t,
119
+ emailId: ContactAddressId.t,
120
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
103
121
  roles: array<Reventless.Role.name>,
104
122
  invitedBy: string,
105
123
  requestedAt: Reventless.DateTime.t,
@@ -108,11 +126,14 @@ type command =
108
126
  // lost, or its attempts spent. Held to one per resend cooldown.
109
127
  | @noApi
110
128
  ReissueRegistrationChallenge({
111
- email: ContactAddressId.t,
129
+ emailId: ContactAddressId.t,
112
130
  requestedAt: Reventless.DateTime.t,
113
131
  })
114
132
  // Releases an address a registration holds and nobody has proved yet.
115
- | @noApi WithdrawRegistration({email: ContactAddressId.t, withdrawnAt: Reventless.DateTime.t})
133
+ | @noApi WithdrawRegistration({emailId: ContactAddressId.t, withdrawnAt: Reventless.DateTime.t})
134
+ // Releases the address of an account that was erased, so its person may
135
+ // register again. Only the erasure workflow sends it, after the account is gone.
136
+ | @noApi ReleaseRegistration({emailId: ContactAddressId.t, releasedAt: Reventless.DateTime.t})
116
137
 
117
138
  // Every outcome of a command relayed for an anonymous caller is a recorded fact
118
139
  // or a quiet no-op, never an error: an error is the one answer a caller could
@@ -126,32 +147,42 @@ type error =
126
147
  @schema
127
148
  type event =
128
149
  | RegistrationRequested({
129
- email: ContactAddressId.t,
150
+ emailId: ContactAddressId.t,
151
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
130
152
  roles: array<string>,
131
153
  requestedAt: Reventless.DateTime.t,
132
154
  })
133
- | RegistrationExpired({email: ContactAddressId.t})
155
+ | RegistrationExpired({emailId: ContactAddressId.t})
134
156
  | RegistrationInvited({
135
- email: ContactAddressId.t,
157
+ emailId: ContactAddressId.t,
158
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
136
159
  roles: array<string>,
137
160
  invitedBy: string,
138
161
  invitedAt: Reventless.DateTime.t,
139
162
  })
140
163
  | RegistrationChallengeReissued({
141
- email: ContactAddressId.t,
164
+ emailId: ContactAddressId.t,
165
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
142
166
  reissuedAt: Reventless.DateTime.t,
143
167
  invitedBy?: string,
144
168
  })
145
- | RegistrationWithdrawn({email: ContactAddressId.t, withdrawnAt: Reventless.DateTime.t})
169
+ | RegistrationWithdrawn({emailId: ContactAddressId.t, withdrawnAt: Reventless.DateTime.t})
146
170
  | RegistrationAttemptedOnTakenAddress({
147
- email: ContactAddressId.t,
171
+ emailId: ContactAddressId.t,
172
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
148
173
  attemptedAt: Reventless.DateTime.t,
149
174
  })
150
175
  | RegistrationChallengeIssued({
151
- email: ContactAddressId.t,
176
+ emailId: ContactAddressId.t,
152
177
  proofHash: string,
153
178
  issuedAt: Reventless.DateTime.t,
154
179
  })
155
- | RegistrationProofAccepted({email: ContactAddressId.t, roles: array<string>, proofHash: string})
156
- | RegistrationProofRefused({email: ContactAddressId.t, reason: string})
157
- | RegistrationCompleted({email: ContactAddressId.t})
180
+ | RegistrationProofAccepted({
181
+ emailId: ContactAddressId.t,
182
+ @pii({subject: "emailId"}) email: Reventless.Email.t,
183
+ roles: array<string>,
184
+ proofHash: string,
185
+ })
186
+ | RegistrationProofRefused({emailId: ContactAddressId.t, reason: string})
187
+ | RegistrationCompleted({emailId: ContactAddressId.t})
188
+ | RegistrationReleased({emailId: ContactAddressId.t, releasedAt: Reventless.DateTime.t})
@@ -1,7 +1,9 @@
1
1
  // Generated by ReScript, PLEASE EDIT WITH CARE
2
2
 
3
3
  import * as Sury from "sury";
4
+ import * as Pii$Reventless from "@reventlessdev/reventless-spec/src/components/Pii.res.mjs";
4
5
  import * as Role$Reventless from "@reventlessdev/reventless-spec/src/types/Role.res.mjs";
6
+ import * as Email$Reventless from "@reventlessdev/reventless-spec/src/semantic/Email.res.mjs";
5
7
  import * as DcbTag$Reventless from "@reventlessdev/reventless-spec/src/components/DcbTag.res.mjs";
6
8
  import * as Api$ReventlessInfra from "@reventlessdev/reventless-infra/src/components/Api.res.mjs";
7
9
  import * as DateTime$Reventless from "@reventlessdev/reventless-spec/src/semantic/DateTime.res.mjs";
@@ -19,99 +21,116 @@ let consumedEventSchema = Sury.union([
19
21
  })),
20
22
  Sury.$schema(s => ({
21
23
  TAG: "RegistrationRequested",
22
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
24
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
25
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
23
26
  roles: s.m(Sury.array(Sury.string)),
24
27
  requestedAt: s.m(DateTime$Reventless.schema)
25
28
  })),
26
29
  Sury.$schema(s => ({
27
30
  TAG: "RegistrationExpired",
28
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
31
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
29
32
  })),
30
33
  Sury.$schema(s => ({
31
34
  TAG: "RegistrationInvited",
32
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
35
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
36
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
33
37
  roles: s.m(Sury.array(Sury.string)),
34
38
  invitedBy: s.m(Sury.string),
35
39
  invitedAt: s.m(DateTime$Reventless.schema)
36
40
  })),
37
41
  Sury.$schema(s => ({
38
42
  TAG: "RegistrationChallengeReissued",
39
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
43
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
44
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
40
45
  reissuedAt: s.m(DateTime$Reventless.schema),
41
46
  invitedBy: s.m(Sury.$option(Sury.string))
42
47
  })),
43
48
  Sury.$schema(s => ({
44
49
  TAG: "RegistrationWithdrawn",
45
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
50
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
46
51
  withdrawnAt: s.m(DateTime$Reventless.schema)
47
52
  })),
48
53
  Sury.$schema(s => ({
49
54
  TAG: "RegistrationAttemptedOnTakenAddress",
50
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
55
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
56
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
51
57
  attemptedAt: s.m(DateTime$Reventless.schema)
52
58
  })),
53
59
  Sury.$schema(s => ({
54
60
  TAG: "RegistrationChallengeIssued",
55
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
61
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
56
62
  proofHash: s.m(Sury.string),
57
63
  issuedAt: s.m(DateTime$Reventless.schema)
58
64
  })),
59
65
  Sury.$schema(s => ({
60
66
  TAG: "RegistrationProofAccepted",
61
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
67
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
68
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
62
69
  roles: s.m(Sury.array(Sury.string)),
63
70
  proofHash: s.m(Sury.string)
64
71
  })),
65
72
  Sury.$schema(s => ({
66
73
  TAG: "RegistrationProofRefused",
67
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
74
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
68
75
  reason: s.m(Sury.string)
69
76
  })),
70
77
  Sury.$schema(s => ({
71
78
  TAG: "RegistrationCompleted",
72
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
79
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
80
+ })),
81
+ Sury.$schema(s => ({
82
+ TAG: "RegistrationReleased",
83
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
84
+ releasedAt: s.m(DateTime$Reventless.schema)
73
85
  }))
74
86
  ]);
75
87
 
76
88
  let commandSchema = Sury.union([
77
89
  Sury.$schema(s => ({
78
90
  TAG: "Register",
79
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
91
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
92
+ email: s.m(Pii$Reventless.mark("emailId", undefined, Email$Reventless.schema)),
80
93
  role: s.m(DcbTag$Reventless.mark(Role$Reventless.nameSchema)),
81
94
  requestedAt: s.m(DateTime$Reventless.schema)
82
95
  })),
83
96
  Sury.$schema(s => ({
84
97
  TAG: "IssueRegistrationChallenge",
85
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
98
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
86
99
  proofHash: s.m(Sury.string),
87
100
  issuedAt: s.m(DateTime$Reventless.schema)
88
101
  })),
89
102
  Sury.$schema(s => ({
90
103
  TAG: "SubmitRegistrationProof",
91
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
104
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
92
105
  proofHash: s.m(Sury.string),
93
106
  presentedAt: s.m(DateTime$Reventless.schema)
94
107
  })),
95
108
  Sury.$schema(s => ({
96
109
  TAG: "RecordRegistrationCompleted",
97
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
110
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
98
111
  })),
99
112
  Sury.$schema(s => ({
100
113
  TAG: "Invite",
101
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
114
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
115
+ email: s.m(Pii$Reventless.mark("emailId", undefined, Email$Reventless.schema)),
102
116
  roles: s.m(Sury.array(Role$Reventless.nameSchema)),
103
117
  invitedBy: s.m(Sury.string),
104
118
  requestedAt: s.m(DateTime$Reventless.schema)
105
119
  })),
106
120
  Sury.$schema(s => ({
107
121
  TAG: "ReissueRegistrationChallenge",
108
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
122
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
109
123
  requestedAt: s.m(DateTime$Reventless.schema)
110
124
  })),
111
125
  Sury.$schema(s => ({
112
126
  TAG: "WithdrawRegistration",
113
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
127
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
114
128
  withdrawnAt: s.m(DateTime$Reventless.schema)
129
+ })),
130
+ Sury.$schema(s => ({
131
+ TAG: "ReleaseRegistration",
132
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
133
+ releasedAt: s.m(DateTime$Reventless.schema)
115
134
  }))
116
135
  ]);
117
136
 
@@ -126,57 +145,67 @@ let errorSchema = Sury.union([
126
145
  let eventSchema = Sury.union([
127
146
  Sury.$schema(s => ({
128
147
  TAG: "RegistrationRequested",
129
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
148
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
149
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
130
150
  roles: s.m(Sury.array(Sury.string)),
131
151
  requestedAt: s.m(DateTime$Reventless.schema)
132
152
  })),
133
153
  Sury.$schema(s => ({
134
154
  TAG: "RegistrationExpired",
135
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
155
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
136
156
  })),
137
157
  Sury.$schema(s => ({
138
158
  TAG: "RegistrationInvited",
139
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
159
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
160
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
140
161
  roles: s.m(Sury.array(Sury.string)),
141
162
  invitedBy: s.m(Sury.string),
142
163
  invitedAt: s.m(DateTime$Reventless.schema)
143
164
  })),
144
165
  Sury.$schema(s => ({
145
166
  TAG: "RegistrationChallengeReissued",
146
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
167
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
168
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
147
169
  reissuedAt: s.m(DateTime$Reventless.schema),
148
170
  invitedBy: s.m(Sury.$option(Sury.string))
149
171
  })),
150
172
  Sury.$schema(s => ({
151
173
  TAG: "RegistrationWithdrawn",
152
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
174
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
153
175
  withdrawnAt: s.m(DateTime$Reventless.schema)
154
176
  })),
155
177
  Sury.$schema(s => ({
156
178
  TAG: "RegistrationAttemptedOnTakenAddress",
157
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
179
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
180
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
158
181
  attemptedAt: s.m(DateTime$Reventless.schema)
159
182
  })),
160
183
  Sury.$schema(s => ({
161
184
  TAG: "RegistrationChallengeIssued",
162
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
185
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
163
186
  proofHash: s.m(Sury.string),
164
187
  issuedAt: s.m(DateTime$Reventless.schema)
165
188
  })),
166
189
  Sury.$schema(s => ({
167
190
  TAG: "RegistrationProofAccepted",
168
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
191
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
192
+ email: s.m(Pii$Reventless.marked("emailId", undefined, Email$Reventless.schema)),
169
193
  roles: s.m(Sury.array(Sury.string)),
170
194
  proofHash: s.m(Sury.string)
171
195
  })),
172
196
  Sury.$schema(s => ({
173
197
  TAG: "RegistrationProofRefused",
174
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
198
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
175
199
  reason: s.m(Sury.string)
176
200
  })),
177
201
  Sury.$schema(s => ({
178
202
  TAG: "RegistrationCompleted",
179
- email: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
203
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema))
204
+ })),
205
+ Sury.$schema(s => ({
206
+ TAG: "RegistrationReleased",
207
+ emailId: s.m(DcbTag$Reventless.mark(ContactAddressId$ReventlessRegistration.schema)),
208
+ releasedAt: s.m(DateTime$Reventless.schema)
180
209
  }))
181
210
  ]);
182
211
 
@@ -187,7 +216,8 @@ let commandSchema$1 = Api$ReventlessInfra.markNoApiVariants(commandSchema, [
187
216
  "RecordRegistrationCompleted",
188
217
  "Invite",
189
218
  "ReissueRegistrationChallenge",
190
- "WithdrawRegistration"
219
+ "WithdrawRegistration",
220
+ "ReleaseRegistration"
191
221
  ]);
192
222
 
193
223
  function authorizationOf(param) {