fix: replace u with U in decodeString, and strip U in toBase64Url
This commit is contained in:
parent
f14050a83d
commit
01d29f0b59
|
@ -19,7 +19,7 @@ export default abstract class Multibase {
|
||||||
}
|
}
|
||||||
bytes = base32.decode(str);
|
bytes = base32.decode(str);
|
||||||
} else if (data[0] === "u") {
|
} else if (data[0] === "u") {
|
||||||
bytes = base64urlpad.decode(data);
|
bytes = base64urlpad.decode(data[0].toUpperCase() + data.substring(1));
|
||||||
} else if (data[0] === ":") {
|
} else if (data[0] === ":") {
|
||||||
bytes = utf8ToBytes(data);
|
bytes = utf8ToBytes(data);
|
||||||
} else {
|
} else {
|
||||||
|
@ -38,7 +38,7 @@ export default abstract class Multibase {
|
||||||
}
|
}
|
||||||
|
|
||||||
toBase64Url(): string {
|
toBase64Url(): string {
|
||||||
return `u${base64urlpad.encode(this.toBytes())}`;
|
return `u${base64urlpad.encode(this.toBytes()).substring(1)}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
toBase58(): string {
|
toBase58(): string {
|
||||||
|
|
Loading…
Reference in New Issue