MCPcopy Create free account
hub / github.com/bufbuild/buf / V1ProtoToDigest

Function V1ProtoToDigest

private/bufpkg/bufmodule/bufmoduleapi/convert.go:69–79  ·  view source on GitHub ↗

V1ProtoToDigest converts the given proto Digest to a Digest. Validation is performed to ensure the DigestType is known, and the value is a valid digest value for the given DigestType.

(protoDigest *modulev1.Digest)

Source from the content-addressed store, hash-verified

67// Validation is performed to ensure the DigestType is known, and the value
68// is a valid digest value for the given DigestType.
69func V1ProtoToDigest(protoDigest *modulev1.Digest) (bufmodule.Digest, error) {
70 digestType, err := v1ProtoToDigestType(protoDigest.Type)
71 if err != nil {
72 return nil, err
73 }
74 casDigest, err := cas.NewDigest(cas.DigestTypeShake256, protoDigest.Value)
75 if err != nil {
76 return nil, err
77 }
78 return bufmodule.NewDigest(digestType, casDigest)
79}
80
81// DigestToV1Beta1Proto converts the given Digest to a proto Digest.
82func DigestToV1Beta1Proto(digest bufmodule.Digest) (*modulev1beta1.Digest, error) {

Callers 1

Calls 3

NewDigestFunction · 0.92
NewDigestFunction · 0.92
v1ProtoToDigestTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…