@dotrino/vault 0.86.0 → 0.86.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/atrest.js +2 -2
- package/src/core/libVersion.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotrino/vault",
|
|
3
|
-
"version": "0.86.
|
|
3
|
+
"version": "0.86.1",
|
|
4
4
|
"description": "La bóveda de Dotrino como librería: el MISMO núcleo que el binario corriendo en el navegador (`@dotrino/vault/browser`), el mostrador de emparejamiento y el cliente de SERVICIO (Node): un proyecto se enrola una vez y jala sus credenciales del vault en vez del .env (`import '@dotrino/vault/config'`).",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "src/index.js",
|
package/src/atrest.js
CHANGED
|
@@ -132,7 +132,7 @@ export function encryptText (plaintext, key) {
|
|
|
132
132
|
|
|
133
133
|
export function decryptText (blob, key) {
|
|
134
134
|
const [magic, iv, ct, tag] = String(blob).split('.')
|
|
135
|
-
if (magic !== MAGIC) throw new Error('at-rest:
|
|
135
|
+
if (magic !== MAGIC) throw new Error('at-rest: unknown format')
|
|
136
136
|
const d = crypto.createDecipheriv('aes-256-gcm', key, Buffer.from(iv, 'base64'))
|
|
137
137
|
d.setAuthTag(Buffer.from(tag, 'base64'))
|
|
138
138
|
return Buffer.concat([d.update(Buffer.from(ct, 'base64')), d.final()]).toString('utf8')
|
|
@@ -176,7 +176,7 @@ export function migrateFile (file, key) {
|
|
|
176
176
|
try { text = fs.readFileSync(file, 'utf8') } catch (_) { return 'sin-archivo' }
|
|
177
177
|
if (isEncrypted(text)) return 'ya-cifrado'
|
|
178
178
|
const blob = encryptText(text, key)
|
|
179
|
-
if (decryptText(blob, key) !== text) throw new Error('at-rest:
|
|
179
|
+
if (decryptText(blob, key) !== text) throw new Error('at-rest: verification failed, the original is untouched')
|
|
180
180
|
const tmp = file + '.atrest.tmp'
|
|
181
181
|
fs.writeFileSync(tmp, blob, { mode: 0o600 })
|
|
182
182
|
fs.renameSync(tmp, file)
|
package/src/core/libVersion.js
CHANGED