multiformats / multiformats/js-multiformats

Proposal: Define `MultihashVerifier` interface

Open
#253 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
268
Forks
57
PR merge metrics
No merged PRs in 30d

Description

Goal

As per https://github.com/ipld/js-car/issues/123 we do need a solution for verifying hashes in CAR files without shipping all the MultihashHasher-s with the CAR library.

Proposal

Define a separate MultihashVerifier interface that can be implemented by all of our hashers. It could look like this:

export interface MultihashVerifier {
  // Fails if source produces a different multihash
  verify(mustihash: Uint8Array, source: Uint8Array): Await<{}>
}

You may be thinking can't I just use MultihashHasher to create a digest from the source and then compare. While you could there are some subtle cases where having MultihashVerifier would be a better option:

  1. Hashing algorithms like blake3 provide incremental verifiability, allowing a more optimal implementation strategy.
  2. It is possible to implement e.g. trust: (config) => MultihashVerifier that could be leveraged as an explicit opt-out as opposed to subtle option that is easy to miss.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reviewing the linked js-car issue and the existing MultihashHasher interfaces and implementations in this repository. Determine the verifier contract, including failure behavior and support for incremental verification, then define the interface and establish how hashers can implement it. Done means the proposal is resolved in a consistent, documented API.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cryptography
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.