creds

package
v0.40.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2022 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	B32CharEncoding = "0123456789abcdefghijklmnopqrstuv"

	B32EncodedPubKeyLen = 52
	B32EncodedKeyIdLen  = 45

	JWTKIDHeader = "kid"
	JWTAlgHeader = "alg"
)
View Source
const (
	JWKFileExtension = ".jwk"
)

Variables

View Source
var B32CredsByteSet = set.NewByteSet([]byte(B32CharEncoding))
View Source
var B32CredsEncoding = base32.NewEncoding(B32CharEncoding).WithPadding(base32.NoPadding)
View Source
var EmptyCreds = DoltCreds{}
View Source
var ErrBadB32CredsEncoding = errors.New("bad base32 credentials encoding")
View Source
var ErrCredsNotFound = errors.New("credentials not found")

Functions

func JWKCredSerialize

func JWKCredSerialize(dc DoltCreds) ([]byte, error)

func JWKCredsWrite

func JWKCredsWrite(wr io.Writer, dc DoltCreds) error

func JWKCredsWriteToDir

func JWKCredsWriteToDir(fs filesys.Filesys, dir string, dc DoltCreds) (string, error)

func PubKeyStrToKIDStr

func PubKeyStrToKIDStr(pub string) (string, error)

func PubKeyToKID

func PubKeyToKID(pub []byte) []byte

func PubKeyToKIDStr

func PubKeyToKIDStr(pub []byte) string

Types

type DoltCreds

type DoltCreds struct {
	PubKey  []byte
	PrivKey []byte
	KeyID   []byte
}

func GenerateCredentials

func GenerateCredentials() (DoltCreds, error)

func JWKCredsDeserialize

func JWKCredsDeserialize(data []byte) (DoltCreds, error)

func JWKCredsRead

func JWKCredsRead(rd io.Reader) (DoltCreds, error)

func JWKCredsReadFromFile

func JWKCredsReadFromFile(fs filesys.Filesys, path string) (DoltCreds, error)

func (DoltCreds) GetRequestMetadata

func (dc DoltCreds) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error)

func (DoltCreds) HasPrivKey

func (dc DoltCreds) HasPrivKey() bool

func (DoltCreds) IsPrivKeyValid

func (dc DoltCreds) IsPrivKeyValid() bool

func (DoltCreds) IsPubKeyValid

func (dc DoltCreds) IsPubKeyValid() bool

func (DoltCreds) KeyIDBase32Str

func (dc DoltCreds) KeyIDBase32Str() string

func (DoltCreds) PrivKeyBase32Str

func (dc DoltCreds) PrivKeyBase32Str() string

func (DoltCreds) PubKeyBase32Str

func (dc DoltCreds) PubKeyBase32Str() string

func (DoltCreds) RequireTransportSecurity

func (dc DoltCreds) RequireTransportSecurity() bool

func (DoltCreds) Sign

func (dc DoltCreds) Sign(data []byte) []byte

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL