KeyPair

public struct KeyPair

A struct representing a both a PrivateKey and PublicKey with helper methods to create various kinds

Public Helpers

  • Create a regular (non HD) KeyPair from a hex seed string

    Declaration

    Swift

    public static func regular(fromSeedString seedString: String) -> KeyPair?

    Parameters

    seedString

    A hex string representing a cryptographic seed (can be created from Mnemonic)

    Return Value

    A KeyPair instance, if able, nil otherwise

  • Create a regular (non HD) KeyPair from a Mnemonic instance

    Declaration

    Swift

    public static func regular(fromMnemonic mnemonic: Mnemonic, passphrase: String) -> KeyPair?

    Parameters

    mnemonic

    An instance of Mnemonic

    Return Value

    A KeyPair instance, if able, nil otherwise

  • Create a KeyPair from a Base58 Check encoded secret key, optionaly encrypted with a passphrase. Supports both Tz1 (edsk… edes…) and Tz2 (spsk… spes…)

    Declaration

    Swift

    public static func regular(fromSecretKey secretKey: String, andPassphrase: String?) -> KeyPair?
  • Create a HD KeyPair from a hex seed string and optional Derivation Path (defaults to m/44’/1729’/0’/0’ ). Only TZ1 are produceable

    Declaration

    Swift

    public static func hd(fromSeedString seedString: String, andDerivationPath derivationPath: String = HD.defaultDerivationPath) -> KeyPair?

    Parameters

    seedString

    A hex string representing a cryptographic seed (can be created from Mnemonic)

    derivationPath

    The derivationPath to use

    Return Value

    A KeyPair instance, if able, nil otherwise

  • Create a HD KeyPair from a Mnemonic instance

    Declaration

    Swift

    public static func hd(fromMnemonic mnemonic: Mnemonic, passphrase: String, andDerivationPath derivationPath: String = HD.defaultDerivationPath) -> KeyPair?

    Parameters

    mnemonic

    An instance of Mnemonic

    derivationPath

    The derivationPath to use

    Return Value

    A KeyPair instance, if able, nil otherwise

Helpers