Merge pull request #754 from RyanRory/bug-fixes

Bug fixes
pull/769/head
RyanZhao 3 years ago committed by GitHub
commit 8d8028da13
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -198,7 +198,7 @@ final class RestoreVC: BaseVC {
do { do {
let hexEncodedSeed = try Mnemonic.decode(mnemonic: mnemonic) let hexEncodedSeed = try Mnemonic.decode(mnemonic: mnemonic)
let seed = Data(hex: hexEncodedSeed) let seed = Data(hex: hexEncodedSeed)
let (ed25519KeyPair, x25519KeyPair) = try! Identity.generate(from: seed) let (ed25519KeyPair, x25519KeyPair) = try Identity.generate(from: seed)
Onboarding.Flow.recover.preregister(with: seed, ed25519KeyPair: ed25519KeyPair, x25519KeyPair: x25519KeyPair) Onboarding.Flow.recover.preregister(with: seed, ed25519KeyPair: ed25519KeyPair, x25519KeyPair: x25519KeyPair)
mnemonicTextView.resignFirstResponder() mnemonicTextView.resignFirstResponder()

@ -96,7 +96,7 @@ public enum GarbageCollectionJob: JobExecutor {
GROUP BY \(interaction[.threadId]) GROUP BY \(interaction[.threadId])
) AS interactionInfo ON interactionInfo.\(threadIdLiteral) = \(interaction[.threadId]) ) AS interactionInfo ON interactionInfo.\(threadIdLiteral) = \(interaction[.threadId])
WHERE ( WHERE (
\(interaction[.timestampMs]) < \(timestampNow - approxSixMonthsInSeconds) AND \(interaction[.timestampMs]) < \((timestampNow - approxSixMonthsInSeconds) * 1000) AND
interactionInfo.interactionCount >= \(minInteractionsToTrimSql) interactionInfo.interactionCount >= \(minInteractionsToTrimSql)
) )
) )

@ -319,7 +319,7 @@ public enum MessageReceiver {
var updatedProfile: Profile = profile var updatedProfile: Profile = profile
// Name // Name
if let name = name, name != profile.name { if let name = name, !name.isEmpty, name != profile.name {
let shouldUpdate: Bool let shouldUpdate: Bool
if isCurrentUser { if isCurrentUser {
shouldUpdate = given(UserDefaults.standard[.lastDisplayNameUpdate]) { shouldUpdate = given(UserDefaults.standard[.lastDisplayNameUpdate]) {

@ -53,7 +53,7 @@ extension ECKeyPair {
public extension Identity { public extension Identity {
static func generate(from seed: Data) throws -> (ed25519KeyPair: Sign.KeyPair, x25519KeyPair: ECKeyPair) { static func generate(from seed: Data) throws -> (ed25519KeyPair: Sign.KeyPair, x25519KeyPair: ECKeyPair) {
assert(seed.count == 16) guard (seed.count == 16) else { throw GeneralError.invalidSeed }
let padding = Data(repeating: 0, count: 16) let padding = Data(repeating: 0, count: 16)
guard guard

@ -19,6 +19,7 @@ public enum General {
} }
public enum GeneralError: Error { public enum GeneralError: Error {
case invalidSeed
case keyGenerationFailed case keyGenerationFailed
} }

Loading…
Cancel
Save