github.com/keybase/client/go@v0.0.0-20241007131713-f10651d043c8/blindtree/defaults.go (about) 1 package blindtree 2 3 import ( 4 "github.com/keybase/client/go/merkletree2" 5 ) 6 7 // Blind tree defaults. Should not be changed without updating the clients first! 8 const encodingType = merkletree2.EncodingTypeBlindedSHA512_256v1 9 const useBlindedValueHashes bool = true 10 const logChildrenPerNode uint8 = 1 11 const maxValuesPerLeaf = 1 12 const keysByteLength = 16 13 14 func GetCurrentBlindTreeConfig() (cfg merkletree2.Config) { 15 valueConstructor := func() interface{} { return BlindMerkleValue{} } 16 17 cfg, err := merkletree2.NewConfig( 18 encodingType.GetEncoder(), 19 useBlindedValueHashes, 20 logChildrenPerNode, 21 maxValuesPerLeaf, 22 keysByteLength, 23 valueConstructor) 24 if err != nil { 25 panic(err) 26 } 27 return cfg 28 } 29 30 // This config uses the non thread safe encoder. 31 func GetCurrentBlindTreeConfigUnsafe() (cfg merkletree2.Config) { 32 valueConstructor := func() interface{} { return BlindMerkleValue{} } 33 34 cfg, err := merkletree2.NewConfig( 35 encodingType.GetUnsafeEncoder(), 36 useBlindedValueHashes, 37 logChildrenPerNode, 38 maxValuesPerLeaf, 39 keysByteLength, 40 valueConstructor) 41 if err != nil { 42 panic(err) 43 } 44 return cfg 45 }