feat(account): deletion orchestration + step-up + gateway edge
Step-up: email accounts confirm with a mailed code (purpose=delete, no deeplink —
ConfirmByToken refuses a delete token so a stray click can't delete); platform-only
accounts type a fixed phrase (anti-impulse). Endpoints /user/delete/{request,confirm};
the confirm orchestration resigns active games, drops all-robot games, tombstones +
anonymizes the account (freeing its creds), and revokes its sessions — the tombstone is
the point of no return, the rest best-effort. Gateway account.delete.{request,confirm}
ops + fbs AccountDeleteConfirm/AccountDeleteRequestResult + branded ru/en delete email.
Integration tests cover the step-up (code + no-email) and the orchestration pieces.
This commit is contained in:
@@ -351,6 +351,26 @@ func (c *Client) ChangeEmailConfirm(ctx context.Context, userID, email, code str
|
||||
return out, err
|
||||
}
|
||||
|
||||
// DeleteRequestResp reports which account-deletion step-up the account uses.
|
||||
type DeleteRequestResp struct {
|
||||
Method string `json:"method"`
|
||||
}
|
||||
|
||||
// DeleteRequest starts account deletion: the backend mails a delete code (email accounts)
|
||||
// or reports the typed-phrase path.
|
||||
func (c *Client) DeleteRequest(ctx context.Context, userID string) (DeleteRequestResp, error) {
|
||||
var out DeleteRequestResp
|
||||
err := c.do(ctx, http.MethodPost, "/api/v1/user/delete/request", userID, "", nil, &out)
|
||||
return out, err
|
||||
}
|
||||
|
||||
// DeleteConfirm verifies the step-up (a mailed code or the typed phrase) and deletes the
|
||||
// account.
|
||||
func (c *Client) DeleteConfirm(ctx context.Context, userID, code, phrase string) error {
|
||||
return c.do(ctx, http.MethodPost, "/api/v1/user/delete/confirm", userID, "",
|
||||
map[string]string{"code": code, "phrase": phrase}, nil)
|
||||
}
|
||||
|
||||
// LinkUnlink detaches a platform identity (kind = "telegram" | "vk") from the caller
|
||||
// and returns the refreshed profile in the result.
|
||||
func (c *Client) LinkUnlink(ctx context.Context, userID, kind string) (LinkResultResp, error) {
|
||||
|
||||
Reference in New Issue
Block a user