-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Public interface documentation fixed
This removes the build constraint from the main interface file `wincred.go` to have the documentation available again on godoc.org. Stubs for the system call functions have been added for unsupported platforms (everything else than windows). The examples have been extracted so a separate file.
- Loading branch information
1 parent
ab1dbd1
commit 1dcb5a2
Showing
6 changed files
with
81 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// +build !windows | ||
|
||
package wincred | ||
|
||
func utf16ToByte(...interface{}) []byte { | ||
return nil | ||
} | ||
|
||
func utf16FromString(...interface{}) []uint16 { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package wincred | ||
|
||
import "fmt" | ||
|
||
func ExampleList() { | ||
if creds, err := List(); err == nil { | ||
for _, cred := range creds { | ||
fmt.Println(cred.TargetName) | ||
} | ||
} | ||
} | ||
|
||
func ExampleGetGenericCredential() { | ||
if cred, err := GetGenericCredential("myGoApplication"); err == nil { | ||
fmt.Println(cred.TargetName, string(cred.CredentialBlob)) | ||
} | ||
} | ||
|
||
func ExampleGenericCredential_Delete() { | ||
cred, _ := GetGenericCredential("myGoApplication") | ||
if err := cred.Delete(); err == nil { | ||
fmt.Println("Deleted") | ||
} | ||
} | ||
|
||
func ExampleGenericCredential_Write() { | ||
cred := NewGenericCredential("myGoApplication") | ||
cred.CredentialBlob = []byte("my secret") | ||
if err := cred.Write(); err == nil { | ||
fmt.Println("Created") | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// +build !windows | ||
|
||
package wincred | ||
|
||
import "errors" | ||
|
||
const ( | ||
sysCRED_TYPE_GENERIC = 0 | ||
sysCRED_TYPE_DOMAIN_PASSWORD = 0 | ||
sysCRED_TYPE_DOMAIN_CERTIFICATE = 0 | ||
sysCRED_TYPE_DOMAIN_VISIBLE_PASSWORD = 0 | ||
sysCRED_TYPE_GENERIC_CERTIFICATE = 0 | ||
sysCRED_TYPE_DOMAIN_EXTENDED = 0 | ||
|
||
sysERROR_NOT_FOUND = "" | ||
) | ||
|
||
func sysCredRead(...interface{}) (*Credential, error) { | ||
return nil, errors.New("Operation not supported") | ||
} | ||
|
||
func sysCredWrite(...interface{}) error { | ||
return errors.New("Operation not supported") | ||
} | ||
|
||
func sysCredDelete(...interface{}) error { | ||
return errors.New("Operation not supported") | ||
} | ||
|
||
func sysCredEnumerate(...interface{}) ([]*Credential, error) { | ||
return nil, errors.New("Operation not supported") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters