Skip to content

Commit

Permalink
fix: notification endpoint update (#1797)
Browse files Browse the repository at this point in the history
Signed-off-by: Misha Sizov <mykhailo.sizov@securekey.com>
  • Loading branch information
mishasizov-SK authored Nov 20, 2024
1 parent a808e30 commit 8c0016b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 10 deletions.
4 changes: 2 additions & 2 deletions component/wallet-cli/pkg/oidc4vci/oidc4vci_flow.go
Original file line number Diff line number Diff line change
Expand Up @@ -1172,13 +1172,13 @@ func (f *Flow) handleIssuanceAck(
slog.Info("Sending wallet notification", "notification_id", notificationID, "endpoint", notificationEndpoint)

ackRequest := oidc4civ1.AckRequest{
Event: "credential_accepted",
Event: lo.ToPtr("credential_accepted"),
EventDescription: nil,
IssuerIdentifier: wellKnown.CredentialIssuer,
InteractionDetails: lo.ToPtr(map[string]interface{}{
"notification_id": notificationID,
}),
NotificationId: notificationID, //todo test without required field
NotificationId: lo.ToPtr(notificationID),
}

b, err := json.Marshal(ackRequest)
Expand Down
3 changes: 0 additions & 3 deletions docs/v1/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2407,9 +2407,6 @@ components:
description: 'Human-readable ASCII text providing additional information, used to assist the Credential Issuer developer in understanding the event that occurred.'
interaction_details:
type: object
required:
- notification_id
- event
AckRequestItem:
deprecated: true
type: object
Expand Down
6 changes: 3 additions & 3 deletions pkg/restapi/v1/oidc4ci/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -654,10 +654,10 @@ func (c *Controller) OidcAcknowledgement(e echo.Context) error {

// todo: according to the spec those 2 fields are required, so condition is redundant.
// Should be removed during endpoint update to the latest spec.
if body.NotificationId != "" && body.Event != "" {
if body.NotificationId != nil && body.Event != nil {
if err := c.ackService.Ack(ctx, oidc4ci.AckRemote{
TxID: issuecredential.TxID(body.NotificationId),
Event: body.Event,
TxID: issuecredential.TxID(lo.FromPtr(body.NotificationId)),
Event: lo.FromPtr(body.Event),
HashedToken: hashedToken,
EventDescription: lo.FromPtr(body.EventDescription),
IssuerIdentifier: lo.FromPtr(body.IssuerIdentifier),
Expand Down
4 changes: 2 additions & 2 deletions pkg/restapi/v1/oidc4ci/openapi.gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 8c0016b

Please sign in to comment.