mirror of
https://github.com/wu736139669/hapi.git
synced 2026-11-25 05:07:05 +00:00
Use auth.hapi.run as the shared RP with an isolated static browser bridge, Hub-bound challenges and accounts, and one-time PKCE code exchange. Update iOS and Android validation, app associations, deployment documentation, and bidirectional browser regression coverage.
20 lines
684 B
Swift
20 lines
684 B
Swift
import Foundation
|
|
@testable import HapiClient
|
|
|
|
#if canImport(CryptoKit)
|
|
let passkeyRegistrationAvailable = true
|
|
#else
|
|
let passkeyRegistrationAvailable = false
|
|
#endif
|
|
|
|
func boundPasskeyChallenge(hub: String = testHubURLString, operation: String = "login", channel: String = "native") -> Data {
|
|
try! JSONSerialization.data(withJSONObject: [
|
|
"v": 1, "hub": hub, "id": String(repeating: "a", count: 43),
|
|
"nonce": String(repeating: "b", count: 43), "operation": operation, "channel": channel
|
|
], options: [.sortedKeys])
|
|
}
|
|
|
|
func boundPasskeyUser(hub: String = testHubURLString) -> Data {
|
|
PasskeyHubBinding.digest(Data(hub.utf8)) + Data(repeating: 1, count: 32)
|
|
}
|