feat(gateway): confirmEmailLink RPC + language on the email request + profile event

Add the confirm-link edge method (auth.email.confirm_link): a new
EmailConfirmLinkRequest/Result fbs table, the transcode const + handler + encoder,
and the backend-client call to the existing /sessions/email/confirm-link endpoint —
it rides Execute under the existing service prefix, so no proto/Caddy change. Add a
language field to EmailRequestRequest and forward it (the backend already seeds it).
Add the NotifyProfile sub-kind + notify.ProfileChanged, published by the confirm-link
handler on a successful link so an in-app session re-fetches its profile when the
email was confirmed in another browser. Regenerated fbs bindings (Go + TS).
This commit is contained in:
Ilia Denisov
2026-07-03 04:22:09 +02:00
parent 25d80bc31d
commit 762155a55e
14 changed files with 418 additions and 41 deletions
+29
View File
@@ -37,6 +37,35 @@ func encodeAck(ok bool) []byte {
return b.FinishedBytes()
}
// encodeConfirmLinkResult builds an EmailConfirmLinkResult payload, embedding the
// minted Session for a login. All strings and the nested Session table are built
// before the result table is opened.
func encodeConfirmLinkResult(r backendclient.ConfirmLinkResp) []byte {
b := flatbuffers.NewBuilder(160)
purpose := b.CreateString(r.Purpose)
status := b.CreateString(r.Status)
var session flatbuffers.UOffsetT
if r.Session != nil {
token := b.CreateString(r.Session.Token)
uid := b.CreateString(r.Session.UserID)
name := b.CreateString(r.Session.DisplayName)
fb.SessionStart(b)
fb.SessionAddToken(b, token)
fb.SessionAddUserId(b, uid)
fb.SessionAddIsGuest(b, r.Session.IsGuest)
fb.SessionAddDisplayName(b, name)
session = fb.SessionEnd(b)
}
fb.EmailConfirmLinkResultStart(b)
fb.EmailConfirmLinkResultAddPurpose(b, purpose)
fb.EmailConfirmLinkResultAddStatus(b, status)
if r.Session != nil {
fb.EmailConfirmLinkResultAddSession(b, session)
}
b.Finish(fb.EmailConfirmLinkResultEnd(b))
return b.FinishedBytes()
}
// encodeProfile builds a Profile payload, including the advertising-banner block
// when the backend marked the viewer eligible.
func encodeProfile(p backendclient.ProfileResp) []byte {