Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

moved keys/ into examples/

  • Loading branch information...
commit 8fe782591cfa1c73ca530475f3a9c0ec18123429 1 parent 48c4755
@mnaamani authored
View
2  .gitignore
@@ -1,4 +1,4 @@
-db/*.fp
+examples/keys/*.fp
build/
node_modules/
.lock-wscript
View
3  examples/alice.js
@@ -2,8 +2,9 @@ var libotr = require('otr');
var dgram = require('dgram');
var ALLOW_NEW_RELATIONSHIPS = true;
+var keys_dir=__dirname+"/keys";
-var alice = new libotr.User({name:'alice',keys:'./db/alice.keys',fingerprints:'./db/alice.fp'});
+var alice = new libotr.User({name:'alice',keys:keys_dir+'/alice.keys',fingerprints:keys_dir+'/alice.fp'});
var BOB = alice.ConnContext("alice@telechat.org","telechat","BOB");
var otrchan = new libotr.OTRChannel(alice, BOB, {
policy:59,
View
4 examples/bob.js
@@ -1,9 +1,9 @@
var libotr = require('otr');
var dgram = require('dgram');
-
+var keys_dir = __dirname+"/keys";
var ALLOW_NEW_RELATIONSHIPS = true;
-var bob = new libotr.User({name:'bob',keys:'./db/bob.keys',fingerprints:'./db/bob.fp'});
+var bob = new libotr.User({name:'bob',keys:keys_dir+'/bob.keys',fingerprints:keys_dir+'/bob.fp'});
var ALICE = bob.ConnContext("bob@telechat.org","telechat","ALICE");
var otrchan = new libotr.OTRChannel(bob, ALICE, {
policy:59,
View
9 examples/genkeys.js
@@ -1,21 +1,20 @@
var otr=require("otr");
console.log("libotr version:",otr.version());
-
var users = {
alice: new otr.UserState(),
bob: new otr.UserState()
};
users.alice.conf ={
- keys: "./db/alice.keys",
- fingerprints: "./db/alice.fp",
+ keys: __dirname+"/keys/alice.keys",
+ fingerprints: __dirname+"/keys/alice.fp",
account: "alice@telechat.org",
proto: "telechat"
};
users.bob.conf={
- keys: "./db/bob.keys",
- fingerprints: "./db/bob.fp",
+ keys: __dirname+"/keys/bob.keys",
+ fingerprints: __dirname+"/keys/bob.fp",
account: "bob@telechat.org",
proto: "telechat"
};
View
0  db/alice.keys → examples/keys/alice.keys
File renamed without changes
View
0  db/bob.keys → examples/keys/bob.keys
File renamed without changes
View
14 examples/test.js
@@ -1,9 +1,9 @@
var libotr = require('otr');
console.log("libotr version:",libotr.version());
//libotr.debugOn();
-
+var keys_dir = __dirname + "/keys";
//create user alice, specify encryption keys and fingerprints files
-var alice = new libotr.User({name:'alice',keys:'./db/alice.keys',fingerprints:'./db/alice.fp'});
+var alice = new libotr.User({name:'alice',keys:keys_dir+'/alice.keys',fingerprints:keys_dir+'/alice.fp'});
//create a connection context used to identify communication with Bob
var BOB = alice.ConnContext("alice@telechat.org","telechat","BOB");
@@ -11,7 +11,7 @@ var BOB = alice.ConnContext("alice@telechat.org","telechat","BOB");
//setup an OTR communication channel with Bob
var otrchan_a = new libotr.OTRChannel(alice, BOB,{policy:libotr.POLICY("ALWAYS"),secret:'s3cr37'});
-var bob = new libotr.User({name:'bob',keys:'./db/bob.keys',fingerprints:'./db/bob.fp'});
+var bob = new libotr.User({name:'bob',keys:keys_dir+'/bob.keys',fingerprints:keys_dir+'/bob.fp'});
var ALICE = bob.ConnContext("bob@telechat.org","telechat","ALICE");
var otrchan_b = new libotr.OTRChannel(bob, ALICE,{policy:libotr.POLICY("ALWAYS"),secret:'s3cr37'});
@@ -57,17 +57,19 @@ otrchan_b.on("message",function(msg){
//connection is encrypted..
otrchan_a.on("gone_secure",function(){
- //if note previously authenticated (fingerpring verified do it now)
+ //if fingerprint not previously authenticated, do it now
if(this.context.trust!="smp"){
- console.log("doing SMP authentication to verify keys...");
- this.start_smp();
+ console.log("Alice initiating SMP authentication to verify keys...");
+ this.start_smp();
}
});
otrchan_b.on("smp_request",function(){
+ console.log("Bob responding to SMP request.");
this.respond_smp();
});
+
//alice sends a message to bob
otrchan_a.send("Hello, World!");

0 comments on commit 8fe7825

Please sign in to comment.
Something went wrong with that request. Please try again.