How to use the jsthemis.SecureComparator function in jsthemis

To help you get started, we’ve selected a few jsthemis examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github cossacklabs / themis / docs / examples / js / secure_comparator_client.js View on Github external
var net = require('net');
var themis = require('jsthemis');

comparator = new themis.SecureComparator(new Buffer.from("secret"));

var client = new net.Socket();
client.connect(1337, '127.0.0.1', function() {
    console.log('Connected');
    client.write(comparator.beginCompare());
});

client.on('data', function(data) {
    d = comparator.proceedCompare(data);
    if(!comparator.isCompareComplete())
	client.write(d);
    else{
	console.log(comparator.isMatch());
        client.destroy();
    }
});
github cossacklabs / themis / docs / examples / js / secure_comparator_server.js View on Github external
var server = net.createServer(function(socket) {

    comparator = new themis.SecureComparator(new Buffer.from("secret"));
  
    socket.on('data', function (data) {
	d=comparator.proceedCompare(data);
	socket.write(d);
	if(comparator.isCompareComplete()){
            console.log(comparator.isMatch());
            socket.destroy();
	}
    });
});

jsthemis

Themis is a convenient cryptographic library for data protection.

Apache-2.0
Latest version published 1 year ago

Package Health Score

62 / 100
Full package analysis