mirror of
https://github.com/tlsnotary/PageSigner.git
synced 2026-01-08 22:27:57 -05:00
31 lines
822 B
JavaScript
31 lines
822 B
JavaScript
// this file is not used by the extension, it serves as an input to to create cose.js with:
|
|
// browserify coseverify.js --standalone COSE > cose.js
|
|
|
|
const cose = require('cose-js');
|
|
|
|
// x,y,doc is an ArrayBuffer
|
|
const verify = function (x, y, doc){
|
|
const verifier = {
|
|
'key': {
|
|
'x': Buffer.from(x),
|
|
'y': Buffer.from(y)
|
|
}
|
|
};
|
|
|
|
cose.sign.verify(
|
|
Buffer.from(doc),
|
|
verifier,
|
|
{defaultType: 18})
|
|
.then((buf) => {
|
|
console.log("Verification successful")
|
|
//console.log('Verified message: ' + buf.toString('utf8'));
|
|
}).catch((error) => {
|
|
console.log(error);
|
|
});
|
|
}
|
|
|
|
if (typeof module !== 'undefined'){ //we are in node.js environment
|
|
module.exports={
|
|
verify
|
|
}
|
|
} |