Skip to content

Commit

Permalink
fix: do not force password slug in identity
Browse files Browse the repository at this point in the history
  • Loading branch information
olastor committed Jan 4, 2024
1 parent b71c36e commit 3f6ae31
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/sss/stanza.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,14 +169,17 @@ func (stanza *SSSStanza) Unwrap (identity *SSSIdentity) (data []byte, err error)
remainingStanzaIdsByType := stanza.getUnecryptedIdsByType()

switch {
case strings.HasPrefix(id.IdentityStr, "password-"):
if id.IdentityStr == "password-" {
return nil, errors.New("Missing id on password")
case strings.HasPrefix(id.IdentityStr, "password"):
msg := "Please enter the password:"

// the slug is only "nice to have" for decryption, so it shouldn't be enforced
if len(id.IdentityStr) > 9 {
passwordId := id.IdentityStr[9:]
msg = fmt.Sprintf("Please enter password \"%s\":", passwordId)
}

// ask for the password
passwordId := id.IdentityStr[9:]
password, err := RequestValue(fmt.Sprintf("Please enter password \"%s\":", passwordId), true)
password, err := RequestValue(msg, true)
if err != nil {
return nil, err
}
Expand Down

0 comments on commit 3f6ae31

Please sign in to comment.