File tree Expand file tree Collapse file tree 3 files changed +18
-36
lines changed Expand file tree Collapse file tree 3 files changed +18
-36
lines changed Original file line number Diff line number Diff line change @@ -36,7 +36,7 @@ extension AuthenticatorData {
3636
3737 let relyingPartyIDHash = Array ( bytes [ ..< 32 ] )
3838 let flags = AuthenticatorFlags ( bytes [ 32 ] )
39- let counter : UInt32 = Data ( bytes [ 33 ..< 37 ] ) . toInteger ( endian : . big )
39+ let counter = UInt32 ( bigEndianBytes : bytes [ 33 ..< 37 ] )
4040
4141 var remainingCount = bytes. count - minAuthDataLength
4242
@@ -90,7 +90,7 @@ extension AuthenticatorData {
9090 /// **credentialIdLength** (2): Byte length L of credentialId, 16-bit unsigned big-endian integer. Value MUST be ≤ 1023.
9191 let idLengthBytes = data [ 53 ..< 55 ] // Length is 2 bytes
9292 let idLengthData = Data ( idLengthBytes)
93- let idLength : UInt16 = idLengthData . toInteger ( endian : . big )
93+ let idLength = UInt16 ( bigEndianBytes : idLengthData )
9494
9595 guard idLength <= 1023
9696 else { throw WebAuthnError . credentialIDTooLong }
Original file line number Diff line number Diff line change @@ -31,3 +31,19 @@ extension BidirectionalCollection where Element == UInt8 {
3131 return result
3232 }
3333}
34+
35+ extension FixedWidthInteger {
36+ /// Initialize a fixed width integer from a contiguous sequence of Bytes representing a big endian type.
37+ /// - Parameter bigEndianBytes: The Bytes to interpret as a big endian integer.
38+ @inlinable
39+ init ( bigEndianBytes: some BidirectionalCollection < UInt8 > ) {
40+ self . init ( bigEndian: bigEndianBytes. casting ( ) )
41+ }
42+
43+ /// Initialize a fixed width integer from a contiguous sequence of Bytes representing a little endian type.
44+ /// - Parameter bigEndianBytes: The Bytes to interpret as a little endian integer.
45+ @inlinable
46+ init ( littleEndianBytes: some BidirectionalCollection < UInt8 > ) {
47+ self . init ( littleEndian: littleEndianBytes. casting ( ) )
48+ }
49+ }
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments