{"id":27639825,"url":"https://github.com/dbohdan/age-edit","last_synced_at":"2025-04-23T22:34:39.131Z","repository":{"id":268380704,"uuid":"904155767","full_name":"dbohdan/age-edit","owner":"dbohdan","description":"Edit files encrypted with age","archived":false,"fork":false,"pushed_at":"2025-02-07T16:25:23.000Z","size":44,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-07T16:35:16.516Z","etag":null,"topics":["age","age-encryption","go","golang"],"latest_commit_sha":null,"homepage":"","language":"Go","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/dbohdan.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-12-16T11:01:38.000Z","updated_at":"2025-01-26T11:41:35.000Z","dependencies_parsed_at":"2024-12-16T12:32:56.348Z","dependency_job_id":"0ecbb895-70ba-4269-8a09-3d5788c72902","html_url":"https://github.com/dbohdan/age-edit","commit_stats":null,"previous_names":["dbohdan/age-edit"],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fage-edit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fage-edit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fage-edit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dbohdan%2Fage-edit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dbohdan","download_url":"https://codeload.github.com/dbohdan/age-edit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250528204,"owners_count":21445507,"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":["age","age-encryption","go","golang"],"created_at":"2025-04-23T22:34:38.384Z","updated_at":"2025-04-23T22:34:39.105Z","avatar_url":"https://github.com/dbohdan.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# age-edit\n\nage-edit is an editor wrapper for files encrypted with [age](https://github.com/FiloSottile/age).\nage-edit is made primarily for Linux and uses `/dev/shm/` by default.\nHowever, it supports and is automatically tested on FreeBSD, macOS, NetBSD, OpenBSD, and Windows.\nIt is left to the user to choose a temporary directory prefix on those systems.\n\nHere is how age-edit works.\nWhen you run age-edit with a private-keys file and an encrypted file as arguments, it performs the following steps:\n\n1. Decrypt the contents of the file encrypted with age to a temporary file using one of the private keys.\n2. Run an editor on the temporary file.\n   (The default editor is [`VISUAL` or `EDITOR`](https://unix.stackexchange.com/questions/4859/visual-vs-editor-what-s-the-difference), but it can be, e.g., LibreOffice.)\n3. Wait for the editor to exit.\n4. Encrypt the temporary file with public keys derived from the private keys.\n   The encrypted file can be optionally \"armored\": stored as ASCII text in the [PEM](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) format.\n5. Finally, delete the temporary file.\n\nIn other words, age-edit implements\n[a](https://wiki.tcl-lang.org/39218)\n\"[with](https://www.python.org/dev/peps/pep-0343/)\"\n[pattern](https://clojuredocs.org/clojure.core/with-open).\n\nIf any error occurs between step 4 and 5, age-edit waits for you to press Enter to delete the temporary file.\nThis gives you an opportunity to save the edited version of the file so you don't lose your edits.\n\nage-edit is beta-quality software.\n\n## Dependencies\n\n### Build\n\n- Go 1.21\n\n### Runtime\n\n- Optional: a temporary filesystem mounted on `/dev/shm/`.\n  It is usually present on Linux with glibc.\n\n## Installation\n\n```shell\ngo install dbohdan.com/age-edit@latest\n```\n\n## Usage\n\n```none\nUsage: age-edit [options] identities encrypted-file\n\nOptions:\n  -a, --armor             write armored age file\n  -e, --editor string     command to use for editing the encrypted file\n  -r, --read-only         discard all changes\n  -t, --temp-dir string   temporary directory prefix (default \"/dev/shm/\")\n  -v, --version           report the program version and exit\n  -w, --warn int          warn if the editor exits after less than a number seconds (zero to disable)\n```\n\n## Editing compressed files\n\nWith a shell script like this, you can edit compressed files using age-edit.\nGive age-edit the path to the shell script as `--editor`.\n\n```shell\n#! /bin/sh\nset -eu\n\ncd \"$(dirname \"$(realpath \"$1\")\")\"\ndecompressed=$(dirname \"$1\")/dc-$(basename \"$1\")\n\n# Decompress if not empty.\nif [ -s \"$1\" ]; then\n    zstd -d \u003c \"$1\" \u003e \"$decompressed\"\nfi\n\"${VISUAL:-${EDITOR:-vi}}\" \"$decompressed\"\nzstd -7 --long \u003c \"$decompressed\" \u003e \"$1\"\n```\n\n## Security and other considerations\n\nThe age identities (private keys) from the keyfile are kept in memory while the encrypted file is being edited.\nOn POSIX systems, the program locks its memory pages using [`mlockall`](https://pubs.opengroup.org/onlinepubs/9799919799/functions/mlockall.html) to prevent being swapped to disk.\nThe process memory may be saved in unencrypted swap if the system is suspended to disk.\nNo attempt to prevent the swapping of the process is made on non-POSIX systems like Windows.\n\nThe decrypted contents of the file is stored by default in the directory `/dev/shm/${USER}/age-edit/`.\nYou can change this to `/custom/path/${USER}/age-edit/`.\nOther programs run by the same user can access the decrypted file contents.\n`/dev/shm/` can be swapped out.\n\nage-edit doesn't work with multi-document editors.\n\n## License\n\nMIT.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbohdan%2Fage-edit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdbohdan%2Fage-edit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdbohdan%2Fage-edit/lists"}