Documentation
¶
Overview ¶
Package uvault creates simple user vaults for credentials
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Credential ¶
type Credential struct { HomeDir string // local user home directory Username string // local user name Hostname string // local hostname File string // credential vault file full path CryptedKValue string // encrypted API password or API key value DecryptedKValue string // decrypted API password or API key valeu CryptJSON string DcryptJSON string B64 string `json:"b64"` // base64 mask to be used by API calls APIKey string `json:"key"` // APIKey, may be used for APIkey, username, in case of basic auth URL string `json:"url"` // API URL }
Credential is an abstraction to credential vault
func (*Credential) ReadFile ¶
func (c *Credential) ReadFile(dirVault, fileVault string) error
ReadFile reads the credential vault and unmarshal it.
Example ¶
package main import ( "fmt" "github.com/marco-ostaska/uvault" ) func main() { var vCred uvault.Credential if err := vCred.ReadFile("uvault", "uvault"); err != nil { fmt.Println(err) } fmt.Println("User:", vCred.APIKey) fmt.Println("Pass:", vCred.DecryptedKValue) }
Output: User: myUser Pass: myPass@#$%^&*
func (*Credential) SetInfo ¶
func (c *Credential) SetInfo(apiKey, keyValue, url, dirVault, fileVault string) error
SetInfo set provided information to credential vault
apiKey and keyValue are the API key and Key Value (username and password in case of Baic Auth)
Example ¶
package main import ( "fmt" "github.com/marco-ostaska/uvault" ) func main() { var vCred uvault.Credential if err := vCred.SetInfo("myUser", "myPass@#$%^&*", "https://xyz.ww/", "uvault", "uvault"); err != nil { fmt.Println(err) } }
Output:
func (*Credential) UserInfo ¶
func (c *Credential) UserInfo(dirVault, fileVault string) error
UserInfo parse HomeDir, Username, Hostname and File to vault.Credential
Click to show internal directories.
Click to hide internal directories.