issuernew

package
v0.0.0-...-ef5c1ef Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: Apache-2.0 Imports: 39 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateLEARCredentialJWTtoken

func CreateLEARCredentialJWTtoken(learCred LEARCredentialEmployee, sigMethod jwt.SigningMethod, privateKey any) (string, error)

CreateLEARCredentialJWTtoken creates a JWT token from the given claims, signed with the first private key associated to the issuer DID

func GenDIDKey

func GenDIDKey() (did string, privateKey jwk.Key, err error)

GenDIDKey generates a new 'did:key' DID by creating an EC key pair

func LookupEnvOrString

func LookupEnvOrString(key string, defaultVal string) string

LookupEnvOrString gets a value from the environment or returns the specified default value

func PubKeyToDIDKey

func PubKeyToDIDKey(pubKeyJWK jwk.Key) (did string, err error)

func RequireAdminOrX509Auth

func RequireAdminOrX509Auth() echo.MiddlewareFunc

RequireAdminOrX509Auth middleware requires a request to have a valid admin Authorization header or x509 client certification set.

Types

type IssuerServer

type IssuerServer struct {
	App *pocketbase.PocketBase
	// contains filtered or unexported fields
}

func New

func New(cfg *my.YAML) *IssuerServer

func (*IssuerServer) Start

func (is *IssuerServer) Start() error

Start initializes the Issuer hooks and adds routes and spawns the server to handle them

type LEARCredentialEmployee

type LEARCredentialEmployee struct {
	Context        []string `json:"@context,omitempty"`
	Id             string   `json:"id,omitempty"`
	TypeCredential []string `json:"type,omitempty"`
	Issuer         struct {
		Id string `json:"id,omitempty"`
	} `json:"issuer,omitempty"`
	IssuanceDate      string `json:"issuanceDate,omitempty"`
	ValidFrom         string `json:"validFrom,omitempty"`
	ExpirationDate    string `json:"expirationDate,omitempty"`
	CredentialSubject struct {
		Mandate Mandate `json:"mandate,omitempty"`
	} `json:"credentialSubject,omitempty"`
}

type LEARCredentialEmployeeJWTClaims

type LEARCredentialEmployeeJWTClaims struct {
	LEARCredentialEmployee
	jwt.RegisteredClaims
}

type Mandate

type Mandate struct {
	Id       string `json:"id,omitempty"`
	Mandator struct {
		OrganizationIdentifier string `json:"organizationIdentifier,omitempty"` // OID 2.5.4.97
		CommonName             string `json:"commonName,omitempty"`             // OID 2.5.4.3
		GivenName              string `json:"givenName,omitempty"`
		Surname                string `json:"surname,omitempty"`
		EmailAddress           string `json:"emailAddress,omitempty"`
		SerialNumber           string `json:"serialNumber,omitempty"`
		Organization           string `json:"organization,omitempty"`
		Country                string `json:"country,omitempty"`
	} `json:"mandator,omitempty"`
	Mandatee struct {
		Id           string `json:"id,omitempty"`
		First_name   string `json:"first_name,omitempty"`
		Last_name    string `json:"last_name,omitempty"`
		Gender       string `json:"gender,omitempty"`
		Email        string `json:"email,omitempty"`
		Mobile_phone string `json:"mobile_phone,omitempty"`
	} `json:"mandatee,omitempty"`
	Power []struct {
		Id           string   `json:"id,omitempty"`
		Tmf_type     string   `json:"tmf_type,omitempty"`
		Tmf_domain   []string `json:"tmf_domain,omitempty"`
		Tmf_function string   `json:"tmf_function,omitempty"`
		Tmf_action   []string `json:"tmf_action,omitempty"`
	} `json:"power,omitempty"`
	LifeSpan struct {
		StartDateTime string `json:"start_date_time,omitempty"`
		EndDateTime   string `json:"end_date_time,omitempty"`
	} `json:"life_span,omitempty"`
}

Jump to

Keyboard shortcuts

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