@simplewebauthn/server
Advanced tools
Comparing version 4.1.0 to 4.2.0
@@ -13,4 +13,3 @@ "use strict"; | ||
const settingsService_1 = __importDefault(require("../services/settingsService")); | ||
// TODO: Re-enable this once we figure out logging | ||
// import { log } from '../helpers/logging'; | ||
const logging_1 = require("../helpers/logging"); | ||
const parseJWT_1 = __importDefault(require("../metadata/parseJWT")); | ||
@@ -24,2 +23,3 @@ const defaultURLMDS = 'https://mds.fidoalliance.org/'; // v3 | ||
})(SERVICE_STATE || (SERVICE_STATE = {})); | ||
const log = logging_1.getLogger('MetadataService'); | ||
/** | ||
@@ -56,2 +56,3 @@ * A basic service for coordinating interactions with the FIDO Metadata Service. This includes BLOB | ||
if (statements === null || statements === void 0 ? void 0 : statements.length) { | ||
let statementsAdded = 0; | ||
statements.forEach(statement => { | ||
@@ -68,10 +69,12 @@ // Only cache statements that are for FIDO2-compatible authenticators | ||
}; | ||
statementsAdded += 1; | ||
} | ||
}); | ||
log(`Cached ${statementsAdded} local statements`); | ||
} | ||
// If MDS servers are provided, then process them and add their statements to the cache | ||
if (mdsServers === null || mdsServers === void 0 ? void 0 : mdsServers.length) { | ||
// TODO: Re-enable this once we figure out logging | ||
// const currentCacheCount = Object.keys(this.statementCache).length; | ||
// let numServers = mdsServers.length; | ||
// Get a current count so we know how many new statements we've added from MDS servers | ||
const currentCacheCount = Object.keys(this.statementCache).length; | ||
let numServers = mdsServers.length; | ||
for (const url of mdsServers) { | ||
@@ -87,11 +90,10 @@ try { | ||
// Notify of the error and move on | ||
// TODO: Re-enable this once we figure out logging | ||
// log('warning', `Could not download BLOB from ${url}:`, err); | ||
// numServers -= 1; | ||
log(`Could not download BLOB from ${url}:`, err); | ||
numServers -= 1; | ||
} | ||
} | ||
// TODO: Re-enable this once we figure out logging | ||
// const newCacheCount = Object.keys(this.statementCache).length; | ||
// const cacheDiff = newCacheCount - currentCacheCount; | ||
// log('info', `Downloaded ${cacheDiff} statements from ${numServers} metadata servers`); | ||
// Calculate the difference to get the total number of new statements we successfully added | ||
const newCacheCount = Object.keys(this.statementCache).length; | ||
const cacheDiff = newCacheCount - currentCacheCount; | ||
log(`Cached ${cacheDiff} statements from ${numServers} metadata server(s)`); | ||
} | ||
@@ -181,6 +183,7 @@ if (verificationMode) { | ||
} | ||
catch (err) { | ||
catch (error) { | ||
const _error = error; | ||
// From FIDO MDS docs: "ignore the file if the chain cannot be verified or if one of the | ||
// chain certificates is revoked" | ||
throw new Error(`BLOB certificate path could not be validated: ${err.message}`); | ||
throw new Error(`BLOB certificate path could not be validated: ${_error.message}`); | ||
} | ||
@@ -252,12 +255,9 @@ // Verify the BLOB JWT signature | ||
if (newState === SERVICE_STATE.DISABLED) { | ||
// TODO: Re-enable this once we figure out logging | ||
// log('MetadataService is DISABLED'); | ||
log('MetadataService is DISABLED'); | ||
} | ||
else if (newState === SERVICE_STATE.REFRESHING) { | ||
// TODO: Re-enable this once we figure out logging | ||
// log('MetadataService is REFRESHING'); | ||
log('MetadataService is REFRESHING'); | ||
} | ||
else if (newState === SERVICE_STATE.READY) { | ||
// TODO: Re-enable this once we figure out logging | ||
// log('MetadataService is READY'); | ||
log('MetadataService is READY'); | ||
} | ||
@@ -264,0 +264,0 @@ } |
{ | ||
"name": "@simplewebauthn/server", | ||
"version": "4.1.0", | ||
"version": "4.2.0", | ||
"description": "SimpleWebAuthn for Servers", | ||
@@ -55,2 +55,3 @@ "main": "dist/index.js", | ||
"cbor": "^5.1.0", | ||
"debug": "^4.3.2", | ||
"elliptic": "^6.5.3", | ||
@@ -62,5 +63,6 @@ "jsrsasign": "^10.4.0", | ||
}, | ||
"gitHead": "bbcb4c28db1073801e41c5a089cd6feb4373c32e", | ||
"gitHead": "73090c98aaaf48aea660f74c965d6f4af14375eb", | ||
"devDependencies": { | ||
"@types/cbor": "^5.0.1", | ||
"@types/debug": "^4.1.7", | ||
"@types/elliptic": "^6.4.13", | ||
@@ -67,0 +69,0 @@ "@types/jsrsasign": "^8.0.13", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
242134
126
3782
12
7
+ Addeddebug@^4.3.2
+ Addeddebug@4.3.7(transitive)
+ Addedms@2.1.3(transitive)