Skip to content

chydof007/cosmostation-mobile

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

👽 Cosmostation Wallet Apps (Android & iOS)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Java 57.8%
  • Swift 40.0%
  • Objective-C 2.2%