Skip to content

Commit

Permalink
Stop saving keys to disk in envelopes
Browse files Browse the repository at this point in the history
  • Loading branch information
dhaavi committed Jul 11, 2022
1 parent 028a0b0 commit 345ceb0
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions cmd/cfg-envelope.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func newEnvelope(name string) (*jess.Envelope, error) {
envelope.SuiteID = jess.SuiteRcptOnly
err = selectSignets(envelope, "recipient")
case "Sign a file":
envelope.SuiteID = jess.SuiteSign
envelope.SuiteID = jess.SuiteSignFileV1
err = selectSignets(envelope, "sender")
}
if err != nil {
Expand Down Expand Up @@ -105,7 +105,20 @@ func editEnvelope(envelope *jess.Envelope) error {

switch {
case strings.HasPrefix(submenu, "Done"):
// save
// Check if the envolope is valid.
if envelope.SecurityLevel == 0 {
fmt.Println("Envelope is invalid, please fix before saving.")
continue
}
// Remove and keys and save.
_ = envelope.LoopSecrets("", func(signet *jess.Signet) error {
signet.Key = nil
return nil
})
_ = envelope.LoopSenders("", func(signet *jess.Signet) error {
signet.Key = nil
return nil
})
return trustStore.StoreEnvelope(envelope)
case strings.HasPrefix(submenu, "Abort"):
return nil
Expand Down

0 comments on commit 345ceb0

Please sign in to comment.