Skip to content

Commit

Permalink
Add vpToken option when sending authorization response.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlongley committed Aug 8, 2024
1 parent 5425692 commit 8015b5d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# @digitalbazaar/oid4-client Changelog

## 3.5.0 - 2024-08-dd

### Added
- Allow `vpToken` param to be given when sending an authorization response.
This param is optional and does not replace the `verifiablePresentation`
parameter which is required to build the presentation submission. The
`vpToken` param can be used if the format of the `vp_token` is not
the plain JSON expression of the `verifiablePresentation`, but is instead
some enveloping format that wraps the VP, such as a JWT (as in VC-JWT).

## 3.4.1 - 2024-07-29

### Fixed
Expand Down
5 changes: 3 additions & 2 deletions lib/oid4vp.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright (c) 2023 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2023-2024 Digital Bazaar, Inc. All rights reserved.
*/
import {assert, assertOptional, fetchJSON} from './util.js';
import {decodeJwt} from 'jose';
Expand Down Expand Up @@ -159,6 +159,7 @@ export async function sendAuthorizationResponse({
verifiablePresentation,
presentationSubmission,
authorizationRequest,
vpToken,
agent
} = {}) {
try {
Expand All @@ -174,7 +175,7 @@ export async function sendAuthorizationResponse({

// send VP and presentation submission to complete exchange
const body = new URLSearchParams();
body.set('vp_token', JSON.stringify(verifiablePresentation));
body.set('vp_token', vpToken ?? JSON.stringify(verifiablePresentation));
body.set('presentation_submission', JSON.stringify(presentationSubmission));
const response = await httpClient.post(authorizationRequest.response_uri, {
agent, body, headers: {accept: 'application/json'},
Expand Down

0 comments on commit 8015b5d

Please sign in to comment.