Skip to content

Commit

Permalink
feat: building generation token class
Browse files Browse the repository at this point in the history
  • Loading branch information
aniebietafia committed Sep 2, 2024
1 parent efca4b0 commit e087559
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions brints-estate-api/src/utils/generate-token.lib.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,25 @@
import * as crypto from 'crypto';

export function generateVerificationToken() {
return crypto.randomBytes(40).toString('hex');
}
// export function generateVerificationToken() {
// return crypto.randomBytes(40).toString('hex');
// }

// export function generateOTP(length: number) {
// return Math.floor(100000 + Math.random() * 900000)
// .toString()
// .slice(0, length);
// }

export class GenerateTokenHelper {
constructor() {}

public generateVerificationToken() {
return crypto.randomBytes(40).toString('hex');
}

export function generateOTP(length: number) {
return Math.floor(100000 + Math.random() * 900000)
.toString()
.slice(0, length);
public generateOTP(length: number) {
return Math.floor(100000 + Math.random() * 900000)
.toString()
.slice(0, length);
}
}

0 comments on commit e087559

Please sign in to comment.