1
0
mirror of https://github.com/bitwarden/mobile synced 2026-01-09 03:53:15 +00:00

PM-5154 Added Fido2AuthenticationService to provide us a wrapper for the actual implementation

This commit is contained in:
Federico Maccaroni
2024-01-03 19:02:49 -03:00
parent 1eb9e5f8ea
commit dfb7a0621f
8 changed files with 68 additions and 8 deletions

View File

@@ -25,7 +25,7 @@ namespace Bit.iOS.Autofill
await ProvideCredentialAsync(false);
}
public void CompleteAssertionRequest(CipherView cipherView)
public async Task CompleteAssertionRequestAsync(CipherView cipherView)
{
if (!UIDevice.CurrentDevice.CheckSystemVersion(17, 0))
{
@@ -34,12 +34,19 @@ namespace Bit.iOS.Autofill
}
// TODO: Generate the credential Signature and Auth data accordingly
var fido2AssertionResult = await _fido2AuthService.Value.GetAssertionAsync(new Bit.Core.Utilities.Fido2.Fido2AuthenticatorGetAssertionParams
{
RpId = cipherView.Login.MainFido2Credential.RpId,
Counter = cipherView.Login.MainFido2Credential.Counter,
CredentialId = cipherView.Login.MainFido2Credential.CredentialId
});
CompleteAssertionRequest(new ASPasskeyAssertionCredential(
cipherView.Login.MainFido2Credential.UserHandle,
cipherView.Login.MainFido2Credential.RpId,
"TODO: Generate Signature",
NSData.FromArray(fido2AssertionResult.Signature),
_context.PasskeyCredentialRequest?.ClientDataHash,
"TODO: Generate Authenticator Data",
NSData.FromArray(fido2AssertionResult.AuthenticatorData),
cipherView.Login.MainFido2Credential.CredentialId
));
}

View File

@@ -29,6 +29,7 @@ namespace Bit.iOS.Autofill
private IAccountsManager _accountsManager;
private readonly LazyResolve<IStateService> _stateService = new LazyResolve<IStateService>();
private readonly LazyResolve<IFido2AuthenticationService> _fido2AuthService = new LazyResolve<IFido2AuthenticationService>();
public CredentialProviderViewController(IntPtr handle)
: base(handle)
@@ -411,7 +412,7 @@ namespace Bit.iOS.Autofill
if (_context.IsPasskey)
{
CompleteAssertionRequest(decCipher);
await CompleteAssertionRequestAsync(decCipher);
return;
}