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

Commit

Permalink
Added batch support (#11)
Browse files Browse the repository at this point in the history
  • Loading branch information
lzap authored Oct 19, 2020
1 parent 0b20237 commit 84eadf0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
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

0 comments on commit 84eadf0

Please sign in to comment.