feat(auth): add username sign-in mode and recovery kits (#3215)

This commit is contained in:
Hampus authored and GitHub committed 2026-10-05 14:10:07 +02:00
1 parent bf3d73a5f7
commit e1eecc3b6c
355 files changed
+52138 -24097

No files matched your search

@@ -181,6 +181,14 @@ export const PasswordChangeCompleteRequest = PasswordChangeTicketRequest.extend(
export type PasswordChangeCompleteRequest = z.infer<typeof PasswordChangeCompleteRequest>;
export const UserPasswordUpdateRequest = z
.object({
new_password: PasswordType.describe('The new password to set'),
})
.extend(SudoVerificationSchema.shape);
export type UserPasswordUpdateRequest = z.infer<typeof UserPasswordUpdateRequest>;
export const FriendRequestByTagRequest = z.object({
username: UsernameType.describe('Username of the user to send friend request'),
discriminator: DiscriminatorType.describe('Discriminator tag of the user'),
@@ -239,6 +239,29 @@ export const PasswordChangeCompleteResponse = z.object({
export type PasswordChangeCompleteResponse = z.infer<typeof PasswordChangeCompleteResponse>;
export const UserPasswordUpdateResponse = z.object({
token: z.string().describe('Authentication token for the newly created session'),
auth_session_id_hash: z.string().describe('Base64url-encoded hash of the newly created authentication session'),
});
export type UserPasswordUpdateResponse = z.infer<typeof UserPasswordUpdateResponse>;
export const RecoveryKitStatusResponse = z.object({
has_recovery_kit: z.boolean().describe('Whether the account has a recovery kit'),
created_at: z.iso.datetime().nullable().describe('ISO 8601 timestamp when the current recovery kit was created'),
});
export type RecoveryKitStatusResponse = z.infer<typeof RecoveryKitStatusResponse>;
export const RecoveryKitCreateResponse = z.object({
recovery_key: z
.string()
.describe('New recovery key as 8 groups of 4 joined by dashes, shown only once. Any previous kit stops working'),
created_at: z.iso.datetime().describe('ISO 8601 timestamp when the recovery kit was created'),
});
export type RecoveryKitCreateResponse = z.infer<typeof RecoveryKitCreateResponse>;
export interface UserProfileResponse {
bio: string | null;
pronouns: string | null;