Nitrokey / pynitrokey

Python client for Nitrokey devices
Apache License 2.0
93 stars 28 forks source link

Update credential support #425

Closed szszszsz closed 10 months ago

szszszsz commented 11 months ago

This PR adds support for the credentials update, introduced in https://github.com/Nitrokey/trussed-secrets-app/pull/99.

It's possible now to rename the credential, change its touch button use requirement, and change content of the PWS fields.

Builds on https://github.com/Nitrokey/pynitrokey/pull/424.

Changes

Checklist

Make sure to run make check and make fix before creating a PR, otherwise the CI will fail.

Test Environment and Execution

Relevant Output Example

~/w/pynitrokey (402-update-credential-2|✔) $ ./venv/bin/nitropy nk3 secrets update --help
Command line tool to interact with Nitrokey devices 0.4.39
Usage: nitropy nk3 secrets update [OPTIONS] NAME

  Update credential. Change Static Password fields, or touch button
  requirement attribute.

Options:
  --login TEXT            Password Safe Login
  --password TEXT         Password Safe Password
  --metadata TEXT         Password Safe Metadata - additional field, to which
                          extra information can be encoded
  --touch-button BOOLEAN  Activate/deactivate touch button requirement
  --help                  Show this message and exit.
~/w/pynitrokey (402-update-credential-2|✔) $ ./venv/bin/nitropy nk3 secrets update "CRED ID" --touch-butto
n False
Command line tool to interact with Nitrokey devices 0.4.39
Please touch the device if it blinks
Done
~/w/pynitrokey (402-update-credential-2|✔) $ ./venv/bin/nitropy nk3 secrets list
Command line tool to interact with Nitrokey devices 0.4.39
Please provide PIN to show PIN-protected entries (if any), or press ENTER to skip
Please touch the device if it blinks
Current PIN (8 attempts left):
No PIN provided
01. CRED ID     Hotp/Sha1
02. CRED ID2    Hotp/Sha1
~/w/pynitrokey (402-update-credential-2|✔) $ ./venv/bin/nitropy nk3 secrets update "CRED ID" --touch-butto
n True
Command line tool to interact with Nitrokey devices 0.4.39
Please touch the device if it blinks
Done
~/w/pynitrokey (402-update-credential-2|✔) $ ./venv/bin/nitropy nk3 secrets list
Command line tool to interact with Nitrokey devices 0.4.39
Please provide PIN to show PIN-protected entries (if any), or press ENTER to skip
Please touch the device if it blinks
Current PIN (8 attempts left):
No PIN provided
01. CRED ID     Hotp/Sha1       touch required
02. CRED ID2    Hotp/Sha1
~/w/pynitrokey (402-update-credential-2|✔) $

Fixes #402

Connected:

szszszsz commented 10 months ago

Updates: