Skip to content

Commit

Permalink
immediate validation for Register
Browse files Browse the repository at this point in the history
  • Loading branch information
woutslakhorst committed Oct 14, 2024
1 parent 63890e6 commit c1fa331
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions discovery/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,16 @@ func (m *Module) Register(context context.Context, serviceID string, presentatio
if exists {
return errors.Join(ErrInvalidPresentation, ErrPresentationAlreadyExists)
}
_, err = m.store.add(serviceID, presentation, "", 0)
return err
record, err := m.store.add(serviceID, presentation, "", 0)
if err != nil {
return err
}
// also update validated flag since validation is already done
if err = m.store.updateValidated([]presentationRecord{*record}); err != nil {
log.Logger().WithError(err).Errorf("failed to update validated flag for presentation (id: %s)", record.ID)
}

return nil
}

func (m *Module) verifyRegistration(definition ServiceDefinition, presentation vc.VerifiablePresentation) error {
Expand Down

0 comments on commit c1fa331

Please sign in to comment.