Add share public key button
This commit is contained in:
parent
d95d0671d6
commit
0a653e928b
|
@ -223,6 +223,12 @@
|
|||
}]];
|
||||
#endif
|
||||
|
||||
[section
|
||||
addItem:[self destructiveButtonItemWithTitle:NSLocalizedString(@"Share Public Key", @"")
|
||||
accessibilityIdentifier:ACCESSIBILITY_IDENTIFIER_WITH_NAME(self, @"share_public_key")
|
||||
selector:@selector(sharePublicKey)
|
||||
color:[UIColor ows_materialBlueColor]]];
|
||||
|
||||
if (TSAccountManager.sharedInstance.isDeregistered) {
|
||||
[section addItem:[self destructiveButtonItemWithTitle:NSLocalizedString(@"SETTINGS_REREGISTER_BUTTON",
|
||||
@"Label for re-registration button.")
|
||||
|
@ -471,6 +477,13 @@
|
|||
}
|
||||
}
|
||||
|
||||
- (void)sharePublicKey
|
||||
{
|
||||
NSString *publicKey = OWSIdentityManager.sharedManager.identityKeyPair.hexEncodedPublicKey;
|
||||
UIActivityViewController *shareVC = [[UIActivityViewController alloc] initWithActivityItems:@[ publicKey ] applicationActivities:nil];
|
||||
[self presentViewController:shareVC animated:YES completion:nil];
|
||||
}
|
||||
|
||||
- (void)reregisterUser
|
||||
{
|
||||
[RegistrationUtils showReregistrationUIFromViewController:self];
|
||||
|
|
|
@ -2570,3 +2570,4 @@
|
|||
"No search results" = "No search results";
|
||||
"Calculating proof of work" = "Calculating proof of work";
|
||||
"Failed to calculate proof of work." = "Failed to calculate proof of work.";
|
||||
"Share Public Key" = "Share Public Key";
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
|
||||
public extension ECKeyPair {
|
||||
|
||||
var hexEncodedPrivateKey: String {
|
||||
@objc var hexEncodedPrivateKey: String {
|
||||
return privateKey.map { String(format: "%02hhx", $0) }.joined()
|
||||
}
|
||||
|
||||
var hexEncodedPublicKey: String {
|
||||
@objc var hexEncodedPublicKey: String {
|
||||
// Prefixing with "05" is necessary for what seems to be a sort of Signal public key versioning system
|
||||
return "05" + publicKey.map { String(format: "%02hhx", $0) }.joined()
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue