fix: replace u with U in decodeString, and strip U in toBase64Url

This commit is contained in:
Derrick Hammer 2023-11-18 08:20:13 -05:00
parent f14050a83d
commit 01d29f0b59
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@ export default abstract class Multibase {
}
bytes = base32.decode(str);
} else if (data[0] === "u") {
bytes = base64urlpad.decode(data);
bytes = base64urlpad.decode(data[0].toUpperCase() + data.substring(1));
} else if (data[0] === ":") {
bytes = utf8ToBytes(data);
} else {
@ -38,7 +38,7 @@ export default abstract class Multibase {
}
toBase64Url(): string {
return `u${base64urlpad.encode(this.toBytes())}`;
return `u${base64urlpad.encode(this.toBytes()).substring(1)}`;
}
toBase58(): string {