Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/presentations.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ async function _deriveCredentials({
let {acceptedCryptosuites = []} = credentialQuery;
if(Array.isArray(acceptedCryptosuites)) {
// remove any invalid values; normalize to objects
return acceptedCryptosuites
acceptedCryptosuites = acceptedCryptosuites
.filter(e => e && (typeof e === 'string' || e.cryptosuite))
.map(e => typeof e === 'string' ? ({cryptosuite: e}) : e);
} else {
Expand Down
4 changes: 2 additions & 2 deletions test/web/35-nfc-data-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as webWallet from '@bedrock/web-wallet';
* Tests for TemplateRenderMethod data model structure validation.
*
* TemplateRenderMethod structure:
*
* ```
* {
* "type": "TemplateRenderMethod", // required.
* "renderEngine": "fixed",
Expand All @@ -18,7 +18,7 @@ import * as webWallet from '@bedrock/web-wallet';
* "mediaType": "application/octet-stream"
* }
* }
*
* ```
* Note: outputPreference.mode, template requirement, and type validation
* are covered in 15-nfc-support.js.
* This file focuses on optional fields and field interactions.
Expand Down
12 changes: 7 additions & 5 deletions test/web/40-nfc-legacy-format.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,19 @@ import * as webWallet from '@bedrock/web-wallet';
/**
* Tests for NfcRenderingTemplate2024 legacy format backward compatibility.
*
* Legacy format (bedrock-web-wallet existing credentials):
* Legacy format (bedrock-web-wallet existing credentials).
*
* ```
* {
* "type": "NfcRenderingTemplate2024",
* "payload": "z..." | "u..." | "data:..." // required (NOT 'template')
* }
*
* ```
* Key differences from TemplateRenderMethod:
*
* Uses 'payload' field instead of 'template'
* No outputPreference object required (type implies NFC)
* No renderProperty support
* Uses 'payload' field instead of 'template'.
* No outputPreference object required (type implies NFC).
* No renderProperty support.
*
* Note: Detection tests (supportsNfc) are in 15-nfc-support.js.
* This file focuses on rendering behavior (renderToNfc).
Expand Down
12 changes: 6 additions & 6 deletions test/web/45-nfc-credential.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('NFC Renderer', function() {
}

eadCredential = await response.json();
console.log('EAD Credential loaded from URL');
// console.log('EAD Credential loaded from URL');
} catch(error) {
console.error('Failed to load EAD credential:', error);
this.skip();
Expand Down Expand Up @@ -134,7 +134,7 @@ describe('NFC Renderer', function() {
}

frCredential = await response.json();
console.log('FirstResponder Credential loaded from URL');
// console.log('FirstResponder Credential loaded from URL');
} catch(error) {
console.error('Failed to load FirstResponder credential:', error);
this.skip();
Expand Down Expand Up @@ -253,8 +253,8 @@ describe('NFC Renderer', function() {
const renderMethods = Array.isArray(eadCredential.renderMethod) ?
eadCredential.renderMethod : [eadCredential.renderMethod];

console.log('EAD renderMethod types:',
renderMethods.map(rm => rm.type));
// console.log('EAD renderMethod types:',
// renderMethods.map(rm => rm.type));

const nfcMethod = renderMethods.find(
rm => rm.type === 'NfcRenderingTemplate2024'
Expand All @@ -274,8 +274,8 @@ describe('NFC Renderer', function() {
const renderMethods = Array.isArray(frCredential.renderMethod) ?
frCredential.renderMethod : [frCredential.renderMethod];

console.log('FirstResponder renderMethod types:',
renderMethods.map(rm => rm.type));
// console.log('FirstResponder renderMethod types:',
// renderMethods.map(rm => rm.type));

const nfcMethod = renderMethods.find(rm =>
rm.type === 'TemplateRenderMethod' &&
Expand Down