getOrCreateInstance
fun getOrCreateInstance(algorithm: SigningAlgorithm, keyId: String?, keySizeInBits: Int = 2048, secureHardwarePreference: SecureHardwarePreference = SecureHardwarePreference.None): AppleKeychainSigningKey(source)
Returns an AppleKeychainSigningKey for the given algorithm and keyId, generating a new key if one does not already exist.
Parameters
keyId
The Keychain key alias to use. When null, a library-managed default alias derived from algorithm is used.
keySizeInBits
RSA key size in bits. Ignored for ECDSA and HMAC keys. Defaults to 2048.
secureHardwarePreference
Controls whether the Secure Enclave is used for key storage. Only ES256 keys can be stored in the Secure Enclave; other algorithms always use the standard hardware-bound Keychain regardless of this setting.