Go wrapper around the Windows Credential Manager API functions.
go get github.com/danieljoos/wincred
See the following examples:
package main
import (
"fmt"
"github.com/danieljoos/wincred"
)
func main() {
cred := wincred.NewGenericCredential("myGoApplication")
cred.CredentialBlob = []byte("my secret")
err := cred.Write()
if err != nil {
fmt.Println(err)
}
}
package main
import (
"fmt"
"github.com/danieljoos/wincred"
)
func main() {
cred, err := wincred.GetGenericCredential("myGoApplication")
if err == nil {
fmt.Println(string(cred.CredentialBlob))
}
}
package main
import (
"fmt"
"github.com/danieljoos/wincred"
)
func main() {
cred, err := wincred.GetGenericCredential("myGoApplication")
if err != nil {
fmt.Println(err)
return
}
cred.Delete()
}
package main
import (
"fmt"
"github.com/danieljoos/wincred"
)
func main() {
creds, err := wincred.List()
if err != nil {
fmt.Println(err)
return
}
for i := range(creds) {
fmt.Println(creds[i].TargetName)
}
}