MCPcopy Index your code
hub / github.com/getsops/sops / validateFileForEncryption

Function validateFileForEncryption

cmd/sops/encrypt.go:69–77  ·  view source on GitHub ↗
(outputStore sops.Store, branches []sops.TreeBranch)

Source from the content-addressed store, hash-verified

67}
68
69func validateFileForEncryption(outputStore sops.Store, branches []sops.TreeBranch) (sops.UserError, int) {
70 if len(branches) < 1 {
71 return &needAtLeastOneDocument{}, codes.NeedAtLeastOneDocument
72 }
73 if outputStore.HasSopsTopLevelKey(branches[0]) {
74 return &fileAlreadyEncryptedError{}, codes.FileAlreadyEncrypted
75 }
76 return nil, 0
77}
78
79func metadataFromEncryptionConfig(config encryptConfig) sops.Metadata {
80 return sops.Metadata{

Callers 3

setFunction · 0.85
encryptFunction · 0.85
runEditorUntilOkFunction · 0.85

Calls 1

HasSopsTopLevelKeyMethod · 0.65

Tested by

no test coverage detected