mirror of
https://github.com/docker/docker-credential-helpers.git
synced 2026-06-13 16:01:28 +05:30
Add go.mod, and vendor wincred v1.0.0
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
committed by
Tibor Vass
parent
f78081d1f7
commit
f7d32862eb
@@ -0,0 +1 @@
|
||||
*.go text eol=lf
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
# Compiled Object files, Static and Dynamic libs (Shared Objects)
|
||||
*.o
|
||||
*.a
|
||||
*.so
|
||||
|
||||
# Folders
|
||||
_obj
|
||||
_test
|
||||
|
||||
# Architecture specific extensions/prefixes
|
||||
*.[568vq]
|
||||
[568vq].out
|
||||
|
||||
*.cgo1.go
|
||||
*.cgo2.c
|
||||
_cgo_defun.c
|
||||
_cgo_gotypes.go
|
||||
_cgo_export.*
|
||||
|
||||
_testmain.go
|
||||
|
||||
*.exe
|
||||
*.test
|
||||
+98
@@ -0,0 +1,98 @@
|
||||
wincred
|
||||
=======
|
||||
|
||||
Go wrapper around the Windows Credential Manager API functions.
|
||||
|
||||
[](https://ci.appveyor.com/project/danieljoos/wincred/branch/master)
|
||||
[](https://godoc.org/github.com/danieljoos/wincred)
|
||||
|
||||
|
||||
Installation
|
||||
------------
|
||||
|
||||
```Go
|
||||
go get github.com/danieljoos/wincred
|
||||
```
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
See the following examples:
|
||||
|
||||
### Create and store a new generic credential object
|
||||
```Go
|
||||
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)
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Retrieve a credential object
|
||||
```Go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/danieljoos/wincred"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cred, err := wincred.GetGenericCredential("myGoApplication")
|
||||
if err == nil {
|
||||
fmt.Println(string(cred.CredentialBlob))
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Remove a credential object
|
||||
```Go
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/danieljoos/wincred"
|
||||
)
|
||||
|
||||
func main() {
|
||||
cred, err := wincred.GetGenericCredential("myGoApplication")
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
return
|
||||
}
|
||||
cred.Delete()
|
||||
}
|
||||
```
|
||||
|
||||
### List all available credentials
|
||||
```Go
|
||||
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)
|
||||
}
|
||||
}
|
||||
```
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
version: '{build}'
|
||||
clone_folder: c:\gopath\src\github.com\danieljoos\wincred
|
||||
environment:
|
||||
GOPATH: c:\gopath
|
||||
install:
|
||||
- cmd: >-
|
||||
rmdir c:\go /s /q
|
||||
|
||||
appveyor DownloadFile https://storage.googleapis.com/golang/go1.6.1.windows-amd64.msi
|
||||
|
||||
msiexec /i go1.6.1.windows-amd64.msi /q
|
||||
|
||||
go version
|
||||
|
||||
go env
|
||||
|
||||
go get -t
|
||||
build_script:
|
||||
- cmd: go install
|
||||
test_script:
|
||||
- cmd: >-
|
||||
cd %GOPATH%/src/github.com/danieljoos/wincred
|
||||
|
||||
go test -v -cover
|
||||
Reference in New Issue
Block a user