replydev / cotp

Trustworthy, encrypted, command-line TOTP/HOTP authenticator app with import functionality.
GNU General Public License v3.0
240 stars 21 forks source link

No way to import OTP URIs as strings (from stdin or arguments) without files #423

Closed brian6932 closed 2 months ago

brian6932 commented 4 months ago

Mentioned in https://github.com/replydev/cotp/issues/157#issuecomment-2062952310. Previously cotp add --otpuri would allow this.

replydev commented 4 months ago

Thanks for reporting. I will try to replicate and release a fix. I do not receive notifications for new messages in closed issues. Please always open a new issue.

replydev commented 4 months ago

So, in #425 the feature removal from a single OTP Uri has been reverted. You can now add the OTP Uri as before.

Said that, the importing error that you faced has been made a bit more clear. The error was the format that you were trying to import. All the import files must be JSON files with a string predefined schema. Please read: https://github.com/replydev/cotp?tab=readme-ov-file#migration-from-other-apps for futher information.

brian6932 commented 4 months ago

It should (also) just work with (cr)lf and/or whitespace in general separated list (Regex::new(r"(?m)\s+").split(string).collect()) (This is how https://github.com/bingzheung/authenticator exports & imports, easier to parse, and also most natural for a user making their own list, so it makes sense imo).

brian6932 commented 3 months ago

Basically, I would like to do things like

qrrs -r qrcode.png | cotp add -u

which would decode a QR code, and then pipes the text into add. Currently I'd have to do something like

qrrs -r qrcode.png | scb
cotp add -u
Password:

Insert the otp uri: <paste>