Skip to content

Commit f418f1f

Browse files
Renamed remaining uses of 'rp' to 'relyingParty' for consistency
1 parent 78e9297 commit f418f1f

File tree

5 files changed

+17
-17
lines changed

5 files changed

+17
-17
lines changed

Sources/WebAuthn/Ceremonies/Authentication/AuthenticatorAssertionResponse.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,11 +102,11 @@ struct ParsedAuthenticatorAssertionResponse {
102102
relyingPartyOrigin: relyingPartyOrigin
103103
)
104104

105-
guard let expectedRpIDData = relyingPartyID.data(using: .utf8) else {
105+
guard let expectedRelyingPartyIDData = relyingPartyID.data(using: .utf8) else {
106106
throw WebAuthnError.invalidRelyingPartyID
107107
}
108-
let expectedRpIDHash = SHA256.hash(data: expectedRpIDData)
109-
guard expectedRpIDHash == authenticatorData.relyingPartyIDHash else {
108+
let expectedRelyingPartyIDHash = SHA256.hash(data: expectedRelyingPartyIDData)
109+
guard expectedRelyingPartyIDHash == authenticatorData.relyingPartyIDHash else {
110110
throw WebAuthnError.relyingPartyIDHashDoesNotMatch
111111
}
112112

Tests/WebAuthnTests/Utils/TestModels/TestAuthData.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ import Crypto
1717
import WebAuthn
1818

1919
struct TestAuthData {
20-
var rpIDHash: [UInt8]?
20+
var relyingPartyIDHash: [UInt8]?
2121
var flags: UInt8?
2222
var counter: [UInt8]?
2323
var attestedCredData: [UInt8]?
2424
var extensions: [UInt8]?
2525

2626
var byteArrayRepresentation: [UInt8] {
2727
var value: [UInt8] = []
28-
if let rpIDHash {
29-
value += rpIDHash
28+
if let relyingPartyIDHash {
29+
value += relyingPartyIDHash
3030
}
3131
if let flags {
3232
value += [flags]
@@ -61,7 +61,7 @@ struct TestAuthDataBuilder {
6161

6262
func validMock() -> Self {
6363
self
64-
.rpIDHash(fromRpID: "example.com")
64+
.relyingPartyIDHash(fromRelyingPartyID: "example.com")
6565
.flags(0b11000101)
6666
.counter([0b00000000, 0b00000000, 0b00000000, 0b00000000])
6767
.attestedCredData(
@@ -75,23 +75,23 @@ struct TestAuthDataBuilder {
7575

7676
/// Creates a valid authData
7777
///
78-
/// rpID = "example.com", user
78+
/// relyingPartyID = "example.com", user
7979
/// flags "extension data included", "user verified" and "user present" are set
8080
/// sign count is set to 0
8181
/// random extension data is included
8282
func validAuthenticationMock() -> Self {
8383
self
84-
.rpIDHash(fromRpID: "example.com")
84+
.relyingPartyIDHash(fromRelyingPartyID: "example.com")
8585
.flags(0b10000101)
8686
.counter([0b00000000, 0b00000000, 0b00000000, 0b00000000])
8787
.extensions([UInt8](repeating: 0, count: 20))
8888
}
8989

90-
func rpIDHash(fromRpID rpID: String) -> Self {
91-
let rpIDData = rpID.data(using: .utf8)!
92-
let rpIDHash = SHA256.hash(data: rpIDData)
90+
func relyingPartyIDHash(fromRelyingPartyID relyingPartyID: String) -> Self {
91+
let relyingPartyIDData = relyingPartyID.data(using: .utf8)!
92+
let relyingPartyIDHash = SHA256.hash(data: relyingPartyIDData)
9393
var temp = self
94-
temp.wrapped.rpIDHash = [UInt8](rpIDHash)
94+
temp.wrapped.relyingPartyIDHash = [UInt8](relyingPartyIDHash)
9595
return temp
9696
}
9797

@@ -148,7 +148,7 @@ struct TestAuthDataBuilder {
148148
extension TestAuthData {
149149
static var valid: Self {
150150
TestAuthData(
151-
rpIDHash: [1],
151+
relyingPartyIDHash: [1],
152152
flags: 1,
153153
counter: [1],
154154
attestedCredData: [2],

Tests/WebAuthnTests/WebAuthnManagerAuthenticationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ final class WebAuthnManagerAuthenticationTests: XCTestCase {
7676
finishAuthentication(
7777
authenticatorData: TestAuthDataBuilder()
7878
.validAuthenticationMock()
79-
.rpIDHash(fromRpID: "wrong-id.org")
79+
.relyingPartyIDHash(fromRelyingPartyID: "wrong-id.org")
8080
.build()
8181
.byteArrayRepresentation
8282
),

Tests/WebAuthnTests/WebAuthnManagerIntegrationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ final class WebAuthnManagerIntegrationTests: XCTestCase {
115115
// Now send `authenticationOptions` to client, which in turn will send the authenticator's response back to us:
116116
// The following lines reflect what an authenticator normally produces
117117
let authenticatorData = TestAuthDataBuilder().validAuthenticationMock()
118-
.rpIDHash(fromRpID: configuration.relyingPartyID)
118+
.relyingPartyIDHash(fromRelyingPartyID: configuration.relyingPartyID)
119119
.counter([0, 0, 0, 1]) // we authenticated once now, so authenticator likely increments the sign counter
120120
.build()
121121
.byteArrayRepresentation

Tests/WebAuthnTests/WebAuthnManagerRegistrationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ final class WebAuthnManagerRegistrationTests: XCTestCase {
235235
await finishRegistration(
236236
attestationObject: TestAttestationObjectBuilder()
237237
.validMock()
238-
.authData(TestAuthDataBuilder().validMock().rpIDHash(fromRpID: "invalid-id.com"))
238+
.authData(TestAuthDataBuilder().validMock().relyingPartyIDHash(fromRelyingPartyID: "invalid-id.com"))
239239
.build()
240240
.cborEncoded
241241
),

0 commit comments

Comments
 (0)