mirror of
https://github.com/bitwarden/mobile
synced 2025-12-11 13:53:29 +00:00
[PM-5731] feat: scaffold make credential
This commit is contained in:
@@ -4,6 +4,7 @@ namespace Bit.Core.Abstractions
|
|||||||
{
|
{
|
||||||
public interface IFido2AuthenticatorService
|
public interface IFido2AuthenticatorService
|
||||||
{
|
{
|
||||||
|
Task<Fido2AuthenticatorMakeCredentialResult> MakeCredentialAsync(Fido2AuthenticatorMakeCredentialParams makeCredentialParams);
|
||||||
Task<Fido2AuthenticatorGetAssertionResult> GetAssertionAsync(Fido2AuthenticatorGetAssertionParams assertionParams);
|
Task<Fido2AuthenticatorGetAssertionResult> GetAssertionAsync(Fido2AuthenticatorGetAssertionParams assertionParams);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,6 +116,10 @@ namespace Bit.Core.Services
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Task<Fido2AuthenticatorMakeCredentialResult> MakeCredentialAsync(Fido2AuthenticatorMakeCredentialParams makeCredentialParams) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
private async Task<List<CipherView>> FindCredentialsById(PublicKeyCredentialDescriptor[] credentials, string rpId)
|
private async Task<List<CipherView>> FindCredentialsById(PublicKeyCredentialDescriptor[] credentials, string rpId)
|
||||||
{
|
{
|
||||||
var ids = new List<string>();
|
var ids = new List<string>();
|
||||||
@@ -229,5 +233,6 @@ namespace Bit.Core.Services
|
|||||||
{
|
{
|
||||||
return Guid.Parse(guid).ToByteArray();
|
return Guid.Parse(guid).ToByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
namespace Bit.Core.Utilities.Fido2
|
||||||
|
{
|
||||||
|
public class Fido2AuthenticatorMakeCredentialParams
|
||||||
|
{
|
||||||
|
///<summary>
|
||||||
|
/// The caller’s RP ID, as determined by the user agent and the client. */
|
||||||
|
///</summary>
|
||||||
|
public string RpId { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// The Relying Party's PublicKeyCredentialRpEntity. */
|
||||||
|
///</summary>
|
||||||
|
public PublicKeyCredentialUserEntity UserEntity { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// The hash of the serialized client data, provided by the client. */
|
||||||
|
///</summary>
|
||||||
|
public byte[] Hash { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// A sequence of pairs of PublicKeyCredentialType and public key algorithms (COSEAlgorithmIdentifier) requested by the Relying Party. This sequence is ordered from most preferred to least preferred. The authenticator makes a best-effort to create the most preferred credential that it can. */
|
||||||
|
///</summary>
|
||||||
|
public PublicKeyCredentialDescriptor[] CredTypesAndPubKeyAlgs { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// The effective resident key requirement for credential creation, a Boolean value determined by the client. Resident is synonymous with discoverable. */
|
||||||
|
///</summary>
|
||||||
|
public bool RequireResidentKey { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// The effective user verification requirement for assertion, a Boolean value provided by the client. */
|
||||||
|
///</summary>
|
||||||
|
public bool RequireUserVerification { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// CTAP2 authenticators support setting this to false, but we only support the WebAuthn authenticator model which does not have that option. */
|
||||||
|
///</summary>
|
||||||
|
// public bool RequireUserPresence { get; set; } // Always required
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The authenticator's attestation preference, a string provided by the client. This is a hint that the client gives to the authenticator about what kind of attestation statement it would like. The authenticator makes a best-effort to satisfy the preference.
|
||||||
|
/// Note: Attestation statements are not supported at this time.
|
||||||
|
/// </summary>
|
||||||
|
// public string AttestationPreference { get; set; }
|
||||||
|
|
||||||
|
public object Extensions { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
|
||||||
|
namespace Bit.Core.Utilities.Fido2
|
||||||
|
{
|
||||||
|
public class Fido2AuthenticatorMakeCredentialResult
|
||||||
|
{
|
||||||
|
public byte[] CredentialId { get; set; }
|
||||||
|
|
||||||
|
public byte[] AttestationObject { get; set; }
|
||||||
|
|
||||||
|
public byte[] AuthData { get; set; }
|
||||||
|
|
||||||
|
public byte[] PublicKey { get; set; }
|
||||||
|
|
||||||
|
public int PublicKeyAlgorithm { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Bit.Core.Utilities.Fido2
|
||||||
|
{
|
||||||
|
public class PublicKeyCredentialUserEntity {
|
||||||
|
public byte[] Id { get; set; }
|
||||||
|
public string Name { get; set; }
|
||||||
|
public string DisplayName { get; set; }
|
||||||
|
public string Icon { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user