keychain

package
v0.0.0-...-9ec35af Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 26, 2013 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Provides an API to access an operating system's keychain securely.

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func Credentials

func Credentials(server string) (username string, password string, err error)

Gets the username and password for the given hostname e.g. "example.com"

Example
// Get credentials
HOSTNAME := "bitbucket.org"
acct, pw, err := keychain.Credentials(HOSTNAME)
handle(err, "Failed to get credentials for "+HOSTNAME)

// Prepare HTTP request to router
req, err := http.NewRequest("GET", PAGE, nil)
handle(err, "Failed to create new request to "+PAGE)
req.SetBasicAuth(acct, pw)

resp, err := http.DefaultClient.Do(req)
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL