Skip to content

Commit

Permalink
use token normalization function when generating tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtoolz committed Dec 16, 2024
1 parent 20ec875 commit acd6b04
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/pds/src/api/com/atproto/server/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit acd6b04

Please sign in to comment.