From acd6b04e56bf34e1cb955a8eeadfdfc51905dffd Mon Sep 17 00:00:00 2001 From: weebney Date: Mon, 16 Dec 2024 14:33:03 -0500 Subject: [PATCH] use token normalization function when generating tokens --- packages/pds/src/api/com/atproto/server/util.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/pds/src/api/com/atproto/server/util.ts b/packages/pds/src/api/com/atproto/server/util.ts index 3f5d1f2dd97..135b51cb0e1 100644 --- a/packages/pds/src/api/com/atproto/server/util.ts +++ b/packages/pds/src/api/com/atproto/server/util.ts @@ -24,8 +24,7 @@ export const genInvCodes = (cfg: ServerConfig, count: number): string[] => { // Random token formatted XXXXX-XXXXX where digits are in base32 export const getEmailToken = () => { - const token = crypto.randomStr(8, 'base32').slice(0, 10).toUpperCase() - return token.slice(0, 5) + '-' + token.slice(5, 10) + return normalizeEmailToken(crypto.randomStr(8, 'base32')) } // Transforms a badly-formed email token to XXXXX-XXXXX