edim

package module
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2025 License: EUPL-1.2 Imports: 1 Imported by: 0

README

go-edim

Module for OpenID4VP presentation protocol. Must be paired with EUDI Verifier Endpoint

Built with Azugo Go Web Framework

This project is built using the Azugo Go Web Framework, a powerful and flexible framework for building modern web applications in Go. Check out the Azugo GitHub page for more information and documentation.

Environment variables

    VERIFIER_BACKEND_URL: http://demo-verifier-backend.edim-dev.svc.cluster.local:8080
    VERIFIER_BACKEND_PRESENT_RETRIES: 24
    VERIFIER_BACKEND_VERIFY_WAIT_IN_SECONDS: 10

VERIFIER_BACKEND_URL Edim verifier endpoint

VERIFIER_BACKEND_PRESENT_RETRIES How many times we try to get verifier backend response

VERIFIER_BACKEND_VERIFY_WAIT_IN_SECONDS How long we wait in seconds for the next retry

Development

Prepare dependecies
go mod download
go generate ./...
Before commit

CI requires linted, formatted code

You should run:

gofmt -s -w ./..

or

gofumpt -w ./..

and fix any errors reported by

golangci-lint run

Verifier

Usage

Add dependency

go get -u github.com/nobid-lsp-latvia/go-edim

Add configuration section

```go
import (
    "github.com/nobid-lsp-latvia/go-edim"
)

type Configuration struct {
    //...
    Verifier *verifier.Configuration `mapstructure:"verifier"`
    //...


    func (c *Configuration) Bind(_ string, v *viper.Viper) {
        c.Configuration.Bind("", v)
        
        c.Verifier = config.Bind(c.Verifier, "verifier", v)
    }
    
}
```

Add initialization

```go
import (
    "github.com/nobid-lsp-latvia/go-idauth"
)

func (a *App) InitServices() error {
    //...
    a.verifierBackendClient = verifier.NewVerifierBackendClient(a.Config().Verifier)
    //...
}
```

Preparing data for qr code content

import (
"github.com/nobid-lsp-latvia/go-edim"
)

req := &[]verifier.IdentificationData{}

resp := &verifier.PrepareResponse{}

resp, err := r.App.VerifierClient().GenerateCredentialOffer(ctx, *req)
if err != nil {
    ctx.Error(err)
    
    return
}

respLink := "eudi-openid4vp://?client_id=" + resp.ClientId + "&request_uri=" + resp.RequestUri

ctx.JSON(&verifier.PrepareResponseLink{
    Link:           respLink,
    PresentationId: resp.PresentationId, // this is used to present verification data
})

Present verification data

import (
    "github.com/nobid-lsp-latvia/go-edim"
)

attestations, err := r.App.VerifierClient().PresentWait(ctx, presentID)

if err != nil {
ctx.Error(err)
return
}

ctx.JSON(attestations)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MultiError

type MultiError struct {
	Errors []error
}

MultiError is a custom error type that holds multiple errors.

func (*MultiError) Add

func (m *MultiError) Add(err error)

Add adds a new error to the MultiError.

func (*MultiError) Error

func (m *MultiError) Error() string

Error implements the error interface for MultiError.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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