-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmds3.js
More file actions
41 lines (37 loc) · 1.44 KB
/
mds3.js
File metadata and controls
41 lines (37 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const fs = require('fs');
const mds3 = require('./fido-mds3/index.js');
const mds3_client = new mds3.Builder().build();
//for test
/*mds3_client.findByAAGUID('9c835346-796b-4c27-8898-d6032f515cc5').then(data => {
//console.log(data);
});*/
if(process.env.FIDO_CONFORMANCE_TEST){
try {
mds3_client.judgeRefresh().then(data =>//load entries first.
{
const conformanceMetadataPath = './fido-conformance-metadata-statements';
const conformanceMetadataFilenames = fs.readdirSync(conformanceMetadataPath);
for (const statementPath of conformanceMetadataFilenames) {
if (statementPath.endsWith('.json')) {
const contents = fs.readFileSync(`${conformanceMetadataPath}/${statementPath}`, 'utf-8');
mds3_client.append(JSON.parse(contents));
}
}
}
).catch(err => {
// Handle promise rejection from judgeRefresh
if (typeof logger !== 'undefined') {
logger.warn('Failed to refresh MDS3 BLOB. Check if MDS3 URL is valid and up-to-date: ' + err.message)
} else {
console.warn('Failed to refresh MDS3 BLOB: ' + err.message)
}
});
} catch (err) {
if (typeof logger !== 'undefined') {
logger.warn('Failed to load fido-conformance-metadata-statements.' + err.message)
} else {
console.warn('Failed to load fido-conformance-metadata-statements: ' + err.message)
}
}
}
module.exports.mds3_client = mds3_client;