mirror of
https://github.com/langgenius/dify.git
synced 2026-05-04 09:28:04 +08:00
chore(web): new lint setup (#30020)
Co-authored-by: yyh <yuanyouhuilyz@gmail.com>
This commit is contained in:
@ -14,15 +14,15 @@
|
||||
*/
|
||||
export function encryptField(plaintext: string): string {
|
||||
try {
|
||||
// Base64 encode the plaintext
|
||||
// btoa works with ASCII, so we need to handle UTF-8 properly
|
||||
// Base64 encode the plaintext
|
||||
// btoa works with ASCII, so we need to handle UTF-8 properly
|
||||
const utf8Bytes = new TextEncoder().encode(plaintext)
|
||||
const base64 = btoa(String.fromCharCode(...utf8Bytes))
|
||||
return base64
|
||||
}
|
||||
catch (error) {
|
||||
console.error('Field encoding failed:', error)
|
||||
// If encoding fails, throw error to prevent sending plaintext
|
||||
// If encoding fails, throw error to prevent sending plaintext
|
||||
throw new Error('Encoding failed. Please check your input.')
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user