| 
						
						
							
								
							
						
						
					 | 
					 | 
					@ -76,7 +76,7 @@
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      return {
 | 
					 | 
					 | 
					 | 
					      return {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        unreadCount: 0,
 | 
					 | 
					 | 
					 | 
					        unreadCount: 0,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        verified: textsecure.storage.protocol.VerifiedStatus.DEFAULT,
 | 
					 | 
					 | 
					 | 
					        verified: textsecure.storage.protocol.VerifiedStatus.DEFAULT,
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        keysPending: true
 | 
					 | 
					 | 
					 | 
					        keyExchangeStatus: 'none'
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      };
 | 
					 | 
					 | 
					 | 
					      };
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    },
 | 
					 | 
					 | 
					 | 
					    },
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
					 | 
					@ -398,29 +398,36 @@
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return contact.isVerified();
 | 
					 | 
					 | 
					 | 
					        return contact.isVerified();
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      });
 | 
					 | 
					 | 
					 | 
					      });
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    },
 | 
					 | 
					 | 
					 | 
					    },
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    isKeysPending() {
 | 
					 | 
					 | 
					 | 
					    getKeyExchangeStatus() {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if (this.isPrivate()) {
 | 
					 | 
					 | 
					 | 
					      return this.get('keyExchangeStatus') || 'none';
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (this.isMe()) {
 | 
					 | 
					 | 
					 | 
					    },
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          return false;
 | 
					 | 
					 | 
					 | 
					    isKeyExchangeCompleted() {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        }
 | 
					 | 
					 | 
					 | 
					      if (!this.isPrivate()) {
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        const keysPending = this.get('keysPending');
 | 
					 | 
					 | 
					 | 
					        throw new Error(
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        if (keysPending === undefined) {
 | 
					 | 
					 | 
					 | 
					          'isKeyExchangeCompleted not implemented for groups'
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          keysPending = true;
 | 
					 | 
					 | 
					 | 
					        );
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      }
 | 
					 | 
					 | 
					 | 
					      }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        return keysPending;
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      if (this.isMe()) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					        return true;
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      }
 | 
					 | 
					 | 
					 | 
					      }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					
 | 
					 | 
					 | 
					 | 
					
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      return this.getKeyExchangeStatus() == 'completed';
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    },
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					    setKeyExchangeStatus(status) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      if (typeof status !== 'string') {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        throw new Error(
 | 
					 | 
					 | 
					 | 
					        throw new Error(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        'isKeysPending not implemented for groups'
 | 
					 | 
					 | 
					 | 
					          'setKeyExchangeStatus expects a string'
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        );
 | 
					 | 
					 | 
					 | 
					        );
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    },
 | 
					 | 
					 | 
					 | 
					      }
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    setKeysPending(keysPending) {
 | 
					 | 
					 | 
					 | 
					      status = status.toLowerCase();
 | 
				
			
			
				
				
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if (typeof keysPending !== 'boolean') {
 | 
					 | 
					 | 
					 | 
					      
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					 | 
					      if (['none', 'ongoing', 'completed'].indexOf(status) < 0) {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        throw new Error(
 | 
					 | 
					 | 
					 | 
					        throw new Error(
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					          'setKeysPending expects a boolean'
 | 
					 | 
					 | 
					 | 
					          'unknown string value given to setKeyExchangeStatus'
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					        );
 | 
					 | 
					 | 
					 | 
					        );
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      }
 | 
					 | 
					 | 
					 | 
					      }
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      this.set({ keysPending });
 | 
					 | 
					 | 
					 | 
					      this.set({ keyExchangeStatus: status });
 | 
				
			
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    },
 | 
					 | 
					 | 
					 | 
					    },
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					    isUnverified() {
 | 
					 | 
					 | 
					 | 
					    isUnverified() {
 | 
				
			
			
		
	
		
		
			
				
					
					 | 
					 | 
					 | 
					      if (this.isPrivate()) {
 | 
					 | 
					 | 
					 | 
					      if (this.isPrivate()) {
 | 
				
			
			
		
	
	
		
		
			
				
					| 
						
							
								
							
						
						
						
					 | 
					 | 
					
 
 |