Skip to content
This repository was archived by the owner on May 11, 2026. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/signing/hmac.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ function replaceAll(s: string, search: string, replace: string) {
* Converts base64 string to ArrayBuffer
*/
function base64ToArrayBuffer(base64: string): ArrayBuffer {
const binaryString = atob(base64);
const base64Std = base64.replace(/-/g, "+").replace(/_/g, "/");
const normalized = base64Std + "===".slice((base64Std.length + 3) % 4);
const binaryString = atob(normalized);
const bytes = new Uint8Array(binaryString.length);
for (let i = 0; i < binaryString.length; i++) {
bytes[i] = binaryString.charCodeAt(i);
Expand Down