Skip to content
This repository has been archived by the owner on Jun 20, 2023. It is now read-only.

Commit

Permalink
chore: deprecate types and readme
Browse files Browse the repository at this point in the history
  • Loading branch information
hacdias committed May 25, 2023
1 parent 062f619 commit 41fc604
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## ❗ This repo is no longer maintained.
👉 We highly recommend switching to the maintained version at https://github.com/ipfs/boxo/tree/main/verifcid.
🏎️ Good news! There is [tooling and documentation](https://github.com/ipfs/boxo#migrating-to-boxo) to expedite a switch in your repo.

⚠️ If you continue using this repo, please note that security fixes will not be provided (unless someone steps in to maintain it).

📚 Learn more, including how to take the maintainership mantle or ask questions, [here](https://github.com/ipfs/boxo/wiki/Copied-or-Migrated-Repos-FAQ).
7 changes: 7 additions & 0 deletions validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,13 @@ import (
mh "github.com/multiformats/go-multihash"
)

// Deprecated: use github.com/ipfs/boxo/verifcid.ErrPossiblyInsecureHashFunction
var ErrPossiblyInsecureHashFunction = fmt.Errorf("potentially insecure hash functions not allowed")

// Deprecated: use github.com/ipfs/boxo/verifcid.ErrBelowMinimumHashLength
var ErrBelowMinimumHashLength = fmt.Errorf("hashes must be at least %d bytes long", minimumHashLength)

// Deprecated: use github.com/ipfs/boxo/verifcid.ErrAboveMaximumHashLength
var ErrAboveMaximumHashLength = fmt.Errorf("hashes must be at most %d bytes long", maximumHashLength)

const minimumHashLength = 20
Expand Down Expand Up @@ -36,6 +41,7 @@ var goodset = map[uint64]bool{
mh.SHA1: true, // not really secure but still useful
}

// Deprecated: use github.com/ipfs/boxo/verifcid.IsGoodHash
func IsGoodHash(code uint64) bool {
good, found := goodset[code]
if good {
Expand All @@ -54,6 +60,7 @@ func IsGoodHash(code uint64) bool {
return false
}

// Deprecated: use github.com/ipfs/boxo/verifcid.ValidateCid
func ValidateCid(c cid.Cid) error {
pref := c.Prefix()
if !IsGoodHash(pref.MhType) {
Expand Down

0 comments on commit 41fc604

Please sign in to comment.