Skip to content
This repository has been archived by the owner on Jul 5, 2024. It is now read-only.

Add support for saving and reloading encrypted backup file #26

Merged

Conversation

cyril42e
Copy link
Contributor

@cyril42e cyril42e commented Jan 15, 2023

Thanks for this great tool, I wanted to use this code to keep encrypted backup files of my tokens, so I made some modifications and then tried to make them clean so that it can be useful to others:

Added two command line arguments (with default values the behavior is unchanged):

  • -save in order to save the encrypted backup file as json. In this case the decryption and console display of the tokens are disabled so that backup password is not required.
  • -load in order to load an encrypted backup file instead of fetching it from the server

I'll add some documentation if you are ok with merging this. I would advise to "hide whitespace" in the "diff view" for the review, as most of the changes are indented lines that are now in if blocks.

It's my first time reading or writing Go, so don't hesitate to advise improvements!

Copy link
Owner

@alexzorin alexzorin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks like a useful change and I'd be happy to merge it. Just a few pieces of feedback.

cmd/authy-export/authy-export.go Outdated Show resolved Hide resolved
cmd/authy-export/authy-export.go Outdated Show resolved Hide resolved
cmd/authy-export/authy-export.go Outdated Show resolved Hide resolved
cmd/authy-export/authy-export.go Outdated Show resolved Hide resolved
objects.go Outdated Show resolved Hide resolved
cmd/authy-export/authy-export.go Outdated Show resolved Hide resolved
Added two command line arguments (with default values the behavior is unchanged):
- `-save` with a filepath in order to save the encrypted backup file as json.
  In this case the decryption and console display of the
  tokens are disabled so that backup password is not required.
- `-load` in order to load an encrypted backup file instead of
  fetching it from the server
@cyril42e cyril42e force-pushed the add-encrypted-backup-file-support branch from c2ad78d to 00ea01b Compare January 16, 2023 22:12
Copy link
Contributor Author

@cyril42e cyril42e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great, thanks for the tips, I applied them and added a few lines of documentation, feel free to make other suggestions!

cmd/authy-export/authy-export.go Outdated Show resolved Hide resolved
cmd/authy-export/authy-export.go Outdated Show resolved Hide resolved
- Don't add a new struct in the interface just for local usage, use unnamed struct instead
- Check error code
- Apply gofmt

Co-authored-by: alexzorin <alex@zorin.au>
@cyril42e cyril42e force-pushed the add-encrypted-backup-file-support branch from 00ea01b to 87e4524 Compare January 16, 2023 22:24
@alexzorin alexzorin merged commit c4f25fd into alexzorin:master Jan 17, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants