-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change the anchorID and badgeID format to MD5
- Loading branch information
Showing
2 changed files
with
11 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,7 @@ | ||
import { Md5 } from 'ts-md5'; | ||
import { CreateCommandParams } from './types'; | ||
|
||
export const getAnchorID = (params: CreateCommandParams): Buffer => | ||
Buffer.concat([Buffer.from(params.spotifyId, 'utf8')]); | ||
export const getAnchorID = (params: CreateCommandParams): Buffer => { | ||
const md5Hash = Md5.hashStr(params.spotifyId); | ||
Check failure on line 5 in src/app/modules/anchor/utils.ts GitHub Actions / build
Check failure on line 5 in src/app/modules/anchor/utils.ts GitHub Actions / build
|
||
return Buffer.concat(([Buffer.from(md5Hash, 'hex')])); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,8 @@ | ||
import { Md5 } from 'ts-md5'; | ||
import { Badges } from './types'; | ||
|
||
export const getBadgeID = (date: string, rank: number, type: Badges): Buffer => | ||
Buffer.from(`${date.replace('-', '_')}_${rank}_${type}`, 'utf8'); | ||
export const getBadgeID = (date: string, rank: number, type: Badges): Buffer =>{ | ||
const idString = `${date.replace('-', '_')}_${rank}_${type}`; | ||
const md5Hash = Md5.hashStr(idString); | ||
Check failure on line 6 in src/app/modules/badge/utils.ts GitHub Actions / build
Check failure on line 6 in src/app/modules/badge/utils.ts GitHub Actions / build
|
||
return Buffer.from(md5Hash, 'hex'); | ||
} |