{"id":23016529,"url":"https://github.com/alexdesousa/oath","last_synced_at":"2025-07-14T03:40:31.291Z","repository":{"id":78371657,"uuid":"238757040","full_name":"alexdesousa/oath","owner":"alexdesousa","description":"Zsh plugin to manage one-time passwords.","archived":false,"fork":false,"pushed_at":"2020-06-19T14:34:44.000Z","size":18,"stargazers_count":8,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-05-02T01:55:50.954Z","etag":null,"topics":["2fa","zsh-plugin"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/alexdesousa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null},"funding":{"github":["alexdesousa"]}},"created_at":"2020-02-06T18:32:49.000Z","updated_at":"2023-02-17T18:21:43.000Z","dependencies_parsed_at":null,"dependency_job_id":"fc331a56-1227-425e-946a-9713e9e317d4","html_url":"https://github.com/alexdesousa/oath","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdesousa%2Foath","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdesousa%2Foath/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdesousa%2Foath/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/alexdesousa%2Foath/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/alexdesousa","download_url":"https://codeload.github.com/alexdesousa/oath/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229810600,"owners_count":18127675,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["2fa","zsh-plugin"],"created_at":"2024-12-15T11:16:42.659Z","updated_at":"2024-12-15T11:16:43.996Z","avatar_url":"https://github.com/alexdesousa.png","language":"Shell","funding_links":["https://github.com/sponsors/alexdesousa"],"categories":["Plugins"],"sub_categories":["ZSH on Windows"],"readme":"# Oath\n\n\u003e A solemn pledge or promise, appealing to a deity, a ruler, or another entity\n\u003e (not necessarily present) to attest to the truth of a statement or sincerity\n\u003e of one's desire to fulfill a contract or promise.\n\n`Oath` is an [Oh My ZSH](https://ohmyz.sh/) plugin that manages 2FA\nauthentication 6 digit tokens. It's highly inspired in\n[this article.](https://www.cyberciti.biz/faq/use-oathtool-linux-command-line-for-2-step-verification-2fa/)\n\n## Pre-requisites\n\n`Oath` pre-requisites are as follows:\n\n- `oathtool` for generating 6 digit tokens.\n- `gnupg2` for handling private keys securely.\n- `xclip` for copying to clipboard.\n- An RSA 4096 bits long key (check [this section](#generating-a-key) for\n  generating a key).\n\n## Small Example\n\n`Oath` allows to add, remove keys as well as show the temporal 6 digit token\ne.g:\n\n- Adding a new key for a domain e.g. for `twitter.com`:\n\n  ```bash\n  ~ $ oath add twitter.com\n  Private Key:\n  [SUCESS]  Key created for twitter.com\n  ```\n\n- Deleting a key for a domain e.g. for `twitter.com`:\n\n  ```bash\n  ~ $ oath delete twitter.com\n  [WARN]    Deleting $OATH_DIR/.oath/twitter.com/424184E122529120CC1821756759ADDD12CB6379.gpg\n  [WARN]    Deleting $OATH_DIR/.oath/twitter.com\n  [SUCCESS]  Key deleted for twitter.com\n  ```\n\n- Showing (and copying to clipboard) the current 6 digit token e.g. for `twitter.com`:\n\n  ```bash\n  ~ $ oath twitter.com\n  012345\n  [SUCCESS]  Code copied to clipboard\n  ```\n\n- Showing (and copying to clipboard) the key for a domain e.g. for `twitter.com`:\n\n  ```bash\n  ~ $ oath pk twitter.com\n  SomePrivateKey\n  [SUCCESS]  Private key copied to clipboard\n  ```\n\n- Listing keys for all domains e.g:\n\n  ```bash\n  ~ $ oath list twitter.com\n  twitter.com\n  github.com\n  ```\n\n- Updating `Oath` to latest version:\n\n  ```bash\n  ~ $ oath update\n  ```\n\n## Installation\n\nJust clone `Oath` as follows:\n\n```bash\n~ $ git clone \"https://github.com/alexdesousa/oath.git\" \"$ZSH_CUSTOM/plugins/oath\"\n```\n\nAnd add the oath to your `plugins` in `$HOME/.zshrc` file:\n\n```bash\n# Activate completions\nautoload -U +X compinit \u0026\u0026 compinit\nautoload -U +X bashcompinit \u0026\u0026 bashcompinit\n\nplugins=(\n  oath\n)\n\n# Variables for Oath\nexport OATH_KEY=\u003cMy Oath key\u003e\nexport OATH_EMAIL=\u003cMy Oath email\u003e\n```\n\n\u003e **Important**: when updating you can run the following:\n\u003e\n\u003e ```bash\n\u003e cd `$ZSH_CUSTOM/plugins/oath` \u0026\u0026 git pull origin master\n\u003e ```\n\n## Generating a Key\n\nFirst you need to create a key with `gpg2` as follows:\n\n```bash\n$ gpg2 --full-gen-key\n```\n\nThis will prompt several questions:\n\n1. Kind of key: Hit `[Enter]` or choose `1` for `RSA and RSA`:\n\n    ```bash\n    gpg (GnuPG) 2.2.19; Copyright (C) 2019 Free Software Foundation, Inc.\n    This is free software: you are free to change and redistribute it.\n    There is NO WARRANTY, to the extent permitted by law.\n\n    Please select what kind of key you want:\n        (1) RSA and RSA (default)\n        (2) DSA and Elgamal\n        (3) DSA (sign only)\n        (4) RSA (sign only)\n      (14) Existing key from card\n    Your selection? 1\n    ```\n\n2. Key size: `4096` is recommended.\n\n    ```bash\n    RSA keys may be between 1024 and 4096 bits long.\n    What keysize do you want? (3072) 4096\n    Requested keysize is 4096 bits\n    ```\n\n3. Expiration: Choose `0` for no expiration.\n\n    ```bash\n    Please specify how long the key should be valid.\n            0 = key does not expire\n          \u003cn\u003e  = key expires in n days\n          \u003cn\u003ew = key expires in n weeks\n          \u003cn\u003em = key expires in n months\n          \u003cn\u003ey = key expires in n years\n    Key is valid for? (0) 0\n    Key does not expire at all\n    ```\n\n4. Hit `y` if everything is correct.\n\n    ```bash\n    Is this correct? (y/N) y\n    ```\n\n5. Identify the key with:\n\n    ```bash\n    GnuPG needs to construct a user ID to identify your key.\n\n    Real name: Alex de Sousa\n    Email address: alex@example.com\n    Comment: My Oath key\n    You selected this USER-ID:\n        \"Alex de Sousa (My Oath key) \u003calex@example.com\u003e\"\n    ```\n\n6. Hit `o` if everything is correct.\n\n    ```bash\n    Change (N)ame, (C)omment, (E)mail or (O)kay/(Q)uit? o\n    ```\n\n7. Move you mouse to generate entropy:\n\n```bash\nWe need to generate a lot of random bytes. It is a good idea to perform\nsome other action (type on the keyboard, move the mouse, utilize the\ndisks) during the prime generation; this gives the random number\ngenerator a better chance to gain enough entropy.\n```\n\n8. Retrieve your key:\n\n    ```bash\n    gpg: key 6759ADDD12CB6379 marked as ultimately trusted\n    gpg: revocation certificate stored as '/home/alex/.gnupg/openpgp-revocs.d/424184E122529120CC1821756759ADDD12CB6379.rev'\n    public and secret key created and signed.\n\n    pub   rsa4096 2020-02-06 [SC]\n          424184E122529120CC1821756759ADDD12CB6379\n    uid                      Alex de Sousa (Oath key) \u003calex@example.com\u003e\n    sub   rsa4096 2020-02-06 [E]\n    ```\n\nThen we'll only need the `email` and the key `uid` e.g. in our example the\nthe following two values:\n\n- `OATH_EMAIL`: `alex@example.com`\n- `OATH_KEY`: `424184E122529120CC1821756759ADDD12CB6379`\n\n\u003e **Important**: The key will be in your `$HOME/.gnupg` folder. Saving this\n\u003e folder is enough to back it up.\n\n## Author\n\nAlexander de Sousa.\n\n## License\n\n`Oath` is released under the MIT License. See the LICENSE file for further\ndetails.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdesousa%2Foath","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Falexdesousa%2Foath","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Falexdesousa%2Foath/lists"}