Created
September 12, 2019 23:16
-
-
Save agl/d4b7a646ec7474eec1071ebc9be77e79 to your computer and use it in GitHub Desktop.
WebAuthn Registration Options classification
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data Attachment = NoAttachment | Platform | CrossPlatform deriving (Show) | |
data ResidentKey = RKNotSpecified | RKDiscouraged | RKPreferred | RKRequired deriving (Show) | |
data UserVerification = UVDiscouraged | UVPreferred | UVRequired deriving (Show) | |
allCreateOptions = do | |
attachment <- [NoAttachment, Platform, CrossPlatform] | |
rk <- [RKNotSpecified, RKDiscouraged, RKPreferred, RKRequired] | |
uv <- [UVDiscouraged, UVPreferred, UVRequired] | |
return (attachment, rk, uv) | |
data CreateType = | |
SecondFactor | | |
SecondFactorUpgrade | -- Potentially for 2nd-factor with optional multi-factor in the future | |
Reauthentication | | |
FirstFactor | | |
Passwordless | -- A potential mode where the user enters a username only. | |
Nonsense | -- Chrome considers this nonsense and maps it to something else | |
Future | -- We haven't figured these out yet | |
Unclassified deriving (Show, Eq) | |
classifyCreation :: (Attachment, ResidentKey, UserVerification) -> CreateType | |
-- There's no default value for |residentKey|, but it has to be “discouraged”, I think. | |
classifyCreation (attachment, RKNotSpecified, uv) = classifyCreation (attachment, RKDiscouraged, uv) | |
classifyCreation (NoAttachment, RKDiscouraged, UVDiscouraged) = SecondFactor | |
classifyCreation (CrossPlatform, RKDiscouraged, UVDiscouraged) = SecondFactor | |
classifyCreation (NoAttachment, RKPreferred, UVDiscouraged) = SecondFactorUpgrade | |
classifyCreation (NoAttachment, RKPreferred, UVPreferred) = SecondFactorUpgrade | |
classifyCreation (NoAttachment, RKDiscouraged, UVRequired) = Reauthentication | |
classifyCreation (Platform, RKDiscouraged, UVRequired) = Reauthentication | |
classifyCreation (NoAttachment, RKRequired, UVRequired) = FirstFactor | |
classifyCreation (CrossPlatform, RKRequired, UVRequired) = FirstFactor | |
classifyCreation (_, RKDiscouraged, UVRequired) = Passwordless | |
classifyCreation (_, RKPreferred, UVRequired) = Passwordless | |
classifyCreation (_, RKRequired, UVDiscouraged) = Nonsense | |
classifyCreation (_, RKRequired, UVPreferred) = Nonsense | |
classifyCreation (_, RKPreferred, _) = Future | |
classifyCreation _ = Unclassified | |
unclassified = filter ((==) Unclassified . classifyCreation) allCreateOptions | |
main = mapM_ (putStrLn . show) unclassified |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment