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)