github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/pvl/init.go (about)

     1  package pvl
     2  
     3  import (
     4  	"github.com/keybase/client/go/libkb"
     5  	"github.com/keybase/client/go/merklestore"
     6  	"github.com/keybase/client/go/protocol/keybase1"
     7  )
     8  
     9  // NewPvlSource creates a new source and installs it into G.
    10  func NewPvlSourceAndInstall(g *libkb.GlobalContext) libkb.MerkleStore {
    11  	supportedVersion := keybase1.MerkleStoreSupportedVersion(SupportedVersion)
    12  	tag := "pvl"
    13  	endpoint := "merkle/pvl"
    14  	getHash := func(root libkb.MerkleRoot) string {
    15  		return root.PvlHash()
    16  	}
    17  	kitFilename := g.Env.GetPvlKitFilename()
    18  	s := merklestore.NewMerkleStore(g, tag, endpoint, kitFilename, supportedVersion, getHash)
    19  	g.SetPvlSource(s)
    20  	return s
    21  }