mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-11-03 03:58:01 +00:00
18 lines
442 B
JavaScript
18 lines
442 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
/* eslint-disable no-undef */
|
|
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);
|
|
}
|