-
Notifications
You must be signed in to change notification settings - Fork 169
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added passkey remote methods to verify auth with passkey
- Loading branch information
1 parent
8d6419f
commit 0dbf126
Showing
8 changed files
with
110 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Foundation | ||
|
||
struct PasskeyAuthChallenge: Decodable { | ||
let relayingParty: String | ||
let challenge: String | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case relayingParty = "rpId" | ||
case challenge | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Foundation | ||
import AuthenticationServices | ||
|
||
struct PasskeyAuthResponse: Codable { | ||
let id: String | ||
let rawId: String | ||
let response: Response | ||
var type: String = "public-key" | ||
|
||
init(from credential: ASAuthorizationPlatformPublicKeyCredentialAssertion) { | ||
self.id = credential.credentialID.base64EncodedString().toBase64url() | ||
self.rawId = credential.credentialID.base64EncodedString().toBase64url() | ||
self.response = PasskeyAuthResponse.Response(clientDataJSON: credential.rawClientDataJSON.base64EncodedString(), authenticatorData: credential.rawAuthenticatorData.base64EncodedString(), signature: credential.signature.base64EncodedString(), userHandle: credential.userID.base64EncodedString()) | ||
} | ||
|
||
struct Response: Codable { | ||
let clientDataJSON: String | ||
let authenticatorData: String | ||
let signature: String | ||
let userHandle: String | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import Foundation | ||
|
||
struct PasskeyVerifyResponse: Decodable { | ||
let username: String | ||
let accessToken: String | ||
let verified: Bool | ||
|
||
enum CodingKeys: String, CodingKey { | ||
case username | ||
case accessToken = "access_token" | ||
case verified | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters