onboarding

package
v0.0.0-...-d2ee197 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func B64Encode

func B64Encode(data []byte) string

func GenerateNonce

func GenerateNonce() string

func LEARIssuanceRequest

func LEARIssuanceRequest(config *Config, learCredData *LEARIssuanceRequestBody) ([]byte, error)

func NewCliAssertion

func NewCliAssertion(learCredential string, didkey string, verifierURL string, privateKey *ecdsa.PrivateKey) (string, error)

func NewVPToken

func NewVPToken(vcStringToken string, didkey string, privateKey *ecdsa.PrivateKey, verifierSBX string) (string, error)

func TokenRequest

func TokenRequest(
	tokenEndpoint string,
	machineCredential string,
	didkey string,
	verifierURL string,
	privateKey *ecdsa.PrivateKey,
) (string, error)

Types

type CliAssertion

type CliAssertion struct {
	jwt.RegisteredClaims
	VpToken string `json:"vp_token"`
}

type Config

type Config struct {
	Environment            Environment `json:"environment,omitempty"`
	ListenAddress          string      `json:"listenAddress,omitempty"`
	CredentialIssuancePath string      `json:"credentialIssuancePath,omitempty"`
	MyDidkey               string      `json:"mydidkey,omitempty"`
	VerifierURL            string      `json:"verifierURL,omitempty"`
	VerifierTokenEndpoint  string      `json:"verifierTokenEndpoint,omitempty"`
	PrivateKeyFilePEM      string      `json:"privateKeyFilePEM,omitempty"`
	MachineCredentialFile  string      `json:"machineCredentialFile,omitempty"`

	PrivateKey        *ecdsa.PrivateKey
	MachineCredential string

	// rest of the fields
	AppName          string     `json:"appName,omitempty"`
	ServerURL        string     `json:"serverURL,omitempty"`
	SenderName       string     `json:"senderName,omitempty"`
	SenderAddress    string     `json:"senderAddress,omitempty"`
	AdminEmail       string     `json:"adminEmail,omitempty"`
	SMTP             SMTPConfig `json:"smtp,omitempty"`
	SupportTeamEmail []string   `json:"supportTeamEmail,omitempty"`
}

func ConfigFromMap

func ConfigFromMap(cfg *yaml.YAML) (*Config, error)

ConfigFromMap parses and validates a configuration specified in YAML, returning the config in a struct format.

func (*Config) Copy

func (s *Config) Copy() Config

func (*Config) OverrideWith

func (s *Config) OverrideWith(other Config)

func (*Config) SetDefaults

func (s *Config) SetDefaults()

func (*Config) String

func (s *Config) String() string

func (*Config) Validate

func (s *Config) Validate() (err error)

type Environment

type Environment string
const Development Environment = "development"
const Preproduction Environment = "preproduction"
const Production Environment = "production"

type LEARIssuanceRequestBody

type LEARIssuanceRequestBody struct {
	Schema        string  `json:"schema,omitempty"`
	OperationMode string  `json:"operation_mode,omitempty"`
	Format        string  `json:"format,omitempty"`
	ResponseUri   string  `json:"response_uri,omitempty"`
	Payload       Payload `json:"payload,omitempty"`
}

func ParseLEARIssuanceRequestBody

func ParseLEARIssuanceRequestBody(body []byte) (*LEARIssuanceRequestBody, error)

type Mandatee

type Mandatee struct {
	FirstName   string `json:"firstName,omitempty"`
	LastName    string `json:"lastName,omitempty"`
	Nationality string `json:"nationality,omitempty"`
	Email       string `json:"email,omitempty"`
}

type Mandator

type Mandator struct {
	OrganizationIdentifier string `json:"organizationIdentifier,omitempty"`
	Organization           string `json:"organization,omitempty"`
	Country                string `json:"country,omitempty"`
	CommonName             string `json:"commonName,omitempty"`
	EmailAddress           string `json:"emailAddress,omitempty"`
	SerialNumber           string `json:"serialNumber,omitempty"`
}

type OnboardServer

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

func New

func New(config *Config) *OnboardServer

New creates an instance of the Issuer, not started yet

func (*OnboardServer) Start

func (is *OnboardServer) Start() error

type Payload

type Payload struct {
	Mandator Mandator `json:"mandator,omitempty"`
	Mandatee Mandatee `json:"mandatee,omitempty"`
	Power    []Power  `json:"power,omitempty"`
}

type Power

type Power struct {
	Type     string  `json:"type,omitempty"`
	Domain   string  `json:"domain,omitempty"`
	Function string  `json:"function,omitempty"`
	Action   Strings `json:"action,omitempty"`
}

type SMTPConfig

type SMTPConfig struct {
	Enabled  bool   `json:"enabled,omitempty"`
	Host     string `json:"host,omitempty"`
	Port     int    `json:"port,omitempty"`
	Tls      bool   `json:"tls,omitempty"`
	Username string `json:"username,omitempty"`
}

type Strings

type Strings []string

The "action" claim can either be a single string or an array. We need to serialize the claim as a single string if the array has only one element

func (Strings) MarshalJSON

func (s Strings) MarshalJSON() (b []byte, err error)

type VP

type VP struct {
	Context              []string `json:"@context"`
	Type                 []string `json:"type"`
	Holder               string   `json:"holder,omitempty"`
	Id                   string   `json:"id,omitempty"`
	VerifiableCredential []string `json:"verifiableCredential"`
}

func (*VP) String

func (o *VP) String() string

type VPToken

type VPToken struct {
	jwt.RegisteredClaims
	VP    VP     `json:"vp"`
	Nonce string `json:"nonce,omitempty"`
}

func (*VPToken) String

func (o *VPToken) String() string

Jump to

Keyboard shortcuts

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