@reventlessdev/reventless-registration 1.0.0-alpha.3 → 1.0.0-alpha.31
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 +10 -0
- package/i18n/en.json +8 -0
- package/package.json +7 -6
- package/src/Registration/ContactAddressId.res +27 -3
- package/src/Registration/ContactAddressId.res.mjs +26 -2
- package/src/Registration/InboundTranslation/CompleteRegistration.res +2 -2
- package/src/Registration/InboundTranslation/CompleteRegistration.res.mjs +3 -3
- package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res +9 -6
- package/src/Registration/InboundTranslation/CompleteRegistration_Translation.res.mjs +16 -9
- package/src/Registration/InboundTranslation/SignUp.res +6 -3
- package/src/Registration/InboundTranslation/SignUp.res.mjs +11 -5
- package/src/Registration/InboundTranslation/SignUp_Translation.res +34 -13
- package/src/Registration/InboundTranslation/SignUp_Translation.res.mjs +26 -5
- package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res +9 -3
- package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal.res.mjs +7 -3
- package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res +10 -7
- package/src/Registration/OutboundTranslation/CreateRegisteredPrincipal_Translation.res.mjs +17 -8
- package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res +36 -7
- package/src/Registration/OutboundTranslation/SendRegistrationChallenge.res.mjs +24 -11
- package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res +115 -44
- package/src/Registration/OutboundTranslation/SendRegistrationChallenge_Translation.res.mjs +203 -61
- package/src/Registration/StateChange/Registrations.res +76 -27
- package/src/Registration/StateChange/Registrations.res.mjs +83 -39
- package/src/Registration/StateChange/Registrations_Decision.res +74 -26
- package/src/Registration/StateChange/Registrations_Decision.res.mjs +106 -47
- package/src/Registration/StateViewStream/RegistrationWindows.res.mjs +1 -1
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// Generated by ReScript, PLEASE EDIT WITH CARE
|
|
2
2
|
|
|
3
3
|
import * as Stdlib_Option from "@rescript/runtime/lib/es6/Stdlib_Option.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as Text$Reventless from "@reventlessdev/reventless-spec/src/i18n/Text.res.mjs";
|
|
5
|
+
import * as Primitive_object from "@rescript/runtime/lib/es6/Primitive_object.js";
|
|
5
6
|
import * as Messaging$Reventless from "@reventlessdev/reventless-spec/src/semantic/Messaging.res.mjs";
|
|
6
7
|
import * as ContactAddressId$ReventlessRegistration from "../ContactAddressId.res.mjs";
|
|
7
8
|
import * as RegistrationChallenge$ReventlessRegistration from "../../RegistrationChallenge.res.mjs";
|
|
@@ -10,82 +11,218 @@ function collect(event, param) {
|
|
|
10
11
|
switch (event.TAG) {
|
|
11
12
|
case "RegistrationRequested" :
|
|
12
13
|
let email = event.email;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
let emailId = event.emailId;
|
|
15
|
+
if (typeof email !== "object") {
|
|
16
|
+
if (email === "Erased") {
|
|
17
|
+
return [];
|
|
18
|
+
} else {
|
|
19
|
+
return [];
|
|
20
|
+
}
|
|
21
|
+
} else {
|
|
22
|
+
return [[
|
|
23
|
+
emailId + `:` + event.requestedAt,
|
|
24
|
+
{
|
|
25
|
+
emailId: emailId,
|
|
26
|
+
email: email._0,
|
|
27
|
+
alreadyRegistered: false,
|
|
28
|
+
language: event.language
|
|
29
|
+
}
|
|
30
|
+
]];
|
|
31
|
+
}
|
|
20
32
|
case "RegistrationAttemptedOnTakenAddress" :
|
|
21
33
|
let email$1 = event.email;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
34
|
+
let emailId$1 = event.emailId;
|
|
35
|
+
if (typeof email$1 !== "object") {
|
|
36
|
+
if (email$1 === "Erased") {
|
|
37
|
+
return [];
|
|
38
|
+
} else {
|
|
39
|
+
return [];
|
|
40
|
+
}
|
|
41
|
+
} else {
|
|
42
|
+
return [[
|
|
43
|
+
emailId$1 + `:taken:` + event.attemptedAt,
|
|
44
|
+
{
|
|
45
|
+
emailId: emailId$1,
|
|
46
|
+
email: email$1._0,
|
|
47
|
+
alreadyRegistered: true
|
|
48
|
+
}
|
|
49
|
+
]];
|
|
50
|
+
}
|
|
29
51
|
case "RegistrationInvited" :
|
|
30
52
|
let email$2 = event.email;
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
53
|
+
let emailId$2 = event.emailId;
|
|
54
|
+
if (typeof email$2 !== "object") {
|
|
55
|
+
if (email$2 === "Erased") {
|
|
56
|
+
return [];
|
|
57
|
+
} else {
|
|
58
|
+
return [];
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
return [[
|
|
62
|
+
emailId$2 + `:invited:` + event.invitedAt,
|
|
63
|
+
{
|
|
64
|
+
emailId: emailId$2,
|
|
65
|
+
email: email$2._0,
|
|
66
|
+
alreadyRegistered: false,
|
|
67
|
+
invited: true,
|
|
68
|
+
roles: event.roles,
|
|
69
|
+
language: event.language
|
|
70
|
+
}
|
|
71
|
+
]];
|
|
72
|
+
}
|
|
40
73
|
case "RegistrationChallengeReissued" :
|
|
41
74
|
let email$3 = event.email;
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
75
|
+
let emailId$3 = event.emailId;
|
|
76
|
+
if (typeof email$3 !== "object") {
|
|
77
|
+
if (email$3 === "Erased") {
|
|
78
|
+
return [];
|
|
79
|
+
} else {
|
|
80
|
+
return [];
|
|
81
|
+
}
|
|
82
|
+
} else {
|
|
83
|
+
return [[
|
|
84
|
+
emailId$3 + `:reissued:` + event.reissuedAt,
|
|
85
|
+
{
|
|
86
|
+
emailId: emailId$3,
|
|
87
|
+
email: email$3._0,
|
|
88
|
+
alreadyRegistered: false,
|
|
89
|
+
invited: Stdlib_Option.isSome(event.invitedBy),
|
|
90
|
+
language: event.language
|
|
91
|
+
}
|
|
92
|
+
]];
|
|
93
|
+
}
|
|
50
94
|
}
|
|
51
95
|
}
|
|
52
96
|
|
|
97
|
+
let challengeSubject = {
|
|
98
|
+
key: "registration.challenge.subject",
|
|
99
|
+
source: "Finish your registration"
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
let challengeBody = {
|
|
103
|
+
key: "registration.challenge.body",
|
|
104
|
+
source: "Your registration code is {token}. Enter it with a password of your choice to finish. It expires in {expiresIn}."
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
let invitedSubject = {
|
|
108
|
+
key: "registration.invited.subject",
|
|
109
|
+
source: "You are invited to create an account"
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
let invitedBody = {
|
|
113
|
+
key: "registration.invited.body",
|
|
114
|
+
source: "You have been invited to create an account{hasRoles, select, yes { as {roles}} other {}}. Your code is {token}. Enter it with this address and a password of your choice to accept. It expires in {expiresIn}."
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
let takenSubject = {
|
|
118
|
+
key: "registration.taken.subject",
|
|
119
|
+
source: "Someone tried to register with your address"
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
let takenBody = {
|
|
123
|
+
key: "registration.taken.body",
|
|
124
|
+
source: "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."
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
let all = [
|
|
128
|
+
challengeSubject,
|
|
129
|
+
challengeBody,
|
|
130
|
+
invitedSubject,
|
|
131
|
+
invitedBody,
|
|
132
|
+
takenSubject,
|
|
133
|
+
takenBody
|
|
134
|
+
];
|
|
135
|
+
|
|
136
|
+
let Messages = {
|
|
137
|
+
challengeSubject: challengeSubject,
|
|
138
|
+
challengeBody: challengeBody,
|
|
139
|
+
invitedSubject: invitedSubject,
|
|
140
|
+
invitedBody: invitedBody,
|
|
141
|
+
takenSubject: takenSubject,
|
|
142
|
+
takenBody: takenBody,
|
|
143
|
+
all: all
|
|
144
|
+
};
|
|
145
|
+
|
|
53
146
|
function expiresIn(invited) {
|
|
54
|
-
return
|
|
147
|
+
return RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeFor(invited)).tokenTtl;
|
|
55
148
|
}
|
|
56
149
|
|
|
57
|
-
function
|
|
58
|
-
return
|
|
150
|
+
function challengeValues(token) {
|
|
151
|
+
return {
|
|
152
|
+
token: {
|
|
153
|
+
TAG: "Text",
|
|
154
|
+
_0: token
|
|
155
|
+
},
|
|
156
|
+
expiresIn: {
|
|
157
|
+
TAG: "Duration",
|
|
158
|
+
_0: RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeFor(false)).tokenTtl
|
|
159
|
+
}
|
|
160
|
+
};
|
|
59
161
|
}
|
|
60
162
|
|
|
61
|
-
function
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
163
|
+
function invitationValues(token, roles) {
|
|
164
|
+
let roles$1 = Stdlib_Option.getOr(roles, []);
|
|
165
|
+
return {
|
|
166
|
+
token: {
|
|
167
|
+
TAG: "Text",
|
|
168
|
+
_0: token
|
|
169
|
+
},
|
|
170
|
+
expiresIn: {
|
|
171
|
+
TAG: "Duration",
|
|
172
|
+
_0: RegistrationChallenge$ReventlessRegistration.policyFor(RegistrationChallenge$ReventlessRegistration.purposeFor(true)).tokenTtl
|
|
173
|
+
},
|
|
174
|
+
hasRoles: {
|
|
175
|
+
TAG: "Text",
|
|
176
|
+
_0: Primitive_object.equal(roles$1, []) ? "no" : "yes"
|
|
177
|
+
},
|
|
178
|
+
roles: {
|
|
179
|
+
TAG: "List",
|
|
180
|
+
_0: roles$1
|
|
181
|
+
}
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function challengeBody$1(token) {
|
|
186
|
+
return Text$Reventless.inSource(challengeBody, challengeValues(token));
|
|
67
187
|
}
|
|
68
188
|
|
|
69
189
|
function invitationBody(token, roles) {
|
|
70
|
-
return
|
|
190
|
+
return Text$Reventless.inSource(invitedBody, invitationValues(token, roles));
|
|
71
191
|
}
|
|
72
192
|
|
|
73
|
-
let noticeBody =
|
|
193
|
+
let noticeBody = Text$Reventless.inSource(takenBody, undefined);
|
|
74
194
|
|
|
75
|
-
function send(capabilities, email, subject, body) {
|
|
76
|
-
|
|
195
|
+
async function send(capabilities, email, requested, subject, body, values) {
|
|
196
|
+
let recipient = {
|
|
77
197
|
TAG: "ToEmail",
|
|
78
198
|
_0: email
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
199
|
+
};
|
|
200
|
+
let reason = await Text$Reventless.compose(capabilities.text, recipient, requested, subject, body, values);
|
|
201
|
+
if (reason.TAG !== "Ok") {
|
|
202
|
+
return {
|
|
203
|
+
TAG: "Error",
|
|
204
|
+
_0: reason._0
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
let message = reason._0;
|
|
208
|
+
let failure = await capabilities.messaging.send(recipient, message);
|
|
209
|
+
if (failure.TAG === "Ok") {
|
|
210
|
+
return {
|
|
211
|
+
TAG: "Ok",
|
|
212
|
+
_0: message.language
|
|
213
|
+
};
|
|
214
|
+
} else {
|
|
215
|
+
return {
|
|
216
|
+
TAG: "Error",
|
|
217
|
+
_0: Messaging$Reventless.failureReason(failure._0)
|
|
218
|
+
};
|
|
219
|
+
}
|
|
83
220
|
}
|
|
84
221
|
|
|
85
222
|
async function translate(_id, item, capabilities) {
|
|
86
223
|
if (item.alreadyRegistered) {
|
|
87
|
-
let
|
|
88
|
-
if (
|
|
224
|
+
let reason = await send(capabilities, item.email, undefined, takenSubject, takenBody, {});
|
|
225
|
+
if (reason.TAG === "Ok") {
|
|
89
226
|
return {
|
|
90
227
|
TAG: "Ok",
|
|
91
228
|
_0: undefined
|
|
@@ -93,7 +230,7 @@ async function translate(_id, item, capabilities) {
|
|
|
93
230
|
} else {
|
|
94
231
|
return {
|
|
95
232
|
TAG: "Error",
|
|
96
|
-
_0:
|
|
233
|
+
_0: reason._0
|
|
97
234
|
};
|
|
98
235
|
}
|
|
99
236
|
}
|
|
@@ -114,24 +251,27 @@ async function translate(_id, item, capabilities) {
|
|
|
114
251
|
_0: `cannot hash a secret: ` + proofHash._0._0
|
|
115
252
|
};
|
|
116
253
|
}
|
|
117
|
-
let
|
|
118
|
-
|
|
254
|
+
let body = invited ? invitedBody : challengeBody;
|
|
255
|
+
let language = await send(capabilities, item.email, item.language, invited ? invitedSubject : challengeSubject, body, invited ? invitationValues(token$1, item.roles) : challengeValues(token$1));
|
|
256
|
+
if (language.TAG === "Ok") {
|
|
119
257
|
return {
|
|
120
258
|
TAG: "Ok",
|
|
121
259
|
_0: [
|
|
122
|
-
item.
|
|
260
|
+
item.emailId,
|
|
123
261
|
{
|
|
124
262
|
TAG: "IssueRegistrationChallenge",
|
|
125
|
-
|
|
263
|
+
emailId: ContactAddressId$ReventlessRegistration.makeFromString(item.emailId),
|
|
126
264
|
proofHash: proofHash._0,
|
|
127
|
-
issuedAt: new Date().toISOString()
|
|
265
|
+
issuedAt: new Date().toISOString(),
|
|
266
|
+
language: language._0,
|
|
267
|
+
messageKey: body.key
|
|
128
268
|
}
|
|
129
269
|
]
|
|
130
270
|
};
|
|
131
271
|
} else {
|
|
132
272
|
return {
|
|
133
273
|
TAG: "Error",
|
|
134
|
-
_0:
|
|
274
|
+
_0: language._0
|
|
135
275
|
};
|
|
136
276
|
}
|
|
137
277
|
}
|
|
@@ -147,9 +287,11 @@ let moduleUrl = "@reventlessdev/reventless-registration/src/Registration/Outboun
|
|
|
147
287
|
export {
|
|
148
288
|
Spec,
|
|
149
289
|
collect,
|
|
290
|
+
Messages,
|
|
150
291
|
expiresIn,
|
|
151
|
-
|
|
152
|
-
|
|
292
|
+
challengeValues,
|
|
293
|
+
invitationValues,
|
|
294
|
+
challengeBody$1 as challengeBody,
|
|
153
295
|
invitationBody,
|
|
154
296
|
noticeBody,
|
|
155
297
|
send,
|
|
@@ -157,4 +299,4 @@ export {
|
|
|
157
299
|
onExhausted,
|
|
158
300
|
moduleUrl,
|
|
159
301
|
}
|
|
160
|
-
/*
|
|
302
|
+
/* noticeBody Not a pure module */
|
|
@@ -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,52 @@ type consumedEvent =
|
|
|
34
40
|
role: @s.matches(Reventless.DcbTag.mark(Reventless.Role.nameSchema)) Reventless.Role.name,
|
|
35
41
|
})
|
|
36
42
|
| RegistrationRequested({
|
|
37
|
-
|
|
43
|
+
emailId: ContactAddressId.t,
|
|
44
|
+
@pii({subject: "emailId"}) email: Reventless.Email.t,
|
|
38
45
|
roles: array<string>,
|
|
39
46
|
requestedAt: Reventless.DateTime.t,
|
|
47
|
+
language?: string,
|
|
40
48
|
})
|
|
41
|
-
| RegistrationExpired({
|
|
49
|
+
| RegistrationExpired({emailId: ContactAddressId.t})
|
|
42
50
|
| RegistrationInvited({
|
|
43
|
-
|
|
51
|
+
emailId: ContactAddressId.t,
|
|
52
|
+
@pii({subject: "emailId"}) email: Reventless.Email.t,
|
|
44
53
|
roles: array<string>,
|
|
45
54
|
invitedBy: string,
|
|
46
55
|
invitedAt: Reventless.DateTime.t,
|
|
56
|
+
language?: string,
|
|
47
57
|
})
|
|
48
58
|
| RegistrationChallengeReissued({
|
|
49
|
-
|
|
59
|
+
emailId: ContactAddressId.t,
|
|
60
|
+
@pii({subject: "emailId"}) email: Reventless.Email.t,
|
|
50
61
|
reissuedAt: Reventless.DateTime.t,
|
|
51
62
|
invitedBy?: string,
|
|
63
|
+
language?: string,
|
|
52
64
|
})
|
|
53
|
-
| RegistrationWithdrawn({
|
|
65
|
+
| RegistrationWithdrawn({emailId: ContactAddressId.t, withdrawnAt: Reventless.DateTime.t})
|
|
54
66
|
| RegistrationAttemptedOnTakenAddress({
|
|
55
|
-
|
|
67
|
+
emailId: ContactAddressId.t,
|
|
68
|
+
@pii({subject: "emailId"}) email: Reventless.Email.t,
|
|
56
69
|
attemptedAt: Reventless.DateTime.t,
|
|
57
70
|
})
|
|
58
71
|
| RegistrationChallengeIssued({
|
|
59
|
-
|
|
72
|
+
emailId: ContactAddressId.t,
|
|
60
73
|
proofHash: string,
|
|
61
74
|
issuedAt: Reventless.DateTime.t,
|
|
75
|
+
/** The language the code went out in, and the key of the mail that carried it: what is
|
|
76
|
+
recorded of a sent mail, never its text. */
|
|
77
|
+
language?: string,
|
|
78
|
+
messageKey?: string,
|
|
79
|
+
})
|
|
80
|
+
| RegistrationProofAccepted({
|
|
81
|
+
emailId: ContactAddressId.t,
|
|
82
|
+
@pii({subject: "emailId"}) email: Reventless.Email.t,
|
|
83
|
+
roles: array<string>,
|
|
84
|
+
proofHash: string,
|
|
62
85
|
})
|
|
63
|
-
|
|
|
64
|
-
|
|
|
65
|
-
|
|
|
86
|
+
| RegistrationProofRefused({emailId: ContactAddressId.t, reason: string})
|
|
87
|
+
| RegistrationCompleted({emailId: ContactAddressId.t})
|
|
88
|
+
| RegistrationReleased({emailId: ContactAddressId.t, releasedAt: Reventless.DateTime.t})
|
|
66
89
|
|
|
67
90
|
// `Register` names the role asked for, and the policy is read by it. The
|
|
68
91
|
// registration records the roles it grants as
|
|
@@ -77,42 +100,51 @@ type consumedEvent =
|
|
|
77
100
|
type command =
|
|
78
101
|
| @noApi
|
|
79
102
|
Register({
|
|
80
|
-
|
|
103
|
+
emailId: ContactAddressId.t,
|
|
104
|
+
@pii({subject: "emailId"}) email: Reventless.Email.t,
|
|
81
105
|
role: @s.matches(Reventless.DcbTag.mark(Reventless.Role.nameSchema)) Reventless.Role.name,
|
|
82
106
|
requestedAt: Reventless.DateTime.t,
|
|
107
|
+
language?: string,
|
|
83
108
|
})
|
|
84
109
|
| @noApi
|
|
85
110
|
IssueRegistrationChallenge({
|
|
86
|
-
|
|
111
|
+
emailId: ContactAddressId.t,
|
|
87
112
|
proofHash: string,
|
|
88
113
|
issuedAt: Reventless.DateTime.t,
|
|
114
|
+
language?: string,
|
|
115
|
+
messageKey?: string,
|
|
89
116
|
})
|
|
90
117
|
| @noApi
|
|
91
118
|
SubmitRegistrationProof({
|
|
92
|
-
|
|
119
|
+
emailId: ContactAddressId.t,
|
|
93
120
|
proofHash: string,
|
|
94
121
|
presentedAt: Reventless.DateTime.t,
|
|
95
122
|
})
|
|
96
|
-
| @noApi RecordRegistrationCompleted({
|
|
123
|
+
| @noApi RecordRegistrationCompleted({emailId: ContactAddressId.t})
|
|
97
124
|
// A signed-in inviter claims the address for someone else, as the roles the
|
|
98
125
|
// app declares by invitation. No door here reaches it: a plugin that provides
|
|
99
126
|
// invitations marks its door `Invite` and checks the inviter before relaying.
|
|
100
127
|
| @noApi
|
|
101
128
|
Invite({
|
|
102
|
-
|
|
129
|
+
emailId: ContactAddressId.t,
|
|
130
|
+
@pii({subject: "emailId"}) email: Reventless.Email.t,
|
|
103
131
|
roles: array<Reventless.Role.name>,
|
|
104
132
|
invitedBy: string,
|
|
105
133
|
requestedAt: Reventless.DateTime.t,
|
|
134
|
+
language?: string,
|
|
106
135
|
})
|
|
107
136
|
// Voids the code a pending registration holds, so a new one is sent: a code
|
|
108
137
|
// lost, or its attempts spent. Held to one per resend cooldown.
|
|
109
138
|
| @noApi
|
|
110
139
|
ReissueRegistrationChallenge({
|
|
111
|
-
|
|
140
|
+
emailId: ContactAddressId.t,
|
|
112
141
|
requestedAt: Reventless.DateTime.t,
|
|
113
142
|
})
|
|
114
143
|
// Releases an address a registration holds and nobody has proved yet.
|
|
115
|
-
| @noApi WithdrawRegistration({
|
|
144
|
+
| @noApi WithdrawRegistration({emailId: ContactAddressId.t, withdrawnAt: Reventless.DateTime.t})
|
|
145
|
+
// Releases the address of an account that was erased, so its person may
|
|
146
|
+
// register again. Only the erasure workflow sends it, after the account is gone.
|
|
147
|
+
| @noApi ReleaseRegistration({emailId: ContactAddressId.t, releasedAt: Reventless.DateTime.t})
|
|
116
148
|
|
|
117
149
|
// Every outcome of a command relayed for an anonymous caller is a recorded fact
|
|
118
150
|
// or a quiet no-op, never an error: an error is the one answer a caller could
|
|
@@ -126,32 +158,49 @@ type error =
|
|
|
126
158
|
@schema
|
|
127
159
|
type event =
|
|
128
160
|
| RegistrationRequested({
|
|
129
|
-
|
|
161
|
+
emailId: ContactAddressId.t,
|
|
162
|
+
@pii({subject: "emailId"}) email: Reventless.Email.t,
|
|
130
163
|
roles: array<string>,
|
|
131
164
|
requestedAt: Reventless.DateTime.t,
|
|
165
|
+
language?: string,
|
|
132
166
|
})
|
|
133
|
-
| RegistrationExpired({
|
|
167
|
+
| RegistrationExpired({emailId: ContactAddressId.t})
|
|
134
168
|
| RegistrationInvited({
|
|
135
|
-
|
|
169
|
+
emailId: ContactAddressId.t,
|
|
170
|
+
@pii({subject: "emailId"}) email: Reventless.Email.t,
|
|
136
171
|
roles: array<string>,
|
|
137
172
|
invitedBy: string,
|
|
138
173
|
invitedAt: Reventless.DateTime.t,
|
|
174
|
+
language?: string,
|
|
139
175
|
})
|
|
140
176
|
| RegistrationChallengeReissued({
|
|
141
|
-
|
|
177
|
+
emailId: ContactAddressId.t,
|
|
178
|
+
@pii({subject: "emailId"}) email: Reventless.Email.t,
|
|
142
179
|
reissuedAt: Reventless.DateTime.t,
|
|
143
180
|
invitedBy?: string,
|
|
181
|
+
language?: string,
|
|
144
182
|
})
|
|
145
|
-
| RegistrationWithdrawn({
|
|
183
|
+
| RegistrationWithdrawn({emailId: ContactAddressId.t, withdrawnAt: Reventless.DateTime.t})
|
|
146
184
|
| RegistrationAttemptedOnTakenAddress({
|
|
147
|
-
|
|
185
|
+
emailId: ContactAddressId.t,
|
|
186
|
+
@pii({subject: "emailId"}) email: Reventless.Email.t,
|
|
148
187
|
attemptedAt: Reventless.DateTime.t,
|
|
149
188
|
})
|
|
150
189
|
| RegistrationChallengeIssued({
|
|
151
|
-
|
|
190
|
+
emailId: ContactAddressId.t,
|
|
152
191
|
proofHash: string,
|
|
153
192
|
issuedAt: Reventless.DateTime.t,
|
|
193
|
+
/** The language the code went out in, and the key of the mail that carried it: what is
|
|
194
|
+
recorded of a sent mail, never its text. */
|
|
195
|
+
language?: string,
|
|
196
|
+
messageKey?: string,
|
|
197
|
+
})
|
|
198
|
+
| RegistrationProofAccepted({
|
|
199
|
+
emailId: ContactAddressId.t,
|
|
200
|
+
@pii({subject: "emailId"}) email: Reventless.Email.t,
|
|
201
|
+
roles: array<string>,
|
|
202
|
+
proofHash: string,
|
|
154
203
|
})
|
|
155
|
-
|
|
|
156
|
-
|
|
|
157
|
-
|
|
|
204
|
+
| RegistrationProofRefused({emailId: ContactAddressId.t, reason: string})
|
|
205
|
+
| RegistrationCompleted({emailId: ContactAddressId.t})
|
|
206
|
+
| RegistrationReleased({emailId: ContactAddressId.t, releasedAt: Reventless.DateTime.t})
|