Ejemplo n.º 1
0
func set_value(service, path, value string) {
	err := keyring.Set(service, path, value)
	if err != nil {
		fmt.Println("error:", err)
		os.Exit(1)
	}
}
Ejemplo n.º 2
0
func main() {
	if pw, err := keyring.Get("keyring_example", "jack"); err == nil {
		fmt.Println("current stored password:"******"no password stored yet")
	} else {
		fmt.Println("got unexpected error:", err)
		os.Exit(1)
	}
	pw, err := gopass.GetPass("enter new password: "******"setting keyring_example/jack to..", pw)
	err = keyring.Set("keyring_example", "jack", pw)
	if err != nil {
		fmt.Println(err)
		os.Exit(1)
	}
	fmt.Println("fetching keyring_example/jack..")
	if pw, err := keyring.Get("keyring_example", "jack"); err == nil {
		fmt.Println("got", pw)
	} else {
		fmt.Println("error:", err)
	}
}
Ejemplo n.º 3
0
func ExampleGet() {
	keyring.Set("keyring-test", "jack", "test password")
	pw, _ := keyring.Get("keyring-test", "jack")
	fmt.Println("pw:", pw)
	// don't ignore errors like this in your code
	// Output:
	// pw: test password
}