2018-07-18 14:13:39 +00:00
|
|
|
import base64js from 'base64-js';
|
|
|
|
|
2018-04-03 14:16:57 +00:00
|
|
|
export function encodeString(string) {
|
|
|
|
var encoded = new TextEncoderLite('utf-8').encode(string);
|
|
|
|
return base64js.fromByteArray(encoded);
|
|
|
|
}
|
|
|
|
|
|
|
|
export function decodeString(b64String) {
|
|
|
|
var uint8array = base64js.toByteArray(b64String);
|
|
|
|
return new TextDecoderLite('utf-8').decode(uint8array);
|
|
|
|
}
|