imskojs / cosmostation-mobile

:rocket: Cosmostation Wallet Apps (Android & iOS)

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cosmostation logo

Cosmostation Mobile Wallet

Welcome to Cosmostation's Open Source Mobile Apps!

MIT Twitter Follow

🚀 Developed / Developing by Cosmostation

About

Cosmostation wallet apps are non-custodial tendermint-based wallet that supports Cosmos Network. We will add more tendermint-based blockchain projects in the coming updates, such as IRISnet, IOV, Kava.

Notice

for generate signature with swift you have to midify BicoinKey library after pod intalled. please check below code for get correct signature in tendermint /Pods/BitcoinKet/Source/Crypro.swift (line ~59)

  public static func sign(_ data: Data, privateKey: PrivateKey) throws -> Data {
      let ctx = secp256k1_context_create(UInt32(SECP256K1_CONTEXT_SIGN))!
      defer { secp256k1_context_destroy(ctx) }

      let signature = UnsafeMutablePointer<secp256k1_ecdsa_signature>.allocate(capacity: 1)
      defer { signature.deallocate() }

      var paddingKey = Data()
      let value: UInt8 = 0
      for i in privateKey.raw.count..<32 {
          paddingKey.append(value)
      }
      paddingKey.append(privateKey.raw)


      let status = data.withUnsafeBytes { (ptr: UnsafePointer<UInt8>) in
          paddingKey.withUnsafeBytes { secp256k1_ecdsa_sign(ctx, signature, ptr, $0, nil, nil) }
      }
      guard status == 1 else { throw CryptoError.signFailed }

      let normalizedsig = UnsafeMutablePointer<secp256k1_ecdsa_signature>.allocate(capacity: 1)
      defer { normalizedsig.deallocate() }
      secp256k1_ecdsa_signature_normalize(ctx, normalizedsig, signature)

      var length: size_t = 128
      var der = Data(count: length)
      guard der.withUnsafeMutableBytes({ return secp256k1_ecdsa_signature_serialize_der(ctx, $0, &length, normalizedsig) }) == 1 else { throw CryptoError.noEnoughSpace }
      der.count = length
      return der
  }

Downloads

Cosmostation's Services and Community

License

Copyright © Cosmostation, Inc. All rights reserved.

Licensed under the MIT.

About

:rocket: Cosmostation Wallet Apps (Android & iOS)

License:MIT License


Languages

Language:Java 58.2%Language:Swift 39.5%Language:Objective-C 2.2%Language:Ruby 0.0%