public void RemoveSignedPreKey(uint signedPreKeyId) { SignedPreKeysRepository signedPreKeysRepository = new SignedPreKeysRepository(); List <SignedPreKeys> signedPreKeys = signedPreKeysRepository.GetSignedPreKeys(Convert.ToString(signedPreKeyId)); if (signedPreKeys != null && signedPreKeys.Count > 0) { SignedPreKeys signedPreKey = signedPreKeys.First(); signedPreKeysRepository.Delete(signedPreKey); } }
public SignedPreKeyRecord LoadSignedPreKey(uint signedPreKeyId) { SignedPreKeysRepository preKeysRepository = new SignedPreKeysRepository(); List <SignedPreKeys> signedPreKeys = preKeysRepository.GetSignedPreKeys(Convert.ToString(signedPreKeyId)); if (signedPreKeys != null && signedPreKeys.Count > 0) { SignedPreKeyRecord signedPreKeyRecord = new SignedPreKeyRecord(signedPreKeys.First().Record); return(signedPreKeyRecord); } return(null); }
public List <SignedPreKeyRecord> LoadSignedPreKeys() { List <SignedPreKeyRecord> retVal = new List <SignedPreKeyRecord>(); SignedPreKeysRepository preKeysRepository = new SignedPreKeysRepository(); List <SignedPreKeys> signedPreKeys = (List <SignedPreKeys>)preKeysRepository.GetAll(); foreach (SignedPreKeys signedPreKeyse in signedPreKeys) { retVal.Add(new SignedPreKeyRecord(signedPreKeyse.Record)); } return(retVal.Count > 0 ? retVal : null); }
public void StoreSignedPreKey(uint signedPreKeyId, SignedPreKeyRecord record) { if (ContainsSignedPreKey(signedPreKeyId)) { RemovePreKey(signedPreKeyId); } SignedPreKeysRepository signedPreKeysRepository = new SignedPreKeysRepository(); SignedPreKeys signedPreKey = new SignedPreKeys() { PreKeyId = Convert.ToString(signedPreKeyId), Record = record.Serialize() }; bool result = signedPreKeysRepository.Save(signedPreKey); }
public void Clear() { IdentityKeysRepository identityKeysRepository = new IdentityKeysRepository(); identityKeysRepository.DeleteAll(); PreKeysRepository preKeysRepository = new PreKeysRepository(); preKeysRepository.DeleteAll(); SenderKeysRepository senderKeysRepository = new SenderKeysRepository(); senderKeysRepository.DeleteAll(); SessionsRepository sessionsRepository = new SessionsRepository(); sessionsRepository.DeleteAll(); SignedPreKeysRepository signedPreKeysRepository = new SignedPreKeysRepository(); signedPreKeysRepository.DeleteAll(); }
public bool ContainsSignedPreKey(uint signedPreKeyId) { SignedPreKeysRepository signedPreKeysRepository = new SignedPreKeysRepository(); return(signedPreKeysRepository.Contains(Convert.ToString(signedPreKeyId))); }