hydroxide-push/cmd/hydroxide/hydroxide.go

41 lines
648 B
Go
Raw Normal View History

2017-08-22 01:04:16 +03:00
package main
import (
"bufio"
"fmt"
"log"
"os"
"github.com/emersion/hydroxide/protonmail"
)
func main() {
c := &protonmail.Client{
RootURL: "https://dev.protonmail.com/api",
AppVersion: "Web_3.11.1",
ClientID: "Web",
ClientSecret: "4957cc9a2e0a2a49d02475c9d013478d",
}
scanner := bufio.NewScanner(os.Stdin)
fmt.Printf("Username: ")
scanner.Scan()
username := scanner.Text()
fmt.Printf("Password: ")
scanner.Scan()
password := scanner.Text()
fmt.Printf("2FA code: ")
scanner.Scan()
code := scanner.Text()
2017-08-22 10:41:47 +03:00
auth, err := c.Auth(username, password, code, nil)
2017-08-22 01:04:16 +03:00
if err != nil {
log.Fatal(err)
}
2017-08-22 10:41:47 +03:00
log.Println(auth)
2017-08-22 01:04:16 +03:00
}