Skip to content

Conversation

@kallal79
Copy link

@kallal79 kallal79 commented Sep 28, 2025

Issue Reference

Fixes: #14 - Investigate whether Provisioning API Client Return Code on Success

Problem Description

The original SubmitConfig.Run() method only returned an error, providing no success information to callers when CoRIM submission succeeded. This made it impossible for applications to display meaningful success messages or status information to users.

Solution

Changed the API signature to return both success information and errors:

Before:

func (cfg SubmitConfig) Run(endorsement []byte, mediaType string) error

After:

func (cfg SubmitConfig) Run(endorsement []byte, mediaType string) (*SubmitSession, error)

Benefits

  • Success Information Access: Callers can now access status, expiry time, and other session details
  • User-Friendly Feedback: Applications can display meaningful success messages
  • Both Sync & Async Support: Works for synchronous and asynchronous submissions
  • Rich Status Details: Access to complete session information from server

Files Changed

  • provisioning/provisioning.go - Updated Run() and pollForSubmissionCompletion() methods
  • provisioning/doc.go - Updated package documentation
  • provisioning/provisioning_test.go - Updated all tests + added success info demonstration tests

Testing

New Tests Added:

  • TestSubmitConfig_Run_success_info_returned - Demonstrates synchronous success info access
  • TestSubmitConfig_Run_async_success_info_returned - Demonstrates asynchronous success info access

Test Results:

 All existing tests updated and passing
 New success info tests pass with example output:
    CoRIM successfully submitted! Status: success, Expires: 2030-12-25T10:30:45.123Z
    CoRIM async submission completed! Status: success, Expires: 2030-12-25T10:30:45.123Z

Usage Example

// OLD (Issue #14 problem)
err := cfg.Run(corimBuf, "application/corim+cbor")
if err != nil {
    log.Fatal(err)
}
//  No success information available

// NEW (Issue #14 fixed)
session, err := cfg.Run(corimBuf, "application/corim+cbor")
if err != nil {
    log.Fatal(err)
}
//  Rich success information now available!
fmt.Printf(" CoRIM successfully submitted!\n")
fmt.Printf("   Status: %s\n", session.Status)
fmt.Printf("   Expires: %s\n", session.Expiry)

Breaking Change Notice

This is a breaking API change, but it directly addresses the core issue #14.

Migration Path:

// Before
err := cfg.Run(data, mediaType)

// After  
session, err := cfg.Run(data, mediaType)
// Now you have access to session.Status, session.Expiry, etc.

…un()

- Change Run() method signature from error to (*SubmitSession, error)
- Allow callers to access success status, expiry time, and details
- Update pollForSubmissionCompletion() to return session information
- Update all tests to handle new API signature
- Add comprehensive tests demonstrating success info access
- Update documentation to reflect API changes

This addresses GitHub Issue veraison#14 by providing callers with rich success
information that can be displayed to users upon successful CoRIM submission.

Breaking change: Method signature changed but directly resolves the issue.

Fixes veraison#14

Signed-off-by: Kallal Mukherjee <[email protected]>
@kallal79
Copy link
Author

kallal79 commented Oct 3, 2025

sir @thomas-fossati sir @setrofim sir @yogeshbdeshpande
Requesting review for PR #35 addressing Issue #14.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Investigate whether Provisioning API Client Return Code on Success

1 participant