2019-08-25 09:39:20 +03:00
|
|
|
"use strict";
|
|
|
|
import { arrayify } from "@ethersproject/bytes";
|
|
|
|
export function decode(textData) {
|
|
|
|
textData = atob(textData);
|
2019-11-20 12:57:38 +03:00
|
|
|
const data = [];
|
2019-08-25 09:39:20 +03:00
|
|
|
for (let i = 0; i < textData.length; i++) {
|
|
|
|
data.push(textData.charCodeAt(i));
|
|
|
|
}
|
|
|
|
return arrayify(data);
|
|
|
|
}
|
|
|
|
export function encode(data) {
|
|
|
|
data = arrayify(data);
|
|
|
|
let textData = "";
|
|
|
|
for (let i = 0; i < data.length; i++) {
|
|
|
|
textData += String.fromCharCode(data[i]);
|
|
|
|
}
|
|
|
|
return btoa(textData);
|
|
|
|
}
|
2020-11-17 07:07:24 +03:00
|
|
|
//# sourceMappingURL=base64.js.map
|