mirror of
https://github.com/maxgoedjen/secretive.git
synced 2025-08-31 01:20:57 +00:00
Fix
This commit is contained in:
parent
225a610801
commit
2ffc78d360
@ -98,7 +98,7 @@ extension SecureEnclave {
|
|||||||
|
|
||||||
// MARK: SecretStoreModifiable
|
// MARK: SecretStoreModifiable
|
||||||
|
|
||||||
public func create(name: String, attributes: Attributes) async throws {
|
public func create(name: String, attributes: Attributes) async throws -> Secret {
|
||||||
var accessError: SecurityError?
|
var accessError: SecurityError?
|
||||||
let flags: SecAccessControlCreateFlags = switch attributes.authentication {
|
let flags: SecAccessControlCreateFlags = switch attributes.authentication {
|
||||||
case .notRequired:
|
case .notRequired:
|
||||||
@ -119,18 +119,18 @@ extension SecureEnclave {
|
|||||||
throw error.takeRetainedValue() as Error
|
throw error.takeRetainedValue() as Error
|
||||||
}
|
}
|
||||||
let dataRep: Data
|
let dataRep: Data
|
||||||
|
let publicKey: Data
|
||||||
switch (attributes.keyType.algorithm, attributes.keyType.size) {
|
switch (attributes.keyType.algorithm, attributes.keyType.size) {
|
||||||
case (.ecdsa, 256):
|
case (.ecdsa, 256):
|
||||||
let publicKey: Data
|
|
||||||
let created = try CryptoKit.SecureEnclave.P256.Signing.PrivateKey(accessControl: access!)
|
let created = try CryptoKit.SecureEnclave.P256.Signing.PrivateKey(accessControl: access!)
|
||||||
dataRep = created.dataRepresentation
|
dataRep = created.dataRepresentation
|
||||||
case (.mldsa, 65):
|
|
||||||
publicKey = created.publicKey.x963Representation
|
publicKey = created.publicKey.x963Representation
|
||||||
|
case (.mldsa, 65):
|
||||||
guard #available(macOS 26.0, *) else { throw Attributes.UnsupportedOptionError() }
|
guard #available(macOS 26.0, *) else { throw Attributes.UnsupportedOptionError() }
|
||||||
let created = try CryptoKit.SecureEnclave.MLDSA65.PrivateKey(accessControl: access!)
|
let created = try CryptoKit.SecureEnclave.MLDSA65.PrivateKey(accessControl: access!)
|
||||||
dataRep = created.dataRepresentation
|
dataRep = created.dataRepresentation
|
||||||
case (.mldsa, 87):
|
|
||||||
publicKey = created.publicKey.rawRepresentation
|
publicKey = created.publicKey.rawRepresentation
|
||||||
|
case (.mldsa, 87):
|
||||||
guard #available(macOS 26.0, *) else { throw Attributes.UnsupportedOptionError() }
|
guard #available(macOS 26.0, *) else { throw Attributes.UnsupportedOptionError() }
|
||||||
let created = try CryptoKit.SecureEnclave.MLDSA87.PrivateKey(accessControl: access!)
|
let created = try CryptoKit.SecureEnclave.MLDSA87.PrivateKey(accessControl: access!)
|
||||||
dataRep = created.dataRepresentation
|
dataRep = created.dataRepresentation
|
||||||
|
Loading…
Reference in New Issue
Block a user