fix: use base64urlpad

This commit is contained in:
Derrick Hammer 2023-11-18 07:55:10 -05:00
parent 1adac41c74
commit 19426b7fdb
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 2 deletions

View File

@ -1,7 +1,7 @@
import { base58btc } from "multiformats/bases/base58"; import { base58btc } from "multiformats/bases/base58";
import { bytesToHex, hexToBytes, utf8ToBytes } from "@noble/hashes/utils"; import { bytesToHex, hexToBytes, utf8ToBytes } from "@noble/hashes/utils";
import { base32 } from "multiformats/bases/base32"; import { base32 } from "multiformats/bases/base32";
import { base64, base64url } from "multiformats/bases/base64"; import { base64, base64urlpad } from "multiformats/bases/base64";
export default abstract class Multibase { export default abstract class Multibase {
abstract toBytes(): Uint8Array; abstract toBytes(): Uint8Array;
@ -23,7 +23,7 @@ export default abstract class Multibase {
while (str.length % 4 !== 0) { while (str.length % 4 !== 0) {
str += "="; str += "=";
} }
bytes = base64url.decode(str); bytes = base64urlpad.decode(str);
} else if (data[0] === ":") { } else if (data[0] === ":") {
bytes = utf8ToBytes(data); bytes = utf8ToBytes(data);
} else { } else {