otp_export icon indicating copy to clipboard operation
otp_export copied to clipboard

how to use the secret data

Open scarlion1 opened this issue 3 years ago • 4 comments

Once I have decoded the protobuf message, the secrets look like your example: "\r\037)\335\260l\377\216=\0352O+\352\221.o\177\014e\030\217\352NM~V\322\322 \320\351@\314C"

but that is in bytes format. So how would I convert that to base32 encoded string to use in an otpauth URI?

scarlion1 avatar Aug 27 '22 05:08 scarlion1

You could use b32encode from the package base64. Checkout parse.py for an example.

qistoph avatar Aug 27 '22 06:08 qistoph

Cool thanks, so I would just have to use a script like:

from base64 import b32encode
print('Encoded string: ', b32encode(b'secret'))

But I wonder if there is a way to do it without python, like just using bash or other command-line utility?

scarlion1 avatar Aug 27 '22 07:08 scarlion1

There are probably a lot of other options. You'd have to search for yourself. I wouldn't know

It does seem there is a base32 tool: https://www.man7.org/linux/man-pages/man1/base32.1.html

qistoph avatar Aug 27 '22 08:08 qistoph

found something that works finally! printf "%b" 'secret' | base32

scarlion1 avatar Aug 27 '22 11:08 scarlion1