1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-13 09:00:04 +00:00

chore: addressed comments

This commit is contained in:
2023-08-08 15:01:32 +05:00
parent 8cdf605006
commit 1531e9cd9c
7 changed files with 36 additions and 36 deletions

View File

@@ -1,4 +1,3 @@
import { randomBytes } from 'crypto'
import { Express } from 'express'
import mongoose, { Mongoose } from 'mongoose'
import { MongoMemoryServer } from 'mongodb-memory-server'
@@ -14,6 +13,7 @@ import {
generateAccessToken,
generateAuthCode,
generateRefreshToken,
randomBytesHexString,
saveTokensInDB,
verifyTokenInDB
} from '../../../utils'
@@ -52,7 +52,7 @@ describe('auth', () => {
describe('token', () => {
const userInfo: InfoJWT = {
clientId,
userId: randomBytes(12).toString('hex')
userId: randomBytesHexString(12)
}
beforeAll(async () => {
await userController.createUser(user)

View File

@@ -145,7 +145,7 @@ describe('web', () => {
expect(res.body.loggedIn).toBeTruthy()
expect(res.body.user).toEqual({
id: expect.anything(),
id: expect.any(String),
username: user.username,
displayName: user.displayName,
isAdmin: user.isAdmin,

4
api/src/utils/crypto.ts Normal file
View File

@@ -0,0 +1,4 @@
import { randomBytes } from 'crypto'
export const randomBytesHexString = (bytesCount: number) =>
randomBytes(bytesCount).toString('hex')

View File

@@ -2,6 +2,7 @@ export * from './appStreamConfig'
export * from './connectDB'
export * from './copySASjsCore'
export * from './createWeboutSasFile'
export * from './crypto'
export * from './desktopAutoExec'
export * from './extractHeaders'
export * from './extractName'