mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-23 05:00:07 +02:00

Validate content hashes in history (log only) GitOrigin-RevId: ed772fc4e4d0aa9e980f9693a759647bd937e13a
18 lines
347 B
JavaScript
18 lines
347 B
JavaScript
// @ts-check
|
|
|
|
const { createHash } = require('node:crypto')
|
|
|
|
/**
|
|
* Compute a SHA-1 hash of the content
|
|
*
|
|
* This is used to validate incoming updates.
|
|
*
|
|
* @param {string} content
|
|
*/
|
|
function getContentHash(content) {
|
|
const hash = createHash('sha-1')
|
|
hash.update(content)
|
|
return hash.digest('hex')
|
|
}
|
|
|
|
module.exports = { getContentHash }
|