Document things more

pull/7/head
Niels Andriesse 6 years ago
parent 4e8e5a4a74
commit a91c636dda

@ -200,7 +200,9 @@ final class OnboardingKeyPairViewController : OnboardingBaseViewController {
do {
let hexEncodedPrivateKey = try Mnemonic.decode(mnemonic: mnemonic)
let keyPair = ECKeyPair.generate(withHexEncodedPrivateKey: hexEncodedPrivateKey)
// Use KVC to access dbConnection even though it's private
let databaseConnection = OWSIdentityManager.shared().value(forKey: "dbConnection") as! YapDatabaseConnection
// OWSPrimaryStorageIdentityKeyStoreIdentityKey is private so just use its value directly
databaseConnection.setObject(keyPair, forKey: "TSStorageManagerIdentityKeyStoreIdentityKey", inCollection: OWSPrimaryStorageIdentityKeyStoreCollection)
hexEncodedPublicKey = keyPair.hexEncodedPublicKey
} catch let error {

@ -19,6 +19,7 @@ extern void curve25519_donna(unsigned char *output, const unsigned char *a, cons
NSMutableData *publicKey = [NSMutableData dataWithLength:ECCKeyLength];
if (!publicKey) { OWSFail(@"Could not allocate buffer"); }
curve25519_donna(publicKey.mutableBytes, privateKey.mutableBytes, basepoint);
// Use KVC to access privateKey and publicKey even though they're private
ECKeyPair *result = [ECKeyPair new];
[result setValue:[privateKey copy] forKey:@"privateKey"];
[result setValue:[publicKey copy] forKey:@"publicKey"];

Loading…
Cancel
Save