generated from cubetiq/ts-project
Task: Add random bytes and string for default crypto
This commit is contained in:
parent
3c12c69606
commit
fb694eb5a2
@ -46,4 +46,12 @@ const decrypt = (
|
||||
return decrypted
|
||||
}
|
||||
|
||||
export { encrypt, decrypt }
|
||||
const cryptoRandomBytes = (length: number): Buffer => {
|
||||
return Buffer.from(crypto.randomBytes(length))
|
||||
}
|
||||
|
||||
const cryptoRandomString = (length: number): string => {
|
||||
return cryptoRandomBytes(length).toString(DEFAULT_BUFFER_TYPE)
|
||||
}
|
||||
|
||||
export { encrypt, decrypt, cryptoRandomBytes, cryptoRandomString }
|
||||
|
Loading…
Reference in New Issue
Block a user