Skip to main content

Fernet Encryption CLI tool

Project description

fernet-encrypt PyPI Docker PyPiStats PyPi

A Fernet encryption CLI tool with a free, open source, remote API

Install

Use pipx to install globally in an isolated python environment.

pipx install fernet-encrypt

Usage

 Usage: fernet-encrypt [OPTIONS] COMMAND [ARGS]...

╭─ Options ───────────────────────────────────────────────────────────────────────────────────╮
│ --install-completion          Install completion for the current shell.                     │
│ --show-completion             Show completion for the current shell, to copy it or          │
│                               customize the installation.                                   │
│ --help                        Show this message and exit.                                   │
╰─────────────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ──────────────────────────────────────────────────────────────────────────────────╮
│ login              Sign up or Login to https://fernet-encrypt.tysonholub.com                │
│ get-keys           Sync remote keys to fernet-encrypt local key storage                     │
│ create-local-key   Create a new local storage Fernet key                                    │
│ encrypt            Encrypt stdin using local key storage or remote API keys                 │
│ decrypt            Decrypt stdin using local key storage or remote API keys                 │
╰─────────────────────────────────────────────────────────────────────────────────────────────╯

login

Interactively login or create a new account

$ fernet-encrypt login

Or, pass a --refresh-token to generate a new access_token without logging in (useful for automation). A refresh_token can be pulled from the .fernet-encrypt file generated by logging in (in package install location)

$ fernet-encrypt login --refresh-token=your-token

get-keys

Sync remote encryption keys to your local package

$ fernet-encrypt get-keys

Or, use --stdout to print the JSON response without syncing to your local package

$ fernet-encrypt get-keys --stdout

create-fernet-key

Create a new local key for encryption

$ fernet-encrypt create-local-key

encrypt

Encrypt stdin data using local key storage.

$ echo "some-data" | fernet-encrypt encrypt

Or, use --remote to use remote API keys to encrypt. You should pass a --name to more easily identify your keys in the web portal

$ echo "some-data" | fernet-encrypt encrypt --name "some-name" --remote

decrypt

Decrypt stdin data using local key storage.

$ cat encrypted.out | fernet-encrypt decrypt

Or, use --remote to use remote API keys to decrypt.

$ cat encrypted.out | fernet-encrypt decrypt --remote

full circle

You can redirect the output to a file or pipe it into another command

$ echo "some-data" | fernet-encrypt encrypt --name "some-name" --remote | base64 -w0 > b64.out
$ base64 -d b64.out | fernet-encrypt decrypt --remote
some-data

In the web portal you should see a filename some-name. If you upload the encryption data, you will download a file named some-name containing some-data

$ base64 -d b64.out > encrypted.out

Dev Prerequisites

  • python 3.12
  • pipx, an optional tool for prerequisite installs
  • poetry (install globally with pipx install poetry)
  • flake8 (install globally with pipx install flake8)
    • flake8-bugbear extension (install with pipx inject flake8 flake8-bugbear)
    • flake8-naming extension (install with pipx inject flake8 pep8-naming)
  • black (install globally with pipx install black)
  • pre-commit (install globally with pipx install pre-commit)
  • just, a Justfile command runner

Windows

Justfile support for Windows requires cygwin. Once installed your PATH will need to be updated to resolve cygpath.exe (probably C:\cygwin64\bin). Justfile will forward any targets with shebangs starting with / to cygwin for execution.

Consider using a bash terminal through WSL instead.

Updating python version:

  • Update python version in Dev Prerequisites above
  • Update [tool.poetry.dependencies] section of pyproject.toml
  • Update pyupgrade hook in .pre-commit-config.yaml
  • Update python version in .gitlab-ci.yml

Justfile Targets

  • install: installs poetry dependencies and pre-commit git hooks
  • update_boilerplate: fetches and applies updates from the boilerplate remote
  • test: runs pytest with test coverage report

Boilerplate

To support pulling updates from the pyplate python boilerplate, add the boilerplate git remote:

git remote add boilerplate git@gitlab.com:tysonholub/pyplate.git

Then moving forward, run just update_boilerplate to pull latest changes from the boilerplate remote. NOTE: you must keep the boilerplate remote history intact to successfully merge updates from the boilerplate remote.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fernet_encrypt-2.0.0.tar.gz (7.0 kB view details)

Uploaded Source

Built Distribution

fernet_encrypt-2.0.0-py3-none-any.whl (8.6 kB view details)

Uploaded Python 3

File details

Details for the file fernet_encrypt-2.0.0.tar.gz.

File metadata

  • Download URL: fernet_encrypt-2.0.0.tar.gz
  • Upload date:
  • Size: 7.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Linux/5.15.154+

File hashes

Hashes for fernet_encrypt-2.0.0.tar.gz
Algorithm Hash digest
SHA256 735811f86e95ce096085e3065cfef5230241486164a917efd9e6269865cbe7b7
MD5 3d6179ce5a3feaf3277e921145594a7a
BLAKE2b-256 452fe2ec3f41ea522a3d1c9a97907717d3c47d0e8eb9eaa56cd3a3e8783a0004

See more details on using hashes here.

File details

Details for the file fernet_encrypt-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: fernet_encrypt-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 8.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.1 CPython/3.13.2 Linux/5.15.154+

File hashes

Hashes for fernet_encrypt-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5170734120dee0361aa72d942f203e3fedda55f734e6832c63cc6ebb0655151c
MD5 de06e02314aed7cfadba183e3a9e0009
BLAKE2b-256 d50e968e0b743308c0f7efe470d13317ca6c402a77e756eb0cd4a301241c948d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page