CryptoKey

public struct CryptoKey

Helper struct to generate and sign the keys

  • Initializes CryptoKey with given keyId String

    Declaration

    Swift

    public init(keyId: String, accessGroup: String? = nil)

    Parameters

    keyId

    user id for which key pair is to be generated

    accessGroup

    Optional Access Group string

  • Query attributes dictionary for generating key pair

    Declaration

    Swift

    public func keyBuilderQuery() -> [String : Any]
  • Creates Keypair for the given builder query attributes

    Throws

    error during private/public key generation

    Declaration

    Swift

    public func createKeyPair(builderQuery: [String : Any]) throws -> KeyPair

    Parameters

    builderQuery

    query attributes dictionary for generating key pair

  • Get the private key from the Keychain for given key alias

    Declaration

    Swift

    public func getSecureKey(pin: String? = nil, reason: String? = nil) -> SecKey?

    Parameters

    pin

    password for the private key credential if applies

    reason

    localized reason for the authentication screen

    Return Value

    private key for the given key alias

  • Delete Keys from the Keychain

    Declaration

    Swift

    public func deleteKeys()
  • Get hash for the given key name (user id)

    Declaration

    Swift

    public static func getKeyAlias(keyName: String) -> String

    Parameters

    keyName

    key names to be hashed

    Return Value

    the hash for the given key name