mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-05 16:02:20 +02:00
fix error: utf8 to base64
This commit is contained in:
parent
1042b528ec
commit
d61274c60a
@ -118,15 +118,17 @@ export function getDataTypeKey(dataType: GameDataType, slotId = 0): string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function encrypt(data: string, bypassLogin: boolean): string {
|
export function encrypt(data: string, bypassLogin: boolean): string {
|
||||||
return (bypassLogin ? (data: string) => btoa(data) : (data: string) => AES.encrypt(data, saveKey))(
|
return (bypassLogin
|
||||||
data,
|
? (data: string) => btoa(encodeURIComponent(data))
|
||||||
) as unknown as string; // TODO: is this correct?
|
: (data: string) => AES.encrypt(data, saveKey))(data) as unknown as string; // TODO: is this correct?
|
||||||
}
|
}
|
||||||
|
|
||||||
export function decrypt(data: string, bypassLogin: boolean): string {
|
export function decrypt(data: string, bypassLogin: boolean): string {
|
||||||
return (bypassLogin ? (data: string) => atob(data) : (data: string) => AES.decrypt(data, saveKey).toString(enc.Utf8))(
|
return (
|
||||||
data,
|
bypassLogin
|
||||||
);
|
? (data: string) => decodeURIComponent(atob(data))
|
||||||
|
: (data: string) => AES.decrypt(data, saveKey).toString(enc.Utf8)
|
||||||
|
)(data);
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface SystemSaveData {
|
export interface SystemSaveData {
|
||||||
|
Loading…
Reference in New Issue
Block a user