diff --git a/src/cid.ts b/src/cid.ts index 07d1374..e711f43 100644 --- a/src/cid.ts +++ b/src/cid.ts @@ -4,15 +4,16 @@ import { encodeCid as encodeCidPortal, } from "@lumeweb/libportal"; import { addContextToErr } from "#err.js"; +import type { CID } from "@lumeweb/libportal"; -export function encodeCid(hash: Uint8Array, size: bigint): any; -export function encodeCid(hash: string, size: bigint): any; +export function encodeCid(hash: Uint8Array, size: bigint): ErrTuple; +export function encodeCid(hash: string, size: bigint): ErrTuple; export function encodeCid( hash: any, size: bigint, type?: number, hashType?: number, -): ErrTuple { +): ErrTuple { try { return [encodeCidPortal(hash, size, type, hashType), null]; } catch (e) { @@ -20,7 +21,7 @@ export function encodeCid( } } -export function decodeCid(cid: string): ErrTuple { +export function decodeCid(cid: string): ErrTuple { try { return [decodeCidPortal(cid), null]; } catch (e) {