add register logic

This commit is contained in:
Ryan Zhao 2023-08-17 14:19:30 +10:00
parent a495b9eb63
commit b9a90cae74
1 changed files with 12 additions and 1 deletions

View File

@ -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)