Skip to content

Commit

Permalink
fix: do not throw error when encountering multiple valid stanzas
Browse files Browse the repository at this point in the history
  • Loading branch information
olastor committed Apr 28, 2024
1 parent fdc9589 commit 83dcd44
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 4 deletions.
40 changes: 40 additions & 0 deletions cmd/age-plugin-fido2-hmac/testdata/multiple-stanzas.txtar
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# fido key must have pin 1234

exec age-keygen
cp stdout identity0.txt

ttyin -stdin yes-pin-no-identity
exec age-plugin-fido2-hmac -g
cp stdout identity1.txt

ttyin -stdin no-pin-yes-identity
exec age-plugin-fido2-hmac -g
cp stdout identity2.txt

exec bash -c 'cat identity0.txt identity1.txt identity2.txt | grep -oP "age1.*" > recipients.txt'

exec age -R recipients.txt -o ciphertext plaintext

ttyin -stdin pin
exec age -d -o plaintext1 -i identity1.txt ciphertext
cmp plaintext plaintext1

exec age -d -o plaintext2 -i identity2.txt ciphertext
cmp plaintext plaintext2

-- pin --
1234
-- yes-pin-no-identity --
1234
y
n

-- no-pin-yes-identity --
1234
n
y

-- magic.txt --
AGE-PLUGIN-FIDO2-HMAC-1VE5KGMEJ945X6CTRM2TF76
-- plaintext --
this is the plaintext
4 changes: 0 additions & 4 deletions pkg/plugin/identity_v1.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,6 @@ func IdentityV1() error {
return false, nil
}

if stanzas != nil {
return false, errors.New("Decrypting multiple stanzas not supported")
}

stanzas = append(stanzas, &age.Stanza{
Type: args[1],
Args: args[2:],
Expand Down

0 comments on commit 83dcd44

Please sign in to comment.