Skip to content

Commit

Permalink
Stub out the rest
Browse files Browse the repository at this point in the history
  • Loading branch information
Hinton committed May 3, 2024
1 parent 4cffe64 commit 1f37c4f
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions languages/swift/iOS/App/ContentView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -339,19 +339,33 @@ struct ContentView: View {
let authenticator = clientFido.authenticator(userInterface: ui, credentialStore: cs)

// Make credential
try await authenticator.makeCredential(
request: MakeCredentialRequest(
clientDataHash: Data(),
rp: PublicKeyCredentialRpEntity(id: "abc", name: "test"),
user: PublicKeyCredentialUserEntity(id: Data(), displayName: "b", name: "c"),
pubKeyCredParams: [PublicKeyCredentialParameters(ty: "public-key", alg: 0)],
excludeList: nil,
requireResidentKey: true,
extensions: nil
)
)
try await authenticator.makeCredential(request: MakeCredentialRequest(
clientDataHash: Data(),
rp: PublicKeyCredentialRpEntity(id: "abc", name: "test"),
user: PublicKeyCredentialUserEntity(id: Data(), displayName: "b", name: "c"),
pubKeyCredParams: [PublicKeyCredentialParameters(ty: "public-key", alg: 0)],
excludeList: nil,
requireResidentKey: true,
extensions: nil
))

// Get Assertion
try await authenticator.getAssertion(request: GetAssertionRequest(
rpId: "",
clientDataHash: Data(),
allowList: nil,
options: Options(rk: true, uv: Uv.preferred),
extensions: nil
))

try await authenticator.silentlyDiscoverCredentials(rpId: "")

// Only on android!
let client = clientFido.client(userInterface: ui, credentialStore: cs)
try await client.authenticate(origin: "test", request: "test", clientData: ClientData.defaultWithExtraData(androidPackageName: "abc"))
try await client.register(origin: "test", request: "test", clientData: ClientData.defaultWithExtraData(androidPackageName: "abc"))
}

}

struct ContentView_Previews: PreviewProvider {
Expand Down Expand Up @@ -383,7 +397,7 @@ extension IgnoreHttpsDelegate: URLSessionDelegate {

class UserInterfaceImpl: UserInterface {
func checkUser(options: BitwardenSdk.CheckUserOptions, credential: BitwardenSdk.CipherView?) async throws -> BitwardenSdk.CheckUserResult {
abort()
return CheckUserResult(userPresent: true, userVerified: true)
}

func pickCredentialForAuthentication(availableCredentials: [BitwardenSdk.Cipher]) async throws -> BitwardenSdk.CipherView {
Expand All @@ -401,6 +415,6 @@ class CredentialStoreImpl: CredentialStore {
}

func saveCredential(cred: BitwardenSdk.Cipher) async throws {
abort()
print("SAVED CREDENTIAL")
}
}

0 comments on commit 1f37c4f

Please sign in to comment.