Comments (3)
i want ask @mnaza to take nodejs part. i have some problem with jsthemis on C level and it's will be longer if i will try understand where is problem than he.
i updated existing code due to renaming acrawriter function and wrote code for example without zones but can't check that it works. Here is patch for nodejs part
diff --git a/examples/nodejs/examples.js b/examples/nodejs/examples.js
new file mode 100644
index 0000000..1ee0d91
--- /dev/null
+++ b/examples/nodejs/examples.js
@@ -0,0 +1,53 @@
+var acra = require('acrawriter');
+var pg = require('pg');
+var fs = require('fs')
+
+var raw_data = 'Test Message';
+
+var config = {
+ user: 'postgres',
+ database: 'acra',
+ password: 'postgres',
+ host: 'localhost',
+ port: 9494,
+ max: 10,
+ idleTimeoutMillis: 30000,
+};
+
+var public_key = fs.readFileSync('.acrakeys/client_storage.pub')
+
+var pool = new pg.Pool(config);
+pool.connect(function(err, client, done) {
+ if(err) {
+ return console.error('error fetching client from pool', err);
+ }
+ client.query('CREATE TABLE IF NOT EXISTS testjs(id SERIAL PRIMARY KEY, data BYTEA, raw_data TEXT)', [], function(err, res) {
+ done();
+ if(err) {
+ return console.error('error running query', err);
+ }
+ });
+ client.query('insert into testjs (data, raw_data) values ($2, $3)', [acra.create_acrastruct(raw_data, public_key, ""), raw_data], function(err, res) {
+ done();
+ if(err) {
+ return console.error('error running query', err);
+ }
+ });
+
+ client.query('select data, raw_data from testjs', [], function(err, res) {
+ done();
+ if(err) {
+ return console.error('error running query', err);
+ }
+ for(i=0;i<res.rows.length;i++){
+ console.log(res.rows[i].data.toString('utf8'));
+ console.log(res.rows[i].raw_data.toString('utf8'));
+ console.log(" ");
+ }
+ });
+ done();
+});
+
+pool.on('error', function (err, client) {
+ console.error('idle client error', err.message, err.stack)
+})
\ No newline at end of file
diff --git a/examples/nodejs/examples_with_zone.js b/examples/nodejs/examples_with_zone.js
index a57d136..518247b 100644
--- a/examples/nodejs/examples_with_zone.js
+++ b/examples/nodejs/examples_with_zone.js
@@ -1,4 +1,4 @@
-var acra = require('acra');
+var acra = require('acrawriter');
var pg = require('pg');
var request = require('sync-request');
@@ -23,20 +23,20 @@ pool.connect(function(err, client, done) {
if(err) {
return console.error('error fetching client from pool', err);
}
- client.query('CREATE TABLE IF NOT EXISTS testjs(id SERIAL PRIMARY KEY, zone BYTEA, data BYTEA, raw_data TEXT)', [], function(err, res) {
+ client.query('CREATE TABLE IF NOT EXISTS testjs_zone(id SERIAL PRIMARY KEY, zone BYTEA, data BYTEA, raw_data TEXT)', [], function(err, res) {
done();
if(err) {
return console.error('error running query', err);
}
});
- client.query('insert into testjs (zone, data, raw_data) values ($1, $2, $3)', [zone.id, acra.create_acra_struct(raw_data, new Buffer(zone.public_key, 'base64'), zone.id), raw_data], function(err, res) {
+ client.query('insert into testjs_zone (zone, data, raw_data) values ($1, $2, $3)', [zone.id, acra.create_acra_struct(raw_data, new Buffer(zone.public_key, 'base64'), zone.id), raw_data], function(err, res) {
done();
if(err) {
return console.error('error running query', err);
}
});
- client.query('select zone, data, raw_data from testjs', [], function(err, res) {
+ client.query('select zone, data, raw_data from testjs_zone', [], function(err, res) {
done();
if(err) {
return console.error('error running query', err);
from acra.
from acra.
completed by #75
from acra.
Related Issues (20)
- [ISSUE] Using Acra as proxy/encryptor with rails app fails to encrypt HOT 4
- [ISSUE] Acra throws errors on tables with columns wrapped with double quotes HOT 3
- [ISSUE] Acra replaces null values by an empty string when using prepared statements HOT 3
- [ISSUE] tls_ocsp_from_cert: ignore doesn't ignore database OCSP, undocumented behaviour HOT 4
- Clarification on replacement of Zones HOT 2
- [ISSUE] Tokenization in MariaDB HOT 2
- Question HOT 2
- [ISSUE] "Error 2006: MySQL server has gone away" while executing mysqli prepared statements HOT 1
- [ISSUE] PAN masking does not meet the PCI SSC requirements HOT 1
- Question about AcraCensor: SQL query without "FROM" HOT 2
- Question about poison records HOT 7
- Online SQL grammar editor/tester
- Ask: How to use Masking? HOT 3
- [ISSUE] Encryption Not working HOT 4
- [ISSUE]Reducing overhead HOT 3
- [ISSUE]Supported MySQL Versions HOT 2
- [Query] acraserver in distributed environment behind load balancer HOT 4
- [ISSUE] Index on encrypted column HOT 1
- [ISSUE]Facing lot of "use of closed network connection" error HOT 2
- What should be the approach to supporting Microsoft SQL Server and Oracle? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acra.