using Bit.Core.Entities; using Duende.IdentityServer.Validation; namespace Bit.Identity.IdentityServer.RequestValidators; public interface IDeviceValidator { /// /// Fetches device from the database using the Device Identifier and the User Id to know if the user /// has ever tried to authenticate with this specific instance of Bitwarden. /// /// user attempting to authenticate /// current instance of Bitwarden the user is interacting with /// null or Device Task GetKnownDeviceAsync(User user, Device device); /// /// Validate the requesting device. Modifies the ValidatorRequestContext with error result if any. /// /// The Request is used to check for the NewDeviceOtp and for the raw device data /// Contains two factor and sso context that are important for decisions on new device verification /// returns true if device is valid and no other action required; if false modifies the context with an error result to be returned; Task ValidateRequestDeviceAsync(ValidatedTokenRequest request, CustomValidatorRequestContext context); }