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

Added batch support #11

Merged
merged 1 commit into from
Oct 19, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,10 @@ cat tokens | while IFS= read -r line; do
done
```

**Batch support**

When environment variable named `AUTHY_EXPORT_PASSWORD` exists, `authy-export` does not ask for a password and uses the variable instead. Use with care!

## LICENSE

Copyright Alex Zorin 2019
Expand Down
11 changes: 7 additions & 4 deletions cmd/authy-export/authy-export.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,13 @@ func main() {
}

// We'll need the prompt the user to give the decryption password
log.Printf("Please provide your Authy TOTP backup password: ")
pp, err := terminal.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
log.Fatalf("Failed to read the password: %v", err)
pp := []byte(os.Getenv("AUTHY_EXPORT_PASSWORD"))
if len(pp) == 0 {
log.Printf("Please provide your Authy TOTP backup password: ")
pp, err = terminal.ReadPassword(int(os.Stdin.Fd()))
if err != nil {
log.Fatalf("Failed to read the password: %v", err)
}
}

// Print out in https://github.com/google/google-authenticator/wiki/Key-Uri-Format format
Expand Down