修改: app/components/settings.tsx

修改:     app/components/ui-lib.tsx
	修改:     app/constant.ts
	修改:     app/utils/encryption.ts
This commit is contained in:
glay
2024-11-06 09:44:36 +08:00
parent c55cea5853
commit 952d8835a3
4 changed files with 36 additions and 3 deletions

View File

@@ -8,6 +8,7 @@ if (!SECRET_KEY || SECRET_KEY.length < 32) {
"ENCRYPTION_KEY environment variable must be set with at least 32 characters",
);
}
export function encrypt(data: string): string {
try {
return AES.encrypt(data, SECRET_KEY).toString();
@@ -26,3 +27,9 @@ export function decrypt(encryptedData: string): string {
return encryptedData; // Fallback to the original data if decryption fails
}
}
export function maskSensitiveValue(value: string): string {
if (!value) return "";
if (value.length <= 4) return value;
return "*".repeat(value.length - 4) + value.slice(-4);
}