fix: check against MAGIC_BYTES
This commit is contained in:
parent
a530a07f01
commit
cb4048b963
|
@ -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");
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue