Skip to content

Biglup/is-cid

Repository files navigation

is-cid

Utils to properly validate CIDs to remove false-positives. This package works with both CJS and ESM.

Example

import * as CidValidator from '@biglup/is-cid';

CidValidator.validate('QmYjtig7VJQ6XsnUjqqJvj7QaMcCAwtrgNdahSiFofrE7o') // true (CIDv0)
CidValidator.validate('bafybeiasb5vpmaounyilfuxbd3lryvosl4yefqrfahsb2esg46q6tu6y5q') // true (CIDv1 in Base32)
CidValidator.validate('zdj7WWeQ43G6JJvLWQWZpyHuAMq6uYWRjkBXFad11vE2LHhQ7') // true (CIDv1 in Base58btc)
CidValidator.validate('xxxxx') // false

Install

$ npm i @biglup/is-cid

License

Licensed under either of

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

About

Set of utilities to validate CID

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published