move to sha-256 fingerprints
This commit is contained in:
parent
8674816d27
commit
91e1077daa
4 changed files with 39 additions and 65 deletions
|
|
@ -297,9 +297,18 @@ localApp.post('/dbChange', (req, res, next) => {
|
|||
})
|
||||
})
|
||||
|
||||
function sha256 (buf) {
|
||||
const crypto = require('crypto')
|
||||
const hash = crypto.createHash('sha256')
|
||||
|
||||
hash.update(buf)
|
||||
return hash.digest('hex').toString('hex')
|
||||
}
|
||||
|
||||
function populateDeviceId (req, res, next) {
|
||||
const deviceId = ((typeof req.connection.getPeerCertificate === 'function' &&
|
||||
req.connection.getPeerCertificate().fingerprint)) || null
|
||||
const deviceId = _.isFunction(req.connection.getPeerCertificate)
|
||||
? sha256(req.connection.getPeerCertificate().raw)
|
||||
: null
|
||||
|
||||
req.deviceId = deviceId
|
||||
req.deviceTime = Date.parse(req.get('date'))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue