UNPKG

@helia/verified-fetch

Version:

A fetch-like API for obtaining verified & trustless IPFS content on the web

10 lines 429 B
import { peerIdFromCID, peerIdFromString } from '@libp2p/peer-id'; import { CID } from 'multiformats/cid'; export function getPeerIdFromString(peerIdString) { if (peerIdString.charAt(0) === '1' || peerIdString.charAt(0) === 'Q') { return peerIdFromString(peerIdString); } // try resolving as a base36 CID return peerIdFromCID(CID.parse(peerIdString)); } //# sourceMappingURL=get-peer-id-from-string.js.map