code: func (ctl *HandshakeController) updateKeys(pubkeyid string, topic *Topic, in bool, symkeyids []string, limit uint16) {
  	ctl.lock.Lock()
  	defer ctl.lock.Unlock()
  	if _, ok := ctl.handshakes[pubkeyid]; !ok {
  		ctl.handshakes[pubkeyid] = make(map[Topic]*handshake)
  
  	}
  	if ctl.handshakes[pubkeyid][*topic] == nil {
  		ctl.handshakes[pubkeyid][*topic] = &handshake{}
  	}
  	var keystore *[]handshakeKey
  	expire := time.Now()
  	if in {
  		keystore = &(ctl.handshakes[pubkeyid][*topic].inKeys)
  	} else {
  		keystore = &(ctl.handshakes[pubkeyid][*topic].outKeys)
  		expire = expire.Add(time.Millisecond * ctl.symKeyExpiryTimeout)
  	}
  	for _, storekey := range *keystore {
  		storekey.expiredAt = expire
  	}
  	for i := 0; i < len(symkeyids); i++ {
  		storekey := handshakeKey{
  			symKeyID: &symkeyids[i],
  			pubKeyID: &pubkeyid,
  			limit:    limit,
  		}
  		*keystore = append(*keystore, storekey)
  		ctl.pss.mx.Lock()
  		ctl.pss.symKeyPool[*storekey.symKeyID][*topic].protected = true
  		ctl.pss.mx.Unlock()
  	}
  	for i := 0; i < len(*keystore); i++ {
  		ctl.symKeyIndex[*(*keystore)[i].symKeyID] = &((*keystore)[i])
  	}
  }
docs: // Add all given symmetric keys with validity limits to store by
  // peer (public key), topic and specified direction