pull/7/head
Niels Andriesse 6 years ago
parent 19a0d85afd
commit 4ce9228afd

@ -18,6 +18,7 @@
#import <SignalServiceKit/AppVersion.h>
#import <SignalServiceKit/PhoneNumberUtil.h>
#import <SignalServiceKit/SignalAccount.h>
#import <SignalServiceKit/SignalServiceKit-Swift.h>
#import <SignalServiceKit/TSAccountManager.h>
NS_ASSUME_NONNULL_BEGIN
@ -396,16 +397,17 @@ NS_ASSUME_NONNULL_BEGIN
if (hasSearchText) {
// Loki:
// ========
NSString *publicKey = self.searchBar.text;
// TODO: Validate public key and show an error if something's wrong
OWSTableSection *newConversationSection = [OWSTableSection new];
[newConversationSection
addItem:[OWSTableItem disclosureItemWithText:NSLocalizedString(@"Start a Conversation", @"")
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"start_conversation")
customRowHeight:UITableViewAutomaticDimension
actionBlock:^{
typeof(self) strongSelf = weakSelf;
if (!strongSelf) { return; }
NSString *publicKey = strongSelf.searchBar.text;
[strongSelf newConversationWithRecipientId:publicKey];
[weakSelf newConversationWithRecipientId:publicKey];
}]];
[contents addSection:newConversationSection];
// ========

@ -1,5 +1,4 @@
#import "ECKeyPair.h"
#import <SignalCoreKit/OWSAsserts.h>
extern void curve25519_donna(unsigned char *output, const unsigned char *a, const unsigned char *b);

@ -10,7 +10,7 @@ public extension ECKeyPair {
return "05" + publicKey.map { String(format: "%02hhx", $0) }.joined()
}
static func isValidHexEncodedPublicKey(candidate: String) -> Bool {
@objc public static func isValidHexEncodedPublicKey(candidate: String) -> Bool {
// Check that it's a valid hexadecimal encoding
let allowedCharacters = CharacterSet(charactersIn: "0123456789ABCDEF")
guard candidate.uppercased().unicodeScalars.allSatisfy({ allowedCharacters.contains($0) }) else { return false }

Loading…
Cancel
Save