SPB Git

spb/os-vault Public

Self-custody, multi-chain crypto wallet for macOS. One recovery phrase, six chain families, zero API keys — nothing leaves your Mac.

Swift 96% Shell 3.4% Makefile 0.6%
1.1 KB · 37 lines swift
Raw Blame History
1import WalletCoreC2import Foundation3// SPDX-License-Identifier: Apache-2.04//5// Copyright © 2017 Trust Wallet.6//7// This is a GENERATED FILE, changes made here WILL BE LOST.8//910import Foundation111213public struct StarkWare {1415    /// Generates the private stark key at the given derivation path from a valid eth signature16    ///17    /// - Parameter derivationPath: non-null StarkEx Derivation path18    /// - Parameter signature: valid eth signature19    /// - Returns:  The private key for the specified derivation path/signature, or `nullptr` if the signature or derivation path is invalid or an internal error occurs.20    public static func getStarkKeyFromSignature(derivationPath: DerivationPath, signature: String) -> PrivateKey? {21        let signatureString = TWStringCreateWithNSString(signature)22        defer {23            TWStringDelete(signatureString)24        }25        guard let value = TWStarkWareGetStarkKeyFromSignature(derivationPath.rawValue, signatureString) else {26            return nil27        }28        return PrivateKey(rawValue: value)29    }303132    init() {33    }343536}37