30 lines
754 B
Swift
30 lines
754 B
Swift
import SwiftUI
|
|
|
|
@main
|
|
struct KoinsApp: App {
|
|
@StateObject private var model: AppModel
|
|
|
|
init() {
|
|
Secp256k1Backend.derivePrivateKey = { entropy in
|
|
KoinsSecp256k1.privateKey(fromEntropy: entropy)
|
|
}
|
|
Secp256k1Backend.publicKey = { privateKey in
|
|
KoinsSecp256k1.publicKey(fromPrivateKey: privateKey)
|
|
}
|
|
Secp256k1Backend.sign = { digest, privateKey in
|
|
KoinsSecp256k1.signDigest(digest, withPrivateKey: privateKey)
|
|
}
|
|
Secp256k1Backend.addScalar = { left, right in
|
|
KoinsSecp256k1.addScalar(left, toScalar: right)
|
|
}
|
|
_model = StateObject(wrappedValue: AppModel())
|
|
SelfTest.runIfRequested()
|
|
}
|
|
|
|
var body: some Scene {
|
|
WindowGroup {
|
|
RootView()
|
|
.environmentObject(model)
|
|
}
|
|
}
|
|
} |