@@ -2,10 +2,10 @@ import NIOCore
2
2
3
3
extension PostgresBackendMessage {
4
4
5
- enum Authentication : PayloadDecodable {
5
+ enum Authentication : PayloadDecodable , Hashable {
6
6
case ok
7
7
case kerberosV5
8
- case md5( salt: ( UInt8 , UInt8 , UInt8 , UInt8 ) )
8
+ case md5( salt: UInt32 )
9
9
case plaintext
10
10
case scmCredential
11
11
case gss
@@ -26,7 +26,7 @@ extension PostgresBackendMessage {
26
26
case 3 :
27
27
return . plaintext
28
28
case 5 :
29
- guard let salt = buffer. readMultipleIntegers ( endianness : . big , as: ( UInt8 , UInt8 , UInt8 , UInt8 ) . self) else {
29
+ guard let salt = buffer. readInteger ( as: UInt32 . self) else {
30
30
throw PSQLPartialDecodingError . expectedAtLeastNRemainingBytes ( 4 , actual: buffer. readableBytes)
31
31
}
32
32
return . md5( salt: salt)
@@ -61,37 +61,6 @@ extension PostgresBackendMessage {
61
61
}
62
62
}
63
63
64
- extension PostgresBackendMessage . Authentication : Equatable {
65
- static func == ( lhs: Self , rhs: Self ) -> Bool {
66
- switch ( lhs, rhs) {
67
- case ( . ok, . ok) :
68
- return true
69
- case ( . kerberosV5, . kerberosV5) :
70
- return true
71
- case ( . md5( let lhs) , . md5( let rhs) ) :
72
- return lhs == rhs
73
- case ( . plaintext, . plaintext) :
74
- return true
75
- case ( . scmCredential, . scmCredential) :
76
- return true
77
- case ( . gss, . gss) :
78
- return true
79
- case ( . sspi, . sspi) :
80
- return true
81
- case ( . gssContinue( let lhs) , . gssContinue( let rhs) ) :
82
- return lhs == rhs
83
- case ( . sasl( let lhs) , . sasl( let rhs) ) :
84
- return lhs == rhs
85
- case ( . saslContinue( let lhs) , . saslContinue( let rhs) ) :
86
- return lhs == rhs
87
- case ( . saslFinal( let lhs) , . saslFinal( let rhs) ) :
88
- return lhs == rhs
89
- default :
90
- return false
91
- }
92
- }
93
- }
94
-
95
64
extension PostgresBackendMessage . Authentication : CustomDebugStringConvertible {
96
65
var debugDescription : String {
97
66
switch self {
0 commit comments