MCPcopy Create free account
hub / github.com/encodeous/nylon / VerifyBundle

Function VerifyBundle

state/distribution.go:24–34  ·  view source on GitHub ↗
(data []byte, key NyPublicKey)

Source from the content-addressed store, hash-verified

22}
23
24func VerifyBundle(data []byte, key NyPublicKey) ([]byte, error) {
25 if len(data) < x25519.SignatureSize {
26 return nil, errors.New("invalid signature: too short")
27 }
28 signature := data[:x25519.SignatureSize]
29 plainText := data[x25519.SignatureSize:]
30 if !x25519.Verify(key[:], plainText, signature) {
31 return nil, errors.New("invalid signature")
32 }
33 return plainText, nil
34}
35
36func SealBundle(data []byte, key []byte) ([]byte, error) {
37 ahead, err := chacha20poly1305.NewX(key[:])

Callers 1

UnbundleConfigFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected