Merge branch 'release-9.0' into chore/merge-9-into-10-20240214
This commit is contained in:
commit
82acc20b9b
2 changed files with 30 additions and 8 deletions
|
|
@ -4,6 +4,7 @@ const crypto = require('crypto')
|
|||
const logger = require('../logger')
|
||||
|
||||
function sha256 (buf) {
|
||||
if (!buf) return null
|
||||
const hash = crypto.createHash('sha256')
|
||||
|
||||
hash.update(buf)
|
||||
|
|
@ -12,9 +13,10 @@ function sha256 (buf) {
|
|||
|
||||
const populateDeviceId = function (req, res, next) {
|
||||
const deviceId = _.isFunction(req.connection.getPeerCertificate)
|
||||
? sha256(req.connection.getPeerCertificate().raw)
|
||||
? sha256(req.connection.getPeerCertificate()?.raw)
|
||||
: null
|
||||
|
||||
if (!deviceId) return res.status(500).json({ error: 'Unable to find certificate' })
|
||||
req.deviceId = deviceId
|
||||
req.deviceTime = req.get('date')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue