Skip to content

Commit

Permalink
Fix linting errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
dlongley committed Nov 27, 2023
1 parent f3405c8 commit 429d24d
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions lib/oid4vp.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,9 @@ export async function toVpr({
}

// converts a VPR to partial "authorization request"
export function fromVpr({verifiablePresentationRequest, strict = false, prefixVC = false} = {}) {
export function fromVpr({
verifiablePresentationRequest, strict = false, prefixVC = false
} = {}) {
try {
let {query} = verifiablePresentationRequest;
if(!Array.isArray(query)) {
Expand All @@ -322,7 +324,7 @@ export function fromVpr({verifiablePresentationRequest, strict = false, prefixVC
response_type: 'vp_token',
presentation_definition: {
id: uuid(),
input_descriptors: credentialQuery.map((q) => _fromQueryByExampleQuery({
input_descriptors: credentialQuery.map(q => _fromQueryByExampleQuery({
credentialQuery: q,
prefixVC
}))
Expand Down Expand Up @@ -742,9 +744,10 @@ function _adjustErroneousPaths(paths) {
// JWT-secured VC, such that only actual VC paths remain
const removed = paths.filter(p => !_isPresentationSubmissionPath(p));
return removed.map(p => {
if (_isJWTPath(p)) {
if(_isJWTPath(p)) {
return '$' + p.slice('$.vc'.length);
} else if (_isSquareJWTPath(p)) {
}
if(_isSquareJWTPath(p)) {
return '$' + p.slice('$[\'vc\']'.length);
}
return p;
Expand Down Expand Up @@ -806,8 +809,9 @@ function _get(sp, name) {
}

function _isPresentationSubmissionPath(path) {
return path.startsWith('$.verifiableCredential[') || path.startsWith('$.vp.')
|| path.startsWith('$[\'verifiableCredential') || path.startsWith('$[\'vp');
return path.startsWith('$.verifiableCredential[') ||
path.startsWith('$.vp.') ||
path.startsWith('$[\'verifiableCredential') || path.startsWith('$[\'vp');
}

function _isJWTPath(path) {
Expand All @@ -816,4 +820,4 @@ function _isJWTPath(path) {

function _isSquareJWTPath(path) {
return path.startsWith('$[\'vc\']');
}
}

0 comments on commit 429d24d

Please sign in to comment.