mirror of
https://github.com/zadam/trilium.git
synced 2024-11-12 02:37:39 +08:00
10 lines
No EOL
446 B
JavaScript
10 lines
No EOL
446 B
JavaScript
module.exports = () => {
|
|
const sql = require('../../src/services/sql');
|
|
const crypto = require('crypto');
|
|
|
|
for (const {etapiTokenId, token} of sql.getRows("SELECT etapiTokenId, tokenHash AS token FROM etapi_tokens")) {
|
|
const tokenHash = crypto.createHash('sha256').update(token).digest('base64');
|
|
|
|
sql.execute(`UPDATE etapi_tokens SET tokenHash = ? WHERE etapiTokenId = ?`, [tokenHash, etapiTokenId]);
|
|
}
|
|
}; |