Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

First draft of issue-34. #36

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cmd/apigw/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ func main() {
if err != nil {
panic(err)
}

httpService, err := httpserver.New(ctx, cfg, apiv1Client, tracer, log.New("httpserver"))
services["httpService"] = httpService
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion internal/apigw/apiv1/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ var (
BuildVarGitCommit string
)

// @title Datastore API
// @title APIGW API
// @version 0.1.0
// @BasePath /api/v1

Expand Down
2 changes: 1 addition & 1 deletion internal/apigw/apiv1/handlers_vc.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func (c *Client) Upload(ctx context.Context, req *model.Upload) error {
return err
}

req.Meta.CreatedAt = time.Now().UTC()
req.Meta.IssuedAt = time.Now().UTC().String()

_, err := c.simpleQueue.VCPersistentSave.Enqueue(ctx, req)
if err != nil {
Expand Down
13 changes: 10 additions & 3 deletions pkg/model/generic.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"encoding/base64"
"net/url"
"time"

"github.com/skip2/go-qrcode"
)
Expand Down Expand Up @@ -109,9 +108,13 @@ type MetaData struct {
// example: 2024-12-31
ValidTo string `json:"valid_to,omitempty" bson:"valid_to" validate:"required"`

// required: false
// required: true
// example: 2024-03-15T10:00:00Z+01:00
CreatedAt time.Time `json:"created_at,omitempty" bson:"created_at"`
IssuedAt string `json:"issued_at,omitempty" bson:"issued_at"`

// required: true
// example: 2024-03-15T10:00:00Z+01:00
ExpiredAt string `json:"expired_at,omitempty" bson:"expired_at"`
}

// Identity identifies a person
Expand Down Expand Up @@ -240,6 +243,10 @@ type Attestation struct {
// required: true
// example: European Health Insurance Card
DescriptionLong string `json:"description_long,omitempty" bson:"description_long" validate:"required"`

// required: true
// example: {"description": "a key-value pair", "key": "value"}
StructuredInformation map[string]any `json:"structured_information,omitempty" bson:"structured_information" validate:"required"`
}

// QR is a collection of fields representing a QR code
Expand Down
19 changes: 12 additions & 7 deletions standards/apiv21.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ Finally, the document data object needs to be submitted. We expect a JSON electr
"member_state": "",
"document_version": 0,
"valid_from": "",
"valid_to":""
"valid_to":"",
"issued_at": "",
"expire_at":""
},
"identity": {
"version": "",
Expand Down Expand Up @@ -89,7 +91,8 @@ Finally, the document data object needs to be submitted. We expect a JSON electr
"version": 0,
"type": "",
"description_short": "",
"description_long": ""
"description_long": "",
"structured_information": {}
},
"document_data": {}
}
Expand Down Expand Up @@ -460,7 +463,8 @@ http OK 200, else 400 and error body
| string | member_state | true | MUST comply with ISO 3166-1 alpha-2 AND MUST only include EU countries |
| string | valid_from | true | iso8601 utc |
| string | valid_to | true | iso8601 utc |
| string | created_at | false | iso8601 utc |
| string | issued_at | true | iso8601 utc |
| string | expired_at | true | iso8601 utc |

### identity{}

Expand Down Expand Up @@ -495,10 +499,11 @@ http OK 200, else 400 and error body

|type| Attribute | required | description |
|-|-|-|-|
| integer | version | true | must be > 0 |
| string | type | true | For internal display interpretation/differentiation |
| string | description_short | true | To display in the portal |
| string | description_long | true | To display in the portal |
| integer | version | true | must be > 0 |
| string | type | true | For internal display interpretation/differentiation |
| string | description_short | true | To display in the portal |
| string | description_long | true | To display in the portal |
| object | structured_information | true | Structured information to be used in in portal |

### document_data{}

Expand Down
Loading