open-vault/ui/app/utils/b64.js
Matthew Irish 3e5731a7b8
UI: ember-auto-import (#4933)
* add auto-import
* remove imports that we can and get rid of autosize shim
* remove items from eslinrc
* import base64js in shamir key
2018-07-18 09:13:39 -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);
}