Latest 0.1.1
Homepage https://github.com/EOSIO/eosio-swift-vault-signature-provider
License MIT Copyright (c) 2017-2019 block.one and its contributors. All rights reserved.
Platforms ios 11.3
Authors , , , , ,

Swift Logo

EOSIO SDK for Swift: Vault Signature Provider EOSIO Alpha

Software License
Swift 4.2

Vault Signature Provider is a pluggable signature provider for EOSIO SDK for Swift. It allows for signing transactions using keys stored in Keychain or the device’s Secure Enclave.

All product and company names are trademarks™ or registered® trademarks of their respective holders. Use of them does not imply any affiliation with or endorsement by them.

Contents

About Signature Providers

The Signature Provider abstraction is arguably the most useful of all of the EOSIO SDK for Swift providers. It is responsible for:

  • finding out what keys are available for signing (getAvailableKeys), and
  • requesting and obtaining transaction signatures with a subset of the available keys (signTransaction).

By simply switching out the signature provider on a transaction, signature requests can be routed any number of ways. Need a signature from keys in the platform’s Keychain or Secure Enclave? Configure the EosioTransaction with this signature provider. Need software signing? Take a look at the Softkey Signature Provider.

All signature providers must conform to the EosioSignatureProviderProtocol Protocol.

Prerequisites

  • Xcode 10 or higher
  • CocoaPods 1.5.3 or higher
  • For iOS, iOS 11.3+

Dependencies

Vault Signature Provider depends on the EOSIO SDK for Swift: Vault library. Vault will automatically be installed when you include Vault Signature Provider in your application with CocoaPods.

To access more Keychain and/or Secure Enclave functionality, use Vault directly. Refer to the EOSIO SDK for Swift: Vault documentation for more information.

Installation

Vault Signature Provider is intended to be used in conjunction with EOSIO SDK for Swift as a provider plugin.

To use Vault Signature Provider with EOSIO SDK for Swift in your app, add the following pods to your Podfile:

use_frameworks!

target "Your Target" do
  pod "EosioSwift", "~> 0.1.1" # EOSIO SDK for Swift core library
  pod "EosioSwiftVaultSignatureProvider", "~> 0.1.1" # pod for this library
  # add other providers for EOSIO SDK for Swift
  pod "EosioSwiftAbieosSerializationProvider", "~> 0.1.1" # serialization provider
end

Then run pod install.

Next, you must configure your application as a member of an App Group. See Apple’s documentation here for instructions on enabling and configuring the App Group Capability in Xcode.

Now Vault Signature Provider is ready for use within EOSIO SDK for Swift according to the EOSIO SDK for Swift Basic Usage instructions.

Direct Usage

Generally, signature providers are called by EosioTransaction during signing. (See an example here.) If you find, however, that you need to get available keys or request signing directly, this library can be invoked as follows:

let signProvider = try? EosioVaultSignatureProvider(accessGroup: "YOUR_ACCESS_GROUP")
let publicKeysArray = signProvider?.getAvailableKeys() // Returns the public keys.

_Learn more about Access Groups here._

To sign an EosioTransaction, create an EosioTransactionSignatureRequest object and call the EosioVaultSignatureProvider.signTransaction(request:completion:) method with the request:

var signRequest = EosioTransactionSignatureRequest()
signRequest.serializedTransaction = serializedTransaction
signRequest.publicKeys = publicKeys
signRequest.chainId = chainId

signProvider.signTransaction(request: signRequest) { (response) in
    ...
}

Documentation

Please refer to the generated code documentation at https://eosio.github.io/eosio-swift-vault-signature-provider or by cloning this repo and opening the docs/index.html file in your browser.

Library Methods

This library is an implementation of EosioSignatureProviderProtocol. It implements the following protocol methods:

  • EosioVaultSignatureProvider.signTransaction(request:completion:) signs an EosioTransaction.
  • EosioVaultSignatureProvider.getAvailableKeys(...) returns an array containing the public keys associated with the private keys that the object is initialized with.

To initialize the implementation:

  • EosioVaultSignatureProvider.init(accessGroup:requireBio:) initializes the signature provider.
    • accessGroup: Learn more about Access Groups here.
    • requireBio: Defaults to false. Some keys may require biometric authentication no matter what this flag is set to. For keys that do not require biometric authentication themselves, this flag can force the bio check.

Other Keychain and/or Secure Enclave functionality can be accessed by calling methods directly on EOSIO SDK for Swift: Vault, which is included with this library as a dependency.

Want to help?

Interested in contributing? That’s awesome! Here are some Contribution Guidelines and the Code of Conduct.

License

MIT

Important

See LICENSE for copyright and license terms. Block.one makes its contribution on a voluntary basis as a member of the EOSIO community and is not responsible for ensuring the overall performance of the software or any related applications. We make no representation, warranty, guarantee or undertaking in respect of the software or any related documentation, whether expressed or implied, including but not limited to the warranties or merchantability, fitness for a particular purpose and noninfringement. In no event shall we be liable for any claim, damages or other liability, whether in an action of contract, tort or otherwise, arising from, out of or in connection with the software or documentation or the use or other dealings in the software or documentation. Any test results or performance figures are indicative and will not reflect performance under all conditions. Any reference to any third party or third-party product, service or other resource is not an endorsement or recommendation by Block.one. We are not responsible, and disclaim any and all responsibility and liability, for your use of or reliance on any of these resources. Third-party resources may be updated, changed or terminated at any time, so the information here may be out of date or inaccurate.

Wallets and related components are complex software that require the highest levels of security. If incorrectly built or used, they may compromise users’ private keys and digital assets. Wallet applications and related components should undergo thorough security evaluations before being used. Only experienced developers should work with this software.

Latest podspec

{
    "name": "EosioSwiftVaultSignatureProvider",
    "version": "0.1.1",
    "summary": "Experimental Keychain and Secure Enclave Signature Provider for Eosio SDK for Swift.",
    "homepage": "https://github.com/EOSIO/eosio-swift-vault-signature-provider",
    "license": {
        "type": "MIT",
        "text": "                           Copyright (c) 2017-2019 block.one and its contributors.  All rights reserved.n"
    },
    "authors": {
        "Todd Bowden": "[email protected]",
        "Serguei Vinnitskii": "[email protected]",
        "Farid Rahmani": "[email protected]",
        "Brandon Fancher": "[email protected]",
        "Steve McCoole": "[email protected]",
        "Ben Martell": "[email protected]"
    },
    "source": {
        "git": "https://github.com/EOSIO/eosio-swift-vault-signature-provider.git",
        "tag": "v0.1.1"
    },
    "swift_version": "4.2",
    "platforms": {
        "ios": "11.3"
    },
    "source_files": [
        "EosioSwiftVaultSignatureProvider/**/*.{c,h,m,cpp,hpp}",
        "EosioSwiftVaultSignatureProvider/**/*.swift"
    ],
    "pod_target_xcconfig": {
        "CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES": "YES",
        "CLANG_ENABLE_MODULES": "YES",
        "SWIFT_COMPILATION_MODE": "wholemodule",
        "ENABLE_BITCODE": "YES"
    },
    "ios": {
        "dependencies": {
            "EosioSwiftEcc": [
                "~> 0.1.1"
            ],
            "EosioSwift": [
                "~> 0.1.1"
            ],
            "EosioSwiftVault": [
                "~> 0.1.1"
            ]
        }
    }
}

Pin It on Pinterest

Share This