fix: don't force override cid type

This commit is contained in:
Derrick Hammer 2023-12-28 03:55:54 -05:00
parent 5dc288b395
commit 64d95353aa
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 2 additions and 8 deletions

View File

@ -1,6 +1,6 @@
import Multibase from "#multibase.js"; import Multibase from "#multibase.js";
import { Multihash } from "#multihash.js"; import { Multihash } from "#multihash.js";
import { CID_HASH_TYPES, CID_TYPES, REGISTRY_TYPES } from "#constants.js"; import { CID_TYPES, REGISTRY_TYPES } from "#constants.js";
import { decodeEndian, encodeEndian } from "#util.js"; import { decodeEndian, encodeEndian } from "#util.js";
import { concatBytes, equalBytes } from "@noble/curves/abstract/utils"; import { concatBytes, equalBytes } from "@noble/curves/abstract/utils";
import { hexToBytes } from "@noble/hashes/utils"; import { hexToBytes } from "@noble/hashes/utils";
@ -30,13 +30,7 @@ export default class CID extends Multibase {
bytes = bytes.slice(1); bytes = bytes.slice(1);
const cid = CID._init(bytes); return CID._init(bytes);
if (cid.hash.functionType !== CID_HASH_TYPES.ED25519) {
return cid.copyWith({ type: CID_TYPES.RAW });
}
return cid;
} }
static fromBytes(bytes: Uint8Array): CID { static fromBytes(bytes: Uint8Array): CID {