gcpsp

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedStatus     = errors.New("unexpected status")
	ErrUnexpectedStatusCode = errors.New("received unexpected status code")
	ErrScoreIsTooLow        = errors.New("score is too low")
)

Functions

This section is empty.

Types

type GetStampsResponse

type GetStampsResponse struct {
	Items []Stamp `json:"items"`
}

GetStampsResponse is a data that is returned by Gitcoin Passport with stamps

type GitcoinPassport

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

GitcoinPassport is an identity provider

func NewIdentityProvider

func NewIdentityProvider(
	logger *logan.Entry,
	settings *config.GitcoinPassportSettings,
	masterQ data.MasterQ,
	ctx context.Context,
	issuer issuer.Issuer,
) *GitcoinPassport

NewIdentityProvider creates a new GitcoinPassport instance

func (*GitcoinPassport) Verify

func (g *GitcoinPassport) Verify(
	user *data.User, verifyDataRaw []byte,
) (*issuer.IdentityProvidersCredentialSubject, []byte, error)

type ProviderData

type ProviderData struct {
	Address string  `json:"address"`
	Score   string  `json:"score"`
	Stamps  []Stamp `json:"stamps"`
}

ProviderData is a data that is returned by Gitcoin Passport

type Stamp

type Stamp struct {
	Version    string `json:"version"`
	Credential struct {
		Type  []string `json:"type"`
		Proof struct {
			Jws                string `json:"jws"`
			Type               string `json:"type"`
			Created            string `json:"created"`
			ProofPurpose       string `json:"proofPurpose"`
			VerificationMethod string `json:"verificationMethod"`
		} `json:"proof"`
		Issuer            string   `json:"issuer"`
		Context           []string `json:"@context"`
		IssuanceDate      string   `json:"issuanceDate"`
		ExpirationDate    string   `json:"expirationDate"`
		CredentialSubject struct {
			Id      string `json:"id"`
			Hash    string `json:"hash"`
			Context []struct {
				Hash     string `json:"hash"`
				Provider string `json:"provider"`
			} `json:"@context"`
			Provider string `json:"provider"`
		} `json:"credentialSubject"`
	} `json:"credential"`
	Metadata *struct {
		Group    string `json:"group"`
		Platform struct {
			Id             string `json:"id"`
			Icon           string `json:"icon"`
			Name           string `json:"name"`
			Description    string `json:"description"`
			ConnectMessage string `json:"connectMessage"`
		} `json:"platform"`
		Name        string `json:"name"`
		Description string `json:"description"`
		Hash        string `json:"hash"`
	} `json:"metadata,omitempty"`
}

Stamp is a user data that is returned by Gitcoin Passport

type SubmitPassportRequest

type SubmitPassportRequest struct {
	ScorerId int    `json:"scorer_id"`
	Address  string `json:"address"`
}

SubmitPassportRequest is a data that is sent to Gitcoin Passport

type SubmitPassportResponse

type SubmitPassportResponse struct {
	Address string `json:"address"`
	Score   string `json:"score"`
	Status  string `json:"status"`
}

SubmitPassportResponse is a data that is returned by Gitcoin Passport with status of request

type VerificationData

type VerificationData resources.GitcoinPassportData

VerificationData is a data that is required by Gitcoin Passport to verify a user

func (VerificationData) Validate

func (v VerificationData) Validate() error

Validate is a method that validates VerificationData

Jump to

Keyboard shortcuts

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