func (s *store) IsTrustedIdentity(id string, key *axolotl.IdentityKey) bool { idkeyfile := filepath.Join(s.identityDir, "remote_"+id) // Trust on first use (TOFU) if !exists(idkeyfile) { return true } b, err := s.readFile(idkeyfile) if err != nil { return false } return bytes.Equal(b, key.Key()[:]) }
func (s *store) IsTrustedIdentity(id string, key *axolotl.IdentityKey) bool { if config.AlwaysTrustPeerID { // Workaround until we handle peer reregistering situations // more securely and with a better UI. return true } idkeyfile := filepath.Join(s.identityDir, "remote_"+id) // Trust on first use (TOFU) if !exists(idkeyfile) { return true } b, err := s.readFile(idkeyfile) if err != nil { return false } return bytes.Equal(b, key.Key()[:]) }
func (s *store) SaveIdentity(id string, key *axolotl.IdentityKey) error { idkeyfile := filepath.Join(s.identityDir, "remote_"+id) return s.writeFile(idkeyfile, key.Key()[:]) }