codekingpro/portable-devtools
114k
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.base64Encode = base64Encode;
4exports.base64Decode = base64Decode;
5/*
6Copyright 2023 The Sigstore Authors.
7
8Licensed under the Apache License, Version 2.0 (the "License");
9you may not use this file except in compliance with the License.
10You may obtain a copy of the License at
11
12 http://www.apache.org/licenses/LICENSE-2.0
13
14Unless required by applicable law or agreed to in writing, software
15distributed under the License is distributed on an "AS IS" BASIS,
16WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17See the License for the specific language governing permissions and
18limitations under the License.
19*/
20const BASE64_ENCODING = 'base64';
21const UTF8_ENCODING = 'utf-8';
22function base64Encode(str) {
23 return Buffer.from(str, UTF8_ENCODING).toString(BASE64_ENCODING);
24}
25function base64Decode(str) {
26 return Buffer.from(str, BASE64_ENCODING).toString(UTF8_ENCODING);
27}
28 