Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit b17ee4b

Browse files
committed
Use abab instead of atob/btoa
1 parent 1638a07 commit b17ee4b

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/secrets/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,16 @@
11
import sodium = require("tweetsodium");
2-
import atob = require("atob");
3-
import btoa = require("btoa");
42
import util = require("util");
3+
import { atob, btoa } from "abab";
54

65
function decode(encoded: string): Uint8Array {
7-
const bytes = atob(encoded)
6+
const bytes = atob(encoded)!
87
.split("")
98
.map((x: string) => x.charCodeAt(0));
109
return Uint8Array.from(bytes);
1110
}
1211

1312
function encode(bytes: Uint8Array): string {
14-
return btoa(String.fromCharCode.apply(null, Array.from(bytes)));
13+
return btoa(String.fromCharCode.apply(null, Array.from(bytes)))!;
1514
}
1615

1716
export function encodeSecret(key: string, value: string): string {

0 commit comments

Comments
 (0)