From b9a90cae749ff7fe9bb12f1bea2da7ed9bb55fbb Mon Sep 17 00:00:00 2001 From: Ryan Zhao Date: Thu, 17 Aug 2023 14:19:30 +1000 Subject: [PATCH] add register logic --- Session/Onboarding/LandingView.swift | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Session/Onboarding/LandingView.swift b/Session/Onboarding/LandingView.swift index 61fbf4767..3ea9d22fe 100644 --- a/Session/Onboarding/LandingView.swift +++ b/Session/Onboarding/LandingView.swift @@ -1,8 +1,10 @@ // Copyright © 2023 Rangeproof Pty Ltd. All rights reserved. import SwiftUI -import UIKit +import Sodium import SessionUIKit +import SignalUtilitiesKit +import SessionUtilitiesKit struct LandingView: View { @EnvironmentObject var host: HostWrapper @@ -101,6 +103,15 @@ struct LandingView: View { } private func register() { + let seed: Data! = try! Randomness.generateRandomBytes(numberBytes: 16) + let (ed25519KeyPair, x25519KeyPair): (KeyPair, KeyPair) = try! Identity.generate(from: seed) + Onboarding.Flow.register + .preregister( + with: seed, + ed25519KeyPair: ed25519KeyPair, + x25519KeyPair: x25519KeyPair + ) + let viewController: SessionHostingViewController = SessionHostingViewController(rootView: DisplayNameView(flow: .register)) viewController.setUpNavBarSessionIcon() self.host.controller?.navigationController?.pushViewController(viewController, animated: true)