open-vault/ui/lib/core/addon/utils/b64.js
Matthew Irish 0ccc8467ec
UI ember engines (#6718)
Adds replication engine and core in-repo addon
2019-05-13 14:05:25 -05:00

12 lines
334 B
JavaScript

import base64js from 'base64-js';
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);
}