@@ -50,8 +50,8 @@ enum CredentialPublicKey {
50
50
self = . ec2( EC2PublicKey (
51
51
algorithm: . algES256,
52
52
curve: . p256,
53
- xCoordinate: Data ( Array ( publicKeyBytes [ 1 ... 33 ] ) ) ,
54
- yCoordinate: Data ( Array ( publicKeyBytes [ 33 ... 65 ] ) )
53
+ xCoordinate: Array ( publicKeyBytes [ 1 ... 33 ] ) ,
54
+ yCoordinate: Array ( publicKeyBytes [ 33 ... 65 ] )
55
55
) )
56
56
return
57
57
}
@@ -96,13 +96,13 @@ struct EC2PublicKey: PublicKey {
96
96
/// The curve on which we derive the signature from.
97
97
let curve : COSECurve
98
98
/// A byte string 32 bytes in length that holds the x coordinate of the key.
99
- let xCoordinate : Data
99
+ let xCoordinate : [ UInt8 ]
100
100
/// A byte string 32 bytes in length that holds the y coordinate of the key.
101
- let yCoordinate : Data
101
+ let yCoordinate : [ UInt8 ]
102
102
103
- var rawRepresentation : Data { xCoordinate + yCoordinate }
103
+ var rawRepresentation : [ UInt8 ] { xCoordinate + yCoordinate }
104
104
105
- init ( algorithm: COSEAlgorithmIdentifier , curve: COSECurve , xCoordinate: Data , yCoordinate: Data ) {
105
+ init ( algorithm: COSEAlgorithmIdentifier , curve: COSECurve , xCoordinate: [ UInt8 ] , yCoordinate: [ UInt8 ] ) {
106
106
self . algorithm = algorithm
107
107
self . curve = curve
108
108
self . xCoordinate = xCoordinate
@@ -126,12 +126,12 @@ struct EC2PublicKey: PublicKey {
126
126
case let . byteString( xCoordinateBytes) = xCoordRaw else {
127
127
throw WebAuthnError . invalidXCoordinate
128
128
}
129
- xCoordinate = Data ( xCoordinateBytes)
129
+ xCoordinate = xCoordinateBytes
130
130
guard let yCoordRaw = publicKeyObject [ COSEKey . y. cbor] ,
131
131
case let . byteString( yCoordinateBytes) = yCoordRaw else {
132
132
throw WebAuthnError . invalidYCoordinate
133
133
}
134
- yCoordinate = Data ( yCoordinateBytes)
134
+ yCoordinate = yCoordinateBytes
135
135
}
136
136
137
137
func verify( signature: some DataProtocol , data: some DataProtocol ) throws {
@@ -162,11 +162,11 @@ struct EC2PublicKey: PublicKey {
162
162
struct RSAPublicKeyData : PublicKey {
163
163
let algorithm : COSEAlgorithmIdentifier
164
164
// swiftlint:disable:next identifier_name
165
- let n : Data
165
+ let n : [ UInt8 ]
166
166
// swiftlint:disable:next identifier_name
167
- let e : Data
167
+ let e : [ UInt8 ]
168
168
169
- var rawRepresentation : Data { n + e }
169
+ var rawRepresentation : [ UInt8 ] { n + e }
170
170
171
171
init ( publicKeyObject: CBOR , algorithm: COSEAlgorithmIdentifier ) throws {
172
172
self . algorithm = algorithm
@@ -175,13 +175,13 @@ struct RSAPublicKeyData: PublicKey {
175
175
case let . byteString( nBytes) = nRaw else {
176
176
throw WebAuthnError . invalidModulus
177
177
}
178
- n = Data ( nBytes)
178
+ n = nBytes
179
179
180
180
guard let eRaw = publicKeyObject [ COSEKey . e. cbor] ,
181
181
case let . byteString( eBytes) = eRaw else {
182
182
throw WebAuthnError . invalidExponent
183
183
}
184
- e = Data ( eBytes)
184
+ e = eBytes
185
185
}
186
186
187
187
func verify( signature: some DataProtocol , data: some DataProtocol ) throws {
0 commit comments