Skip to content

Commit

Permalink
change the anchorID and badgeID format to MD5
Browse files Browse the repository at this point in the history
  • Loading branch information
curvesy committed Nov 2, 2023
1 parent 1183d48 commit b247ea5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/app/modules/anchor/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
import { Md5 } from 'ts-md5';

Check failure on line 1 in src/app/modules/anchor/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unable to resolve path to module '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

View workflow job for this annotation

GitHub Actions / build

Unsafe assignment of an `any` value

Check failure on line 5 in src/app/modules/anchor/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unsafe member access .hashStr on an `any` value

Check failure on line 5 in src/app/modules/anchor/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unsafe call of an `any` typed value
return Buffer.concat(([Buffer.from(md5Hash, 'hex')]));

Check failure on line 6 in src/app/modules/anchor/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unsafe argument of type `any` assigned to a parameter of type `WithImplicitCoercion<string> | { [Symbol.toPrimitive](hint: "string"): string; }`
}
8 changes: 6 additions & 2 deletions src/app/modules/badge/utils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
import { Md5 } from 'ts-md5';

Check failure on line 1 in src/app/modules/badge/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unable to resolve path to module '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

View workflow job for this annotation

GitHub Actions / build

Unsafe assignment of an `any` value

Check failure on line 6 in src/app/modules/badge/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unsafe member access .hashStr on an `any` value

Check failure on line 6 in src/app/modules/badge/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unsafe call of an `any` typed value
return Buffer.from(md5Hash, 'hex');

Check failure on line 7 in src/app/modules/badge/utils.ts

View workflow job for this annotation

GitHub Actions / build

Unsafe argument of type `any` assigned to a parameter of type `WithImplicitCoercion<string> | { [Symbol.toPrimitive](hint: "string"): string; }`
}

0 comments on commit b247ea5

Please sign in to comment.