fix: check against MAGIC_BYTES

This commit is contained in:
Derrick Hammer 2023-06-24 03:33:57 -04:00
parent a530a07f01
commit cb4048b963
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 1 additions and 1 deletions

View File

@ -36,7 +36,7 @@ export function encodeCid(hash: any, size: bigint) {
export function decodeCid(cid: string): CID {
let bytes = base58btc.decode(cid);
if (!arrayBufferEqual(bytes.slice(0, 2).buffer, bytes.buffer)) {
if (!arrayBufferEqual(bytes.slice(0, 2).buffer, MAGIC_BYTES.buffer)) {
throw new Error("Invalid cid");
}