Skip to content

.verify method bug? #39

@certifirm

Description

@certifirm

I test the following code with an input file (OTS) that can be verified and upgraded:

let ruta_fichero_ots = require('path').resolve(sails.config.appPath) + '/sellostiempoweb/' + registro.id_usuario + '/' + registro.uid_fichero + '.pdf.ots';
let fichero_ots_buffer = await fs.readFile(ruta_fichero_ots);

let hash = Buffer.from(registro.hash, 'hex');

let detached = OpenTimestamps.DetachedTimestampFile.fromHash(new OpenTimestamps.Ops.OpSHA256(), hash);
const detachedOts = OpenTimestamps.DetachedTimestampFile.deserialize(fichero_ots_buffer);
let cambiado1 = await OpenTimestamps.upgrade(detachedOts);
let verifyResult = await OpenTimestamps.verify(detachedOts, detached);
let cambiado2 = await OpenTimestamps.upgrade(detachedOts);

console.log('CAMBIADO1: ' + cambiado1);
console.log('CAMBIADO2: ' + cambiado2);

The exit is:

CAMBIADO1: true
CAMBIADO2: false

It's like verify changes the input "detachedOts". But if I read detachedOTS variable before and after verifyResult, it's the same.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions