From 4b960c5cb3f7495c0689adcb65c62a1032ae2650 Mon Sep 17 00:00:00 2001 From: Ali Mihandoost Date: Sat, 13 May 2023 19:54:01 +0330 Subject: [PATCH] feat(crypto): add some pre config --- core/crypto/src/pre-config.ts | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 core/crypto/src/pre-config.ts diff --git a/core/crypto/src/pre-config.ts b/core/crypto/src/pre-config.ts new file mode 100644 index 000000000..bd3a5be08 --- /dev/null +++ b/core/crypto/src/pre-config.ts @@ -0,0 +1,27 @@ +import {HashGeneratorConfig, TokenGeneratorConfig} from './type.js'; + +/** + * Hash generator pre configuration for making random self-validate **secrets**. + */ +export const secretGeneratorPreConfig: HashGeneratorConfig = { + algorithm: 'sha256', + encoding: 'base64url', + crcLength: 4, +}; + +/** + * Hash generator pre configuration for making random self-validate **user-id**. + */ +export const userIdGeneratorPreConfig: HashGeneratorConfig = { + algorithm: 'sha1', + encoding: 'base64url', + crcLength: 4, +}; + +/** + * Token generator pre configuration for making secure self-validate **user-token**. + */ +export const userTokenGeneratorPreConfig: Pick = { + algorithm: 'sha224', + encoding: 'base64url', +};