When trying to generate a new key via keychain, I get an error thrown.
KeyManagementError: PUB_R1_5LfLBzXdsHCd1WqTF9a7VrCoxintemEDSKK4i63UiCC7rx9fiD not found
let secKey = try keychain.createEllipticCurveSecKey(secureEnclave: secureEnclave, tag: tag, label: nil, protection: protection, accessFlag: accessFlag)
guard let eosioPublicKey = secKey.publicKey?.externalRepresentation?.compressedPublicKey?.toEosioR1PublicKey else {
throw EosioError(.keyManagementError, reason: "Unable to create public key")
}
var vaultKey = try getVaultKey(eosioPublicKey: eosioPublicKey)
As you can see the newVaultKey function creates the key, then tries to retrieve it from keychain without it actually being added to the keychain first. I could see a case where you might actually not want the key to be saved to keychain upon generation. For instance, you generate a key and the user doesn't follow throw with creating an account, etc. This could create abandoned keys in the keychain.
When trying to generate a new key via keychain, I get an error thrown.
KeyManagementError: PUB_R1_5LfLBzXdsHCd1WqTF9a7VrCoxintemEDSKK4i63UiCC7rx9fiD not found
As you can see the newVaultKey function creates the key, then tries to retrieve it from keychain without it actually being added to the keychain first. I could see a case where you might actually not want the key to be saved to keychain upon generation. For instance, you generate a key and the user doesn't follow throw with creating an account, etc. This could create abandoned keys in the keychain.