public RawAuthenticatorMakeCredentialOptions(AuthenticatorMakeCredentialOptions makeOptions)
        {
            ExcludeCredentialsList = new RawCredentialsList(makeOptions.ExcludeCredentials);

            if (makeOptions.ExcludeCredentialsEx?.Count > 0)
            {
                _excludeCredentialsExList = new RawCredentialExList(makeOptions.ExcludeCredentialsEx);
                ExcludeCredentialsExListPtr = Marshal.AllocHGlobal(Marshal.SizeOf<RawCredentialExList>());
                Marshal.StructureToPtr(_excludeCredentialsExList, ExcludeCredentialsExListPtr, false);
            }

            CancellationId = IntPtr.Zero;
            if (makeOptions.CancellationId.HasValue)
            {
                CancellationId = Marshal.AllocHGlobal(Marshal.SizeOf<Guid>());
                Marshal.StructureToPtr(makeOptions.CancellationId.Value, CancellationId, false);
            }

            TimeoutMilliseconds = makeOptions.TimeoutMilliseconds;
            AuthenticatorAttachment = makeOptions.AuthenticatorAttachment;
            UserVerificationRequirement = makeOptions.UserVerificationRequirement;
            AttestationConveyancePreference = makeOptions.AttestationConveyancePreference;
            RequireResidentKey = makeOptions.RequireResidentKey;

            Extensions = new RawWebauthnExtensions { Count = 0, Extensions = IntPtr.Zero }; //TODO
        }
Example #2
0
        public RawAuthenticatorGetAssertionOptions(AuthenticatorGetAssertionOptions getOptions)
        {
            AllowCredentialsList = new RawCredentialsList(getOptions.AllowedCredentials);

            if (getOptions.AllowedCredentialsEx?.Count > 0)
            {
                _allowedCredentialsExList = new RawCredentialExList(getOptions.AllowedCredentialsEx);
                AllowCredentialsExListPtr = Marshal.AllocHGlobal(Marshal.SizeOf <RawCredentialExList>());
                Marshal.StructureToPtr(_allowedCredentialsExList, AllowCredentialsExListPtr, false);
            }

            CancellationId = IntPtr.Zero;
            if (getOptions.CancellationId.HasValue)
            {
                CancellationId = Marshal.AllocHGlobal(Marshal.SizeOf <Guid>());
                Marshal.StructureToPtr(getOptions.CancellationId.Value, CancellationId, false);
            }

            U2fAppId            = getOptions.U2fAppId;
            U2fAppIdUsedBoolPtr = Marshal.AllocHGlobal(Marshal.SizeOf <bool>());

            TimeoutMilliseconds         = getOptions.TimeoutMilliseconds;
            AuthenticatorAttachment     = getOptions.AuthenticatorAttachment;
            UserVerificationRequirement = getOptions.UserVerificationRequirement;

            Extensions = new RawWebauthnExtensions {
                Count = 0, Extensions = IntPtr.Zero
            };                                                                              //TODO
        }