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.2 KB · 40 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 final class TONMessageSigner {1415    /// Signs an arbitrary message to prove ownership of an address for off-chain services.16    /// https://github.com/ton-foundation/specs/blob/main/specs/wtf-0002.md17    /// 18    /// - Parameter private_key:: the private key used for signing19    /// - Parameter message:: A custom message which is input to the signing.20    /// - Returns:s the signature, Hex-encoded. On invalid input null is returned. Returned object needs to be deleted after use.21    public static func signMessage(privateKey: PrivateKey, message: String) -> String? {22        let messageString = TWStringCreateWithNSString(message)23        defer {24            TWStringDelete(messageString)25        }26        guard let result = TWTONMessageSignerSignMessage(privateKey.rawValue, messageString) else {27            return nil28        }29        return TWStringNSString(result)30    }3132    let rawValue: OpaquePointer3334    init(rawValue: OpaquePointer) {35        self.rawValue = rawValue36    }373839}40