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%
897 B · 36 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 Foundation1112/// Represents an ASN.1 DER parser.13public struct AsnParser {1415    /// Parses the given ECDSA signature from ASN.1 DER encoded bytes.16    ///17    /// - Parameter encoded: The ASN.1 DER encoded signature.18    /// - Returns: The ECDSA signature standard binary representation: RS, where R - 32 byte array, S - 32 byte array.19    public static func ecdsaSignatureFromDer(encoded: Data) -> Data? {20        let encodedData = TWDataCreateWithNSData(encoded)21        defer {22            TWDataDelete(encodedData)23        }24        guard let result = TWAsnParserEcdsaSignatureFromDer(encodedData) else {25            return nil26        }27        return TWDataNSData(result)28    }293031    init() {32    }333435}36