Harden rotateSignedPrekey against nonexistent identity key
This is now what happens after Signal Desktop discovers that it is no longer linked with a mobile device, since the identityh key is deleted.
This commit is contained in:
		
					parent
					
						
							
								153a22f46b
							
						
					
				
			
			
				commit
				
					
						1c6d91b59c
					
				
			
		
					 1 changed files with 7 additions and 0 deletions
				
			
		|  | @ -154,9 +154,16 @@ | ||||||
|                 var server = this.server; |                 var server = this.server; | ||||||
|                 var cleanSignedPreKeys = this.cleanSignedPreKeys; |                 var cleanSignedPreKeys = this.cleanSignedPreKeys; | ||||||
| 
 | 
 | ||||||
|  |                 // TODO: harden this against missing identity key? Otherwise, we get
 | ||||||
|  |                 //   retries every five seconds.
 | ||||||
|                 return store.getIdentityKeyPair().then(function(identityKey) { |                 return store.getIdentityKeyPair().then(function(identityKey) { | ||||||
|                     return libsignal.KeyHelper.generateSignedPreKey(identityKey, signedKeyId); |                     return libsignal.KeyHelper.generateSignedPreKey(identityKey, signedKeyId); | ||||||
|  |                 }, function(error) { | ||||||
|  |                     console.log('Failed to get identity key. Canceling key rotation.'); | ||||||
|                 }).then(function(res) { |                 }).then(function(res) { | ||||||
|  |                     if (!res) { | ||||||
|  |                         return; | ||||||
|  |                     } | ||||||
|                     console.log('Saving new signed prekey', res.keyId); |                     console.log('Saving new signed prekey', res.keyId); | ||||||
|                     return Promise.all([ |                     return Promise.all([ | ||||||
|                         textsecure.storage.put('signedKeyId', signedKeyId + 1), |                         textsecure.storage.put('signedKeyId', signedKeyId + 1), | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Scott Nonnenberg
				Scott Nonnenberg