github

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: Nov 25, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RepoForPath

func RepoForPath(path string) (string, string)

func RepoForURL

func RepoForURL(u url.URL) (string, string)

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, cfg config.GithubConfig) (Client, error)

func (Client) CreateAccessToken

func (c Client) CreateAccessToken(ctx context.Context, repositoryURL string) (string, time.Time, error)

type KMSClient

type KMSClient interface {
	Sign(ctx context.Context, in *kms.SignInput, optFns ...func(*kms.Options)) (*kms.SignOutput, error)
}

KMSClient defines the AWS API surface required by the KMSSigner.

type KMSSigner

type KMSSigner struct {
	ARN    string
	Method jwt.SigningMethod
}

KMSSigner defines a Signer compatible with the ghinstallation plugin that uses KMS to sign the JWT. KMS signing ensures that the private key is never exposed to the application.

func NewAWSKMSSigner

func NewAWSKMSSigner(ctx context.Context, arn string) (KMSSigner, error)

func NewKMSSigner

func NewKMSSigner(client KMSClient, arn string) KMSSigner

func (KMSSigner) Sign

func (s KMSSigner) Sign(claims jwt.Claims) (string, error)

type KMSSigningMethod

type KMSSigningMethod struct {
	// contains filtered or unexported fields
}

Defines a golang-jwt compatible signing method that uses AWS KMS.

func NewSigningMethod

func NewSigningMethod(client KMSClient) KMSSigningMethod

func (KMSSigningMethod) Alg

func (k KMSSigningMethod) Alg() string

Alg returns the signing algorithm allowed for this method, which is "RS256".

func (KMSSigningMethod) Sign

func (k KMSSigningMethod) Sign(signingString string, key any) (string, error)

Sign uses AWS KMS to sign the given string with the provided key (the string ARN of the KMS key to use). This will fail if the current AWS user does not have permission to sign the key, or if KMS cannot be reached, or if the key doesn't exist.

func (KMSSigningMethod) Verify

func (k KMSSigningMethod) Verify(signingString string, signature string, key interface{}) error

Jump to

Keyboard shortcuts

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