まず、エクスポートから QRコードを表示。
![Google Authenticator から secret を抽出する](https://i0.wp.com/android.benigumo.com/wp-content/uploads/2023/03/113594144-f015d200-963f-11eb-8cd2-0d3b6c075443.png?ssl=1)
テキスト化します。
otpauth-migration://offline?data=XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
※ 登録数が多ければ、XXX.. は、すごく長いです。
それをさらに以下のツールでデコードします。
👉 dim13/otpauth: Google Authenticator migration decoder ![hatena-bookmark](https://b.hatena.ne.jp/entry/image/https://github.com/dim13/otpauth)
go を入れるのがだるいので対応するバイナリをダウンロードします。
![dim13/otpauth: Google Authenticator migration decoder](https://i0.wp.com/android.benigumo.com/wp-content/uploads/2023/03/174806.png?ssl=1)
👉 Release v0.5.1 · dim13/otpauth ![hatena-bookmark](https://b.hatena.ne.jp/entry/image/https://github.com/dim13/otpauth/releases/tag/v0.5.1)
どれなのか、良くわからないので、インストール先を調べます。
❯ uname -a
Darwin iMac.local 22.3.0 Darwin Kernel Version 22.3.0: Mon Jan 30 20:42:11 PST 2023; root:xnu-8792.81.3~2/RELEASE_X86_64 x86_64
❯ uname -m
x86_64
otpauth-v0.5.1-darwin-amd64.tgz
をダウンロードして展開します。M1+なら「arm64」
。
先に取得したテキストを渡して実行します。
❯ ./otpauth -link "otpauth-migration://offline?data=XXXXX..."
otpauth://totp/Example%20Company:[email protected]?algorithm=SHA1&digits=6&issuer=Example+Company&period=30&secret=QUU6EA2GHORGMD22SN2YKU6VKISCKYAG
otpauth://totp/Henrik%20Schacks%20blog?algorithm=SHA1&digits=6&period=30&secret=5YGQ4IAR32CYA6PY
otpauth://totp/[email protected]?algorithm=SHA1&digits=6&issuer=MyCompanyName.AbpZeroTemplate&period=30&secret=MFRDCZDFMQ3DAMDC
otpauth://totp/WordPress:ThinkingTeapot?algorithm=SHA1&digits=6&issuer=WordPress&period=30&secret=S55IFILZLA6DESAO
otpauth://totp/Google:[email protected]?algorithm=SHA1&digits=6&issuer=Google&period=30&secret=QJV3EN5JJJHGQ4PK3M6E576YMWUC5D4X
...
これの secret パラメータがそれ。base32 でエンコードされた文字列です。
👉 RFC 6238: TOTP: Time-Based One-Time Password Algorithm ![hatena-bookmark](https://b.hatena.ne.jp/entry/image/https://www.rfc-editor.org/rfc/rfc6238)
他のTOTPジェネレータにも登録しておくと安心できます。
![](https://i0.wp.com/android.benigumo.com/wp-content/uploads/2023/03/220434.png?ssl=1)
👉 「GitHub」で2要素認証の義務化、3月13日から - ケータイ Watch ![hatena-bookmark](https://b.hatena.ne.jp/entry/image/https://k-tai.watch.impress.co.jp/docs/news/1485011.html)