MCPcopy Create free account
hub / github.com/FuAdmin/fu-admin / Base64Encryption

Class Base64Encryption

web/src/utils/cipher.ts:54–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

52
53// Define a singleton class for Base64 encryption
54class Base64Encryption implements Encryption {
55 private static instance: Base64Encryption;
56
57 private constructor() {}
58
59 // Get the singleton instance
60 // 获取单例实例
61 public static getInstance(): Base64Encryption {
62 if (!Base64Encryption.instance) {
63 Base64Encryption.instance = new Base64Encryption();
64 }
65 return Base64Encryption.instance;
66 }
67
68 encrypt(plainText: string) {
69 return UTF8.parse(plainText).toString(Base64);
70 }
71
72 decrypt(cipherText: string) {
73 return Base64.parse(cipherText).toString(UTF8);
74 }
75}
76
77// Define a singleton class for MD5 Hashing
78class MD5Hashing implements Hashing {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected