Type AAGUID as Opaque128 instead of UUID

This commit is contained in:
João D. Moreira
2026-05-06 13:50:56 +02:00
parent 83d36dbed7
commit c028dba1e8
4 changed files with 7 additions and 7 deletions
@@ -156,7 +156,7 @@ extension CTAP2.GetInfo.Response {
return Self(
versions: [.fido2_1],
aaguid: UUID(),
aaguid: CTAP2.GetInfo.AAGUID(rawValue: Data(repeating: 0, count: 16))!,
extensions: [],
options: options,
maxMsgSize: 1200,
@@ -176,7 +176,7 @@ extension CTAP2.GetInfo.Response {
return Self(
versions: [.fido2_1],
aaguid: UUID(),
aaguid: CTAP2.GetInfo.AAGUID(rawValue: Data(repeating: 0, count: 16))!,
extensions: [],
options: options,
maxMsgSize: 1200,
@@ -29,7 +29,7 @@ extension CTAP2.GetInfo.Response: CBOR.Decodable {
let versions = versionStrings.map { CTAP2.GetInfo.AuthenticatorVersion($0) }
// Required: aaguid (0x03) - 16-byte byte string
guard let aaguid: UUID = map[.int(0x03)]?.cborDecoded() else {
guard let aaguid: CTAP2.GetInfo.AAGUID = map[.int(0x03)]?.cborDecoded() else {
return nil
}
@@ -89,10 +89,10 @@ extension CTAP2.Extension.Identifier: CBOR.Decodable {
}
}
extension UUID: CBOR.Decodable {
extension CTAP2.GetInfo.Opaque128: CBOR.Decodable {
init?(cbor: CBOR.Value) {
guard let data = cbor.dataValue, data.count == 16 else { return nil }
self = data.withUnsafeBytes { UUID(uuid: $0.load(as: uuid_t.self)) }
guard let data = cbor.dataValue else { return nil }
self.init(rawValue: data)
}
}
@@ -16,7 +16,7 @@ import Foundation
extension CTAP2.GetInfo {
/// Authenticator Attestation Global Unique ID (128-bit identifier).
public typealias AAGUID = UUID
public typealias AAGUID = Opaque128
/// CTAP/FIDO protocol version supported by an authenticator.
///