credential

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Jul 10, 2024 License: Apache-2.0 Imports: 12 Imported by: 6

Documentation

Index

Constants

View Source
const (
	InvalidTransactionId = "invalid_transaction_id"
	IssuancePending      = "issuance_pending"
)
View Source
const (
	ProofTypeJWT   = "jwt"
	ProofTypeCWT   = "cwt"
	ProofTypeLDPvP = "ldp_vp"
)
View Source
const (
	//	Credential Error Options
	InvalidCredentialRequest    = "invalid_credential_request"
	UnsupportedCredentialType   = "unsupported_credential_type"
	UnsupportedCredentialFormat = "unsupported_credential_format"
	InvalidProof                = "invalid_proof"
	InvalidEncryptionParameters = "invalid_encryption_parameters"
)

Variables

View Source
var (
	ErrInvalidCredentialRequest    = CredentialErrorResponse{ErrorMsg: InvalidCredentialRequest}
	ErrUnsupportedCredentialType   = CredentialErrorResponse{ErrorMsg: UnsupportedCredentialType}
	ErrUnsupportedCredentialFormat = CredentialErrorResponse{ErrorMsg: UnsupportedCredentialFormat}
	ErrInvalidProof                = CredentialErrorResponse{ErrorMsg: InvalidProof}
	ErrInvalidEncryptionParameters = CredentialErrorResponse{ErrorMsg: InvalidEncryptionParameters}
)

Functions

This section is empty.

Types

type AuthorizationCode

type AuthorizationCode struct {
	IssuerState string `json:"issuer_state"`
}

type CredentialConfiguration

type CredentialConfiguration struct {
	Format                               string                `json:"format"`
	Scope                                string                `json:"scope"`
	CryptographicBindingMethodsSupported []string              `json:"cryptographic_binding_methods_supported"`
	CredentialSigningAlgValuesSupported  []string              `json:"credential_signing_alg_values_supported"`
	CredentialDefinition                 CredentialDefinition  `json:"credential_definition"`
	ProofTypesSupported                  map[string]ProofType  `json:"proof_types_supported"`
	Display                              []LocalizedCredential `json:"display"`

	///Out of OID Spec, but useful
	Schema  map[string]interface{} `json:"schema,omitempty"` //json Schema representation of payload
	Subject string                 `json:"topic,omitempty"`  // Subject of the credential within the system
}

type CredentialDeferredRequest

type CredentialDeferredRequest struct {
	TransactionID string `json:"transaction_id"`
}

type CredentialDefinition

type CredentialDefinition struct {
	Type              []string                     `json:"type"`
	CredentialSubject map[string]CredentialSubject `json:"credentialSubject"`
}

type CredentialErrorResponse

type CredentialErrorResponse struct {
	ErrorMsg  string  `json:"error"`
	ErrorDesc *string `json:"error_description,omitempty"`
}

func (CredentialErrorResponse) Error

func (e CredentialErrorResponse) Error() string

type CredentialOffer

type CredentialOffer struct {
	CredentialOfferUri string `json:"credential_offer_uri,omitempty"`
	CredentialOffer    string `json:"credential_offer,omitempty"`
}

func (*CredentialOffer) GetOfferParameters

func (offering *CredentialOffer) GetOfferParameters() (*CredentialOfferParameters, error)

Extracts the Parameters of the offering link

type CredentialOfferParameters

type CredentialOfferParameters struct {
	CredentialIssuer string   `json:"credential_issuer"`
	Credentials      []string `json:"credential_configuration_ids"`
	Grants           Grants   `json:"grants"`
}
func (offerParameter *CredentialOfferParameters) CreateOfferLink() (*CredentialOffer, error)

func (*CredentialOfferParameters) GetIssuerMetadata

func (offerParameter *CredentialOfferParameters) GetIssuerMetadata() (*IssuerMetadata, error)

type CredentialRequest

type CredentialRequest struct {
	Format               string `json:"format"`
	CredentialIdentifier string `json:"credential_identifier,omitempty"`
	Proof                *Proof `json:"proof,omitempty"`
}

func (*CredentialRequest) CheckRequestValid

func (request *CredentialRequest) CheckRequestValid(audience string, cNonce string, validTypes []string) (*jwt.Token, error)

