Skip to content

Getting Started

Edoardo Tenani edited this page Aug 2, 2022 · 3 revisions

This page will guide you in adding your first secret to 2ami and generating your first token.

Before continuing, make sure 2ami is installed and available in your CLI by running 2ami.

This guide expects you to have a secret you want to use (maybe it's the right time to add 2FA to one of your account or to update the configurations? 😉), but if that's not the case, you can use this fake secret: ORSXG5A=.

This is the first thing to note about this tool: it does not uses QR code images (as most of the other ones) but the string representation of the secret. Why? Because is a CLI tool, and passing it an image is more complex than copy/pasting the secret, which generally is available next to the QR code (look for "add your secret manually" or "show the secret" kind of wording).

The second thing to note is that currently it supports only TOTP tokens (time-based tokens) and not HOTP (event-based, with a counter).

Once you have the secret, add it to 2ami by running:

$ 2ami add MyService

and pasting the secret when asked for it (pasting the secret prevent you from passing it a parameter in the CLI, which would risk leaking the secret on the file system - shell history, and persisting it),

Verify the secret has been added with 2ami list:

$ 2ami list
MyService

You're now ready to create your first token! Run

$ 2ami generate MyService
413228

and 🤯 DONE.

2ami did some assumptions for you:

  1. the length of the token to be generated is 6 by default, but you can configure it when adding the secret passing a value to the --digits flag;
  2. the interval at which the token is renewed is 30 seconds by default, you can configure it when adding the secret passing a value to the --interval flag.

You can now add more secrets! 🔒

Clone this wiki locally