Skip to content

Commit 86d4722

Browse files
author
Andre Bluehs
committed
remove base64-arraybuffer
1 parent 673168b commit 86d4722

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

package-lock.json

Lines changed: 0 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"@hpke/chacha20poly1305": "^1.2.7",
1414
"@hpke/core": "^1.2.7",
1515
"@hpke/dhkem-x25519": "^1.2.7",
16-
"base64-arraybuffer": "^1.0.2",
1716
"itty-router": "^5.0.17"
1817
},
1918
"devDependencies": {

src/matched_data.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import { CipherSuite, HkdfSha256 } from "@hpke/core";
22
import { DhkemX25519HkdfSha256 } from "@hpke/dhkem-x25519";
33
import { Chacha20Poly1305 } from "@hpke/chacha20poly1305";
4-
import { decode as b64decode } from "base64-arraybuffer";
54
import { TransformNewlineStream } from "./transform_newline_stream";
65

76
/**
@@ -70,3 +69,15 @@ function decodebin(enc: ArrayBuffer) {
7069
};
7170
}
7271
}
72+
73+
function b64decode(base64: string) {
74+
const binaryString = atob(base64);
75+
const length = binaryString.length;
76+
const bytes = new Uint8Array(length);
77+
78+
for (let i = 0; i < length; i++) {
79+
bytes[i] = binaryString.charCodeAt(i);
80+
}
81+
82+
return bytes.buffer;
83+
}

0 commit comments

Comments
 (0)