@ -355,7 +355,7 @@ describe("SignalProtocolStore", function() {
} ) ;
} ) ;
} ) ;
} ) ;
} ) ;
} ) ;
describe ( 'process VerifiedMessag e', function ( ) {
describe ( 'process ContactSyncVerificationStat e', function ( ) {
var record ;
var record ;
var newIdentity = libsignal . crypto . getRandomBytes ( 33 ) ;
var newIdentity = libsignal . crypto . getRandomBytes ( 33 ) ;
var keychangeTriggered ;
var keychangeTriggered ;
@ -387,12 +387,12 @@ describe("SignalProtocolStore", function() {
} ) ;
} ) ;
it ( 'does nothing' , function ( ) {
it ( 'does nothing' , function ( ) {
return store . process VerifiedMessag e(
return store . process ContactSyncVerificationStat e(
identifier , store . VerifiedStatus . DEFAULT , newIdentity
identifier , store . VerifiedStatus . DEFAULT , newIdentity
) . then ( fetchRecord ) . then ( function ( ) {
) . then ( fetchRecord ) . then ( function ( ) {
// fetchRecord resolved so there is a record.
// fetchRecord resolved so there is a record.
// Bad.
// Bad.
throw new Error ( "process VerifiedMessag e should not save new records") ;
throw new Error ( "process ContactSyncVerificationStat e should not save new records") ;
} , function ( ) {
} , function ( ) {
assert . strictEqual ( keychangeTriggered , 0 ) ;
assert . strictEqual ( keychangeTriggered , 0 ) ;
} ) ;
} ) ;
@ -412,13 +412,13 @@ describe("SignalProtocolStore", function() {
return wrapDeferred ( record . save ( ) ) ;
return wrapDeferred ( record . save ( ) ) ;
} ) ;
} ) ;
it ( ' saves the new identity and marks it DEFAULT ', function ( ) {
it ( ' does not save the new identity (because this is a less secure state) ', function ( ) {
return store . process VerifiedMessag e(
return store . process ContactSyncVerificationStat e(
identifier , store . VerifiedStatus . DEFAULT , newIdentity
identifier , store . VerifiedStatus . DEFAULT , newIdentity
) . then ( fetchRecord ) . then ( function ( ) {
) . then ( fetchRecord ) . then ( function ( ) {
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . DEFAULT ) ;
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . VERIFIED ) ;
assertEqualArrayBuffers ( record . get ( 'publicKey' ) , newIdentit y) ;
assertEqualArrayBuffers ( record . get ( 'publicKey' ) , testKey. pubKe y) ;
assert . strictEqual ( keychangeTriggered , 1 ) ;
assert . strictEqual ( keychangeTriggered , 0 ) ;
} ) ;
} ) ;
} ) ;
} ) ;
} ) ;
} ) ;
@ -436,7 +436,7 @@ describe("SignalProtocolStore", function() {
} ) ;
} ) ;
it ( 'updates the verified status' , function ( ) {
it ( 'updates the verified status' , function ( ) {
return store . process VerifiedMessag e(
return store . process ContactSyncVerificationStat e(
identifier , store . VerifiedStatus . DEFAULT , testKey . pubKey
identifier , store . VerifiedStatus . DEFAULT , testKey . pubKey
) . then ( fetchRecord ) . then ( function ( ) {
) . then ( fetchRecord ) . then ( function ( ) {
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . DEFAULT ) ;
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . DEFAULT ) ;
@ -459,7 +459,7 @@ describe("SignalProtocolStore", function() {
} ) ;
} ) ;
it ( 'does not hang' , function ( ) {
it ( 'does not hang' , function ( ) {
return store . process VerifiedMessag e(
return store . process ContactSyncVerificationStat e(
identifier , store . VerifiedStatus . DEFAULT , testKey . pubKey
identifier , store . VerifiedStatus . DEFAULT , testKey . pubKey
) . then ( fetchRecord ) . then ( function ( ) {
) . then ( fetchRecord ) . then ( function ( ) {
assert . strictEqual ( keychangeTriggered , 0 ) ;
assert . strictEqual ( keychangeTriggered , 0 ) ;
@ -476,7 +476,7 @@ describe("SignalProtocolStore", function() {
} ) ;
} ) ;
it ( 'saves the new identity and marks it verified' , function ( ) {
it ( 'saves the new identity and marks it verified' , function ( ) {
return store . process VerifiedMessag e(
return store . process ContactSyncVerificationStat e(
identifier , store . VerifiedStatus . UNVERIFIED , newIdentity
identifier , store . VerifiedStatus . UNVERIFIED , newIdentity
) . then ( fetchRecord ) . then ( function ( ) {
) . then ( fetchRecord ) . then ( function ( ) {
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . UNVERIFIED ) ;
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . UNVERIFIED ) ;
@ -500,7 +500,7 @@ describe("SignalProtocolStore", function() {
} ) ;
} ) ;
it ( 'saves the new identity and marks it UNVERIFIED' , function ( ) {
it ( 'saves the new identity and marks it UNVERIFIED' , function ( ) {
return store . process VerifiedMessag e(
return store . process ContactSyncVerificationStat e(
identifier , store . VerifiedStatus . UNVERIFIED , newIdentity
identifier , store . VerifiedStatus . UNVERIFIED , newIdentity
) . then ( fetchRecord ) . then ( function ( ) {
) . then ( fetchRecord ) . then ( function ( ) {
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . UNVERIFIED ) ;
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . UNVERIFIED ) ;
@ -523,7 +523,7 @@ describe("SignalProtocolStore", function() {
} ) ;
} ) ;
it ( 'updates the verified status' , function ( ) {
it ( 'updates the verified status' , function ( ) {
return store . process VerifiedMessag e(
return store . process ContactSyncVerificationStat e(
identifier , store . VerifiedStatus . UNVERIFIED , testKey . pubKey
identifier , store . VerifiedStatus . UNVERIFIED , testKey . pubKey
) . then ( fetchRecord ) . then ( function ( ) {
) . then ( fetchRecord ) . then ( function ( ) {
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . UNVERIFIED ) ;
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . UNVERIFIED ) ;
@ -546,7 +546,7 @@ describe("SignalProtocolStore", function() {
} ) ;
} ) ;
it ( 'does not hang' , function ( ) {
it ( 'does not hang' , function ( ) {
return store . process VerifiedMessag e(
return store . process ContactSyncVerificationStat e(
identifier , store . VerifiedStatus . UNVERIFIED , testKey . pubKey
identifier , store . VerifiedStatus . UNVERIFIED , testKey . pubKey
) . then ( fetchRecord ) . then ( function ( ) {
) . then ( fetchRecord ) . then ( function ( ) {
assert . strictEqual ( keychangeTriggered , 0 ) ;
assert . strictEqual ( keychangeTriggered , 0 ) ;
@ -565,7 +565,7 @@ describe("SignalProtocolStore", function() {
} ) ;
} ) ;
it ( 'saves the new identity and marks it verified' , function ( ) {
it ( 'saves the new identity and marks it verified' , function ( ) {
return store . process VerifiedMessag e(
return store . process ContactSyncVerificationStat e(
identifier , store . VerifiedStatus . VERIFIED , newIdentity
identifier , store . VerifiedStatus . VERIFIED , newIdentity
) . then ( fetchRecord ) . then ( function ( ) {
) . then ( fetchRecord ) . then ( function ( ) {
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . VERIFIED ) ;
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . VERIFIED ) ;
@ -589,7 +589,7 @@ describe("SignalProtocolStore", function() {
} ) ;
} ) ;
it ( 'saves the new identity and marks it VERIFIED' , function ( ) {
it ( 'saves the new identity and marks it VERIFIED' , function ( ) {
return store . process VerifiedMessag e(
return store . process ContactSyncVerificationStat e(
identifier , store . VerifiedStatus . VERIFIED , newIdentity
identifier , store . VerifiedStatus . VERIFIED , newIdentity
) . then ( fetchRecord ) . then ( function ( ) {
) . then ( fetchRecord ) . then ( function ( ) {
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . VERIFIED ) ;
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . VERIFIED ) ;
@ -612,7 +612,7 @@ describe("SignalProtocolStore", function() {
} ) ;
} ) ;
it ( 'saves the identity and marks it verified' , function ( ) {
it ( 'saves the identity and marks it verified' , function ( ) {
return store . process VerifiedMessag e(
return store . process ContactSyncVerificationStat e(
identifier , store . VerifiedStatus . VERIFIED , testKey . pubKey
identifier , store . VerifiedStatus . VERIFIED , testKey . pubKey
) . then ( fetchRecord ) . then ( function ( ) {
) . then ( fetchRecord ) . then ( function ( ) {
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . VERIFIED ) ;
assert . strictEqual ( record . get ( 'verified' ) , store . VerifiedStatus . VERIFIED ) ;
@ -635,7 +635,7 @@ describe("SignalProtocolStore", function() {
} ) ;
} ) ;
it ( 'does not hang' , function ( ) {
it ( 'does not hang' , function ( ) {
return store . process VerifiedMessag e(
return store . process ContactSyncVerificationStat e(
identifier , store . VerifiedStatus . VERIFIED , testKey . pubKey
identifier , store . VerifiedStatus . VERIFIED , testKey . pubKey
) . then ( fetchRecord ) . then ( function ( ) {
) . then ( fetchRecord ) . then ( function ( ) {
assert . strictEqual ( keychangeTriggered , 0 ) ;
assert . strictEqual ( keychangeTriggered , 0 ) ;