# TOTP Code Backup

**URL:** <https://forum.dangerousthings.com/t/totp-code-backup/19003>\
**Category:** VivoKey Apex\
**Created:** [June 14, 2023, 2:14pm UTC](https://forum.dangerousthings.com/t/totp-code-backup/19003 "2023-06-14T14:14:02Z")\
**Posts on this page:** 1\
**Showing post:** 6

<div class="post-metadata">

**Author:** ![StarGate01](https://forum.dangerousthings.com/user_avatar/forum.dangerousthings.com/stargate01/32/13866_2.png) [@StarGate01](https://forum.dangerousthings.com/u/StarGate01)\
**Post date:** [February 6, 2024, 3:31pm UTC](https://forum.dangerousthings.com/t/totp-code-backup/19003/6 "2024-02-06T15:31:08Z")

</div>

Just a quick note for anyone who stumbles upon this: KeePassXC is able to properly store TOTP secrets (and also generate TOTP codes). You can use a small shell command in Linux to mass import these TOTP entries from KeePassXC into the OTP applet on the Apex:

```auto
keepassxc-cli export -f xml /home/user/Database.kdbx | xmllint -xpath "//Key[text()='otp']/following-sibling::Value/text()" - | xargs -l ykman -r "READER_NAME" oath accounts uri

```

If your KeePassXC database is secured using the HMAC-SHA1 Yubico-style protocol as well, add e.g. `-y "1:12341234"` to the `keepassxc-cli` command, `12341234` being the serial number of the key (displayed in KeePassXC) and `1` the slot to use.

You also have to replace the path `/home/user/Database.kdbx` with the path to your KeePassXC database. In addition, the `READER_NAME` string has to be relaced with the name of the PC/SC reader you use, you can look those up by running `pcsc_scan`.

In terms of requirements, you will need `yubikey-manager` CLI tool, and the `libxml2` tools.

Also, just as a final note: I do not recommend storing these TOTP secrets in the same database where you store the associated passwords for these accounts.

---

_[View the full topic](https://forum.dangerousthings.com/t/totp-code-backup/19003)._