type CredentialRespEnc

type CredentialRespEnc struct {
	AlgValuesSupported []string `json:"alg_values_supported"`
	EncValuesSupported []string `json:"enc_values_supported"`
	EncryptionRequired bool     `json:"encryption_required"`
}

type CredentialResponse

type CredentialResponse struct {
	Format          string      `json:"format"`
	Credential      interface{} `json:"credential,omitempty"`
	TransactionID   string      `json:"transaction_id,omitempty"`
	CNonce          string      `json:"c_nonce,omitempty"`
	CNonceExpiresIn int         `json:"c_nonce_expires_in,omitempty"`
	NotificationId  string      `json:"notification_id,omitempty"`
}

type CredentialResponseError

type CredentialResponseError struct {
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

type CredentialSubject

type CredentialSubject struct {
	Display Display `json:"display"`
}

type DescriptiveURL

type DescriptiveURL struct {
	URL             string `json:"url"`
	AlternativeText string `json:"alternative_text"`
}

type Display

type Display struct {
	Name   string `json:"name"`
	Locale string `json:"locale"`
}

type Grants

type Grants struct {
	AuthorizationCode *AuthorizationCode `json:"authorization_code,omitempty"`
	PreAuthorizedCode *PreAuthorizedCode `json:"urn:ietf:params:oauth:grant-type:pre-authorized_code,omitempty"`
}

type IssuerMetadata

type IssuerMetadata struct {
	CredentialIssuer                  string                             `json:"credential_issuer"`
	AuthorizationServers              []string                           `json:"authorization_servers"`
	CredentialEndpoint                string                             `json:"credential_endpoint"`
	BatchCredentialEndpoint           *string                            `json:"batch_credential_endpoint"`
	DeferredCredentialEndpoint        *string                            `json:"deferred_credential_endpoint"`
	CredentialResponseEncryption      CredentialRespEnc                  `json:"credential_response_encryption"`
	Display                           []LocalizedCredential              `json:"display"`
	CredentialConfigurationsSupported map[string]CredentialConfiguration `json:"credential_configurations_supported"`
}

func (*IssuerMetadata) CredentialRequest

func (metadata *IssuerMetadata) CredentialRequest(request CredentialRequest, token oauth.Token) (*CredentialResponse, error)

func (*IssuerMetadata) FindFittingAuthorizationServer

func (metadata *IssuerMetadata) FindFittingAuthorizationServer(grant oauth.GrantType) (*oauth.OpenIdConfiguration, error)

type JwtKeyProofType

type JwtKeyProofType struct {
	Nonce    string `json:"nonce"`
	Issuer   string `json:"iss,omitempty"`
	Audience string `json:"aud"`
	IssuedAt string `json:"iat"`
}

type LocalizedCredential

type LocalizedCredential struct {
	Name            string         `json:"name"`
	Locale          string         `json:"locale"`
	BackgroundColor string         `json:"background_color,omitempty"`
	TextColor       string         `json:"text_color,omitempty"`
}

type PreAuthorizedCode

type PreAuthorizedCode struct {
	PreAuthorizationCode    string  `json:"pre-authorized_code"`
	TxCode                  *TxCode `json:"tx_code,omitempty"`
	Interval                int     `json:"interval,omitempty"`
	AuthorizationServerHint string  `json:"authorization_server,omitempty"`
}

type Proof

type Proof struct {
	ProofType string  `json:"proof_type"`
	Jwt       *string `json:"jwt"`
	Cwt       *string `json:"cwt"`
	LdpVp     *string `json:"ldp_vp"`
}

func (*Proof) CheckProof

func (proof *Proof) CheckProof(audience string, cNonce string) (*jwt.Token, error)

func (*Proof) GetProof

func (proof *Proof) GetProof() *string

type ProofType

type ProofType struct {
	ProofSigningAlgValuesSupported []string `json:"proof_signing_alg_values_supported"`
}

type TxCode added in v1.0.0

type TxCode struct {
	InputMode   string `json:"input_mode,omitempty"`
	Length      int    `json:"length,omitempty"`
	Description string `json:"description,omitempty"`
}

Jump to

Keyboard shortcuts

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