@@ -20,9 +20,9 @@ import (
2020 "github.com/ipld/go-car/util"
2121)
2222
23- // ValidateProof validates a proof for a Cid at a specified offset. If the proof is valid, the return
23+ // Verify validates a proof for a Cid at a specified offset. If the proof is valid, the return
2424// parameter is true. If the proof is invalid false is returned. In any other case an error is returned.
25- func ValidateProof (ctx context.Context , root cid.Cid , offset uint64 , proof []byte ) (bool , error ) {
25+ func Verify (ctx context.Context , root cid.Cid , offset uint64 , proof []byte ) (bool , error ) {
2626 r := bufio .NewReader (bytes .NewReader (proof ))
2727
2828 bstore := blockstore .NewBlockstore (dssync .MutexWrap (datastore .NewMapDatastore ()))
@@ -54,16 +54,16 @@ func ValidateProof(ctx context.Context, root cid.Cid, offset uint64, proof []byt
5454 // Smart (or lazy?) way to verify the proof. If we assume an ideal full DAGStore, trying to
5555 // re-create the proof with the proof as the underlying blockstore should fail if something
5656 // is missing.
57- regenProof , err := CreateProof (ctx , root , offset , dserv )
57+ regenProof , err := Prove (ctx , root , offset , dserv )
5858 if err != nil {
5959 return false , nil
6060 }
6161
6262 return bytes .Equal (proof , regenProof ), nil
6363}
6464
65- // CreateProof creates a proof for a Cid at a specified file offset.
66- func CreateProof (ctx context.Context , root cid.Cid , offset uint64 , dserv ipld.DAGService ) ([]byte , error ) {
65+ // Prove creates a proof for a Cid at a specified file offset.
66+ func Prove (ctx context.Context , root cid.Cid , offset uint64 , dserv ipld.DAGService ) ([]byte , error ) {
6767 n , err := dserv .Get (ctx , root )
6868 if err != nil {
6969 return nil , fmt .Errorf ("get %s from dag service: %s" , root , err )
0 commit comments