-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify v2 #1392
Verify v2 #1392
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just a few small things.
|
||
public struct P256JWTValidator { | ||
|
||
let jwtString: String |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can this be private
?
let jwtString: String | |
private let jwtString: String |
self.jwtString = jwtString | ||
} | ||
|
||
public func isValid(publicKey: P256.Signing.PublicKey) throws -> Bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this unit tested?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not as a unit here but we have it covered in the AttestationJWTVerifierTests as it depends on P256JWTValidator
func getVerifyContext(requestId: RPCID, domain: String) -> VerifyContext { | ||
(try? verifyContextStore.get(key: requestId.string)) ?? verifyClient.createVerifyContext(origin: nil, domain: domain, isScam: false) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I find this a bit easier to read.
func getVerifyContext(requestId: RPCID, domain: String) -> VerifyContext { | |
(try? verifyContextStore.get(key: requestId.string)) ?? verifyClient.createVerifyContext(origin: nil, domain: domain, isScam: false) | |
} | |
func getVerifyContext(requestId: RPCID, domain: String) -> VerifyContext { | |
guard let context = try? verifyContextStore.get(key: requestId.string) else { | |
return verifyClient.createVerifyContext(origin: nil, domain: domain, isScam: false) | |
} | |
return context | |
} |
@@ -56,7 +56,14 @@ class AuthRequestSubscriber { | |||
Task(priority: .high) { | |||
let assertionId = payload.decryptedPayload.sha256().toHexString() | |||
do { | |||
let response = try await verifyClient.verifyOrigin(assertionId: assertionId) | |||
let response: VerifyResponse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see warning: let assertionId = payload.decryptedPayload.sha256().toHexString()
👆
@@ -397,7 +401,14 @@ private extension ApproveEngine { | |||
Task(priority: .high) { | |||
let assertionId = payload.decryptedPayload.sha256().toHexString() | |||
do { | |||
let response = try await verifyClient.verifyOrigin(assertionId: assertionId) | |||
let response: VerifyResponse |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
☝️
|
||
func fetchPublicKey() async throws -> VerifyServerPublicKey { | ||
guard let url = URL(string: urlString) else { | ||
throw NSError(domain: "", code: 0, userInfo: [NSLocalizedDescriptionKey: "Invalid URL"]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just out of curiosity is there a reason we use an NSError
here? What not use a custom type conforming to Error
?
Quality Gate passedIssues Measures |
Description
Implements verify v2 api
Resolves # (issue)
How Has This Been Tested?
Due Dilligence