Documentation ¶
Overview ¶
Package vault manages encryption for sl1cmd 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 CryptP string // encrypted API password DcryptP string // decrypted API password CryptJSON string DcryptJSON string B64 string `json:"b64"` // base64 mask to be used by API calls UserAPI string `json:"user"` // API username URL string `json:"url"` // API URL }
Credential is an abstraction to credential vault
func (*Credential) ReadFile ¶
func (c *Credential) ReadFile() error
ReadFile reads the credential vault and unmarshal it.
Example ¶
package main import ( "fmt" "github.com/marco-ostaska/sl1cmd/pkg/sl1/vault" ) func main() { var vCred vault.Credential if err := vCred.ReadFile(); err != nil { fmt.Println(err) } fmt.Println("User:", vCred.UserAPI) fmt.Println("Pass:", vCred.DcryptP) }
Output: User: myUser Pass: myPass@#$%^&*
func (*Credential) SetInfo ¶
func (c *Credential) SetInfo(user, passwd, url string) error
SetInfo set provided information to credential vault
Example ¶
package main import ( "fmt" "github.com/marco-ostaska/sl1cmd/pkg/sl1/vault" ) func main() { var vCred vault.Credential if err := vCred.SetInfo("myUser", "myPass@#$%^&*", "https://sl1api/"); err != nil { fmt.Println(err) } }
Output:
func (*Credential) UserInfo ¶
func (c *Credential) UserInfo() error
UserInfo parse HomeDir, Username, Hostname and File to vault.Credential
Click to show internal directories.
Click to hide internal directories.