PrivateKey

public struct PrivateKey : Codable
extension PrivateKey: CustomStringConvertible
extension PrivateKey: Equatable

A struct representing a PrivateKey

Properties

  • The raw bytes of the private key

    Declaration

    Swift

    public var bytes: [UInt8]
  • The signing curve used by the public key, to generate a wallet address

    Declaration

    Swift

    public let signingCurve: EllipticalCurve
  • Return a Base58 encoded version of the privateKey

    Declaration

    Swift

    public var base58CheckRepresentation: String { get }

Init

  • Initialize a key with the given bytes.

    Declaration

    Swift

    public init(_ bytes: [UInt8], signingCurve: EllipticalCurve = .ed25519)

    Parameters

    bytes

    Raw bytes of the private key.

    signingCurve

    The elliptical curve to use for the key. Defaults to ed25519.

  • Initialize a key with the given base58check encoded string.

    Declaration

    Swift

    public init?(_ string: String, signingCurve: EllipticalCurve = .ed25519)

    Parameters

    string

    A base58check encoded string.

    signingCurve

    The elliptical curve to use for the key. Defaults to ed25519.

Utils

  • Sign the given hex encoded string with the given key.

    Declaration

    Swift

    public func sign(hex: String) -> [UInt8]?

    Parameters

    hex

    The hex string to sign.

    Return Value

    A signature from the input.

  • Sign the given bytes.

    Declaration

    Swift

    public func sign(bytes: [UInt8]) -> [UInt8]?

    Parameters

    bytes

    The raw bytes to sign.

    Return Value

    A signature from the input.

  • Declaration

    Swift

    public var description: String { get }
  • Declaration

    Swift

    public static func == (lhs: PrivateKey, rhs: PrivateKey) -> Bool