shomei-core 0.3.0.1 → 0.4.0.0
raw patch · 42 files changed
+749/−223 lines, 42 filesdep ~shomei-corePVP ok
version bump matches the API change (PVP)
Dependency ranges changed: shomei-core
API changes (from Hackage documentation)
- Shomei.Prelude: ($dmparseJSON) :: (FromJSON a, Generic a, GFromJSON Zero (Rep a)) => Value -> Parser a
- Shomei.Prelude: ($dmtoJSON) :: (ToJSON a, Generic a, GToJSON' Value Zero (Rep a)) => a -> Value
+ Shomei.Account.Admin.Recovery: resetUserSecondFactors :: forall (es :: [Effect]). (AuthUnitOfWork :> es, Clock :> es, Notifier :> es) => RecoveryActor -> UserId -> RecoveryCommand -> Eff es (Either AuthError RecoveryResult)
+ Shomei.Account.Admin.Recovery.Domain: AdministratorService :: UserId -> RecoveryActor
+ Shomei.Account.Admin.Recovery.Domain: AuthenticatedAdministrator :: UserId -> RecoveryActor
+ Shomei.Account.Admin.Recovery.Domain: LocalOperator :: Text -> RecoveryActor
+ Shomei.Account.Admin.Recovery.Domain: RecoveryCommand :: !Bool -> !Text -> RecoveryCommand
+ Shomei.Account.Admin.Recovery.Domain: RecoveryCounts :: !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> !Int -> RecoveryCounts
+ Shomei.Account.Admin.Recovery.Domain: RecoveryResult :: !UTCTime -> !RecoveryCounts -> !Bool -> RecoveryResult
+ Shomei.Account.Admin.Recovery.Domain: [authorizationCodesInvalidated] :: RecoveryCounts -> !Int
+ Shomei.Account.Admin.Recovery.Domain: [caseReference] :: RecoveryCommand -> !Text
+ Shomei.Account.Admin.Recovery.Domain: [ceremoniesRemoved] :: RecoveryCounts -> !Int
+ Shomei.Account.Admin.Recovery.Domain: [counts] :: RecoveryResult -> !RecoveryCounts
+ Shomei.Account.Admin.Recovery.Domain: [identityVerified] :: RecoveryCommand -> !Bool
+ Shomei.Account.Admin.Recovery.Domain: [passkeysRemoved] :: RecoveryCounts -> !Int
+ Shomei.Account.Admin.Recovery.Domain: [passwordResetTokensRevoked] :: RecoveryCounts -> !Int
+ Shomei.Account.Admin.Recovery.Domain: [recoveryCodesRemoved] :: RecoveryCounts -> !Int
+ Shomei.Account.Admin.Recovery.Domain: [refreshTokensRevoked] :: RecoveryCounts -> !Int
+ Shomei.Account.Admin.Recovery.Domain: [resetAt] :: RecoveryResult -> !UTCTime
+ Shomei.Account.Admin.Recovery.Domain: [sessionsRevoked] :: RecoveryCounts -> !Int
+ Shomei.Account.Admin.Recovery.Domain: [totpCredentialsRemoved] :: RecoveryCounts -> !Int
+ Shomei.Account.Admin.Recovery.Domain: [verifiedNotificationDestination] :: RecoveryResult -> !Bool
+ Shomei.Account.Admin.Recovery.Domain: data RecoveryActor
+ Shomei.Account.Admin.Recovery.Domain: data RecoveryCommand
+ Shomei.Account.Admin.Recovery.Domain: data RecoveryCounts
+ Shomei.Account.Admin.Recovery.Domain: data RecoveryResult
+ Shomei.Account.Admin.Recovery.Domain: instance Data.Aeson.Types.FromJSON.FromJSON Shomei.Account.Admin.Recovery.Domain.RecoveryActor
+ Shomei.Account.Admin.Recovery.Domain: instance Data.Aeson.Types.FromJSON.FromJSON Shomei.Account.Admin.Recovery.Domain.RecoveryCommand
+ Shomei.Account.Admin.Recovery.Domain: instance Data.Aeson.Types.FromJSON.FromJSON Shomei.Account.Admin.Recovery.Domain.RecoveryCounts
+ Shomei.Account.Admin.Recovery.Domain: instance Data.Aeson.Types.FromJSON.FromJSON Shomei.Account.Admin.Recovery.Domain.RecoveryResult
+ Shomei.Account.Admin.Recovery.Domain: instance Data.Aeson.Types.ToJSON.ToJSON Shomei.Account.Admin.Recovery.Domain.RecoveryActor
+ Shomei.Account.Admin.Recovery.Domain: instance Data.Aeson.Types.ToJSON.ToJSON Shomei.Account.Admin.Recovery.Domain.RecoveryCommand
+ Shomei.Account.Admin.Recovery.Domain: instance Data.Aeson.Types.ToJSON.ToJSON Shomei.Account.Admin.Recovery.Domain.RecoveryCounts
+ Shomei.Account.Admin.Recovery.Domain: instance Data.Aeson.Types.ToJSON.ToJSON Shomei.Account.Admin.Recovery.Domain.RecoveryResult
+ Shomei.Account.Admin.Recovery.Domain: instance GHC.Classes.Eq Shomei.Account.Admin.Recovery.Domain.RecoveryActor
+ Shomei.Account.Admin.Recovery.Domain: instance GHC.Classes.Eq Shomei.Account.Admin.Recovery.Domain.RecoveryCommand
+ Shomei.Account.Admin.Recovery.Domain: instance GHC.Classes.Eq Shomei.Account.Admin.Recovery.Domain.RecoveryCounts
+ Shomei.Account.Admin.Recovery.Domain: instance GHC.Classes.Eq Shomei.Account.Admin.Recovery.Domain.RecoveryResult
+ Shomei.Account.Admin.Recovery.Domain: instance GHC.Internal.Generics.Generic Shomei.Account.Admin.Recovery.Domain.RecoveryActor
+ Shomei.Account.Admin.Recovery.Domain: instance GHC.Internal.Generics.Generic Shomei.Account.Admin.Recovery.Domain.RecoveryCommand
+ Shomei.Account.Admin.Recovery.Domain: instance GHC.Internal.Generics.Generic Shomei.Account.Admin.Recovery.Domain.RecoveryCounts
+ Shomei.Account.Admin.Recovery.Domain: instance GHC.Internal.Generics.Generic Shomei.Account.Admin.Recovery.Domain.RecoveryResult
+ Shomei.Account.Admin.Recovery.Domain: instance GHC.Internal.Show.Show Shomei.Account.Admin.Recovery.Domain.RecoveryActor
+ Shomei.Account.Admin.Recovery.Domain: instance GHC.Internal.Show.Show Shomei.Account.Admin.Recovery.Domain.RecoveryCommand
+ Shomei.Account.Admin.Recovery.Domain: instance GHC.Internal.Show.Show Shomei.Account.Admin.Recovery.Domain.RecoveryCounts
+ Shomei.Account.Admin.Recovery.Domain: instance GHC.Internal.Show.Show Shomei.Account.Admin.Recovery.Domain.RecoveryResult
+ Shomei.Account.Admin.Recovery.Domain: recoveryActorUser :: RecoveryActor -> Maybe UserId
+ Shomei.Account.Admin.Recovery.Domain: validateRecovery :: RecoveryActor -> RecoveryCommand -> Either AuthError ()
+ Shomei.Account.Notification.Domain: SecondFactorsReset :: !Email -> !UTCTime -> !Text -> Notification
+ Shomei.Account.Notification.Domain: [occurredAt] :: Notification -> !UTCTime
+ Shomei.Account.Notification.Domain: [supportInstructions] :: Notification -> !Text
+ Shomei.Account.User.Domain: [authenticationGeneration] :: User -> !Int64
+ Shomei.Audit.Event.Codec: knownAuthEventTypes :: [Text]
+ Shomei.Audit.Event.Domain: UserSecondFactorsReset :: UserSecondFactorsResetData -> AuthEvent
+ Shomei.Audit.Event.Domain: UserSecondFactorsResetData :: !UserId -> !RecoveryActor -> !Text -> !RecoveryCounts -> !UTCTime -> UserSecondFactorsResetData
+ Shomei.Audit.Event.Domain: [caseReference] :: UserSecondFactorsResetData -> !Text
+ Shomei.Audit.Event.Domain: [counts] :: UserSecondFactorsResetData -> !RecoveryCounts
+ Shomei.Audit.Event.Domain: [recoveryActor] :: UserSecondFactorsResetData -> !RecoveryActor
+ Shomei.Audit.Event.Domain: data UserSecondFactorsResetData
+ Shomei.Audit.Event.Domain: instance Data.Aeson.Types.FromJSON.FromJSON Shomei.Audit.Event.Domain.UserSecondFactorsResetData
+ Shomei.Audit.Event.Domain: instance Data.Aeson.Types.ToJSON.ToJSON Shomei.Audit.Event.Domain.UserSecondFactorsResetData
+ Shomei.Audit.Event.Domain: instance GHC.Classes.Eq Shomei.Audit.Event.Domain.UserSecondFactorsResetData
+ Shomei.Audit.Event.Domain: instance GHC.Internal.Generics.Generic Shomei.Audit.Event.Domain.UserSecondFactorsResetData
+ Shomei.Audit.Event.Domain: instance GHC.Internal.Show.Show Shomei.Audit.Event.Domain.UserSecondFactorsResetData
+ Shomei.Error: StaleAuthentication :: AuthError
+ Shomei.Mfa.Totp.Domain: [authenticationGeneration] :: TotpCredential -> !Maybe Int64
+ Shomei.Mfa.Totp.Store: [RemoveTotpCredential] :: forall (a :: Type -> Type). UserId -> AuthenticationGuard -> TotpCredentialId -> UTCTime -> TotpCredentialStore a (Either AuthError ())
+ Shomei.Mfa.Totp.Store: removeTotpCredential :: forall (es :: [Effect]). TotpCredentialStore :> es => UserId -> AuthenticationGuard -> TotpCredentialId -> UTCTime -> Eff es (Either AuthError ())
+ Shomei.OAuth.AuthorizationCode.Domain: [authenticationGeneration] :: AuthorizationCode -> !Maybe Int64
+ Shomei.Passkey.Domain: [authenticationGeneration] :: PendingCeremony -> !Maybe Int64
+ Shomei.Passkey.Domain: [initiatingSession] :: PendingCeremony -> !Maybe SessionId
+ Shomei.Prelude: (#%%=) :: MonadState s m => ALens s s a b -> (a -> (r, b)) -> m r
+ Shomei.Prelude: (#%%~) :: Functor f => ALens s t a b -> (a -> f b) -> s -> f t
+ Shomei.Prelude: (#%=) :: MonadState s m => ALens s s a b -> (a -> b) -> m ()
+ Shomei.Prelude: (#%~) :: ALens s t a b -> (a -> b) -> s -> t
+ Shomei.Prelude: (#) :: AReview t b -> b -> t
+ Shomei.Prelude: (#=) :: MonadState s m => ALens s s a b -> b -> m ()
+ Shomei.Prelude: (#~) :: ALens s t a b -> b -> s -> t
+ Shomei.Prelude: (%%=) :: forall {k} s m p r (a :: k) b. MonadState s m => Over p ((,) r) s s a b -> p a (r, b) -> m r
+ Shomei.Prelude: (%%@=) :: MonadState s m => Over (Indexed i) ((,) r) s s a b -> (i -> a -> (r, b)) -> m r
+ Shomei.Prelude: (%%@~) :: forall {k1} i f s (t :: k1) a (b :: k1). Over (Indexed i) f s t a b -> (i -> a -> f b) -> s -> f t
+ Shomei.Prelude: (%%~) :: forall {k} f s (t :: k) a (b :: k). LensLike f s t a b -> (a -> f b) -> s -> f t
+ Shomei.Prelude: (%=) :: MonadState s m => ASetter s s a b -> (a -> b) -> m ()
+ Shomei.Prelude: (%@=) :: MonadState s m => AnIndexedSetter i s s a b -> (i -> a -> b) -> m ()
+ Shomei.Prelude: (%@~) :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> t
+ Shomei.Prelude: (%~) :: ASetter s t a b -> (a -> b) -> s -> t
+ Shomei.Prelude: (&&=) :: MonadState s m => ASetter' s Bool -> Bool -> m ()
+ Shomei.Prelude: (&&~) :: ASetter s t Bool Bool -> Bool -> s -> t
+ Shomei.Prelude: (&) :: a -> (a -> b) -> b
+ Shomei.Prelude: (&~) :: s -> State s a -> s
+ Shomei.Prelude: (**=) :: (MonadState s m, Floating a) => ASetter' s a -> a -> m ()
+ Shomei.Prelude: (**~) :: Floating a => ASetter s t a a -> a -> s -> t
+ Shomei.Prelude: (*=) :: (MonadState s m, Num a) => ASetter' s a -> a -> m ()
+ Shomei.Prelude: (*~) :: Num a => ASetter s t a a -> a -> s -> t
+ Shomei.Prelude: (+=) :: (MonadState s m, Num a) => ASetter' s a -> a -> m ()
+ Shomei.Prelude: (+~) :: Num a => ASetter s t a a -> a -> s -> t
+ Shomei.Prelude: (-=) :: (MonadState s m, Num a) => ASetter' s a -> a -> m ()
+ Shomei.Prelude: (-~) :: Num a => ASetter s t a a -> a -> s -> t
+ Shomei.Prelude: (...) :: forall {k} f c s t p (a :: k) b. (Applicative f, Plated c) => LensLike f s t c c -> Over p f c c a b -> Over p f s t a b
+ Shomei.Prelude: (.=) :: MonadState s m => ASetter s s a b -> b -> m ()
+ Shomei.Prelude: (.>) :: (st -> r) -> (kab -> st) -> kab -> r
+ Shomei.Prelude: (.@=) :: MonadState s m => AnIndexedSetter i s s a b -> (i -> b) -> m ()
+ Shomei.Prelude: (.@~) :: AnIndexedSetter i s t a b -> (i -> b) -> s -> t
+ Shomei.Prelude: (.~) :: ASetter s t a b -> b -> s -> t
+ Shomei.Prelude: (//=) :: (MonadState s m, Fractional a) => ASetter' s a -> a -> m ()
+ Shomei.Prelude: (//~) :: Fractional a => ASetter s t a a -> a -> s -> t
+ Shomei.Prelude: (<#%=) :: MonadState s m => ALens s s a b -> (a -> b) -> m b
+ Shomei.Prelude: (<#%~) :: ALens s t a b -> (a -> b) -> s -> (b, t)
+ Shomei.Prelude: (<#=) :: MonadState s m => ALens s s a b -> b -> m b
+ Shomei.Prelude: (<#~) :: ALens s t a b -> b -> s -> (b, t)
+ Shomei.Prelude: (<%=) :: MonadState s m => LensLike ((,) b) s s a b -> (a -> b) -> m b
+ Shomei.Prelude: (<%@=) :: MonadState s m => Over (Indexed i) ((,) b) s s a b -> (i -> a -> b) -> m b
+ Shomei.Prelude: (<%@~) :: Over (Indexed i) ((,) b) s t a b -> (i -> a -> b) -> s -> (b, t)
+ Shomei.Prelude: (<%~) :: LensLike ((,) b) s t a b -> (a -> b) -> s -> (b, t)
+ Shomei.Prelude: (<&&=) :: MonadState s m => LensLike' ((,) Bool) s Bool -> Bool -> m Bool
+ Shomei.Prelude: (<&&~) :: LensLike ((,) Bool) s t Bool Bool -> Bool -> s -> (Bool, t)
+ Shomei.Prelude: (<&>) :: Functor f => f a -> (a -> b) -> f b
+ Shomei.Prelude: (<**=) :: (MonadState s m, Floating a) => LensLike' ((,) a) s a -> a -> m a
+ Shomei.Prelude: (<**~) :: Floating a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
+ Shomei.Prelude: (<*=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
+ Shomei.Prelude: (<*~) :: Num a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
+ Shomei.Prelude: (<+=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
+ Shomei.Prelude: (<+~) :: Num a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
+ Shomei.Prelude: (<-=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
+ Shomei.Prelude: (<-~) :: Num a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
+ Shomei.Prelude: (<.) :: Indexable i p => (Indexed i s t -> r) -> ((a -> b) -> s -> t) -> p a b -> r
+ Shomei.Prelude: (<.=) :: MonadState s m => ASetter s s a b -> b -> m b
+ Shomei.Prelude: (<.>) :: Indexable (i, j) p => (Indexed i s t -> r) -> (Indexed j a b -> s -> t) -> p a b -> r
+ Shomei.Prelude: (<.~) :: ASetter s t a b -> b -> s -> (b, t)
+ Shomei.Prelude: (<//=) :: (MonadState s m, Fractional a) => LensLike' ((,) a) s a -> a -> m a
+ Shomei.Prelude: (<//~) :: Fractional a => LensLike ((,) a) s t a a -> a -> s -> (a, t)
+ Shomei.Prelude: (<<%=) :: (Strong p, MonadState s m) => Over p ((,) a) s s a b -> p a b -> m a
+ Shomei.Prelude: (<<%@=) :: MonadState s m => Over (Indexed i) ((,) a) s s a b -> (i -> a -> b) -> m a
+ Shomei.Prelude: (<<%@~) :: Over (Indexed i) ((,) a) s t a b -> (i -> a -> b) -> s -> (a, t)
+ Shomei.Prelude: (<<%~) :: LensLike ((,) a) s t a b -> (a -> b) -> s -> (a, t)
+ Shomei.Prelude: (<<&&=) :: MonadState s m => LensLike' ((,) Bool) s Bool -> Bool -> m Bool
+ Shomei.Prelude: (<<&&~) :: LensLike' ((,) Bool) s Bool -> Bool -> s -> (Bool, s)
+ Shomei.Prelude: (<<**=) :: (MonadState s m, Floating a) => LensLike' ((,) a) s a -> a -> m a
+ Shomei.Prelude: (<<**~) :: Floating a => LensLike' ((,) a) s a -> a -> s -> (a, s)
+ Shomei.Prelude: (<<*=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
+ Shomei.Prelude: (<<*~) :: Num a => LensLike' ((,) a) s a -> a -> s -> (a, s)
+ Shomei.Prelude: (<<+=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
+ Shomei.Prelude: (<<+~) :: Num a => LensLike' ((,) a) s a -> a -> s -> (a, s)
+ Shomei.Prelude: (<<-=) :: (MonadState s m, Num a) => LensLike' ((,) a) s a -> a -> m a
+ Shomei.Prelude: (<<-~) :: Num a => LensLike' ((,) a) s a -> a -> s -> (a, s)
+ Shomei.Prelude: (<<.=) :: MonadState s m => LensLike ((,) a) s s a b -> b -> m a
+ Shomei.Prelude: (<<.~) :: LensLike ((,) a) s t a b -> b -> s -> (a, t)
+ Shomei.Prelude: (<<//=) :: (MonadState s m, Fractional a) => LensLike' ((,) a) s a -> a -> m a
+ Shomei.Prelude: (<<//~) :: Fractional a => LensLike' ((,) a) s a -> a -> s -> (a, s)
+ Shomei.Prelude: (<<<>:=) :: (MonadState s m, Semigroup r) => LensLike' ((,) r) s r -> r -> m r
+ Shomei.Prelude: (<<<>:~) :: Semigroup m => LensLike' ((,) m) s m -> m -> s -> (m, s)
+ Shomei.Prelude: (<<<>=) :: (MonadState s m, Semigroup r) => LensLike' ((,) r) s r -> r -> m r
+ Shomei.Prelude: (<<<>~) :: Semigroup r => LensLike' ((,) r) s r -> r -> s -> (r, s)
+ Shomei.Prelude: (<<<|=) :: (MonadState s m, Cons b b a a) => LensLike ((,) b) s s b b -> a -> m b
+ Shomei.Prelude: (<<<|~) :: Cons b b a a => LensLike' ((,) b) s b -> a -> s -> (b, s)
+ Shomei.Prelude: (<<>:=) :: (MonadState s m, Semigroup r) => LensLike' ((,) r) s r -> r -> m r
+ Shomei.Prelude: (<<>:~) :: Semigroup m => LensLike ((,) m) s t m m -> m -> s -> (m, t)
+ Shomei.Prelude: (<<>=) :: (MonadState s m, Semigroup r) => LensLike' ((,) r) s r -> r -> m r
+ Shomei.Prelude: (<<>~) :: Semigroup m => LensLike ((,) m) s t m m -> m -> s -> (m, t)
+ Shomei.Prelude: (<<?=) :: MonadState s m => LensLike ((,) a) s s a (Maybe b) -> b -> m a
+ Shomei.Prelude: (<<?~) :: LensLike ((,) a) s t a (Maybe b) -> b -> s -> (a, t)
+ Shomei.Prelude: (<<^=) :: (MonadState s m, Num a, Integral e) => LensLike' ((,) a) s a -> e -> m a
+ Shomei.Prelude: (<<^^=) :: (MonadState s m, Fractional a, Integral e) => LensLike' ((,) a) s a -> e -> m a
+ Shomei.Prelude: (<<^^~) :: (Fractional a, Integral e) => LensLike' ((,) a) s a -> e -> s -> (a, s)
+ Shomei.Prelude: (<<^~) :: (Num a, Integral e) => LensLike' ((,) a) s a -> e -> s -> (a, s)
+ Shomei.Prelude: (<<|=) :: (MonadState s m, Cons b b a a) => LensLike ((,) b) s s b b -> a -> m b
+ Shomei.Prelude: (<<|>=) :: (MonadState s m, Snoc b b p p) => LensLike ((,) b) s s b b -> p -> m b
+ Shomei.Prelude: (<<|>~) :: Snoc b b p p => LensLike' ((,) b) s b -> p -> s -> (b, s)
+ Shomei.Prelude: (<<||=) :: MonadState s m => LensLike' ((,) Bool) s Bool -> Bool -> m Bool
+ Shomei.Prelude: (<<||~) :: LensLike' ((,) Bool) s Bool -> Bool -> s -> (Bool, s)
+ Shomei.Prelude: (<<|~) :: Cons b b a a => LensLike ((,) b) s t b b -> a -> s -> (b, t)
+ Shomei.Prelude: (<<~) :: MonadState s m => ALens s s a b -> m b -> m b
+ Shomei.Prelude: (<>:=) :: (MonadState s m, Semigroup a) => ASetter' s a -> a -> m ()
+ Shomei.Prelude: (<>:~) :: Semigroup b => ASetter s t b b -> b -> s -> t
+ Shomei.Prelude: (<>=) :: (MonadState s m, Semigroup a) => ASetter' s a -> a -> m ()
+ Shomei.Prelude: (<>~) :: Semigroup a => ASetter s t a a -> a -> s -> t
+ Shomei.Prelude: (<?=) :: MonadState s m => ASetter s s a (Maybe b) -> b -> m b
+ Shomei.Prelude: (<?~) :: ASetter s t a (Maybe b) -> b -> s -> (b, t)
+ Shomei.Prelude: (<^=) :: (MonadState s m, Num a, Integral e) => LensLike' ((,) a) s a -> e -> m a
+ Shomei.Prelude: (<^^=) :: (MonadState s m, Fractional a, Integral e) => LensLike' ((,) a) s a -> e -> m a
+ Shomei.Prelude: (<^^~) :: (Fractional a, Integral e) => LensLike ((,) a) s t a a -> e -> s -> (a, t)
+ Shomei.Prelude: (<^~) :: (Num a, Integral e) => LensLike ((,) a) s t a a -> e -> s -> (a, t)
+ Shomei.Prelude: (<|) :: Cons s s a a => a -> s -> s
+ Shomei.Prelude: (<|=) :: (MonadState s m, Cons b b a a) => ASetter s s b b -> a -> m ()
+ Shomei.Prelude: (<|>=) :: (MonadState s m, Snoc b b p p) => LensLike ((,) b) s s b b -> p -> m b
+ Shomei.Prelude: (<|>~) :: Snoc b b p p => LensLike ((,) b) s t b b -> p -> s -> (b, t)
+ Shomei.Prelude: (<||=) :: MonadState s m => LensLike' ((,) Bool) s Bool -> Bool -> m Bool
+ Shomei.Prelude: (<||~) :: LensLike ((,) Bool) s t Bool Bool -> Bool -> s -> (Bool, t)
+ Shomei.Prelude: (<|~) :: Cons b b a a => ASetter s t b b -> a -> s -> t
+ Shomei.Prelude: (<~) :: MonadState s m => ASetter s s a b -> m b -> m ()
+ Shomei.Prelude: (>$) :: Contravariant f => b -> f b -> f a
+ Shomei.Prelude: (?=) :: MonadState s m => ASetter s s a (Maybe b) -> b -> m ()
+ Shomei.Prelude: (??) :: Functor f => f (a -> b) -> a -> f b
+ Shomei.Prelude: (?~) :: ASetter s t a (Maybe b) -> b -> s -> t
+ Shomei.Prelude: (^#) :: s -> ALens s t a b -> a
+ Shomei.Prelude: (^.) :: s -> Getting a s a -> a
+ Shomei.Prelude: (^..) :: s -> Getting (Endo [a]) s a -> [a]
+ Shomei.Prelude: (^=) :: (MonadState s m, Num a, Integral e) => ASetter' s a -> e -> m ()
+ Shomei.Prelude: (^?!) :: HasCallStack => s -> Getting (Endo a) s a -> a
+ Shomei.Prelude: (^?) :: s -> Getting (First a) s a -> Maybe a
+ Shomei.Prelude: (^@.) :: s -> IndexedGetting i (i, a) s a -> (i, a)
+ Shomei.Prelude: (^@..) :: s -> IndexedGetting i (Endo [(i, a)]) s a -> [(i, a)]
+ Shomei.Prelude: (^@?!) :: HasCallStack => s -> IndexedGetting i (Endo (i, a)) s a -> (i, a)
+ Shomei.Prelude: (^@?) :: s -> IndexedGetting i (Endo (Maybe (i, a))) s a -> Maybe (i, a)
+ Shomei.Prelude: (^^=) :: (MonadState s m, Fractional a, Integral e) => ASetter' s a -> e -> m ()
+ Shomei.Prelude: (^^~) :: (Fractional a, Integral e) => ASetter s t a a -> e -> s -> t
+ Shomei.Prelude: (^~) :: (Num a, Integral e) => ASetter s t a a -> e -> s -> t
+ Shomei.Prelude: (|>) :: Snoc s s a a => s -> a -> s
+ Shomei.Prelude: (|>=) :: (MonadState s m, Snoc b b a a) => ASetter s s b b -> a -> m ()
+ Shomei.Prelude: (|>~) :: Snoc b b a a => ASetter s t b b -> a -> s -> t
+ Shomei.Prelude: (||=) :: MonadState s m => ASetter' s Bool -> Bool -> m ()
+ Shomei.Prelude: (||~) :: ASetter s t Bool Bool -> Bool -> s -> t
+ Shomei.Prelude: Bazaar :: (forall (f :: Type -> Type). Applicative f => p a (f b) -> f t) -> Bazaar (p :: Type -> Type -> Type) a b t
+ Shomei.Prelude: Bazaar1 :: (forall (f :: Type -> Type). Apply f => p a (f b) -> f t) -> Bazaar1 (p :: Type -> Type -> Type) a b t
+ Shomei.Prelude: Const :: a -> Const a (b :: k)
+ Shomei.Prelude: Context :: (b -> t) -> a -> Context a b t
+ Shomei.Prelude: Fold :: Fold s a -> ReifiedFold s a
+ Shomei.Prelude: Getter :: Getter s a -> ReifiedGetter s a
+ Shomei.Prelude: Identity :: a -> Identity a
+ Shomei.Prelude: Indexed :: (i -> a -> b) -> Indexed i a b
+ Shomei.Prelude: IndexedFold :: IndexedFold i s a -> ReifiedIndexedFold i s a
+ Shomei.Prelude: IndexedGetter :: IndexedGetter i s a -> ReifiedIndexedGetter i s a
+ Shomei.Prelude: IndexedLens :: IndexedLens i s t a b -> ReifiedIndexedLens i s t a b
+ Shomei.Prelude: IndexedSetter :: IndexedSetter i s t a b -> ReifiedIndexedSetter i s t a b
+ Shomei.Prelude: IndexedTraversal :: IndexedTraversal i s t a b -> ReifiedIndexedTraversal i s t a b
+ Shomei.Prelude: Iso :: Iso s t a b -> ReifiedIso s t a b
+ Shomei.Prelude: Lens :: Lens s t a b -> ReifiedLens s t a b
+ Shomei.Prelude: MethodName :: Name -> Name -> DefName
+ Shomei.Prelude: Prism :: Prism s t a b -> ReifiedPrism s t a b
+ Shomei.Prelude: Setter :: Setter s t a b -> ReifiedSetter s t a b
+ Shomei.Prelude: TopName :: Name -> DefName
+ Shomei.Prelude: Traversal :: Traversal s t a b -> ReifiedTraversal s t a b
+ Shomei.Prelude: [Identical] :: forall {k} {k1} (a :: k) (b :: k1). Identical a b a b
+ Shomei.Prelude: [Refl] :: forall {k} (a :: k). a :~: a
+ Shomei.Prelude: [getConst] :: Const a (b :: k) -> a
+ Shomei.Prelude: [runBazaar1] :: Bazaar1 (p :: Type -> Type -> Type) a b t -> forall (f :: Type -> Type). Apply f => p a (f b) -> f t
+ Shomei.Prelude: [runBazaar] :: Bazaar (p :: Type -> Type -> Type) a b t -> forall (f :: Type -> Type). Applicative f => p a (f b) -> f t
+ Shomei.Prelude: [runFold] :: ReifiedFold s a -> Fold s a
+ Shomei.Prelude: [runGetter] :: ReifiedGetter s a -> Getter s a
+ Shomei.Prelude: [runIdentity] :: Identity a -> a
+ Shomei.Prelude: [runIndexedFold] :: ReifiedIndexedFold i s a -> IndexedFold i s a
+ Shomei.Prelude: [runIndexedGetter] :: ReifiedIndexedGetter i s a -> IndexedGetter i s a
+ Shomei.Prelude: [runIndexedLens] :: ReifiedIndexedLens i s t a b -> IndexedLens i s t a b
+ Shomei.Prelude: [runIndexedSetter] :: ReifiedIndexedSetter i s t a b -> IndexedSetter i s t a b
+ Shomei.Prelude: [runIndexedTraversal] :: ReifiedIndexedTraversal i s t a b -> IndexedTraversal i s t a b
+ Shomei.Prelude: [runIndexed] :: Indexed i a b -> i -> a -> b
+ Shomei.Prelude: [runIso] :: ReifiedIso s t a b -> Iso s t a b
+ Shomei.Prelude: [runLens] :: ReifiedLens s t a b -> Lens s t a b
+ Shomei.Prelude: [runPrism] :: ReifiedPrism s t a b -> Prism s t a b
+ Shomei.Prelude: [runSetter] :: ReifiedSetter s t a b -> Setter s t a b
+ Shomei.Prelude: [runTraversal] :: ReifiedTraversal s t a b -> Traversal s t a b
+ Shomei.Prelude: _1 :: Field1 s t a b => Lens s t a b
+ Shomei.Prelude: _1' :: Field1 s t a b => Lens s t a b
+ Shomei.Prelude: _10 :: Field10 s t a b => Lens s t a b
+ Shomei.Prelude: _10' :: Field10 s t a b => Lens s t a b
+ Shomei.Prelude: _11 :: Field11 s t a b => Lens s t a b
+ Shomei.Prelude: _11' :: Field11 s t a b => Lens s t a b
+ Shomei.Prelude: _12 :: Field12 s t a b => Lens s t a b
+ Shomei.Prelude: _12' :: Field12 s t a b => Lens s t a b
+ Shomei.Prelude: _13 :: Field13 s t a b => Lens s t a b
+ Shomei.Prelude: _13' :: Field13 s t a b => Lens s t a b
+ Shomei.Prelude: _14 :: Field14 s t a b => Lens s t a b
+ Shomei.Prelude: _14' :: Field14 s t a b => Lens s t a b
+ Shomei.Prelude: _15 :: Field15 s t a b => Lens s t a b
+ Shomei.Prelude: _15' :: Field15 s t a b => Lens s t a b
+ Shomei.Prelude: _16 :: Field16 s t a b => Lens s t a b
+ Shomei.Prelude: _16' :: Field16 s t a b => Lens s t a b
+ Shomei.Prelude: _17 :: Field17 s t a b => Lens s t a b
+ Shomei.Prelude: _17' :: Field17 s t a b => Lens s t a b
+ Shomei.Prelude: _18 :: Field18 s t a b => Lens s t a b
+ Shomei.Prelude: _18' :: Field18 s t a b => Lens s t a b
+ Shomei.Prelude: _19 :: Field19 s t a b => Lens s t a b
+ Shomei.Prelude: _19' :: Field19 s t a b => Lens s t a b
+ Shomei.Prelude: _2 :: Field2 s t a b => Lens s t a b
+ Shomei.Prelude: _2' :: Field2 s t a b => Lens s t a b
+ Shomei.Prelude: _3 :: Field3 s t a b => Lens s t a b
+ Shomei.Prelude: _3' :: Field3 s t a b => Lens s t a b
+ Shomei.Prelude: _4 :: Field4 s t a b => Lens s t a b
+ Shomei.Prelude: _4' :: Field4 s t a b => Lens s t a b
+ Shomei.Prelude: _5 :: Field5 s t a b => Lens s t a b
+ Shomei.Prelude: _5' :: Field5 s t a b => Lens s t a b
+ Shomei.Prelude: _6 :: Field6 s t a b => Lens s t a b
+ Shomei.Prelude: _6' :: Field6 s t a b => Lens s t a b
+ Shomei.Prelude: _7 :: Field7 s t a b => Lens s t a b
+ Shomei.Prelude: _7' :: Field7 s t a b => Lens s t a b
+ Shomei.Prelude: _8 :: Field8 s t a b => Lens s t a b
+ Shomei.Prelude: _8' :: Field8 s t a b => Lens s t a b
+ Shomei.Prelude: _9 :: Field9 s t a b => Lens s t a b
+ Shomei.Prelude: _9' :: Field9 s t a b => Lens s t a b
+ Shomei.Prelude: _Cons :: Cons s t a b => Prism s t (a, s) (b, t)
+ Shomei.Prelude: _Empty :: AsEmpty a => Prism' a ()
+ Shomei.Prelude: _GWrapped' :: forall s (d :: Meta) (c :: Meta) (s' :: Meta) a. (Generic s, D1 d (C1 c (S1 s' (Rec0 a))) ~ Rep s, Unwrapped s ~ GUnwrapped (Rep s)) => Iso' s (Unwrapped s)
+ Shomei.Prelude: _Just :: forall a b p f. (Choice p, Applicative f) => p a (f b) -> p (Maybe a) (f (Maybe b))
+ Shomei.Prelude: _Left :: forall a c b p f. (Choice p, Applicative f) => p a (f b) -> p (Either a c) (f (Either b c))
+ Shomei.Prelude: _Nothing :: forall a p f. (Choice p, Applicative f) => p () (f ()) -> p (Maybe a) (f (Maybe a))
+ Shomei.Prelude: _Right :: forall c a b p f. (Choice p, Applicative f) => p a (f b) -> p (Either c a) (f (Either c b))
+ Shomei.Prelude: _Show :: (Read a, Show a) => Prism' String a
+ Shomei.Prelude: _Snoc :: Snoc s t a b => Prism s t (s, a) (t, b)
+ Shomei.Prelude: _Unwrapped :: Rewrapping s t => Iso (Unwrapped t) (Unwrapped s) t s
+ Shomei.Prelude: _Unwrapped' :: Wrapped s => Iso' (Unwrapped s) s
+ Shomei.Prelude: _Unwrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso (Unwrapped t) (Unwrapped s) t s
+ Shomei.Prelude: _Unwrapping' :: Wrapped s => (Unwrapped s -> s) -> Iso' (Unwrapped s) s
+ Shomei.Prelude: _Void :: forall s a p f. (Choice p, Applicative f) => p a (f Void) -> p s (f s)
+ Shomei.Prelude: _Wrapped :: Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
+ Shomei.Prelude: _Wrapped' :: Wrapped s => Iso' s (Unwrapped s)
+ Shomei.Prelude: _Wrapping :: Rewrapping s t => (Unwrapped s -> s) -> Iso s t (Unwrapped s) (Unwrapped t)
+ Shomei.Prelude: _Wrapping' :: Wrapped s => (Unwrapped s -> s) -> Iso' s (Unwrapped s)
+ Shomei.Prelude: _head :: Cons s s a a => Traversal' s a
+ Shomei.Prelude: _init :: Snoc s s a a => Traversal' s s
+ Shomei.Prelude: _last :: Snoc s s a a => Traversal' s a
+ Shomei.Prelude: _tail :: Cons s s a a => Traversal' s s
+ Shomei.Prelude: abbreviatedFields :: LensRules
+ Shomei.Prelude: abbreviatedNamer :: FieldNamer
+ Shomei.Prelude: ala :: (Functor f, Rewrapping s t) => (Unwrapped s -> s) -> ((Unwrapped t -> t) -> f s) -> f (Unwrapped s)
+ Shomei.Prelude: alaf :: (Functor f, Functor g, Rewrapping s t) => (Unwrapped s -> s) -> (f t -> g s) -> f (Unwrapped t) -> g (Unwrapped s)
+ Shomei.Prelude: allOf :: Getting All s a -> (a -> Bool) -> s -> Bool
+ Shomei.Prelude: alongside :: LensLike (AlongsideLeft f b') s t a b -> LensLike (AlongsideRight f t) s' t' a' b' -> LensLike f (s, s') (t, t') (a, a') (b, b')
+ Shomei.Prelude: altOf :: Applicative f => Getting (Alt f a) s a -> s -> f a
+ Shomei.Prelude: andOf :: Getting All s Bool -> s -> Bool
+ Shomei.Prelude: anon :: a -> (a -> Bool) -> Iso' (Maybe a) a
+ Shomei.Prelude: anyOf :: Getting Any s a -> (a -> Bool) -> s -> Bool
+ Shomei.Prelude: argument :: forall (p :: Type -> Type -> Type) b r a. Profunctor p => Setter (p b r) (p a r) a b
+ Shomei.Prelude: asIndex :: (Indexable i p, Contravariant f, Functor f) => p i (f i) -> Indexed i s (f s)
+ Shomei.Prelude: aside :: APrism s t a b -> Prism (e, s) (e, t) (e, a) (e, b)
+ Shomei.Prelude: assign :: MonadState s m => ASetter s s a b -> b -> m ()
+ Shomei.Prelude: assignA :: Arrow p => ASetter s t a b -> p s b -> p s t
+ Shomei.Prelude: asumOf :: Alternative f => Getting (Endo (f a)) s (f a) -> s -> f a
+ Shomei.Prelude: at :: At m => Index m -> Lens' m (Maybe (IxValue m))
+ Shomei.Prelude: au :: Functor f => AnIso s t a b -> ((b -> t) -> f s) -> f a
+ Shomei.Prelude: auf :: (Functor f, Functor g) => AnIso s t a b -> (f t -> g s) -> f b -> g a
+ Shomei.Prelude: backwards :: (Profunctor p, Profunctor q) => Optical p q (Backwards f) s t a b -> Optical p q f s t a b
+ Shomei.Prelude: below :: forall (f :: Type -> Type) s a. Traversable f => APrism' s a -> Prism' (f s) (f a)
+ Shomei.Prelude: beside :: (Representable q, Applicative (Rep q), Applicative f, Bitraversable r) => Optical p q f s t a b -> Optical p q f s' t' a b -> Optical p q f (r s s') (r t t') a b
+ Shomei.Prelude: bimap :: Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d
+ Shomei.Prelude: bimapping :: forall (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) s t a b s' t' a' b'. (Bifunctor f, Bifunctor g) => AnIso s t a b -> AnIso s' t' a' b' -> Iso (f s s') (g t t') (f a a') (g b b')
+ Shomei.Prelude: both :: forall (r :: Type -> Type -> Type) a b. Bitraversable r => Traversal (r a a) (r b b) a b
+ Shomei.Prelude: both1 :: forall (r :: Type -> Type -> Type) a b. Bitraversable1 r => Traversal1 (r a a) (r b b) a b
+ Shomei.Prelude: camelCaseFields :: LensRules
+ Shomei.Prelude: camelCaseNamer :: FieldNamer
+ Shomei.Prelude: censoring :: MonadWriter w m => Setter w w u v -> (u -> v) -> m a -> m a
+ Shomei.Prelude: children :: Plated a => a -> [a]
+ Shomei.Prelude: choosing :: Functor f => LensLike f s t a b -> LensLike f s' t' a b -> LensLike f (Either s s') (Either t t') a b
+ Shomei.Prelude: chosen :: forall a b p f. (Conjoined p, Functor f) => p a (f b) -> p (Either a a) (f (Either b b))
+ Shomei.Prelude: class AsEmpty a
+ Shomei.Prelude: class Ixed m => At m
+ Shomei.Prelude: class forall a. () => Functor p a => Bifunctor (p :: Type -> Type -> Type)
+ Shomei.Prelude: class Profunctor p => Choice (p :: Type -> Type -> Type)
+ Shomei.Prelude: class (Choice p, Corepresentable p, Comonad Corep p, Traversable Corep p, Strong p, Representable p, Monad Rep p, MonadFix Rep p, Distributive Rep p, Costrong p, ArrowLoop p, ArrowApply p, ArrowChoice p, Closed p) => Conjoined (p :: Type -> Type -> Type)
+ Shomei.Prelude: class Cons s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Contains m
+ Shomei.Prelude: class Contravariant (f :: Type -> Type)
+ Shomei.Prelude: class Each s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field10 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field11 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field12 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field13 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field14 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field15 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field16 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field17 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field18 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field19 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field2 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field3 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field4 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field5 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field6 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field7 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field8 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Field9 s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Foldable f => FoldableWithIndex i (f :: Type -> Type) | f -> i
+ Shomei.Prelude: class Functor f => FunctorWithIndex i (f :: Type -> Type) | f -> i
+ Shomei.Prelude: class GPlated a (g :: k -> Type)
+ Shomei.Prelude: class GPlated1 (f :: k -> Type) (g :: k -> Type)
+ Shomei.Prelude: class Conjoined p => Indexable i (p :: Type -> Type -> Type)
+ Shomei.Prelude: class Ixed m
+ Shomei.Prelude: class (Magnified m ~ Magnified n, MonadReader b m, MonadReader a n) => Magnify (m :: Type -> Type) (n :: Type -> Type) b a | m -> b, n -> a, m a -> n, n b -> m
+ Shomei.Prelude: class Plated a
+ Shomei.Prelude: class Prefixed t
+ Shomei.Prelude: class Profunctor (p :: Type -> Type -> Type)
+ Shomei.Prelude: class Reversing t
+ Shomei.Prelude: class (Profunctor p, Bifunctor p) => Reviewable (p :: Type -> Type -> Type)
+ Shomei.Prelude: class Wrapped s => Rewrapped s t
+ Shomei.Prelude: class (Rewrapped s t, Rewrapped t s) => Rewrapping s t
+ Shomei.Prelude: class (Applicative f, Distributive f, Traversable f) => Settable (f :: Type -> Type)
+ Shomei.Prelude: class Snoc s t a b | s -> a, t -> b, s b -> t, t a -> s
+ Shomei.Prelude: class Suffixed t
+ Shomei.Prelude: class (Functor t, Foldable t) => Traversable (t :: Type -> Type)
+ Shomei.Prelude: class (Foldable1 t, Traversable t) => Traversable1 (t :: Type -> Type)
+ Shomei.Prelude: class (FunctorWithIndex i t, FoldableWithIndex i t, Traversable t) => TraversableWithIndex i (t :: Type -> Type) | t -> i
+ Shomei.Prelude: class Ord k => TraverseMax k (m :: Type -> Type) | m -> k
+ Shomei.Prelude: class Ord k => TraverseMin k (m :: Type -> Type) | m -> k
+ Shomei.Prelude: class Wrapped s where {
+ Shomei.Prelude: class (MonadState s m, MonadState t n) => Zoom (m :: Type -> Type) (n :: Type -> Type) s t | m -> s, n -> t, m t -> n, n s -> m
+ Shomei.Prelude: classIdFields :: LensRules
+ Shomei.Prelude: classIdNamer :: FieldNamer
+ Shomei.Prelude: classUnderscoreNoPrefixFields :: LensRules
+ Shomei.Prelude: classUnderscoreNoPrefixNamer :: FieldNamer
+ Shomei.Prelude: classyRules :: LensRules
+ Shomei.Prelude: classyRules_ :: LensRules
+ Shomei.Prelude: cloneEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2). AnEquality s t a b -> Equality s t a b
+ Shomei.Prelude: cloneIndexPreservingLens :: ALens s t a b -> IndexPreservingLens s t a b
+ Shomei.Prelude: cloneIndexPreservingSetter :: ASetter s t a b -> IndexPreservingSetter s t a b
+ Shomei.Prelude: cloneIndexPreservingTraversal :: ATraversal s t a b -> IndexPreservingTraversal s t a b
+ Shomei.Prelude: cloneIndexPreservingTraversal1 :: ATraversal1 s t a b -> IndexPreservingTraversal1 s t a b
+ Shomei.Prelude: cloneIndexedLens :: AnIndexedLens i s t a b -> IndexedLens i s t a b
+ Shomei.Prelude: cloneIndexedSetter :: AnIndexedSetter i s t a b -> IndexedSetter i s t a b
+ Shomei.Prelude: cloneIndexedTraversal :: AnIndexedTraversal i s t a b -> IndexedTraversal i s t a b
+ Shomei.Prelude: cloneIndexedTraversal1 :: AnIndexedTraversal1 i s t a b -> IndexedTraversal1 i s t a b
+ Shomei.Prelude: cloneIso :: AnIso s t a b -> Iso s t a b
+ Shomei.Prelude: cloneLens :: ALens s t a b -> Lens s t a b
+ Shomei.Prelude: clonePrism :: APrism s t a b -> Prism s t a b
+ Shomei.Prelude: cloneSetter :: ASetter s t a b -> Setter s t a b
+ Shomei.Prelude: cloneTraversal :: ATraversal s t a b -> Traversal s t a b
+ Shomei.Prelude: cloneTraversal1 :: ATraversal1 s t a b -> Traversal1 s t a b
+ Shomei.Prelude: coerced :: forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
+ Shomei.Prelude: composOpFold :: Plated a => b -> (b -> b -> b) -> (a -> b) -> a -> b
+ Shomei.Prelude: concatMapOf :: Getting [r] s a -> (a -> [r]) -> s -> [r]
+ Shomei.Prelude: concatOf :: Getting [r] s [r] -> s -> [r]
+ Shomei.Prelude: confusing :: Applicative f => LensLike (Curried (Yoneda f) (Yoneda f)) s t a b -> LensLike f s t a b
+ Shomei.Prelude: conjoined :: Conjoined p => (p ~ (->) => q (a -> b) r) -> q (p a b) r -> q (p a b) r
+ Shomei.Prelude: cons :: Cons s s a a => a -> s -> s
+ Shomei.Prelude: contains :: Contains m => Index m -> Lens' m Bool
+ Shomei.Prelude: contexts :: Plated a => a -> [Context a a a]
+ Shomei.Prelude: contextsOf :: ATraversal' a a -> a -> [Context a a a]
+ Shomei.Prelude: contextsOn :: Plated a => ATraversal s t a a -> s -> [Context a a t]
+ Shomei.Prelude: contextsOnOf :: ATraversal s t a a -> ATraversal' a a -> s -> [Context a a t]
+ Shomei.Prelude: contramap :: Contravariant f => (a' -> a) -> f a -> f a'
+ Shomei.Prelude: contramapped :: forall (f :: Type -> Type) b a. Contravariant f => Setter (f b) (f a) a b
+ Shomei.Prelude: contramapping :: forall (f :: Type -> Type) s t a b. Contravariant f => AnIso s t a b -> Iso (f a) (f b) (f s) (f t)
+ Shomei.Prelude: cosmos :: Plated a => Fold a a
+ Shomei.Prelude: cosmosOf :: (Applicative f, Contravariant f) => LensLike' f a a -> LensLike' f a a
+ Shomei.Prelude: cosmosOn :: (Applicative f, Contravariant f, Plated a) => LensLike' f s a -> LensLike' f s a
+ Shomei.Prelude: cosmosOnOf :: (Applicative f, Contravariant f) => LensLike' f s a -> LensLike' f a a -> LensLike' f s a
+ Shomei.Prelude: createClass :: Lens' LensRules Bool
+ Shomei.Prelude: curried :: forall a b c d e f1 p f2. (Profunctor p, Functor f2) => p (a -> b -> c) (f2 (d -> e -> f1)) -> p ((a, b) -> c) (f2 ((d, e) -> f1))
+ Shomei.Prelude: cycled :: Apply f => LensLike f s t a b -> LensLike f s t a b
+ Shomei.Prelude: data (a :: k) :~: (b :: k)
+ Shomei.Prelude: data Context a b t
+ Shomei.Prelude: data DefName
+ Shomei.Prelude: data Identical (a :: k) (b :: k1) (s :: k) (t :: k1)
+ Shomei.Prelude: data Leftmost a
+ Shomei.Prelude: data LensRules
+ Shomei.Prelude: data Level i a
+ Shomei.Prelude: data Magma i t b a
+ Shomei.Prelude: data Rightmost a
+ Shomei.Prelude: data Sequenced a (m :: Type -> Type)
+ Shomei.Prelude: data Traversed a (f :: Type -> Type)
+ Shomei.Prelude: declareClassy :: DecsQ -> DecsQ
+ Shomei.Prelude: declareClassyFor :: [(String, (String, String))] -> [(String, String)] -> DecsQ -> DecsQ
+ Shomei.Prelude: declareFields :: DecsQ -> DecsQ
+ Shomei.Prelude: declareLenses :: DecsQ -> DecsQ
+ Shomei.Prelude: declareLensesFor :: [(String, String)] -> DecsQ -> DecsQ
+ Shomei.Prelude: declareLensesWith :: LensRules -> DecsQ -> DecsQ
+ Shomei.Prelude: declarePrisms :: DecsQ -> DecsQ
+ Shomei.Prelude: declareWrapped :: DecsQ -> DecsQ
+ Shomei.Prelude: deep :: (Conjoined p, Applicative f, Plated s) => Traversing p f s s a b -> Over p f s s a b
+ Shomei.Prelude: deepOf :: (Conjoined p, Applicative f) => LensLike f s t s t -> Traversing p f s t a b -> Over p f s t a b
+ Shomei.Prelude: defaultFieldRules :: LensRules
+ Shomei.Prelude: devoid :: forall {k} p f (a :: k) b. Over p f Void Void a b
+ Shomei.Prelude: dimap :: Profunctor p => (a -> b) -> (c -> d) -> p b c -> p a d
+ Shomei.Prelude: dimapping :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) s t a b s' t' a' b'. (Profunctor p, Profunctor q) => AnIso s t a b -> AnIso s' t' a' b' -> Iso (p a s') (q b t') (p s a') (q t b')
+ Shomei.Prelude: distrib :: (Conjoined p, Functor f) => p a b -> p (f a) (f b)
+ Shomei.Prelude: dropping :: (Conjoined p, Applicative f) => Int -> Over p (Indexing f) s t a a -> Over p f s t a a
+ Shomei.Prelude: droppingWhile :: (Conjoined p, Profunctor q, Applicative f) => (a -> Bool) -> Optical p q (Compose (State Bool) f) s t a a -> Optical p q f s t a a
+ Shomei.Prelude: each :: Each s t a b => Traversal s t a b
+ Shomei.Prelude: elemIndexOf :: Eq a => IndexedGetting i (First i) s a -> a -> s -> Maybe i
+ Shomei.Prelude: elemIndicesOf :: Eq a => IndexedGetting i (Endo [i]) s a -> a -> s -> [i]
+ Shomei.Prelude: elemOf :: Eq a => Getting Any s a -> a -> s -> Bool
+ Shomei.Prelude: element :: forall (t :: Type -> Type) a. Traversable t => Int -> IndexedTraversal' Int (t a) a
+ Shomei.Prelude: elementOf :: forall (f :: Type -> Type) s t a. Applicative f => LensLike (Indexing f) s t a a -> Int -> IndexedLensLike Int f s t a a
+ Shomei.Prelude: elements :: forall (t :: Type -> Type) a. Traversable t => (Int -> Bool) -> IndexedTraversal' Int (t a) a
+ Shomei.Prelude: elementsOf :: forall (f :: Type -> Type) s t a. Applicative f => LensLike (Indexing f) s t a a -> (Int -> Bool) -> IndexedLensLike Int f s t a a
+ Shomei.Prelude: enum :: Enum a => Iso' Int a
+ Shomei.Prelude: equality :: forall {k1} {k2} (s :: k1) (a :: k1) (b :: k2) (t :: k2). (s :~: a) -> (b :~: t) -> Equality s t a b
+ Shomei.Prelude: equality' :: forall {k2} (a :: k2) (b :: k2). (a :~: b) -> Equality' a b
+ Shomei.Prelude: failing :: (Conjoined p, Applicative f) => Traversing p f s t a b -> Over p f s t a b -> Over p f s t a b
+ Shomei.Prelude: failover :: Alternative m => LensLike ((,) Any) s t a b -> (a -> b) -> s -> m t
+ Shomei.Prelude: filtered :: (Choice p, Applicative f) => (a -> Bool) -> Optic' p f a a
+ Shomei.Prelude: filteredBy :: (Indexable i p, Applicative f) => Getting (First i) a i -> p a (f a) -> a -> f a
+ Shomei.Prelude: findIndexOf :: IndexedGetting i (First i) s a -> (a -> Bool) -> s -> Maybe i
+ Shomei.Prelude: findIndicesOf :: IndexedGetting i (Endo [i]) s a -> (a -> Bool) -> s -> [i]
+ Shomei.Prelude: findMOf :: Monad m => Getting (Endo (m (Maybe a))) s a -> (a -> m Bool) -> s -> m (Maybe a)
+ Shomei.Prelude: findOf :: Getting (Endo (Maybe a)) s a -> (a -> Bool) -> s -> Maybe a
+ Shomei.Prelude: first1Of :: Getting (First a) s a -> s -> a
+ Shomei.Prelude: firstOf :: Getting (Leftmost a) s a -> s -> Maybe a
+ Shomei.Prelude: firsting :: forall (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) s t a b x y. (Bifunctor f, Bifunctor g) => AnIso s t a b -> Iso (f s x) (g t y) (f a x) (g b y)
+ Shomei.Prelude: flipped :: forall a b c a' b' c' p f. (Profunctor p, Functor f) => p (b -> a -> c) (f (b' -> a' -> c')) -> p (a -> b -> c) (f (a' -> b' -> c'))
+ Shomei.Prelude: foldBy :: Foldable t => (a -> a -> a) -> a -> t a -> a
+ Shomei.Prelude: foldByOf :: Fold s a -> (a -> a -> a) -> a -> s -> a
+ Shomei.Prelude: foldMapBy :: Foldable t => (r -> r -> r) -> r -> (a -> r) -> t a -> r
+ Shomei.Prelude: foldMapByOf :: Fold s a -> (r -> r -> r) -> r -> (a -> r) -> s -> r
+ Shomei.Prelude: foldMapOf :: Getting r s a -> (a -> r) -> s -> r
+ Shomei.Prelude: foldOf :: Getting a s a -> s -> a
+ Shomei.Prelude: folded :: forall (f :: Type -> Type) a. Foldable f => IndexedFold Int (f a) a
+ Shomei.Prelude: folded64 :: forall (f :: Type -> Type) a. Foldable f => IndexedFold Int64 (f a) a
+ Shomei.Prelude: folding :: Foldable f => (s -> f a) -> Fold s a
+ Shomei.Prelude: foldl1Of :: HasCallStack => Getting (Dual (Endo (Maybe a))) s a -> (a -> a -> a) -> s -> a
+ Shomei.Prelude: foldl1Of' :: HasCallStack => Getting (Endo (Endo (Maybe a))) s a -> (a -> a -> a) -> s -> a
+ Shomei.Prelude: foldlMOf :: Monad m => Getting (Endo (r -> m r)) s a -> (r -> a -> m r) -> r -> s -> m r
+ Shomei.Prelude: foldlOf :: Getting (Dual (Endo r)) s a -> (r -> a -> r) -> r -> s -> r
+ Shomei.Prelude: foldlOf' :: Getting (Endo (Endo r)) s a -> (r -> a -> r) -> r -> s -> r
+ Shomei.Prelude: foldr1Of :: HasCallStack => Getting (Endo (Maybe a)) s a -> (a -> a -> a) -> s -> a
+ Shomei.Prelude: foldr1Of' :: HasCallStack => Getting (Dual (Endo (Endo (Maybe a)))) s a -> (a -> a -> a) -> s -> a
+ Shomei.Prelude: foldrMOf :: Monad m => Getting (Dual (Endo (r -> m r))) s a -> (a -> r -> m r) -> r -> s -> m r
+ Shomei.Prelude: foldrOf :: Getting (Endo r) s a -> (a -> r -> r) -> r -> s -> r
+ Shomei.Prelude: foldrOf' :: Getting (Dual (Endo (Endo r))) s a -> (a -> r -> r) -> r -> s -> r
+ Shomei.Prelude: foldring :: (Contravariant f, Applicative f) => ((a -> f a -> f a) -> f a -> s -> f a) -> LensLike f s t a b
+ Shomei.Prelude: for1Of_ :: Functor f => Getting (TraversedF r f) s a -> s -> (a -> f r) -> f ()
+ Shomei.Prelude: forMOf :: LensLike (WrappedMonad m) s t a b -> s -> (a -> m b) -> m t
+ Shomei.Prelude: forMOf_ :: Monad m => Getting (Sequenced r m) s a -> s -> (a -> m r) -> m ()
+ Shomei.Prelude: forOf :: LensLike f s t a b -> s -> (a -> f b) -> f t
+ Shomei.Prelude: forOf_ :: Functor f => Getting (Traversed r f) s a -> s -> (a -> f r) -> f ()
+ Shomei.Prelude: from :: AnIso s t a b -> Iso b a t s
+ Shomei.Prelude: fromEq :: forall {k2} {k1} (s :: k2) (t :: k1) (a :: k2) (b :: k1). AnEquality s t a b -> Equality b a t s
+ Shomei.Prelude: fromLeibniz :: forall {k1} {k2} (a :: k1) (b :: k2) (s :: k1) (t :: k2). (Identical a b a b -> Identical a b s t) -> Equality s t a b
+ Shomei.Prelude: fromLeibniz' :: forall {k2} (s :: k2) (a :: k2). ((s :~: s) -> s :~: a) -> Equality' s a
+ Shomei.Prelude: fusing :: Functor f => LensLike (Yoneda f) s t a b -> LensLike f s t a b
+ Shomei.Prelude: generateLazyPatterns :: Lens' LensRules Bool
+ Shomei.Prelude: generateRecordSyntax :: Lens' LensRules Bool
+ Shomei.Prelude: generateSignatures :: Lens' LensRules Bool
+ Shomei.Prelude: generateUpdateableOptics :: Lens' LensRules Bool
+ Shomei.Prelude: getting :: (Profunctor p, Profunctor q, Functor f, Contravariant f) => Optical p q f s t a b -> Optical' p q f s a
+ Shomei.Prelude: gplate :: (Generic a, GPlated a (Rep a)) => Traversal' a a
+ Shomei.Prelude: gplate1 :: forall {k} (f :: k -> Type) (a :: k). (Generic1 f, GPlated1 f (Rep1 f)) => Traversal' (f a) (f a)
+ Shomei.Prelude: has :: Getting Any s a -> s -> Bool
+ Shomei.Prelude: hasn't :: Getting All s a -> s -> Bool
+ Shomei.Prelude: head1 :: forall (t :: Type -> Type) a. Traversable1 t => Lens' (t a) a
+ Shomei.Prelude: holes :: Plated a => a -> [Pretext (->) a a a]
+ Shomei.Prelude: holes1Of :: Conjoined p => Over p (Bazaar1 p a a) s t a a -> s -> NonEmpty (Pretext p a a t)
+ Shomei.Prelude: holesOf :: Conjoined p => Over p (Bazaar p a a) s t a a -> s -> [Pretext p a a t]
+ Shomei.Prelude: holesOn :: Conjoined p => Over p (Bazaar p a a) s t a a -> s -> [Pretext p a a t]
+ Shomei.Prelude: holesOnOf :: Conjoined p => LensLike (Bazaar p r r) s t a b -> Over p (Bazaar p r r) a b r r -> s -> [Pretext p r r t]
+ Shomei.Prelude: iall :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Bool
+ Shomei.Prelude: iallOf :: IndexedGetting i All s a -> (i -> a -> Bool) -> s -> Bool
+ Shomei.Prelude: iany :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Bool
+ Shomei.Prelude: ianyOf :: IndexedGetting i Any s a -> (i -> a -> Bool) -> s -> Bool
+ Shomei.Prelude: iat :: At m => Index m -> IndexedLens' (Index m) m (Maybe (IxValue m))
+ Shomei.Prelude: icensoring :: MonadWriter w m => IndexedSetter i w w u v -> (i -> u -> v) -> m a -> m a
+ Shomei.Prelude: icompose :: Indexable p c => (i -> j -> p) -> (Indexed i s t -> r) -> (Indexed j a b -> s -> t) -> c a b -> r
+ Shomei.Prelude: iconcatMap :: FoldableWithIndex i f => (i -> a -> [b]) -> f a -> [b]
+ Shomei.Prelude: iconcatMapOf :: IndexedGetting i [r] s a -> (i -> a -> [r]) -> s -> [r]
+ Shomei.Prelude: icontains :: Contains m => Index m -> IndexedLens' (Index m) m Bool
+ Shomei.Prelude: idroppingWhile :: (Indexable i p, Profunctor q, Applicative f) => (i -> a -> Bool) -> Optical (Indexed i) q (Compose (State Bool) f) s t a a -> Optical p q f s t a a
+ Shomei.Prelude: ifailover :: Alternative m => Over (Indexed i) ((,) Any) s t a b -> (i -> a -> b) -> s -> m t
+ Shomei.Prelude: ifiltered :: (Indexable i p, Applicative f) => (i -> a -> Bool) -> Optical' p (Indexed i) f a a
+ Shomei.Prelude: ifind :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Maybe (i, a)
+ Shomei.Prelude: ifindMOf :: Monad m => IndexedGetting i (Endo (m (Maybe a))) s a -> (i -> a -> m Bool) -> s -> m (Maybe a)
+ Shomei.Prelude: ifindOf :: IndexedGetting i (Endo (Maybe a)) s a -> (i -> a -> Bool) -> s -> Maybe a
+ Shomei.Prelude: ifoldMap :: (FoldableWithIndex i f, Monoid m) => (i -> a -> m) -> f a -> m
+ Shomei.Prelude: ifoldMap' :: (FoldableWithIndex i f, Monoid m) => (i -> a -> m) -> f a -> m
+ Shomei.Prelude: ifoldMapBy :: FoldableWithIndex i t => (r -> r -> r) -> r -> (i -> a -> r) -> t a -> r
+ Shomei.Prelude: ifoldMapByOf :: IndexedFold i t a -> (r -> r -> r) -> r -> (i -> a -> r) -> t -> r
+ Shomei.Prelude: ifoldMapOf :: IndexedGetting i m s a -> (i -> a -> m) -> s -> m
+ Shomei.Prelude: ifolded :: forall i (f :: Type -> Type) a. FoldableWithIndex i f => IndexedFold i (f a) a
+ Shomei.Prelude: ifolding :: (Foldable f, Indexable i p, Contravariant g, Applicative g) => (s -> f (i, a)) -> Over p g s t a b
+ Shomei.Prelude: ifoldl :: FoldableWithIndex i f => (i -> b -> a -> b) -> b -> f a -> b
+ Shomei.Prelude: ifoldl' :: FoldableWithIndex i f => (i -> b -> a -> b) -> b -> f a -> b
+ Shomei.Prelude: ifoldlM :: (FoldableWithIndex i f, Monad m) => (i -> b -> a -> m b) -> b -> f a -> m b
+ Shomei.Prelude: ifoldlMOf :: Monad m => IndexedGetting i (Endo (r -> m r)) s a -> (i -> r -> a -> m r) -> r -> s -> m r
+ Shomei.Prelude: ifoldlOf :: IndexedGetting i (Dual (Endo r)) s a -> (i -> r -> a -> r) -> r -> s -> r
+ Shomei.Prelude: ifoldlOf' :: IndexedGetting i (Endo (r -> r)) s a -> (i -> r -> a -> r) -> r -> s -> r
+ Shomei.Prelude: ifoldr :: FoldableWithIndex i f => (i -> a -> b -> b) -> b -> f a -> b
+ Shomei.Prelude: ifoldr' :: FoldableWithIndex i f => (i -> a -> b -> b) -> b -> f a -> b
+ Shomei.Prelude: ifoldrM :: (FoldableWithIndex i f, Monad m) => (i -> a -> b -> m b) -> b -> f a -> m b
+ Shomei.Prelude: ifoldrMOf :: Monad m => IndexedGetting i (Dual (Endo (r -> m r))) s a -> (i -> a -> r -> m r) -> r -> s -> m r
+ Shomei.Prelude: ifoldrOf :: IndexedGetting i (Endo r) s a -> (i -> a -> r -> r) -> r -> s -> r
+ Shomei.Prelude: ifoldrOf' :: IndexedGetting i (Dual (Endo (r -> r))) s a -> (i -> a -> r -> r) -> r -> s -> r
+ Shomei.Prelude: ifoldring :: (Indexable i p, Contravariant f, Applicative f) => ((i -> a -> f a -> f a) -> f a -> s -> f a) -> Over p f s t a b
+ Shomei.Prelude: ifor :: (TraversableWithIndex i t, Applicative f) => t a -> (i -> a -> f b) -> f (t b)
+ Shomei.Prelude: iforM :: (TraversableWithIndex i t, Monad m) => t a -> (i -> a -> m b) -> m (t b)
+ Shomei.Prelude: iforMOf :: (Indexed i a (WrappedMonad m b) -> s -> WrappedMonad m t) -> s -> (i -> a -> m b) -> m t
+ Shomei.Prelude: iforMOf_ :: Monad m => IndexedGetting i (Sequenced r m) s a -> s -> (i -> a -> m r) -> m ()
+ Shomei.Prelude: iforM_ :: (FoldableWithIndex i t, Monad m) => t a -> (i -> a -> m b) -> m ()
+ Shomei.Prelude: iforOf :: (Indexed i a (f b) -> s -> f t) -> s -> (i -> a -> f b) -> f t
+ Shomei.Prelude: iforOf_ :: Functor f => IndexedGetting i (Traversed r f) s a -> s -> (i -> a -> f r) -> f ()
+ Shomei.Prelude: ifor_ :: (FoldableWithIndex i t, Applicative f) => t a -> (i -> a -> f b) -> f ()
+ Shomei.Prelude: ignored :: Applicative f => pafb -> s -> f s
+ Shomei.Prelude: iix :: Ixed m => Index m -> IndexedTraversal' (Index m) m (IxValue m)
+ Shomei.Prelude: ilens :: (s -> (i, a)) -> (s -> b -> t) -> IndexedLens i s t a b
+ Shomei.Prelude: ilevels :: forall (f :: Type -> Type) i s t a b j. Applicative f => Traversing (Indexed i) f s t a b -> IndexedLensLike Int f s t (Level i a) (Level j b)
+ Shomei.Prelude: ilike :: (Indexable i p, Contravariant f, Functor f) => i -> a -> Over' p f s a
+ Shomei.Prelude: ilistening :: MonadWriter w m => IndexedGetting i (i, u) w u -> m a -> m (a, (i, u))
+ Shomei.Prelude: ilistenings :: MonadWriter w m => IndexedGetting i v w u -> (i -> u -> v) -> m a -> m (a, v)
+ Shomei.Prelude: ilocally :: MonadReader s m => AnIndexedSetter i s s a b -> (i -> a -> b) -> m r -> m r
+ Shomei.Prelude: iloci :: forall i a c s b p f. (Indexable i p, Applicative f) => p a (f b) -> Bazaar (Indexed i) a c s -> f (Bazaar (Indexed i) b c s)
+ Shomei.Prelude: imagma :: Over (Indexed i) (Molten i a b) s t a b -> Iso s t' (Magma i t b a) (Magma j t' c c)
+ Shomei.Prelude: imap :: FunctorWithIndex i f => (i -> a -> b) -> f a -> f b
+ Shomei.Prelude: imapAccumL :: TraversableWithIndex i t => (i -> s -> a -> (s, b)) -> s -> t a -> (s, t b)
+ Shomei.Prelude: imapAccumLOf :: Over (Indexed i) (State acc) s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
+ Shomei.Prelude: imapAccumR :: TraversableWithIndex i t => (i -> s -> a -> (s, b)) -> s -> t a -> (s, t b)
+ Shomei.Prelude: imapAccumROf :: Over (Indexed i) (Backwards (State acc)) s t a b -> (i -> acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
+ Shomei.Prelude: imapM :: (TraversableWithIndex i t, Monad m) => (i -> a -> m b) -> t a -> m (t b)
+ Shomei.Prelude: imapMOf :: Over (Indexed i) (WrappedMonad m) s t a b -> (i -> a -> m b) -> s -> m t
+ Shomei.Prelude: imapMOf_ :: Monad m => IndexedGetting i (Sequenced r m) s a -> (i -> a -> m r) -> s -> m ()
+ Shomei.Prelude: imapM_ :: (FoldableWithIndex i t, Monad m) => (i -> a -> m b) -> t a -> m ()
+ Shomei.Prelude: imapOf :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> t
+ Shomei.Prelude: imapped :: forall i (f :: Type -> Type) a b. FunctorWithIndex i f => IndexedSetter i (f a) (f b) a b
+ Shomei.Prelude: imodifying :: MonadState s m => AnIndexedSetter i s s a b -> (i -> a -> b) -> m ()
+ Shomei.Prelude: index :: (Indexable i p, Eq i, Applicative f) => i -> Optical' p (Indexed i) f a a
+ Shomei.Prelude: indexed :: Indexable i p => p a b -> i -> a -> b
+ Shomei.Prelude: indexing :: Indexable Int p => ((a -> Indexing f b) -> s -> Indexing f t) -> p a (f b) -> s -> f t
+ Shomei.Prelude: indexing64 :: Indexable Int64 p => ((a -> Indexing64 f b) -> s -> Indexing64 f t) -> p a (f b) -> s -> f t
+ Shomei.Prelude: indices :: (Indexable i p, Applicative f) => (i -> Bool) -> Optical' p (Indexed i) f a a
+ Shomei.Prelude: infix 4 :~:
+ Shomei.Prelude: infixl 1 <&>
+ Shomei.Prelude: infixl 4 >$
+ Shomei.Prelude: inone :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Bool
+ Shomei.Prelude: inoneOf :: IndexedGetting i Any s a -> (i -> a -> Bool) -> s -> Bool
+ Shomei.Prelude: inside :: forall (p :: Type -> Type -> Type) s t a b e. Corepresentable p => ALens s t a b -> Lens (p e s) (p e t) (p e a) (p e b)
+ Shomei.Prelude: involuted :: (a -> a) -> Iso' a a
+ Shomei.Prelude: iover :: AnIndexedSetter i s t a b -> (i -> a -> b) -> s -> t
+ Shomei.Prelude: ipartsOf :: (Indexable [i] p, Functor f) => Traversing (Indexed i) f s t a a -> Over p f s t [a] [a]
+ Shomei.Prelude: ipartsOf' :: forall i p f s t a. (Indexable [i] p, Functor f) => Over (Indexed i) (Bazaar' (Indexed i) a) s t a a -> Over p f s t [a] [a]
+ Shomei.Prelude: ipassing :: MonadWriter w m => IndexedSetter i w w u v -> m (a, i -> u -> v) -> m a
+ Shomei.Prelude: iplens :: (s -> a) -> (s -> b -> t) -> IndexPreservingLens s t a b
+ Shomei.Prelude: ipre :: IndexedGetting i (First (i, a)) s a -> IndexPreservingGetter s (Maybe (i, a))
+ Shomei.Prelude: ipreuse :: MonadState s m => IndexedGetting i (First (i, a)) s a -> m (Maybe (i, a))
+ Shomei.Prelude: ipreuses :: MonadState s m => IndexedGetting i (First r) s a -> (i -> a -> r) -> m (Maybe r)
+ Shomei.Prelude: ipreview :: MonadReader s m => IndexedGetting i (First (i, a)) s a -> m (Maybe (i, a))
+ Shomei.Prelude: ipreviews :: MonadReader s m => IndexedGetting i (First r) s a -> (i -> a -> r) -> m (Maybe r)
+ Shomei.Prelude: iset :: AnIndexedSetter i s t a b -> (i -> b) -> s -> t
+ Shomei.Prelude: isets :: ((i -> a -> b) -> s -> t) -> IndexedSetter i s t a b
+ Shomei.Prelude: isn't :: APrism s t a b -> s -> Bool
+ Shomei.Prelude: iso :: (s -> a) -> (b -> t) -> Iso s t a b
+ Shomei.Prelude: itakingWhile :: (Indexable i p, Profunctor q, Contravariant f, Applicative f) => (i -> a -> Bool) -> Optical' (Indexed i) q (Const (Endo (f s)) :: Type -> Type) s a -> Optical' p q f s a
+ Shomei.Prelude: iterated :: Apply f => (a -> a) -> LensLike' f a a
+ Shomei.Prelude: ito :: (Indexable i p, Contravariant f) => (s -> (i, a)) -> Over' p f s a
+ Shomei.Prelude: itoList :: FoldableWithIndex i f => f a -> [(i, a)]
+ Shomei.Prelude: itoListOf :: IndexedGetting i (Endo [(i, a)]) s a -> s -> [(i, a)]
+ Shomei.Prelude: itraverse :: (TraversableWithIndex i t, Applicative f) => (i -> a -> f b) -> t a -> f (t b)
+ Shomei.Prelude: itraverseBy :: TraversableWithIndex i t => (forall x. () => x -> f x) -> (forall x y. () => f (x -> y) -> f x -> f y) -> (i -> a -> f b) -> t a -> f (t b)
+ Shomei.Prelude: itraverseByOf :: IndexedTraversal i s t a b -> (forall x. () => x -> f x) -> (forall x y. () => f (x -> y) -> f x -> f y) -> (i -> a -> f b) -> s -> f t
+ Shomei.Prelude: itraverseOf :: (Indexed i a (f b) -> s -> f t) -> (i -> a -> f b) -> s -> f t
+ Shomei.Prelude: itraverseOf_ :: Functor f => IndexedGetting i (Traversed r f) s a -> (i -> a -> f r) -> s -> f ()
+ Shomei.Prelude: itraverse_ :: (FoldableWithIndex i t, Applicative f) => (i -> a -> f b) -> t a -> f ()
+ Shomei.Prelude: itraversed :: forall i (t :: Type -> Type) a b. TraversableWithIndex i t => IndexedTraversal i (t a) (t b) a b
+ Shomei.Prelude: iunsafePartsOf :: (Indexable [i] p, Functor f) => Traversing (Indexed i) f s t a b -> Over p f s t [a] [b]
+ Shomei.Prelude: iunsafePartsOf' :: forall i s t a b. Over (Indexed i) (Bazaar (Indexed i) a b) s t a b -> IndexedLens [i] s t [a] [b]
+ Shomei.Prelude: iuse :: MonadState s m => IndexedGetting i (i, a) s a -> m (i, a)
+ Shomei.Prelude: iuses :: MonadState s m => IndexedGetting i r s a -> (i -> a -> r) -> m r
+ Shomei.Prelude: iview :: MonadReader s m => IndexedGetting i (i, a) s a -> m (i, a)
+ Shomei.Prelude: iviews :: MonadReader s m => IndexedGetting i r s a -> (i -> a -> r) -> m r
+ Shomei.Prelude: ix :: Ixed m => Index m -> Traversal' m (IxValue m)
+ Shomei.Prelude: ixAt :: At m => Index m -> Traversal' m (IxValue m)
+ Shomei.Prelude: last1 :: forall (t :: Type -> Type) a. Traversable1 t => Lens' (t a) a
+ Shomei.Prelude: last1Of :: Getting (Last a) s a -> s -> a
+ Shomei.Prelude: lastOf :: Getting (Rightmost a) s a -> s -> Maybe a
+ Shomei.Prelude: lazy :: Strict lazy strict => Iso' strict lazy
+ Shomei.Prelude: left' :: Choice p => p a b -> p (Either a c) (Either b c)
+ Shomei.Prelude: lengthOf :: Getting (Endo (Endo Int)) s a -> s -> Int
+ Shomei.Prelude: lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b
+ Shomei.Prelude: lensClass :: Lens' LensRules ClassyNamer
+ Shomei.Prelude: lensField :: Lens' LensRules FieldNamer
+ Shomei.Prelude: lensRules :: LensRules
+ Shomei.Prelude: lensRulesFor :: [(String, String)] -> LensRules
+ Shomei.Prelude: levels :: forall (f :: Type -> Type) s t a b. Applicative f => Traversing (->) f s t a b -> IndexedLensLike Int f s t (Level () a) (Level () b)
+ Shomei.Prelude: lifted :: forall (m :: Type -> Type) a b. Monad m => Setter (m a) (m b) a b
+ Shomei.Prelude: like :: (Profunctor p, Contravariant f, Functor f) => a -> Optic' p f s a
+ Shomei.Prelude: lined :: forall (f :: Type -> Type). Applicative f => IndexedLensLike' Int f String String
+ Shomei.Prelude: listening :: MonadWriter w m => Getting u w u -> m a -> m (a, u)
+ Shomei.Prelude: listenings :: MonadWriter w m => Getting v w u -> (u -> v) -> m a -> m (a, v)
+ Shomei.Prelude: lmap :: Profunctor p => (a -> b) -> p b c -> p a c
+ Shomei.Prelude: lmapping :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) s t a b x y. (Profunctor p, Profunctor q) => AnIso s t a b -> Iso (p a x) (q b y) (p s x) (q t y)
+ Shomei.Prelude: locally :: MonadReader s m => ASetter s s a b -> (a -> b) -> m r -> m r
+ Shomei.Prelude: loci :: forall a c s b f. Applicative f => (a -> f b) -> Bazaar (->) a c s -> f (Bazaar (->) b c s)
+ Shomei.Prelude: locus :: forall (p :: Type -> Type -> Type -> Type) a c s b. IndexedComonadStore p => Lens (p a c s) (p b c s) a b
+ Shomei.Prelude: lookingupNamer :: [(String, String)] -> FieldNamer
+ Shomei.Prelude: lookupOf :: Eq k => Getting (Endo (Maybe v)) s (k, v) -> k -> s -> Maybe v
+ Shomei.Prelude: magma :: LensLike (Mafic a b) s t a b -> Iso s u (Magma Int t b a) (Magma j u c c)
+ Shomei.Prelude: magnify :: Magnify m n b a => ((Functor (Magnified m c), Contravariant (Magnified m c)) => LensLike' (Magnified m c) a b) -> m c -> n c
+ Shomei.Prelude: makeClassy :: Name -> DecsQ
+ Shomei.Prelude: makeClassyFor :: String -> String -> [(String, String)] -> Name -> DecsQ
+ Shomei.Prelude: makeClassyPrisms :: Name -> DecsQ
+ Shomei.Prelude: makeClassy_ :: Name -> DecsQ
+ Shomei.Prelude: makeFields :: Name -> DecsQ
+ Shomei.Prelude: makeFieldsId :: Name -> DecsQ
+ Shomei.Prelude: makeFieldsNoPrefix :: Name -> DecsQ
+ Shomei.Prelude: makeLenses :: Name -> DecsQ
+ Shomei.Prelude: makeLensesFor :: [(String, String)] -> Name -> DecsQ
+ Shomei.Prelude: makeLensesWith :: LensRules -> Name -> DecsQ
+ Shomei.Prelude: makePrisms :: Name -> DecsQ
+ Shomei.Prelude: makeWrapped :: Name -> DecsQ
+ Shomei.Prelude: mapAccumLOf :: LensLike (State acc) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
+ Shomei.Prelude: mapAccumROf :: LensLike (Backwards (State acc)) s t a b -> (acc -> a -> (acc, b)) -> acc -> s -> (acc, t)
+ Shomei.Prelude: mapEq :: forall k1 k2 (s :: k1) (t :: k2) (a :: k1) (b :: k2) f. AnEquality s t a b -> f s -> f a
+ Shomei.Prelude: mapMOf :: LensLike (WrappedMonad m) s t a b -> (a -> m b) -> s -> m t
+ Shomei.Prelude: mapMOf_ :: Monad m => Getting (Sequenced r m) s a -> (a -> m r) -> s -> m ()
+ Shomei.Prelude: mapOf :: ASetter s t a b -> (a -> b) -> s -> t
+ Shomei.Prelude: mapped :: forall (f :: Type -> Type) a b. Functor f => Setter (f a) (f b) a b
+ Shomei.Prelude: mapping :: forall (f :: Type -> Type) (g :: Type -> Type) s t a b. (Functor f, Functor g) => AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
+ Shomei.Prelude: mappingNamer :: (String -> [String]) -> FieldNamer
+ Shomei.Prelude: matching :: APrism s t a b -> s -> Either t a
+ Shomei.Prelude: matching' :: LensLike (Either a) s t a b -> s -> Either t a
+ Shomei.Prelude: maximum1Of :: Ord a => Getting (Max a) s a -> s -> a
+ Shomei.Prelude: maximumByOf :: Getting (Endo (Endo (Maybe a))) s a -> (a -> a -> Ordering) -> s -> Maybe a
+ Shomei.Prelude: maximumOf :: Ord a => Getting (Endo (Endo (Maybe a))) s a -> s -> Maybe a
+ Shomei.Prelude: minimum1Of :: Ord a => Getting (Min a) s a -> s -> a
+ Shomei.Prelude: minimumByOf :: Getting (Endo (Endo (Maybe a))) s a -> (a -> a -> Ordering) -> s -> Maybe a
+ Shomei.Prelude: minimumOf :: Ord a => Getting (Endo (Endo (Maybe a))) s a -> s -> Maybe a
+ Shomei.Prelude: modifying :: MonadState s m => ASetter s s a b -> (a -> b) -> m ()
+ Shomei.Prelude: msumOf :: MonadPlus m => Getting (Endo (m a)) s (m a) -> s -> m a
+ Shomei.Prelude: nearly :: a -> (a -> Bool) -> Prism' a ()
+ Shomei.Prelude: newtype Bazaar (p :: Type -> Type -> Type) a b t
+ Shomei.Prelude: newtype Bazaar1 (p :: Type -> Type -> Type) a b t
+ Shomei.Prelude: newtype Const a (b :: k)
+ Shomei.Prelude: newtype Identity a
+ Shomei.Prelude: newtype Indexed i a b
+ Shomei.Prelude: newtype ReifiedFold s a
+ Shomei.Prelude: newtype ReifiedGetter s a
+ Shomei.Prelude: newtype ReifiedIndexedFold i s a
+ Shomei.Prelude: newtype ReifiedIndexedGetter i s a
+ Shomei.Prelude: newtype ReifiedIndexedLens i s t a b
+ Shomei.Prelude: newtype ReifiedIndexedSetter i s t a b
+ Shomei.Prelude: newtype ReifiedIndexedTraversal i s t a b
+ Shomei.Prelude: newtype ReifiedIso s t a b
+ Shomei.Prelude: newtype ReifiedLens s t a b
+ Shomei.Prelude: newtype ReifiedPrism s t a b
+ Shomei.Prelude: newtype ReifiedSetter s t a b
+ Shomei.Prelude: newtype ReifiedTraversal s t a b
+ Shomei.Prelude: non :: Eq a => a -> Iso' (Maybe a) a
+ Shomei.Prelude: non' :: APrism' a () -> Iso' (Maybe a) a
+ Shomei.Prelude: none :: Foldable f => (a -> Bool) -> f a -> Bool
+ Shomei.Prelude: noneOf :: Getting Any s a -> (a -> Bool) -> s -> Bool
+ Shomei.Prelude: notElemOf :: Eq a => Getting All s a -> a -> s -> Bool
+ Shomei.Prelude: notNullOf :: Getting Any s a -> s -> Bool
+ Shomei.Prelude: nullOf :: Getting All s a -> s -> Bool
+ Shomei.Prelude: only :: Eq a => a -> Prism' a ()
+ Shomei.Prelude: op :: Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s
+ Shomei.Prelude: orOf :: Getting Any s Bool -> s -> Bool
+ Shomei.Prelude: outside :: forall (p :: Type -> Type -> Type) s t a b r. Representable p => APrism s t a b -> Lens (p t r) (p s r) (p b r) (p a r)
+ Shomei.Prelude: over :: ASetter s t a b -> (a -> b) -> s -> t
+ Shomei.Prelude: overA :: Arrow ar => LensLike (Context a b) s t a b -> ar a b -> ar s t
+ Shomei.Prelude: overEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) p. AnEquality s t a b -> p a b -> p s t
+ Shomei.Prelude: para :: Plated a => (a -> [r] -> r) -> a -> r
+ Shomei.Prelude: paraOf :: Getting (Endo [a]) a a -> (a -> [r] -> r) -> a -> r
+ Shomei.Prelude: parts :: Plated a => Lens' a [a]
+ Shomei.Prelude: partsOf :: Functor f => Traversing (->) f s t a a -> LensLike f s t [a] [a]
+ Shomei.Prelude: partsOf' :: ATraversal s t a a -> Lens s t [a] [a]
+ Shomei.Prelude: passing :: MonadWriter w m => Setter w w u v -> m (a, u -> v) -> m a
+ Shomei.Prelude: pattern Wrapped :: Rewrapped s s => Unwrapped s -> s
+ Shomei.Prelude: pattern List :: IsList l => [Item l] -> l
+ Shomei.Prelude: pattern (:>) :: Snoc a a b b => a -> b -> a
+ Shomei.Prelude: pattern Swapped :: Swap p => p b a -> p a b
+ Shomei.Prelude: pattern Empty :: AsEmpty s => s
+ Shomei.Prelude: pattern Unwrapped :: Rewrapped t t => t -> Unwrapped t
+ Shomei.Prelude: plate :: Plated a => Traversal' a a
+ Shomei.Prelude: pre :: Getting (First a) s a -> IndexPreservingGetter s (Maybe a)
+ Shomei.Prelude: prefixed :: Prefixed t => t -> Prism' t t
+ Shomei.Prelude: preuse :: MonadState s m => Getting (First a) s a -> m (Maybe a)
+ Shomei.Prelude: preuses :: MonadState s m => Getting (First r) s a -> (a -> r) -> m (Maybe r)
+ Shomei.Prelude: preview :: MonadReader s m => Getting (First a) s a -> m (Maybe a)
+ Shomei.Prelude: previews :: MonadReader s m => Getting (First r) s a -> (a -> r) -> m (Maybe r)
+ Shomei.Prelude: prism :: (b -> t) -> (s -> Either t a) -> Prism s t a b
+ Shomei.Prelude: prism' :: (b -> s) -> (s -> Maybe a) -> Prism s s a b
+ Shomei.Prelude: productOf :: Num a => Getting (Endo (Endo a)) s a -> s -> a
+ Shomei.Prelude: re :: AReview t b -> Getter b t
+ Shomei.Prelude: reindexed :: Indexable j p => (i -> j) -> (Indexed i a b -> r) -> p a b -> r
+ Shomei.Prelude: repeated :: Apply f => LensLike' f a a
+ Shomei.Prelude: replicated :: Int -> Fold a a
+ Shomei.Prelude: retagged :: (Profunctor p, Bifunctor p) => p a b -> p s b
+ Shomei.Prelude: reuse :: MonadState b m => AReview t b -> m t
+ Shomei.Prelude: reuses :: MonadState b m => AReview t b -> (t -> r) -> m r
+ Shomei.Prelude: reversed :: Reversing a => Iso' a a
+ Shomei.Prelude: reversing :: Reversing t => t -> t
+ Shomei.Prelude: review :: MonadReader b m => AReview t b -> m t
+ Shomei.Prelude: reviewing :: (Bifunctor p, Functor f) => Optic (Tagged :: Type -> Type -> Type) Identity s t a b -> Optic' p f t b
+ Shomei.Prelude: reviews :: MonadReader b m => AReview t b -> (t -> r) -> m r
+ Shomei.Prelude: rewrite :: Plated a => (a -> Maybe a) -> a -> a
+ Shomei.Prelude: rewriteM :: (Monad m, Plated a) => (a -> m (Maybe a)) -> a -> m a
+ Shomei.Prelude: rewriteMOf :: Monad m => LensLike (WrappedMonad m) a b a b -> (b -> m (Maybe a)) -> a -> m b
+ Shomei.Prelude: rewriteMOn :: (Monad m, Plated a) => LensLike (WrappedMonad m) s t a a -> (a -> m (Maybe a)) -> s -> m t
+ Shomei.Prelude: rewriteMOnOf :: Monad m => LensLike (WrappedMonad m) s t a b -> LensLike (WrappedMonad m) a b a b -> (b -> m (Maybe a)) -> s -> m t
+ Shomei.Prelude: rewriteOf :: ASetter a b a b -> (b -> Maybe a) -> a -> b
+ Shomei.Prelude: rewriteOn :: Plated a => ASetter s t a a -> (a -> Maybe a) -> s -> t
+ Shomei.Prelude: rewriteOnOf :: ASetter s t a b -> ASetter a b a b -> (b -> Maybe a) -> s -> t
+ Shomei.Prelude: right' :: Choice p => p a b -> p (Either c a) (Either c b)
+ Shomei.Prelude: rmap :: Profunctor p => (b -> c) -> p a b -> p a c
+ Shomei.Prelude: rmapping :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) s t a b x y. (Profunctor p, Profunctor q) => AnIso s t a b -> Iso (p x s) (q y t) (p x a) (q y b)
+ Shomei.Prelude: runEq :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2). AnEquality s t a b -> Identical s t a b
+ Shomei.Prelude: sans :: At m => Index m -> m -> m
+ Shomei.Prelude: scanl1Of :: LensLike (State (Maybe a)) s t a a -> (a -> a -> a) -> s -> t
+ Shomei.Prelude: scanr1Of :: LensLike (Backwards (State (Maybe a))) s t a a -> (a -> a -> a) -> s -> t
+ Shomei.Prelude: scribe :: (MonadWriter t m, Monoid s) => ASetter s t a b -> b -> m ()
+ Shomei.Prelude: seconding :: forall (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) s t a b x y. (Bifunctor f, Bifunctor g) => AnIso s t a b -> Iso (f x s) (g y t) (f x a) (g y b)
+ Shomei.Prelude: selfIndex :: Indexable a p => p a fb -> a -> fb
+ Shomei.Prelude: sequence1Of_ :: Functor f => Getting (TraversedF a f) s (f a) -> s -> f ()
+ Shomei.Prelude: sequenceAOf :: LensLike f s t (f b) b -> s -> f t
+ Shomei.Prelude: sequenceAOf_ :: Functor f => Getting (Traversed a f) s (f a) -> s -> f ()
+ Shomei.Prelude: sequenceBy :: Traversable t => (forall x. () => x -> f x) -> (forall x y. () => f (x -> y) -> f x -> f y) -> t (f a) -> f (t a)
+ Shomei.Prelude: sequenceByOf :: Traversal s t (f b) b -> (forall x. () => x -> f x) -> (forall x y. () => f (x -> y) -> f x -> f y) -> s -> f t
+ Shomei.Prelude: sequenceOf :: LensLike (WrappedMonad m) s t (m b) b -> s -> m t
+ Shomei.Prelude: sequenceOf_ :: Monad m => Getting (Sequenced a m) s (m a) -> s -> m ()
+ Shomei.Prelude: set :: ASetter s t a b -> b -> s -> t
+ Shomei.Prelude: set' :: ASetter' s a -> a -> s -> s
+ Shomei.Prelude: sets :: (Profunctor p, Profunctor q, Settable f) => (p a b -> q s t) -> Optical p q f s t a b
+ Shomei.Prelude: setting :: ((a -> b) -> s -> t) -> IndexPreservingSetter s t a b
+ Shomei.Prelude: simple :: forall {k2} (a :: k2) k3 p (f :: k2 -> k3). p a (f a) -> p a (f a)
+ Shomei.Prelude: simpleLenses :: Lens' LensRules Bool
+ Shomei.Prelude: simply :: forall {k} {k1} p (f :: k -> k1) (s :: k) (a :: k) r. (Optic' p f s a -> r) -> Optic' p f s a -> r
+ Shomei.Prelude: singular :: (HasCallStack, Conjoined p, Functor f) => Traversing p f s t a a -> Over p f s t a a
+ Shomei.Prelude: snoc :: Snoc s s a a => s -> a -> s
+ Shomei.Prelude: storing :: ALens s t a b -> b -> s -> t
+ Shomei.Prelude: strict :: Strict lazy strict => Iso' lazy strict
+ Shomei.Prelude: substEq :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) r. AnEquality s t a b -> ((s ~ a, t ~ b) => r) -> r
+ Shomei.Prelude: suffixed :: Suffixed t => t -> Prism' t t
+ Shomei.Prelude: sumOf :: Num a => Getting (Endo (Endo a)) s a -> s -> a
+ Shomei.Prelude: swapped :: forall (p :: Type -> Type -> Type) a b c d. Swap p => Iso (p a b) (p c d) (p b a) (p d c)
+ Shomei.Prelude: taking :: (Conjoined p, Applicative f) => Int -> Traversing p f s t a a -> Over p f s t a a
+ Shomei.Prelude: takingWhile :: (Conjoined p, Applicative f) => (a -> Bool) -> Over p (TakingWhile p f a a) s t a a -> Over p f s t a a
+ Shomei.Prelude: to :: (Profunctor p, Contravariant f) => (s -> a) -> Optic' p f s a
+ Shomei.Prelude: toListOf :: Getting (Endo [a]) s a -> s -> [a]
+ Shomei.Prelude: toNonEmptyOf :: Getting (NonEmptyDList a) s a -> s -> NonEmpty a
+ Shomei.Prelude: transform :: Plated a => (a -> a) -> a -> a
+ Shomei.Prelude: transformM :: (Monad m, Plated a) => (a -> m a) -> a -> m a
+ Shomei.Prelude: transformMOf :: Monad m => LensLike (WrappedMonad m) a b a b -> (b -> m b) -> a -> m b
+ Shomei.Prelude: transformMOn :: (Monad m, Plated a) => LensLike (WrappedMonad m) s t a a -> (a -> m a) -> s -> m t
+ Shomei.Prelude: transformMOnOf :: Monad m => LensLike (WrappedMonad m) s t a b -> LensLike (WrappedMonad m) a b a b -> (b -> m b) -> s -> m t
+ Shomei.Prelude: transformOf :: ASetter a b a b -> (b -> b) -> a -> b
+ Shomei.Prelude: transformOn :: Plated a => ASetter s t a a -> (a -> a) -> s -> t
+ Shomei.Prelude: transformOnOf :: ASetter s t a b -> ASetter a b a b -> (b -> b) -> s -> t
+ Shomei.Prelude: transposeOf :: LensLike ZipList s t [a] a -> s -> [t]
+ Shomei.Prelude: traversal :: ((a -> f b) -> s -> f t) -> LensLike f s t a b
+ Shomei.Prelude: traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
+ Shomei.Prelude: traverse1 :: (Traversable1 t, Apply f) => (a -> f b) -> t a -> f (t b)
+ Shomei.Prelude: traverse1Of_ :: Functor f => Getting (TraversedF r f) s a -> (a -> f r) -> s -> f ()
+ Shomei.Prelude: traverseBy :: Traversable t => (forall x. () => x -> f x) -> (forall x y. () => f (x -> y) -> f x -> f y) -> (a -> f b) -> t a -> f (t b)
+ Shomei.Prelude: traverseByOf :: Traversal s t a b -> (forall x. () => x -> f x) -> (forall x y. () => f (x -> y) -> f x -> f y) -> (a -> f b) -> s -> f t
+ Shomei.Prelude: traverseMax :: TraverseMax k m => IndexedTraversal' k (m v) v
+ Shomei.Prelude: traverseMin :: TraverseMin k m => IndexedTraversal' k (m v) v
+ Shomei.Prelude: traverseOf :: LensLike f s t a b -> (a -> f b) -> s -> f t
+ Shomei.Prelude: traverseOf_ :: Functor f => Getting (Traversed r f) s a -> (a -> f r) -> s -> f ()
+ Shomei.Prelude: traversed :: forall (f :: Type -> Type) a b. Traversable f => IndexedTraversal Int (f a) (f b) a b
+ Shomei.Prelude: traversed1 :: forall (f :: Type -> Type) a b. Traversable1 f => IndexedTraversal1 Int (f a) (f b) a b
+ Shomei.Prelude: traversed64 :: forall (f :: Type -> Type) a b. Traversable f => IndexedTraversal Int64 (f a) (f b) a b
+ Shomei.Prelude: type ALens s t a b = LensLike Pretext (->) a b s t a b
+ Shomei.Prelude: type ALens' s a = ALens s s a a
+ Shomei.Prelude: type APrism s t a b = Market a b a Identity b -> Market a b s Identity t
+ Shomei.Prelude: type APrism' s a = APrism s s a a
+ Shomei.Prelude: type AReview t b = Optic' Tagged :: Type -> Type -> Type Identity t b
+ Shomei.Prelude: type ASetter s t a b = a -> Identity b -> s -> Identity t
+ Shomei.Prelude: type ASetter' s a = ASetter s s a a
+ Shomei.Prelude: type ATraversal s t a b = LensLike Bazaar (->) a b s t a b
+ Shomei.Prelude: type ATraversal' s a = ATraversal s s a a
+ Shomei.Prelude: type ATraversal1 s t a b = LensLike Bazaar1 (->) a b s t a b
+ Shomei.Prelude: type ATraversal1' s a = ATraversal1 s s a a
+ Shomei.Prelude: type Accessing (p :: Type -> Type -> Type) m s a = p a Const m a -> s -> Const m s
+ Shomei.Prelude: type AnEquality (s :: k) (t :: k1) (a :: k) (b :: k2) = Identical a Proxy b a Proxy b -> Identical a Proxy b s Proxy t
+ Shomei.Prelude: type AnEquality' (s :: k) (a :: k) = AnEquality s s a a
+ Shomei.Prelude: type AnIndexedLens i s t a b = Optical Indexed i (->) Pretext Indexed i a b s t a b
+ Shomei.Prelude: type AnIndexedLens' i s a = AnIndexedLens i s s a a
+ Shomei.Prelude: type AnIndexedSetter i s t a b = Indexed i a Identity b -> s -> Identity t
+ Shomei.Prelude: type AnIndexedSetter' i s a = AnIndexedSetter i s s a a
+ Shomei.Prelude: type AnIndexedTraversal i s t a b = Over Indexed i Bazaar Indexed i a b s t a b
+ Shomei.Prelude: type AnIndexedTraversal' i s a = AnIndexedTraversal i s s a a
+ Shomei.Prelude: type AnIndexedTraversal1 i s t a b = Over Indexed i Bazaar1 Indexed i a b s t a b
+ Shomei.Prelude: type AnIndexedTraversal1' i s a = AnIndexedTraversal1 i s s a a
+ Shomei.Prelude: type AnIso s t a b = Exchange a b a Identity b -> Exchange a b s Identity t
+ Shomei.Prelude: type AnIso' s a = AnIso s s a a
+ Shomei.Prelude: type As (a :: k2) = Equality' a a
+ Shomei.Prelude: type Bazaar' (p :: Type -> Type -> Type) a = Bazaar p a a
+ Shomei.Prelude: type Bazaar1' (p :: Type -> Type -> Type) a = Bazaar1 p a a
+ Shomei.Prelude: type ClassyNamer = Name -> Maybe (Name, Name)
+ Shomei.Prelude: type Context' a = Context a a
+ Shomei.Prelude: type Equality' (s :: k2) (a :: k2) = Equality s s a a
+ Shomei.Prelude: type FieldNamer = Name -> [Name] -> Name -> [DefName]
+ Shomei.Prelude: type Getting r s a = a -> Const r a -> s -> Const r s
+ Shomei.Prelude: type IndexPreservingLens' s a = IndexPreservingLens s s a a
+ Shomei.Prelude: type IndexPreservingSetter' s a = IndexPreservingSetter s s a a
+ Shomei.Prelude: type IndexPreservingTraversal' s a = IndexPreservingTraversal s s a a
+ Shomei.Prelude: type IndexPreservingTraversal1' s a = IndexPreservingTraversal1 s s a a
+ Shomei.Prelude: type IndexedGetting i m s a = Indexed i a Const m a -> s -> Const m s
+ Shomei.Prelude: type IndexedLens' i s a = IndexedLens i s s a a
+ Shomei.Prelude: type IndexedLensLike' i (f :: Type -> Type) s a = IndexedLensLike i f s s a a
+ Shomei.Prelude: type IndexedSetter' i s a = IndexedSetter i s s a a
+ Shomei.Prelude: type IndexedTraversal' i s a = IndexedTraversal i s s a a
+ Shomei.Prelude: type IndexedTraversal1' i s a = IndexedTraversal1 i s s a a
+ Shomei.Prelude: type Iso' s a = Iso s s a a
+ Shomei.Prelude: type Lens' s a = Lens s s a a
+ Shomei.Prelude: type LensLike (f :: k -> Type) s (t :: k) a (b :: k) = a -> f b -> s -> f t
+ Shomei.Prelude: type LensLike' (f :: Type -> Type) s a = LensLike f s s a a
+ Shomei.Prelude: type Optic (p :: k -> k1 -> Type) (f :: k2 -> k1) (s :: k) (t :: k2) (a :: k) (b :: k2) = p a f b -> p s f t
+ Shomei.Prelude: type Review t b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Choice p, Bifunctor p, Settable f) => Optic' p f t b
+ Shomei.Prelude: type Optical (p :: k -> k1 -> Type) (q :: k2 -> k1 -> Type) (f :: k3 -> k1) (s :: k2) (t :: k3) (a :: k) (b :: k3) = p a f b -> q s f t
+ Shomei.Prelude: type Optical' (p :: k -> k1 -> Type) (q :: k -> k1 -> Type) (f :: k -> k1) (s :: k) (a :: k) = Optical p q f s s a a
+ Shomei.Prelude: type Over (p :: k -> Type -> Type) (f :: k1 -> Type) s (t :: k1) (a :: k) (b :: k1) = p a f b -> s -> f t
+ Shomei.Prelude: type Over' (p :: Type -> Type -> Type) (f :: Type -> Type) s a = Over p f s s a a
+ Shomei.Prelude: type Prism' s a = Prism s s a a
+ Shomei.Prelude: type ReifiedIndexedLens' i s a = ReifiedIndexedLens i s s a a
+ Shomei.Prelude: type ReifiedIndexedSetter' i s a = ReifiedIndexedSetter i s s a a
+ Shomei.Prelude: type ReifiedIndexedTraversal' i s a = ReifiedIndexedTraversal i s s a a
+ Shomei.Prelude: type ReifiedIso' s a = ReifiedIso s s a a
+ Shomei.Prelude: type ReifiedLens' s a = ReifiedLens s s a a
+ Shomei.Prelude: type ReifiedPrism' s a = ReifiedPrism s s a a
+ Shomei.Prelude: type ReifiedSetter' s a = ReifiedSetter s s a a
+ Shomei.Prelude: type ReifiedTraversal' s a = ReifiedTraversal s s a a
+ Shomei.Prelude: type Setter' s a = Setter s s a a
+ Shomei.Prelude: type Setting (p :: Type -> Type -> Type) s t a b = p a Identity b -> s -> Identity t
+ Shomei.Prelude: type Setting' (p :: Type -> Type -> Type) s a = Setting p s s a a
+ Shomei.Prelude: type Simple (f :: k1 -> k1 -> k2 -> k2 -> k) (s :: k1) (a :: k2) = f s s a a
+ Shomei.Prelude: type Traversal' s a = Traversal s s a a
+ Shomei.Prelude: type Traversal1' s a = Traversal1 s s a a
+ Shomei.Prelude: type Traversing (p :: Type -> Type -> Type) (f :: Type -> Type) s t a b = Over p BazaarT p f a b s t a b
+ Shomei.Prelude: type Traversing' (p :: Type -> Type -> Type) (f :: Type -> Type) s a = Traversing p f s s a a
+ Shomei.Prelude: type Traversing1 (p :: Type -> Type -> Type) (f :: Type -> Type) s t a b = Over p BazaarT1 p f a b s t a b
+ Shomei.Prelude: type Traversing1' (p :: Type -> Type -> Type) (f :: Type -> Type) s a = Traversing1 p f s s a a
+ Shomei.Prelude: type Unwrapped s = GUnwrapped Rep s;
+ Shomei.Prelude: type Traversal1 s t a b = forall (f :: Type -> Type). Apply f => a -> f b -> s -> f t
+ Shomei.Prelude: type family Zoomed (m :: Type -> Type) :: Type -> Type -> Type
+ Shomei.Prelude: type Prism s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Choice p, Applicative f) => p a f b -> p s f t
+ Shomei.Prelude: un :: (Profunctor p, Bifunctor p, Functor f) => Getting a s a -> Optic' p f a s
+ Shomei.Prelude: uncons :: Cons s s a a => s -> Maybe (a, s)
+ Shomei.Prelude: uncurried :: forall a b c d e f1 p f2. (Profunctor p, Functor f2) => p ((a, b) -> c) (f2 ((d, e) -> f1)) -> p (a -> b -> c) (f2 (d -> e -> f1))
+ Shomei.Prelude: under :: AnIso s t a b -> (t -> s) -> b -> a
+ Shomei.Prelude: underEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) p. AnEquality s t a b -> p t s -> p b a
+ Shomei.Prelude: underscoreFields :: LensRules
+ Shomei.Prelude: underscoreNamer :: FieldNamer
+ Shomei.Prelude: underscoreNoPrefixNamer :: FieldNamer
+ Shomei.Prelude: unfolded :: (b -> Maybe (a, b)) -> Fold b a
+ Shomei.Prelude: united :: forall a f. Functor f => (() -> f ()) -> a -> f a
+ Shomei.Prelude: universe :: Plated a => a -> [a]
+ Shomei.Prelude: universeOf :: Getting (Endo [a]) a a -> a -> [a]
+ Shomei.Prelude: universeOn :: Plated a => Getting (Endo [a]) s a -> s -> [a]
+ Shomei.Prelude: universeOnOf :: Getting (Endo [a]) s a -> Getting (Endo [a]) a a -> s -> [a]
+ Shomei.Prelude: unsafePartsOf :: Functor f => Traversing (->) f s t a b -> LensLike f s t [a] [b]
+ Shomei.Prelude: unsafePartsOf' :: ATraversal s t a b -> Lens s t [a] [b]
+ Shomei.Prelude: unsafeSingular :: (HasCallStack, Conjoined p, Functor f) => Traversing p f s t a b -> Over p f s t a b
+ Shomei.Prelude: unsnoc :: Snoc s s a a => s -> Maybe (s, a)
+ Shomei.Prelude: unto :: (Profunctor p, Bifunctor p, Functor f) => (b -> t) -> Optic p f s t a b
+ Shomei.Prelude: use :: MonadState s m => Getting a s a -> m a
+ Shomei.Prelude: uses :: MonadState s m => LensLike' (Const r :: Type -> Type) s a -> (a -> r) -> m r
+ Shomei.Prelude: view :: MonadReader s m => Getting a s a -> m a
+ Shomei.Prelude: views :: MonadReader s m => LensLike' (Const r :: Type -> Type) s a -> (a -> r) -> m r
+ Shomei.Prelude: withEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) r. AnEquality s t a b -> ((s :~: a) -> (b :~: t) -> r) -> r
+ Shomei.Prelude: withIndex :: (Indexable i p, Functor f) => p (i, s) (f (j, t)) -> Indexed i s (f t)
+ Shomei.Prelude: withIso :: AnIso s t a b -> ((s -> a) -> (b -> t) -> r) -> r
+ Shomei.Prelude: withLens :: ALens s t a b -> ((s -> a) -> (s -> b -> t) -> r) -> r
+ Shomei.Prelude: withPrism :: APrism s t a b -> ((b -> t) -> (s -> Either t a) -> r) -> r
+ Shomei.Prelude: without :: APrism s t a b -> APrism u v c d -> Prism (Either s u) (Either t v) (Either a c) (Either b d)
+ Shomei.Prelude: worded :: forall (f :: Type -> Type). Applicative f => IndexedLensLike' Int f String String
+ Shomei.Prelude: xplat :: forall {k2} s g (t :: k2) a (b :: k2). Optic (Costar ((->) s)) g s t a b -> ((s -> a) -> g b) -> g t
+ Shomei.Prelude: xplatf :: forall {k} {k2} f g (s :: k) (t :: k2) (a :: k) (b :: k2). Optic (Costar f) g s t a b -> (f a -> g b) -> f s -> g t
+ Shomei.Prelude: zoom :: Zoom m n s t => LensLike' (Zoomed m c) t s -> m c -> n c
+ Shomei.Prelude: }
+ Shomei.Session.Authentication.Guard: AuthenticationGuard :: !Int64 -> !Maybe SessionId -> !Maybe PasskeyId -> AuthenticationGuard
+ Shomei.Session.Authentication.Guard: [assertedPasskey] :: AuthenticationGuard -> !Maybe PasskeyId
+ Shomei.Session.Authentication.Guard: [generation] :: AuthenticationGuard -> !Int64
+ Shomei.Session.Authentication.Guard: [initiatingSession] :: AuthenticationGuard -> !Maybe SessionId
+ Shomei.Session.Authentication.Guard: data AuthenticationGuard
+ Shomei.Session.Authentication.Guard: instance Data.Aeson.Types.FromJSON.FromJSON Shomei.Session.Authentication.Guard.AuthenticationGuard
+ Shomei.Session.Authentication.Guard: instance Data.Aeson.Types.ToJSON.ToJSON Shomei.Session.Authentication.Guard.AuthenticationGuard
+ Shomei.Session.Authentication.Guard: instance GHC.Classes.Eq Shomei.Session.Authentication.Guard.AuthenticationGuard
+ Shomei.Session.Authentication.Guard: instance GHC.Internal.Generics.Generic Shomei.Session.Authentication.Guard.AuthenticationGuard
+ Shomei.Session.Authentication.Guard: instance GHC.Internal.Show.Show Shomei.Session.Authentication.Guard.AuthenticationGuard
+ Shomei.Session.Authentication.Guard: userGuard :: User -> AuthenticationGuard
+ Shomei.Session.Domain: sessionInvolves :: UserId -> Session -> Bool
+ Shomei.Session.Domain: sessionKindFromText :: Text -> Either Text SessionKind
+ Shomei.Session.Domain: sessionKindToText :: SessionKind -> Text
+ Shomei.Session.UnitOfWork.Store: RotationInvalid :: RotationOutcome
+ Shomei.Session.UnitOfWork.Store: [ResetUserSecondFactors] :: forall (a :: Type -> Type). RecoveryActor -> UserId -> RecoveryCommand -> UTCTime -> AuthUnitOfWork a (Either AuthError (RecoveryResult, Maybe Email))
+ Shomei.Session.UnitOfWork.Store: resetSecondFactors :: forall (es :: [Effect]). AuthUnitOfWork :> es => RecoveryActor -> UserId -> RecoveryCommand -> UTCTime -> Eff es (Either AuthError (RecoveryResult, Maybe Email))
+ Shomei.Session.Workflow: [authenticationGuard] :: SessionOptions -> !Maybe AuthenticationGuard
- Shomei.Account.User.Domain: User :: !UserId -> !LoginId -> !Maybe Email -> !Maybe Text -> !UserStatus -> !Maybe UTCTime -> !UTCTime -> !UTCTime -> User
+ Shomei.Account.User.Domain: User :: !UserId -> !LoginId -> !Maybe Email -> !Maybe Text -> !UserStatus -> !Maybe UTCTime -> !UTCTime -> !UTCTime -> !Int64 -> User
- Shomei.Mfa.RecoveryCode.Store: [ReplaceRecoveryCodes] :: forall (a :: Type -> Type). UserId -> [NewRecoveryCode] -> RecoveryCodeStore a ()
+ Shomei.Mfa.RecoveryCode.Store: [ReplaceRecoveryCodes] :: forall (a :: Type -> Type). UserId -> AuthenticationGuard -> UTCTime -> [NewRecoveryCode] -> RecoveryCodeStore a (Either AuthError ())
- Shomei.Mfa.RecoveryCode.Store: replaceRecoveryCodes :: forall (es :: [Effect]). RecoveryCodeStore :> es => UserId -> [NewRecoveryCode] -> Eff es ()
+ Shomei.Mfa.RecoveryCode.Store: replaceRecoveryCodes :: forall (es :: [Effect]). RecoveryCodeStore :> es => UserId -> AuthenticationGuard -> UTCTime -> [NewRecoveryCode] -> Eff es (Either AuthError ())
- Shomei.Mfa.Totp.Domain: TotpCredential :: !TotpCredentialId -> !UserId -> !TotpSecret -> !Maybe Int64 -> !Maybe UTCTime -> !UTCTime -> TotpCredential
+ Shomei.Mfa.Totp.Domain: TotpCredential :: !Maybe Int64 -> !TotpCredentialId -> !UserId -> !TotpSecret -> !Maybe Int64 -> !Maybe UTCTime -> !UTCTime -> TotpCredential
- Shomei.Mfa.Totp.Store: [ConfirmTotp] :: forall (a :: Type -> Type). TotpCredentialId -> UTCTime -> TotpCredentialStore a ()
+ Shomei.Mfa.Totp.Store: [ConfirmTotp] :: forall (a :: Type -> Type). UserId -> AuthenticationGuard -> TotpCredentialId -> UTCTime -> TotpCredentialStore a (Either AuthError ())
- Shomei.Mfa.Totp.Store: [UpsertTotpEnrollment] :: forall (a :: Type -> Type). NewTotpCredential -> TotpCredentialStore a TotpCredential
+ Shomei.Mfa.Totp.Store: [UpsertTotpEnrollment] :: forall (a :: Type -> Type). AuthenticationGuard -> NewTotpCredential -> TotpCredentialStore a (Either AuthError TotpCredential)
- Shomei.Mfa.Totp.Store: confirmTotp :: forall (es :: [Effect]). TotpCredentialStore :> es => TotpCredentialId -> UTCTime -> Eff es ()
+ Shomei.Mfa.Totp.Store: confirmTotp :: forall (es :: [Effect]). TotpCredentialStore :> es => UserId -> AuthenticationGuard -> TotpCredentialId -> UTCTime -> Eff es (Either AuthError ())
- Shomei.Mfa.Totp.Store: upsertTotpEnrollment :: forall (es :: [Effect]). TotpCredentialStore :> es => NewTotpCredential -> Eff es TotpCredential
+ Shomei.Mfa.Totp.Store: upsertTotpEnrollment :: forall (es :: [Effect]). TotpCredentialStore :> es => AuthenticationGuard -> NewTotpCredential -> Eff es (Either AuthError TotpCredential)
- Shomei.Mfa.Totp.Workflow: enrollTotp :: forall (es :: [Effect]). (TotpCredentialStore :> es, TokenGen :> es, Clock :> es, IOE :> es) => ShomeiConfig -> User -> Eff es (Either AuthError TotpEnrollment)
+ Shomei.Mfa.Totp.Workflow: enrollTotp :: forall (es :: [Effect]). (TotpCredentialStore :> es, TokenGen :> es, Clock :> es, IOE :> es) => ShomeiConfig -> User -> Maybe SessionId -> Eff es (Either AuthError TotpEnrollment)
- Shomei.Mfa.Totp.Workflow: regenerateRecoveryCodes :: forall (es :: [Effect]). (RecoveryCodeStore :> es, TokenGen :> es, AuthEventPublisher :> es, Clock :> es, IOE :> es) => ShomeiConfig -> User -> Eff es (Either AuthError [Text])
+ Shomei.Mfa.Totp.Workflow: regenerateRecoveryCodes :: forall (es :: [Effect]). (RecoveryCodeStore :> es, TokenGen :> es, AuthEventPublisher :> es, Clock :> es, IOE :> es) => ShomeiConfig -> User -> Maybe SessionId -> Eff es (Either AuthError [Text])
- Shomei.Mfa.Totp.Workflow: removeTotp :: forall (es :: [Effect]). (TotpCredentialStore :> es, RecoveryCodeStore :> es, AuthEventPublisher :> es, LoginAttemptStore :> es, Clock :> es) => ShomeiConfig -> ProofContext -> User -> TotpRemovalProof -> Eff es (Either AuthError ())
+ Shomei.Mfa.Totp.Workflow: removeTotp :: forall (es :: [Effect]). (TotpCredentialStore :> es, RecoveryCodeStore :> es, AuthEventPublisher :> es, LoginAttemptStore :> es, Clock :> es) => ShomeiConfig -> ProofContext -> User -> Maybe SessionId -> TotpRemovalProof -> Eff es (Either AuthError ())
- Shomei.Mfa.Totp.Workflow: verifyTotpEnrollment :: forall (es :: [Effect]). (TotpCredentialStore :> es, AuthEventPublisher :> es, Clock :> es) => ShomeiConfig -> User -> Text -> Eff es (Either AuthError ())
+ Shomei.Mfa.Totp.Workflow: verifyTotpEnrollment :: forall (es :: [Effect]). (TotpCredentialStore :> es, AuthEventPublisher :> es, Clock :> es) => ShomeiConfig -> User -> Maybe SessionId -> Text -> Eff es (Either AuthError ())
- Shomei.Mfa.Workflow: prepareMfaChallenge :: forall (es :: [Effect]). (PasskeyStore :> es, PendingCeremonyStore :> es, WebAuthnCeremony :> es, TotpCredentialStore :> es, RecoveryCodeStore :> es, AuthEventPublisher :> es, IOE :> es) => ShomeiConfig -> User -> UTCTime -> Eff es (CeremonyId, Value, [Text])
+ Shomei.Mfa.Workflow: prepareMfaChallenge :: forall (es :: [Effect]). (PasskeyStore :> es, PendingCeremonyStore :> es, WebAuthnCeremony :> es, TotpCredentialStore :> es, RecoveryCodeStore :> es, AuthEventPublisher :> es, IOE :> es) => ShomeiConfig -> User -> UTCTime -> Eff es (Either AuthError (CeremonyId, Value, [Text]))
- Shomei.OAuth.AuthorizationCode.Domain: AuthorizationCode :: !Text -> !Text -> !Text -> !UserId -> !Set Scope -> !Maybe Text -> !Maybe Text -> !UTCTime -> !UTCTime -> !UTCTime -> !Maybe UTCTime -> !Maybe SessionId -> AuthorizationCode
+ Shomei.OAuth.AuthorizationCode.Domain: AuthorizationCode :: !Maybe Int64 -> !Text -> !Text -> !Text -> !UserId -> !Set Scope -> !Maybe Text -> !Maybe Text -> !UTCTime -> !UTCTime -> !UTCTime -> !Maybe UTCTime -> !Maybe SessionId -> AuthorizationCode
- Shomei.OAuth.AuthorizationCode.Store: [PutAuthorizationCode] :: forall (a :: Type -> Type). NewAuthorizationCode -> OAuthCodeStore a ()
+ Shomei.OAuth.AuthorizationCode.Store: [PutAuthorizationCode] :: forall (a :: Type -> Type). AuthenticationGuard -> NewAuthorizationCode -> OAuthCodeStore a (Either AuthError ())
- Shomei.OAuth.AuthorizationCode.Store: putAuthorizationCode :: forall (es :: [Effect]). OAuthCodeStore :> es => NewAuthorizationCode -> Eff es ()
+ Shomei.OAuth.AuthorizationCode.Store: putAuthorizationCode :: forall (es :: [Effect]). OAuthCodeStore :> es => AuthenticationGuard -> NewAuthorizationCode -> Eff es (Either AuthError ())
- Shomei.OAuth.Authorize.Workflow: authorize :: forall (es :: [Effect]). (OAuthCodeStore :> es, TokenGen :> es, AuthEventPublisher :> es, Clock :> es, SessionStore :> es) => ShomeiConfig -> OAuthClient -> AuthClaims -> AuthorizeParams -> Eff es (Either AuthorizeError IssuedCode)
+ Shomei.OAuth.Authorize.Workflow: authorize :: forall (es :: [Effect]). (OAuthCodeStore :> es, TokenGen :> es, AuthEventPublisher :> es, Clock :> es, SessionStore :> es, UserStore :> es) => ShomeiConfig -> OAuthClient -> AuthClaims -> AuthorizeParams -> Eff es (Either AuthorizeError IssuedCode)
- Shomei.Passkey.Ceremony.Store: [PutPendingCeremony] :: forall (a :: Type -> Type). PendingCeremony -> PendingCeremonyStore a ()
+ Shomei.Passkey.Ceremony.Store: [PutPendingCeremony] :: forall (a :: Type -> Type). PendingCeremony -> PendingCeremonyStore a (Either AuthError ())
- Shomei.Passkey.Ceremony.Store: putPendingCeremony :: forall (es :: [Effect]). PendingCeremonyStore :> es => PendingCeremony -> Eff es ()
+ Shomei.Passkey.Ceremony.Store: putPendingCeremony :: forall (es :: [Effect]). PendingCeremonyStore :> es => PendingCeremony -> Eff es (Either AuthError ())
- Shomei.Passkey.Domain: PendingCeremony :: !CeremonyId -> !Maybe UserId -> !CeremonyKind -> !ByteString -> !UTCTime -> !UTCTime -> PendingCeremony
+ Shomei.Passkey.Domain: PendingCeremony :: !Maybe Int64 -> !Maybe SessionId -> !CeremonyId -> !Maybe UserId -> !CeremonyKind -> !ByteString -> !UTCTime -> !UTCTime -> PendingCeremony
- Shomei.Passkey.Store: [CreatePasskey] :: forall (a :: Type -> Type). Int -> NewPasskeyCredential -> PasskeyStore a (Either AuthError PasskeyCredential)
+ Shomei.Passkey.Store: [CreatePasskey] :: forall (a :: Type -> Type). AuthenticationGuard -> Int -> NewPasskeyCredential -> PasskeyStore a (Either AuthError PasskeyCredential)
- Shomei.Passkey.Store: createPasskey :: forall (es :: [Effect]). PasskeyStore :> es => Int -> NewPasskeyCredential -> Eff es (Either AuthError PasskeyCredential)
+ Shomei.Passkey.Store: createPasskey :: forall (es :: [Effect]). PasskeyStore :> es => AuthenticationGuard -> Int -> NewPasskeyCredential -> Eff es (Either AuthError PasskeyCredential)
- Shomei.Passkey.Workflow: beginPasskeyRegistration :: forall (es :: [Effect]). (UserStore :> es, PasskeyStore :> es, PendingCeremonyStore :> es, WebAuthnCeremony :> es, Clock :> es, IOE :> es) => ShomeiConfig -> UserId -> Eff es (Either AuthError (CeremonyId, Value))
+ Shomei.Passkey.Workflow: beginPasskeyRegistration :: forall (es :: [Effect]). (UserStore :> es, PasskeyStore :> es, PendingCeremonyStore :> es, WebAuthnCeremony :> es, Clock :> es, IOE :> es) => ShomeiConfig -> UserId -> Maybe SessionId -> Eff es (Either AuthError (CeremonyId, Value))
- Shomei.Session.Authentication.Workflow: issueSession :: forall (es :: [Effect]). (AuthUnitOfWork :> es, TokenSigner :> es, TokenGen :> es, RoleStore :> es, ClaimsEnricher :> es) => ShomeiConfig -> Bool -> User -> UTCTime -> Eff es (SessionId, TokenPair)
+ Shomei.Session.Authentication.Workflow: issueSession :: forall (es :: [Effect]). (AuthUnitOfWork :> es, TokenSigner :> es, TokenGen :> es, RoleStore :> es, ClaimsEnricher :> es) => ShomeiConfig -> Bool -> User -> UTCTime -> Eff es (Either AuthError (SessionId, TokenPair))
- Shomei.Session.UnitOfWork.Store: [PersistNewSession] :: forall (a :: Type -> Type). NewSession -> NewSessionToken -> (SessionId -> [AuthEvent]) -> AuthUnitOfWork a (Session, PersistedRefreshToken)
+ Shomei.Session.UnitOfWork.Store: [PersistNewSession] :: forall (a :: Type -> Type). AuthenticationGuard -> NewSession -> NewSessionToken -> (SessionId -> [AuthEvent]) -> AuthUnitOfWork a (Either AuthError (Session, PersistedRefreshToken))
- Shomei.Session.UnitOfWork.Store: persistNewSession :: forall (es :: [Effect]). AuthUnitOfWork :> es => NewSession -> NewSessionToken -> (SessionId -> [AuthEvent]) -> Eff es (Session, PersistedRefreshToken)
+ Shomei.Session.UnitOfWork.Store: persistNewSession :: forall (es :: [Effect]). AuthUnitOfWork :> es => AuthenticationGuard -> NewSession -> NewSessionToken -> (SessionId -> [AuthEvent]) -> Eff es (Either AuthError (Session, PersistedRefreshToken))
- Shomei.Session.Workflow: SessionOptions :: !Maybe Text -> !Set Scope -> !Bool -> SessionOptions
+ Shomei.Session.Workflow: SessionOptions :: !Maybe Text -> !Set Scope -> !Bool -> !Maybe AuthenticationGuard -> SessionOptions
- Shomei.Session.Workflow: issueSession :: forall (es :: [Effect]). (AuthUnitOfWork :> es, TokenSigner :> es, TokenGen :> es, RoleStore :> es, ClaimsEnricher :> es) => ShomeiConfig -> Bool -> User -> UTCTime -> Eff es (SessionId, TokenPair)
+ Shomei.Session.Workflow: issueSession :: forall (es :: [Effect]). (AuthUnitOfWork :> es, TokenSigner :> es, TokenGen :> es, RoleStore :> es, ClaimsEnricher :> es) => ShomeiConfig -> Bool -> User -> UTCTime -> Eff es (Either AuthError (SessionId, TokenPair))
- Shomei.Session.Workflow: issueSessionWith :: forall (es :: [Effect]). (AuthUnitOfWork :> es, TokenSigner :> es, TokenGen :> es, RoleStore :> es, ClaimsEnricher :> es) => ShomeiConfig -> SessionOptions -> User -> UTCTime -> Eff es (SessionId, TokenPair, AuthClaims)
+ Shomei.Session.Workflow: issueSessionWith :: forall (es :: [Effect]). (AuthUnitOfWork :> es, TokenSigner :> es, TokenGen :> es, RoleStore :> es, ClaimsEnricher :> es) => ShomeiConfig -> SessionOptions -> User -> UTCTime -> Eff es (Either AuthError (SessionId, TokenPair, AuthClaims))
Files
- CHANGELOG.md +8/−0
- shomei-core.cabal +5/−2
- src/Shomei/Account/Admin/Recovery.hs +25/−0
- src/Shomei/Account/Admin/Recovery/Domain.hs +52/−0
- src/Shomei/Account/Notification/Domain.hs +5/−0
- src/Shomei/Account/User/Domain.hs +5/−2
- src/Shomei/Audit/Event/Codec.hs +52/−0
- src/Shomei/Audit/Event/Domain.hs +13/−0
- src/Shomei/Delegation/Workflow.hs +2/−2
- src/Shomei/Error.hs +1/−0
- src/Shomei/Mfa/RecoveryCode/Store.hs +5/−3
- src/Shomei/Mfa/Totp/Domain.hs +2/−1
- src/Shomei/Mfa/Totp/Store.hs +13/−6
- src/Shomei/Mfa/Totp/Workflow.hs +17/−10
- src/Shomei/Mfa/Workflow.hs +40/−25
- src/Shomei/OAuth/AuthorizationCode/Domain.hs +3/−1
- src/Shomei/OAuth/AuthorizationCode/Store.hs +5/−3
- src/Shomei/OAuth/Authorize/Workflow.hs +20/−14
- src/Shomei/OAuth/TokenExchange/Workflow.hs +3/−3
- src/Shomei/OAuth/TokenGrant/Workflow.hs +8/−5
- src/Shomei/Passkey/Ceremony/Store.hs +3/−2
- src/Shomei/Passkey/Domain.hs +5/−2
- src/Shomei/Passkey/Store.hs +5/−4
- src/Shomei/Passkey/Workflow.hs +19/−12
- src/Shomei/Session/Authentication/Guard.hs +18/−0
- src/Shomei/Session/Authentication/Workflow.hs +10/−6
- src/Shomei/Session/Domain.hs +24/−0
- src/Shomei/Session/UnitOfWork/Store.hs +15/−3
- src/Shomei/Session/Workflow.hs +11/−9
- src/Shomei/Test/InMemory.hs +148/−36
- test/Shomei/Account/Admin/WorkflowSpec.hs +71/−2
- test/Shomei/Account/Verification/WorkflowSpec.hs +2/−0
- test/Shomei/Audit/Event/CodecSpec.hs +17/−10
- test/Shomei/Mfa/Totp/StoreSpec.hs +23/−9
- test/Shomei/Mfa/WorkflowSpec.hs +6/−4
- test/Shomei/OAuth/Authorize/WorkflowSpec.hs +5/−1
- test/Shomei/OAuth/TokenGrant/WorkflowSpec.hs +2/−0
- test/Shomei/OAuthCodeStoreSpec.hs +21/−7
- test/Shomei/Passkey/WorkflowSpec.hs +6/−6
- test/Shomei/PasskeyStoreSpec.hs +29/−13
- test/Shomei/Session/Authentication/ConcurrencySpec.hs +11/−8
- test/Shomei/Session/Authentication/WorkflowSpec.hs +14/−12
CHANGELOG.md view
@@ -4,6 +4,14 @@ [PVP](https://pvp.haskell.org/) and is versioned independently of the other Shōmei packages. +## 0.4.0.0 — 2026-11-25++- `Shomei.Session.Domain` exports `sessionKindToText`/`sessionKindFromText` (the one spelling shared by persistence and introspection) and `sessionInvolves`. **Behavior:** `RevokeAllUserSessions` implementations must also revoke sessions in which the user is the delegated actor, and `RevokeServiceAccount` must revoke the account's live machine and delegated sessions; the in-memory interpreters do.++- **Breaking:** add audited administrator second-factor recovery, authentication generations on users/pending state, guarded persistence ports and typed stale-proof rejection. Session issuance returns an explicit Either; enrollment APIs bind an optional trusted source session. Add secret-free recovery notifications and the reset audit event.++- Export `knownAuthEventTypes` from the audit codec for version-specific event vocabulary validation.+ ## 0.3.0.1 — 2026-11-17 - Admit `base64` 2.0 and 2.1 (`>=1.0 && <2.2`), so consumers whose `tls` stack resolves base64 2.0 through `crypton-pem` need no `allow-newer`. No source or API change: the passkey codec uses only `encodeBase64Unpadded`, `decodeBase64UnpaddedUntyped` and `extractBase64`, whose behavior is unchanged in base64 2.x.
shomei-core.cabal view
@@ -1,6 +1,6 @@ cabal-version: 3.0 name: shomei-core-version: 0.3.0.1+version: 0.4.0.0 synopsis: Transport-agnostic domain: types, commands, events, errors, and effects @@ -58,6 +58,8 @@ import: warnings, shared hs-source-dirs: src exposed-modules:+ Shomei.Account.Admin.Recovery+ Shomei.Account.Admin.Recovery.Domain Shomei.Account.Admin.Workflow Shomei.Account.Credential.Domain Shomei.Account.Credential.Store@@ -117,6 +119,7 @@ Shomei.ServiceAccount.Domain Shomei.ServiceAccount.Secret Shomei.ServiceAccount.Store+ Shomei.Session.Authentication.Guard Shomei.Session.Authentication.Workflow Shomei.Session.Command Shomei.Session.Domain@@ -206,7 +209,7 @@ effectful >=2.5 && <2.8, effectful-core >=2.5 && <2.8, generic-lens >=2.2 && <2.4,- shomei-core ^>=0.3.0.0,+ shomei-core ^>=0.4.0.0, tasty >=1.4 && <1.6, tasty-hunit >=0.10 && <0.11, text >=2.0 && <2.2,
+ src/Shomei/Account/Admin/Recovery.hs view
@@ -0,0 +1,25 @@+-- | Shared validated recovery. Calling surfaces enforce authority before invoking it.+module Shomei.Account.Admin.Recovery (module Shomei.Account.Admin.Recovery.Domain, resetUserSecondFactors) where++import Effectful (Eff, (:>))+import Shomei.Account.Admin.Recovery.Domain+import Shomei.Account.Notification.Domain (Notification (SecondFactorsReset))+import Shomei.Account.Notification.Store (Notifier, sendNotification)+import Shomei.Error (AuthError)+import Shomei.Id (UserId)+import Shomei.Prelude+import Shomei.Session.UnitOfWork.Store (AuthUnitOfWork, resetSecondFactors)+import Shomei.Time.Store (Clock, now)++resetUserSecondFactors :: (AuthUnitOfWork :> es, Clock :> es, Notifier :> es) => RecoveryActor -> UserId -> RecoveryCommand -> Eff es (Either AuthError RecoveryResult)+resetUserSecondFactors actor uid command = case validateRecovery actor command of+ Left err -> pure (Left err)+ Right () -> do+ ts <- now+ result <- resetSecondFactors actor uid command ts+ case result of+ Left err -> pure (Left err)+ Right (committed, destination) -> do+ -- The destination was captured under the same user lock as the committed reset.+ forM_ destination \address -> sendNotification (SecondFactorsReset address ts "Your second factors were reset by an administrator. Sign in with your password and immediately enroll replacement factors and new recovery codes. If you did not request this, contact your established support channel immediately.")+ pure (Right committed)
+ src/Shomei/Account/Admin/Recovery/Domain.hs view
@@ -0,0 +1,52 @@+-- | Secret-free administrative recovery commands, attribution, and committed effects.+module Shomei.Account.Admin.Recovery.Domain (RecoveryActor (..), RecoveryCommand (..), RecoveryCounts (..), RecoveryResult (..), validateRecovery, recoveryActorUser) where++import Data.Char (isAlphaNum, isAscii)+import Data.Text qualified as Text+import Shomei.Error (AuthError (InvalidInput))+import Shomei.Id (UserId)+import Shomei.Prelude++-- | Local labels are asserted attribution. Service principals are not human operators.+data RecoveryActor = AuthenticatedAdministrator UserId | AdministratorService UserId | LocalOperator Text+ deriving stock (Generic, Eq, Show)+ deriving anyclass (FromJSON, ToJSON)++data RecoveryCommand = RecoveryCommand {identityVerified :: !Bool, caseReference :: !Text}+ deriving stock (Generic, Eq, Show)+ deriving anyclass (FromJSON, ToJSON)++data RecoveryCounts = RecoveryCounts+ { passkeysRemoved :: !Int,+ totpCredentialsRemoved :: !Int,+ recoveryCodesRemoved :: !Int,+ ceremoniesRemoved :: !Int,+ sessionsRevoked :: !Int,+ refreshTokensRevoked :: !Int,+ authorizationCodesInvalidated :: !Int,+ passwordResetTokensRevoked :: !Int+ }+ deriving stock (Generic, Eq, Show)+ deriving anyclass (FromJSON, ToJSON)++data RecoveryResult = RecoveryResult+ { resetAt :: !UTCTime,+ counts :: !RecoveryCounts,+ verifiedNotificationDestination :: !Bool+ }+ deriving stock (Generic, Eq, Show)+ deriving anyclass (FromJSON, ToJSON)++validateRecovery :: RecoveryActor -> RecoveryCommand -> Either AuthError ()+validateRecovery actor cmd+ | not cmd.identityVerified || not (boundedLabel cmd.caseReference) = Left InvalidInput+ | LocalOperator label <- actor, not (boundedLabel label) = Left InvalidInput+ | otherwise = Right ()+ where+ boundedLabel s = not (Text.null s) && Text.length s <= 128 && Text.all (\c -> isAscii c && (isAlphaNum c || c `elem` ("._:/-" :: String))) s++recoveryActorUser :: RecoveryActor -> Maybe UserId+recoveryActorUser = \case+ AuthenticatedAdministrator uid -> Just uid+ AdministratorService uid -> Just uid+ LocalOperator _ -> Nothing
src/Shomei/Account/Notification/Domain.hs view
@@ -19,5 +19,10 @@ token :: !OneTimeToken, expiresAt :: !UTCTime }+ | SecondFactorsReset+ { email :: !Email,+ occurredAt :: !UTCTime,+ supportInstructions :: !Text+ } deriving stock (Generic, Eq, Show) deriving anyclass (FromJSON, ToJSON)
src/Shomei/Account/User/Domain.hs view
@@ -7,7 +7,8 @@ ) where -import Data.Aeson (withObject, (.:), (.:?))+import Data.Aeson (withObject, (.!=), (.:), (.:?))+import Data.Int (Int64) import Data.Text qualified as Text import Shomei.Account.Email.Domain (Email, emailText, mkEmail, parseStoredEmail) import Shomei.Account.LoginId.Domain (LoginId, loginIdText, mkLoginId, parseLoginIdForAuthentication)@@ -27,7 +28,8 @@ status :: !UserStatus, emailVerifiedAt :: !(Maybe UTCTime), createdAt :: !UTCTime,- updatedAt :: !UTCTime+ updatedAt :: !UTCTime,+ authenticationGeneration :: !Int64 } deriving stock (Generic, Eq, Show) deriving anyclass (ToJSON)@@ -46,6 +48,7 @@ <*> o .:? "emailVerifiedAt" <*> o .: "createdAt" <*> o .: "updatedAt"+ <*> (o .:? "authenticationGeneration" .!= 0) data NewUser = NewUser { loginId :: !LoginId,
src/Shomei/Audit/Event/Codec.hs view
@@ -15,6 +15,7 @@ module Shomei.Audit.Event.Codec ( reconstructAuthEvent, projectAuthEvent,+ knownAuthEventTypes, ) where @@ -26,6 +27,54 @@ import Shomei.Id (sessionIdToUUID, userIdToUUID) import Shomei.Prelude +-- | Stored event names supported by this binary. Keep in sync with the codec fixtures.+knownAuthEventTypes :: [Text]+knownAuthEventTypes =+ [ "user_registered",+ "login_succeeded",+ "login_failed",+ "session_started",+ "session_revoked",+ "refresh_token_rotated",+ "refresh_token_reuse_detected",+ "email_verification_requested",+ "email_verified",+ "password_reset_requested",+ "password_reset_completed",+ "password_changed",+ "password_change_failed",+ "user_suspended",+ "user_deleted",+ "user_reinstated",+ "user_second_factors_reset",+ "account_locked",+ "login_throttled",+ "passkey_registered",+ "passkey_removed",+ "mfa_challenged",+ "mfa_succeeded",+ "mfa_failed",+ "totp_enrolled",+ "totp_removed",+ "recovery_codes_generated",+ "recovery_code_used",+ "impersonation_started",+ "impersonation_stopped",+ "impersonation_action_blocked",+ "service_on_behalf_issued",+ "service_token_issued",+ "role_granted",+ "role_revoked",+ "service_account_created",+ "service_account_secret_rotated",+ "service_account_revoked",+ "oauth_client_created",+ "oauth_client_revoked",+ "oauth_code_issued",+ "oauth_code_replayed",+ "notification_delivery_failed"+ ]+ -- | Reconstruct a typed event. The @event_type@ strings are the exact ones the writer -- emits (see 'Shomei.Audit.Publisher.Postgres.projectAuthEvent'); keep the two in lockstep. -- A 'Left' means either an unknown @event_type@ or a payload that does not decode into the@@ -47,6 +96,7 @@ "password_change_failed" -> PasswordChangeFailed <$> parse payload "user_suspended" -> UserSuspended <$> parse payload "user_deleted" -> UserDeleted <$> parse payload+ "user_second_factors_reset" -> UserSecondFactorsReset <$> parse payload "user_reinstated" -> UserReinstated <$> parse payload "account_locked" -> AccountLocked <$> parse payload "login_throttled" -> LoginThrottled <$> parse payload@@ -124,6 +174,8 @@ (Just (userIdToUUID d.userId), Nothing, "user_suspended", toJSON d, d.occurredAt) UserDeleted d -> (Just (userIdToUUID d.userId), Nothing, "user_deleted", toJSON d, d.occurredAt)+ UserSecondFactorsReset d ->+ (Just (userIdToUUID d.userId), Nothing, "user_second_factors_reset", toJSON d, d.occurredAt) UserReinstated d -> (Just (userIdToUUID d.userId), Nothing, "user_reinstated", toJSON d, d.occurredAt) AccountLocked d@(AccountLockedData _ _ _ _ occ) ->
src/Shomei/Audit/Event/Domain.hs view
@@ -26,6 +26,7 @@ UserSuspendedData (..), UserDeletedData (..), UserReinstatedData (..),+ UserSecondFactorsResetData (..), AccountLockedData (..), LoginThrottledData (..), PasskeyRegisteredData (..),@@ -58,6 +59,7 @@ import Data.Aeson (withObject, (.:), (.:?)) import Data.Set (Set) import Data.UUID qualified as UUID+import Shomei.Account.Admin.Recovery.Domain (RecoveryActor, RecoveryCounts) import Shomei.Account.Email.Domain (Email, parseStoredEmail) import Shomei.Account.LoginId.Domain (LoginId, parseLoginIdForAuthentication) import Shomei.Authorization.Claims.Domain (Role, Scope)@@ -507,6 +509,16 @@ deriving stock (Generic, Eq, Show) deriving anyclass (FromJSON, ToJSON) +data UserSecondFactorsResetData = UserSecondFactorsResetData+ { userId :: !UserId,+ recoveryActor :: !RecoveryActor,+ caseReference :: !Text,+ counts :: !RecoveryCounts,+ occurredAt :: !UTCTime+ }+ deriving stock (Generic, Eq, Show)+ deriving anyclass (FromJSON, ToJSON)+ data AuthEvent = UserRegistered UserRegisteredData | LoginSucceeded LoginSucceededData@@ -524,6 +536,7 @@ | UserSuspended UserSuspendedData | UserDeleted UserDeletedData | UserReinstated UserReinstatedData+ | UserSecondFactorsReset UserSecondFactorsResetData | AccountLocked AccountLockedData | LoginThrottled LoginThrottledData | PasskeyRegistered PasskeyRegisteredData
src/Shomei/Delegation/Workflow.hs view
@@ -132,8 +132,8 @@ -- 'subjectUserId', @act@ = 'actorUserId') plus 'scopes'. No refresh token, no @LoginSucceeded@\/ -- @SessionStarted@ events — the delegated session cannot be silently renewed and dies at its TTL. ----- This is the single mint both delegation flows share, so the standards-based token-exchange grant--- and the bespoke @\/auth\/impersonate@ endpoint cannot drift in session shape or claim contents.+-- This is the single mint both modes of the @POST \/oauth\/token@ token-exchange grant share,+-- so impersonation and service on-behalf-of cannot drift in session shape or claim contents. -- The audit event is the caller's responsibility, because impersonation and on-behalf-of publish -- different events. mintDelegatedToken ::
src/Shomei/Error.hs view
@@ -64,6 +64,7 @@ LoginIdAlreadyRegistered | InvalidCredentials | UserNotActive+ | StaleAuthentication | SessionNotFound | SessionExpired | SessionRevoked
src/Shomei/Mfa/RecoveryCode/Store.hs view
@@ -19,21 +19,23 @@ import Effectful (Dispatch (Dynamic), DispatchOf, Eff, Effect, (:>)) import Effectful.Dispatch.Dynamic (send)+import Shomei.Error (AuthError) import Shomei.Id (UserId) import Shomei.Mfa.Totp.Domain (NewRecoveryCode) import Shomei.Prelude+import Shomei.Session.Authentication.Guard (AuthenticationGuard) data RecoveryCodeStore :: Effect where -- | Atomically replace the user's whole recovery-code set (delete existing, insert new).- ReplaceRecoveryCodes :: UserId -> [NewRecoveryCode] -> RecoveryCodeStore m ()+ ReplaceRecoveryCodes :: UserId -> AuthenticationGuard -> UTCTime -> [NewRecoveryCode] -> RecoveryCodeStore m (Either AuthError ()) -- | Compare-and-set: spend an unused code whose hash matches. 'True' iff a row was consumed. ConsumeRecoveryCode :: UserId -> Text -> UTCTime -> RecoveryCodeStore m Bool CountUnusedRecoveryCodes :: UserId -> RecoveryCodeStore m Int type instance DispatchOf RecoveryCodeStore = Dynamic -replaceRecoveryCodes :: (RecoveryCodeStore :> es) => UserId -> [NewRecoveryCode] -> Eff es ()-replaceRecoveryCodes u cs = send (ReplaceRecoveryCodes u cs)+replaceRecoveryCodes :: (RecoveryCodeStore :> es) => UserId -> AuthenticationGuard -> UTCTime -> [NewRecoveryCode] -> Eff es (Either AuthError ())+replaceRecoveryCodes u proofState ts cs = send (ReplaceRecoveryCodes u proofState ts cs) consumeRecoveryCode :: (RecoveryCodeStore :> es) => UserId -> Text -> UTCTime -> Eff es Bool consumeRecoveryCode u h t = send (ConsumeRecoveryCode u h t)
src/Shomei/Mfa/Totp/Domain.hs view
@@ -34,7 +34,8 @@ -- been activated with a first valid code; @lastUsedCounter@ is the replay-defense high-water -- mark (RFC 6238 §5.2), 'Nothing' until the first acceptance. data TotpCredential = TotpCredential- { totpCredentialId :: !TotpCredentialId,+ { authenticationGeneration :: !(Maybe Int64),+ totpCredentialId :: !TotpCredentialId, userId :: !UserId, secret :: !TotpSecret, lastUsedCounter :: !(Maybe Int64),
src/Shomei/Mfa/Totp/Store.hs view
@@ -16,40 +16,47 @@ confirmTotp, setTotpLastUsedCounter, deleteTotpByUser,+ removeTotpCredential, ) where import Data.Int (Int64) import Effectful (Dispatch (Dynamic), DispatchOf, Eff, Effect, (:>)) import Effectful.Dispatch.Dynamic (send)+import Shomei.Error (AuthError) import Shomei.Id (TotpCredentialId, UserId) import Shomei.Mfa.Totp.Domain (NewTotpCredential, TotpCredential) import Shomei.Prelude+import Shomei.Session.Authentication.Guard (AuthenticationGuard) data TotpCredentialStore :: Effect where -- | Insert the enrollment, replacing any existing (unconfirmed) row for the user.- UpsertTotpEnrollment :: NewTotpCredential -> TotpCredentialStore m TotpCredential+ UpsertTotpEnrollment :: AuthenticationGuard -> NewTotpCredential -> TotpCredentialStore m (Either AuthError TotpCredential) FindTotpByUser :: UserId -> TotpCredentialStore m (Maybe TotpCredential) -- | Mark the credential confirmed (activated) at the given time.- ConfirmTotp :: TotpCredentialId -> UTCTime -> TotpCredentialStore m ()+ ConfirmTotp :: UserId -> AuthenticationGuard -> TotpCredentialId -> UTCTime -> TotpCredentialStore m (Either AuthError ()) -- | Advance the replay-defense high-water counter only when the supplied value is newer. -- 'False' means another request already accepted this counter (or a later one). SetTotpLastUsedCounter :: TotpCredentialId -> Int64 -> TotpCredentialStore m Bool+ RemoveTotpCredential :: UserId -> AuthenticationGuard -> TotpCredentialId -> UTCTime -> TotpCredentialStore m (Either AuthError ()) DeleteTotpByUser :: UserId -> TotpCredentialStore m () type instance DispatchOf TotpCredentialStore = Dynamic -upsertTotpEnrollment :: (TotpCredentialStore :> es) => NewTotpCredential -> Eff es TotpCredential-upsertTotpEnrollment = send . UpsertTotpEnrollment+upsertTotpEnrollment :: (TotpCredentialStore :> es) => AuthenticationGuard -> NewTotpCredential -> Eff es (Either AuthError TotpCredential)+upsertTotpEnrollment proofState = send . UpsertTotpEnrollment proofState findTotpByUser :: (TotpCredentialStore :> es) => UserId -> Eff es (Maybe TotpCredential) findTotpByUser = send . FindTotpByUser -confirmTotp :: (TotpCredentialStore :> es) => TotpCredentialId -> UTCTime -> Eff es ()-confirmTotp i t = send (ConfirmTotp i t)+confirmTotp :: (TotpCredentialStore :> es) => UserId -> AuthenticationGuard -> TotpCredentialId -> UTCTime -> Eff es (Either AuthError ())+confirmTotp uid proofState i t = send (ConfirmTotp uid proofState i t) setTotpLastUsedCounter :: (TotpCredentialStore :> es) => TotpCredentialId -> Int64 -> Eff es Bool setTotpLastUsedCounter i c = send (SetTotpLastUsedCounter i c) deleteTotpByUser :: (TotpCredentialStore :> es) => UserId -> Eff es () deleteTotpByUser = send . DeleteTotpByUser++removeTotpCredential :: (TotpCredentialStore :> es) => UserId -> AuthenticationGuard -> TotpCredentialId -> UTCTime -> Eff es (Either AuthError ())+removeTotpCredential uid proofState tcid ts = send (RemoveTotpCredential uid proofState tcid ts)
src/Shomei/Mfa/Totp/Workflow.hs view
@@ -34,7 +34,7 @@ import Shomei.Authorization.Claims.Domain (Issuer (..)) import Shomei.Config (ShomeiConfig (..), TotpConfig (..)) import Shomei.Error (AuthError (..))-import Shomei.Id (TotpCredentialId, genRecoveryCodeId, genTotpCredentialId)+import Shomei.Id (SessionId, TotpCredentialId, genRecoveryCodeId, genTotpCredentialId) import Shomei.Mfa.RecoveryCode.Store (RecoveryCodeStore, consumeRecoveryCode, replaceRecoveryCodes) import Shomei.Mfa.Totp.Algorithm (TotpSecret (..), secretToBase32, verifyTotp) import Shomei.Mfa.Totp.Algorithm qualified as Totp@@ -42,13 +42,14 @@ import Shomei.Mfa.Totp.Store ( TotpCredentialStore, confirmTotp,- deleteTotpByUser, findTotpByUser,+ removeTotpCredential, setTotpLastUsedCounter, upsertTotpEnrollment, ) import Shomei.Prelude import Shomei.ServiceAccount.Secret (sha256Hex)+import Shomei.Session.Authentication.Guard (AuthenticationGuard (..), userGuard) import Shomei.Session.Command (ProofContext, proofContextFor) import Shomei.Session.LoginAttempt.Domain (AttemptFactor (..)) import Shomei.Session.LoginAttempt.Store (LoginAttemptStore)@@ -90,8 +91,9 @@ (TotpCredentialStore :> es, TokenGen :> es, Clock :> es, IOE :> es) => ShomeiConfig -> User ->+ Maybe SessionId -> Eff es (Either AuthError TotpEnrollment)-enrollTotp cfg user = runErrorNoCallStack do+enrollTotp cfg user sourceSession = runErrorNoCallStack do unless (totpEnabled (totpConfig cfg)) (throwError TotpDisabled) ts <- now let User {userId = uid} = user@@ -100,7 +102,7 @@ secretBytes <- generateRandomBytes 20 let secret = TotpSecret secretBytes tcid <- genTotpCredentialId- _ <- upsertTotpEnrollment NewTotpCredential {totpCredentialId = tcid, userId = uid, secret, createdAt = ts}+ _ <- either throwError pure =<< upsertTotpEnrollment ((userGuard user) {initiatingSession = sourceSession}) NewTotpCredential {totpCredentialId = tcid, userId = uid, secret, createdAt = ts} pure TotpEnrollment { secretBase32 = secretToBase32 secret,@@ -115,9 +117,10 @@ (TotpCredentialStore :> es, AuthEventPublisher :> es, Clock :> es) => ShomeiConfig -> User ->+ Maybe SessionId -> Text -> Eff es (Either AuthError ())-verifyTotpEnrollment cfg user code = runErrorNoCallStack do+verifyTotpEnrollment cfg user sourceSession code = runErrorNoCallStack do unless (totpEnabled (totpConfig cfg)) (throwError TotpDisabled) ts <- now let User {userId = uid} = user@@ -125,9 +128,11 @@ cred <- case existing of Just c | not (confirmed c), not (enrollmentExpired cfg ts c) -> pure c _ -> throwError TotpEnrollmentNotFound+ let TotpCredential {authenticationGeneration} = cred+ when (authenticationGeneration /= Just user.authenticationGeneration) (throwError StaleAuthentication) case verifyTotp (secretOf cred) Nothing ts code of Just accepted -> do- confirmTotp (tcId cred) ts+ either throwError pure =<< confirmTotp uid ((userGuard user) {initiatingSession = sourceSession}) (tcId cred) ts won <- setTotpLastUsedCounter (tcId cred) accepted unless won do publishAuthEvent (Event.MfaFailed (Event.MfaFailedData (Just uid) "totp_replayed" ts))@@ -150,9 +155,10 @@ ShomeiConfig -> ProofContext -> User ->+ Maybe SessionId -> TotpRemovalProof -> Eff es (Either AuthError ())-removeTotp cfg pctx user proof = runErrorNoCallStack do+removeTotp cfg pctx user sourceSession proof = runErrorNoCallStack do ts <- now let User {userId = uid} = user ctx = proofContextFor pctx (loginIdText user.loginId)@@ -189,7 +195,7 @@ publishAuthEvent (Event.MfaFailed (Event.MfaFailedData (Just uid) "recovery_invalid" ts)) throwError RecoveryCodeInvalid recordProofSuccess ctx factor gate.standingLockout ts- deleteTotpByUser uid+ either throwError pure =<< removeTotpCredential uid ((userGuard user) {initiatingSession = sourceSession}) (tcId cred) ts publishAuthEvent (Event.TotpRemoved (Event.TotpRemovedData uid ts)) -- | Generate a fresh set of 'recoveryCodeSetSize' single-use codes, replacing any previous set,@@ -199,8 +205,9 @@ (RecoveryCodeStore :> es, TokenGen :> es, AuthEventPublisher :> es, Clock :> es, IOE :> es) => ShomeiConfig -> User ->+ Maybe SessionId -> Eff es (Either AuthError [Text])-regenerateRecoveryCodes _cfg user = runErrorNoCallStack do+regenerateRecoveryCodes _cfg user sourceSession = runErrorNoCallStack do ts <- now let User {userId = uid} = user codes <- forM [1 .. recoveryCodeSetSize] \_ -> formatRecoveryCode <$> generateRandomBytes 10@@ -210,7 +217,7 @@ (\rid code -> NewRecoveryCode {recoveryCodeId = rid, codeHash = recoveryCodeHash code, createdAt = ts}) ids codes- replaceRecoveryCodes uid rows+ either throwError pure =<< replaceRecoveryCodes uid ((userGuard user) {initiatingSession = sourceSession}) ts rows publishAuthEvent (Event.RecoveryCodesGenerated (Event.RecoveryCodesGeneratedData uid recoveryCodeSetSize ts)) pure codes
src/Shomei/Mfa/Workflow.hs view
@@ -70,6 +70,7 @@ updatePasskeySignCounter, ) import Shomei.Prelude+import Shomei.Session.Authentication.Guard (AuthenticationGuard (..), userGuard) import Shomei.Session.Command (ProofContext, proofContextFor) import Shomei.Session.LoginAttempt.Domain (AttemptFactor (..)) import Shomei.Session.LoginAttempt.Store (LoginAttemptStore)@@ -77,7 +78,7 @@ import Shomei.Session.Token.Domain (TokenPair) import Shomei.Session.Token.Generator (TokenGen) import Shomei.Session.UnitOfWork.Store (AuthUnitOfWork)-import Shomei.Session.Workflow (ensureEmailVerified, issueSession)+import Shomei.Session.Workflow (SessionOptions (..), defaultSessionOptions, ensureEmailVerified, issueSessionWith) import Shomei.SigningKey.Signer (TokenSigner) import Shomei.Time.Store (Clock, now) @@ -111,8 +112,8 @@ ShomeiConfig -> User -> UTCTime ->- Eff es (CeremonyId, Value, [Text])-prepareMfaChallenge cfg user ts = do+ Eff es (Either AuthError (CeremonyId, Value, [Text]))+prepareMfaChallenge cfg user ts = runErrorNoCallStack do let User {userId = uid} = user creds <- findPasskeysByUser uid mTotp <- findTotpByUser uid@@ -135,15 +136,18 @@ pure (optionsJson, optionsBlob) else pure (object [], BS.empty) cid <- genCeremonyId- putPendingCeremony- PendingCeremony- { ceremonyId = cid,- userId = Just uid,- kind = AuthenticationCeremony,- optionsBlob = optionsBlob,- createdAt = ts,- expiresAt = addUTCTime (pendingCeremonyTTL (webauthnConfig cfg)) ts- }+ either throwError pure+ =<< putPendingCeremony+ PendingCeremony+ { authenticationGeneration = Just user.authenticationGeneration,+ initiatingSession = Nothing,+ ceremonyId = cid,+ userId = Just uid,+ kind = AuthenticationCeremony,+ optionsBlob = optionsBlob,+ createdAt = ts,+ expiresAt = addUTCTime (pendingCeremonyTTL (webauthnConfig cfg)) ts+ } publishAuthEvent (Event.MfaChallenged (Event.MfaChallengedData uid cid ts)) pure (cid, optionsJson, methods) @@ -205,11 +209,13 @@ Eff es (Either AuthError (User, TokenPair)) completeMfaWith cfg pctx remember ceremonyId completion = runErrorNoCallStack do ts <- now- PendingCeremony {kind, userId = mUid, optionsBlob} <-+ PendingCeremony {kind, userId = mUid, optionsBlob, authenticationGeneration} <- maybe (throwError PendingCeremonyNotFound) pure =<< takePendingCeremony ceremonyId ts when (kind /= AuthenticationCeremony) (throwError PendingCeremonyNotFound) uid <- maybe (throwError PendingCeremonyNotFound) pure mUid+ generation <- maybe (throwError StaleAuthentication) pure authenticationGeneration user <- maybe (throwError InvalidCredentials) pure =<< findUserById uid+ when (user.authenticationGeneration /= generation) (throwError StaleAuthentication) let User {status = userStatus} = user when (userStatus /= UserActive) (throwError UserNotActive) -- 'login' already gates before handing out a ceremony id, so this rarely fires; it keeps@@ -237,8 +243,8 @@ unless won (failMfa failure (Just uid) "signature counter replayed") MfaTotp code -> completeTotp failure uid ts code MfaRecoveryCode code -> completeRecovery failure uid ts code+ (sid, pair, _) <- either throwError pure =<< issueSessionWith cfg defaultSessionOptions {remember, authenticationGuard = Just (userGuard user)} user ts recordProofSuccess ctx factor gate.standingLockout ts- (sid, pair) <- issueSession cfg remember user ts publishAuthEvent (Event.MfaSucceeded (Event.MfaSucceededData uid sid ts)) pure (user, pair) @@ -311,15 +317,18 @@ ts <- now BeginCeremony {optionsJson, optionsBlob} <- beginAuthenticationCeremony UVRequired [] cid <- genCeremonyId- putPendingCeremony- PendingCeremony- { ceremonyId = cid,- userId = Nothing,- kind = AuthenticationCeremony,- optionsBlob = optionsBlob,- createdAt = ts,- expiresAt = addUTCTime (pendingCeremonyTTL (webauthnConfig cfg)) ts- }+ either throwError pure+ =<< putPendingCeremony+ PendingCeremony+ { authenticationGeneration = Nothing,+ initiatingSession = Nothing,+ ceremonyId = cid,+ userId = Nothing,+ kind = AuthenticationCeremony,+ optionsBlob = optionsBlob,+ createdAt = ts,+ expiresAt = addUTCTime (pendingCeremonyTTL (webauthnConfig cfg)) ts+ } pure (cid, optionsJson) -- | Finish a passwordless login: consume the pending ceremony, resolve the user from the@@ -379,10 +388,16 @@ when failureGate.locked do publishAuthEvent (Event.MfaFailed (Event.MfaFailedData Nothing "account_locked" ts)) throwError MfaAssertionInvalid+ -- Resolve and capture the user's generation BEFORE the expensive proof check.+ assertedId <- maybe (throwError MfaAssertionInvalid) pure (assertionCredentialId assertion)+ resolved <- maybe (throwError MfaAssertionInvalid) pure =<< findPasskeyByCredentialId assertedId+ let PasskeyCredential {userId = resolvedUid} = resolved+ observedUser <- maybe (throwError InvalidCredentials) pure =<< findUserById resolvedUid (passkey, verified) <- verifyAssertion failure Nothing optionsBlob assertion let PasskeyCredential {userId = pkUid, passkeyId} = passkey VerifiedAuthentication {newSignCounter} = verified- user <- maybe (throwError InvalidCredentials) pure =<< findUserById pkUid+ let user = observedUser+ when (pkUid /= resolvedUid) (throwError MfaAssertionInvalid) let User {status = userStatus} = user when (userStatus /= UserActive) (throwError UserNotActive) -- The assertion is already verified above, so the account's existence is not in question.@@ -394,8 +409,8 @@ throwError MfaAssertionInvalid won <- updatePasskeySignCounter passkeyId newSignCounter ts unless won (failMfa failure (Just pkUid) "signature counter replayed")+ (sid, pair, _) <- either throwError pure =<< issueSessionWith cfg defaultSessionOptions {remember, authenticationGuard = Just ((userGuard user) {assertedPasskey = Just passkeyId})} user ts recordProofSuccess ctx FactorPasskey gate.standingLockout ts- (sid, pair) <- issueSession cfg remember user ts publishAuthEvent (Event.MfaSucceeded (Event.MfaSucceededData pkUid sid ts)) pure (user, pair)
src/Shomei/OAuth/AuthorizationCode/Domain.hs view
@@ -14,13 +14,15 @@ ) where +import Data.Int (Int64) import Data.Set (Set) import Shomei.Authorization.Claims.Domain (Scope) import Shomei.Id (SessionId, UserId) import Shomei.Prelude data AuthorizationCode = AuthorizationCode- { -- | SHA-256 hex of the opaque code; the primary key+ { authenticationGeneration :: !(Maybe Int64),+ -- | SHA-256 hex of the opaque code; the primary key codeHash :: !Text, -- | the only client that may exchange this code clientId :: !Text,
src/Shomei/OAuth/AuthorizationCode/Store.hs view
@@ -21,12 +21,14 @@ import Effectful (Dispatch (..), DispatchOf, Eff, Effect, (:>)) import Effectful.Dispatch.Dynamic (send)+import Shomei.Error (AuthError) import Shomei.Id (SessionId) import Shomei.OAuth.AuthorizationCode.Domain (AuthorizationCode, NewAuthorizationCode) import Shomei.Prelude+import Shomei.Session.Authentication.Guard (AuthenticationGuard) data OAuthCodeStore :: Effect where- PutAuthorizationCode :: NewAuthorizationCode -> OAuthCodeStore m ()+ PutAuthorizationCode :: AuthenticationGuard -> NewAuthorizationCode -> OAuthCodeStore m (Either AuthError ()) -- | Redeem a code by its SHA-256 hex digest, atomically and at most once. -- -- Returns the row only if it was unconsumed /and/ unexpired at the given time, and stamps@@ -42,8 +44,8 @@ type instance DispatchOf OAuthCodeStore = Dynamic -putAuthorizationCode :: (OAuthCodeStore :> es) => NewAuthorizationCode -> Eff es ()-putAuthorizationCode = send . PutAuthorizationCode+putAuthorizationCode :: (OAuthCodeStore :> es) => AuthenticationGuard -> NewAuthorizationCode -> Eff es (Either AuthError ())+putAuthorizationCode proofState = send . PutAuthorizationCode proofState consumeAuthorizationCode :: (OAuthCodeStore :> es) => Text -> UTCTime -> Eff es (Maybe AuthorizationCode) consumeAuthorizationCode h t = send (ConsumeAuthorizationCode h t)
src/Shomei/OAuth/Authorize/Workflow.hs view
@@ -32,7 +32,9 @@ import Data.Time (addUTCTime) import Effectful (Eff, (:>)) import Effectful.Error.Static (runErrorNoCallStack, throwError)+import Shomei.Account.User.Store (UserStore, findUserById) import Shomei.Audit.Event.Domain qualified as Event+import Shomei.Session.Authentication.Guard (AuthenticationGuard (..), userGuard) -- Imported WITHOUT (..): 'OAuthClient' shares @clientId@ / @status@ / @createdAt@ with several -- other domain records, which would defeat @OverloadedRecordDot@. Every field is read through a@@ -147,7 +149,8 @@ TokenGen :> es, AuthEventPublisher :> es, Clock :> es,- SessionStore :> es+ SessionStore :> es,+ UserStore :> es ) => ShomeiConfig -> OAuthClient ->@@ -170,19 +173,22 @@ -- The refresh-token generator is the codebase's single CSPRNG opaque-token source (32 bytes, -- base64url). A code is the same kind of secret with a shorter life. RefreshToken code <- generateOpaqueToken- putAuthorizationCode- NewAuthorizationCode- { codeHash = sha256Hex code,- clientId = client ^. #clientId,- redirectUri = params.redirectUri,- userId = claims.subject,- scopes = granted,- nonce = params.nonce,- codeChallenge = challenge,- authTime = claims.authTime,- createdAt = ts,- expiresAt = addUTCTime (cfg ^. #oauthConfig . #authorizationCodeTTL) ts- }+ user <- maybe (throwError (AuthorizeLoginRequired SessionNotLive)) pure =<< findUserById claims.subject+ either (const (throwError (AuthorizeLoginRequired SessionNotLive))) pure+ =<< putAuthorizationCode+ ((userGuard user) {initiatingSession = Just claims.sessionId})+ NewAuthorizationCode+ { codeHash = sha256Hex code,+ clientId = client ^. #clientId,+ redirectUri = params.redirectUri,+ userId = claims.subject,+ scopes = granted,+ nonce = params.nonce,+ codeChallenge = challenge,+ authTime = claims.authTime,+ createdAt = ts,+ expiresAt = addUTCTime (cfg ^. #oauthConfig . #authorizationCodeTTL) ts+ } publishAuthEvent ( Event.OAuthCodeIssued Event.OAuthCodeIssuedData
src/Shomei/OAuth/TokenExchange/Workflow.hs view
@@ -3,15 +3,15 @@ -- Token exchange generalizes the two delegated-token stories Shōmei already tells into one -- standard grant. Both modes issue a __delegation-shaped__ token — @sub@ names the represented -- party, @act@ names who is wielding it — through the single shared mint--- 'Shomei.Delegation.Workflow.mintDelegatedToken', so the standards path and the bespoke--- @\/auth\/impersonate@ endpoint cannot drift.+-- 'Shomei.Delegation.Workflow.mintDelegatedToken', so impersonation and service on-behalf-of+-- cannot drift in session shape or claim contents. -- -- * __Impersonation mode__ — an operator holding the @impersonate:user@ scope exchanges a bare -- user id (@subject_token_type = urn:shomei:params:oauth:token-type:user-id@) plus their own -- access token as the @actor_token@, for a token that /is/ that user. This reuses -- 'Shomei.Delegation.Workflow.startImpersonation' verbatim, so the scope gate, freshness -- gate, self\/active-target checks, refresh-less session, and @impersonation_started@ audit--- event are literally the same code as the bespoke endpoint.+-- event are shared with the library's impersonation workflow. -- -- * __Service on-behalf-of mode__ — a service account (EP-4) authenticates as the OAuth client of -- the request and presents a user's access token as the @subject_token@. It receives a
src/Shomei/OAuth/TokenGrant/Workflow.hs view
@@ -57,6 +57,7 @@ import Shomei.OAuth.IdToken.Domain (IdToken, IdTokenClaims (..)) import Shomei.Prelude import Shomei.ServiceAccount.Secret (sha256Hex, verifyServiceSecret)+import Shomei.Session.Authentication.Guard (AuthenticationGuard (..)) import Shomei.Session.Authentication.Workflow qualified as Wf import Shomei.Session.Command (RefreshCommand (..), RefreshOrigin (OAuthClientRefresh)) import Shomei.Session.RefreshToken.Domain (RefreshToken)@@ -190,13 +191,15 @@ unless ((u ^. #status) == UserActive) (throwError (GrantInvalidGrant "the code's user is not active")) either (const (throwError (GrantInvalidGrant "the code's user has not verified their email"))) pure (ensureEmailVerified cfg u) pure u+ generation <- maybe (throwError (GrantInvalidGrant "legacy authentication state")) pure (row ^. #authenticationGeneration) let granted = row ^. #scopes (sid, pair, claims) <-- issueSessionWith- cfg- SessionOptions {oauthClientId = Just (cmd ^. #clientId), extraScopes = granted, remember = False}- user- ts+ either (const (throwError (GrantInvalidGrant "authentication state changed"))) pure+ =<< issueSessionWith+ cfg+ SessionOptions {oauthClientId = Just (cmd ^. #clientId), extraScopes = granted, remember = False, authenticationGuard = Just (AuthenticationGuard generation Nothing Nothing)}+ user+ ts bindAuthorizationCodeSession (row ^. #codeHash) sid idToken <- if Scope "openid" `Set.member` granted
src/Shomei/Passkey/Ceremony/Store.hs view
@@ -26,19 +26,20 @@ import Effectful (Dispatch (Dynamic), DispatchOf, Eff, Effect, (:>)) import Effectful.Dispatch.Dynamic (send)+import Shomei.Error (AuthError) import Shomei.Id (CeremonyId) import Shomei.Passkey.Domain (PendingCeremony) import Shomei.Prelude data PendingCeremonyStore :: Effect where- PutPendingCeremony :: PendingCeremony -> PendingCeremonyStore m ()+ PutPendingCeremony :: PendingCeremony -> PendingCeremonyStore m (Either AuthError ()) -- | Consume-once: remove the row and return it iff present AND @expiresAt > now@; -- otherwise return 'Nothing' (removing an expired row too). @now@ is the second arg. TakePendingCeremony :: CeremonyId -> UTCTime -> PendingCeremonyStore m (Maybe PendingCeremony) type instance DispatchOf PendingCeremonyStore = Dynamic -putPendingCeremony :: (PendingCeremonyStore :> es) => PendingCeremony -> Eff es ()+putPendingCeremony :: (PendingCeremonyStore :> es) => PendingCeremony -> Eff es (Either AuthError ()) putPendingCeremony = send . PutPendingCeremony takePendingCeremony :: (PendingCeremonyStore :> es) => CeremonyId -> UTCTime -> Eff es (Maybe PendingCeremony)
src/Shomei/Passkey/Domain.hs view
@@ -35,10 +35,11 @@ import Data.Base64.Types (extractBase64) import Data.ByteString (ByteString) import Data.ByteString.Base64.URL qualified as B64U+import Data.Int (Int64) import Data.Text qualified as Text import Data.Text.Encoding qualified as TE import Data.Word (Word32)-import Shomei.Id (CeremonyId, PasskeyId, UserId)+import Shomei.Id (CeremonyId, PasskeyId, SessionId, UserId) import Shomei.Prelude -- | Per-ceremony WebAuthn user-verification policy. Kept in the pure passkey domain so the@@ -127,7 +128,9 @@ -- | The short-lived challenge/options state (EP-1 defines; EP-2 persists). data PendingCeremony = PendingCeremony- { ceremonyId :: !CeremonyId,+ { authenticationGeneration :: !(Maybe Int64),+ initiatingSession :: !(Maybe SessionId),+ ceremonyId :: !CeremonyId, userId :: !(Maybe UserId), kind :: !CeremonyKind, optionsBlob :: !ByteString,
src/Shomei/Passkey/Store.hs view
@@ -38,10 +38,11 @@ WebAuthnCredentialId, ) import Shomei.Prelude+import Shomei.Session.Authentication.Guard (AuthenticationGuard) data PasskeyStore :: Effect where -- | Atomically count and insert within the requested 1–100 credential ceiling.- CreatePasskey :: Int -> NewPasskeyCredential -> PasskeyStore m (Either AuthError PasskeyCredential)+ CreatePasskey :: AuthenticationGuard -> Int -> NewPasskeyCredential -> PasskeyStore m (Either AuthError PasskeyCredential) FindPasskeysByUser :: UserId -> PasskeyStore m [PasskeyCredential] FindPasskeyByCredentialId :: WebAuthnCredentialId -> PasskeyStore m (Maybe PasskeyCredential) FindPasskeysByUserHandle :: UserHandle -> PasskeyStore m [PasskeyCredential]@@ -54,10 +55,10 @@ type instance DispatchOf PasskeyStore = Dynamic -createPasskey :: (PasskeyStore :> es) => Int -> NewPasskeyCredential -> Eff es (Either AuthError PasskeyCredential)-createPasskey limit credential+createPasskey :: (PasskeyStore :> es) => AuthenticationGuard -> Int -> NewPasskeyCredential -> Eff es (Either AuthError PasskeyCredential)+createPasskey proofState limit credential | maybe False ((> 128) . Text.length) credential.label = pure (Left InvalidInput)- | otherwise = send (CreatePasskey limit credential)+ | otherwise = send (CreatePasskey proofState limit credential) findPasskeysByUser :: (PasskeyStore :> es) => UserId -> Eff es [PasskeyCredential] findPasskeysByUser = send . FindPasskeysByUser
src/Shomei/Passkey/Workflow.hs view
@@ -34,7 +34,7 @@ import Shomei.Audit.Publisher.Store (AuthEventPublisher, publishAuthEvent) import Shomei.Config (ShomeiConfig (..), WebAuthnConfig (..)) import Shomei.Error (AuthError (..))-import Shomei.Id (CeremonyId, PasskeyId, UserId, genCeremonyId, userIdToUUID)+import Shomei.Id (CeremonyId, PasskeyId, SessionId, UserId, genCeremonyId, userIdToUUID) import Shomei.Passkey.Ceremony.Port ( BeginCeremony (..), CredentialUserInfo (..),@@ -53,6 +53,7 @@ ) import Shomei.Passkey.Store (PasskeyStore, createPasskey, deletePasskey, findPasskeysByUser) import Shomei.Prelude+import Shomei.Session.Authentication.Guard (AuthenticationGuard (..), userGuard) import Shomei.Time.Store (Clock, now) -- | Derive a stable WebAuthn user handle from the Shōmei user id: the 16 bytes of the@@ -78,8 +79,9 @@ ) => ShomeiConfig -> UserId ->+ Maybe SessionId -> Eff es (Either AuthError (CeremonyId, Value))-beginPasskeyRegistration cfg uid = runErrorNoCallStack do+beginPasskeyRegistration cfg uid sourceSession = runErrorNoCallStack do ts <- now user <- maybe (throwError InvalidCredentials) pure =<< findUserById uid existing <- findPasskeysByUser uid@@ -97,15 +99,18 @@ excludeIds = map (\PasskeyCredential {credentialId} -> credentialId) existing BeginCeremony {optionsJson, optionsBlob} <- beginRegistrationCeremony info excludeIds ceremonyId <- genCeremonyId- putPendingCeremony- PendingCeremony- { ceremonyId = ceremonyId,- userId = Just uid,- kind = RegistrationCeremony,- optionsBlob = optionsBlob,- createdAt = ts,- expiresAt = addUTCTime (pendingCeremonyTTL (webauthnConfig cfg)) ts- }+ either throwError pure+ =<< putPendingCeremony+ PendingCeremony+ { authenticationGeneration = Just user.authenticationGeneration,+ initiatingSession = sourceSession,+ ceremonyId = ceremonyId,+ userId = Just uid,+ kind = RegistrationCeremony,+ optionsBlob = optionsBlob,+ createdAt = ts,+ expiresAt = addUTCTime (pendingCeremonyTTL (webauthnConfig cfg)) ts+ } pure (ceremonyId, optionsJson) completePasskeyRegistration ::@@ -124,17 +129,19 @@ completePasskeyRegistration cfg uid ceremonyId credentialJson mLabel = runErrorNoCallStack do when (maybe False ((> 128) . Text.length) mLabel) (throwError InvalidInput) ts <- now- PendingCeremony {kind, userId = pendingUid, optionsBlob} <-+ PendingCeremony {kind, userId = pendingUid, optionsBlob, authenticationGeneration, initiatingSession} <- maybe (throwError PendingCeremonyNotFound) pure =<< takePendingCeremony ceremonyId ts -- Reject a ceremony that is not a registration, or that was begun for a different user. when (kind /= RegistrationCeremony) (throwError PendingCeremonyNotFound) when (pendingUid /= Just uid) (throwError PendingCeremonyNotFound)+ generation <- maybe (throwError StaleAuthentication) pure authenticationGeneration VerifiedRegistration {credentialId, userHandle, publicKey, signCounter, transports} <- either (throwError . WebAuthnCeremonyError) pure =<< completeRegistrationCeremony optionsBlob credentialJson passkey <- either throwError pure =<< createPasskey+ (AuthenticationGuard generation initiatingSession Nothing) cfg.maxPasskeysPerUser NewPasskeyCredential { userId = uid,
+ src/Shomei/Session/Authentication/Guard.hs view
@@ -0,0 +1,18 @@+-- | State observed before checking a proof. Persistence checks it under the user lock.+module Shomei.Session.Authentication.Guard (AuthenticationGuard (..), userGuard) where++import Data.Int (Int64)+import Shomei.Account.User.Domain (User (..))+import Shomei.Id (PasskeyId, SessionId)+import Shomei.Prelude++data AuthenticationGuard = AuthenticationGuard+ { generation :: !Int64,+ initiatingSession :: !(Maybe SessionId),+ assertedPasskey :: !(Maybe PasskeyId)+ }+ deriving stock (Generic, Eq, Show)+ deriving anyclass (FromJSON, ToJSON)++userGuard :: User -> AuthenticationGuard+userGuard user = AuthenticationGuard user.authenticationGeneration Nothing Nothing
src/Shomei/Session/Authentication/Workflow.hs view
@@ -60,6 +60,7 @@ import Shomei.Passkey.Ceremony.Store (PendingCeremonyStore) import Shomei.Passkey.Store (PasskeyStore, countPasskeysByUser) import Shomei.Prelude+import Shomei.Session.Authentication.Guard (userGuard) import Shomei.Session.Command (ClientContext (..), LoginCommand (..), LogoutCommand (..), RefreshCommand (..), RefreshOrigin (..), SignupCommand (..)) import Shomei.Session.Domain (NewSession (..), Session (..), SessionKind (InteractiveSession), SessionStatus (SessionActive)) import Shomei.Session.LoginAttempt.Domain (AccountLockout (..), AttemptFactor (FactorPassword), FailureOutcome (..))@@ -156,7 +157,8 @@ -- Session row, refresh-token row, and both audit events in one transaction: a crash here -- leaves the new user with no session rather than a session with no token. (session, _token) <-- persistNewSession+ either throwError pure =<< persistNewSession+ (userGuard user) NewSession { userId = user.userId, createdAt = ts,@@ -239,12 +241,13 @@ -- time. mCred <- findPasswordCredentialByLoginId cmd.loginId cred <- maybe (failLoginTimed rl outcome ctx cmd ts) pure mCred+ -- Capture the generation before checking the password, including the non-MFA path.+ mUser <- findUserById cred.userId ok <- verifyPassword cmd.password cred.passwordHash unless ok (failLogin rl outcome ctx (Just cred.userId) ts) -- The password hash was already evaluated, so the missing-user and inactive-user branches do- -- not need a dummy hash. Keeping the user lookup after verification also leaves the common- -- wrong-password path at four database checkouts, including its audit event.- mUser <- findUserById cred.userId+ -- not need a dummy hash. The user snapshot above retains the generation observed before+ -- verification, so recovery cannot attach a newer generation to this proof. user <- maybe (failLogin rl outcome ctx (Just cred.userId) ts) pure mUser when (user.status /= UserActive) do publishNewLock rl outcome ctx ts@@ -261,16 +264,16 @@ let hasSecondFactor = passkeyCount > 0 || totpEnrolled if requireSecondFactor (mfaConfig cfg) && hasSecondFactor then do- (cid, optionsJson, methods) <- prepareMfaChallenge cfg user ts+ (cid, optionsJson, methods) <- either throwError pure =<< prepareMfaChallenge cfg user ts -- A correct password that advances to MFA is neither a failed proof nor a fully -- authenticated success. Remove its provisional row without resetting earlier failures. discardLoginAttempt outcome.attemptId when outcome.lockedNow (clearAccountLockout ctx.accountKey) pure (MfaRequired MfaChallenge {ceremonyId = cid, options = optionsJson, methods = methods}) else do+ (_sid, pair) <- either throwError pure =<< issueSession cfg cmd.remember user ts convertLoginAttemptToSuccess outcome.attemptId when (outcome.lockedNow || isJust outcome.priorLockout) (clearAccountLockout ctx.accountKey)- (_sid, pair) <- issueSession cfg cmd.remember user ts pure (LoginComplete user pair) -- | 'failLogin' preceded by a dummy Argon2id verification, for the login paths that fail@@ -422,6 +425,7 @@ } (Event.RefreshTokenRotated (Event.RefreshTokenRotatedData tok.sessionId tok.refreshTokenId ts)) case outcome of+ RotationInvalid -> pure (Left SessionRevoked) RotationConflict -> reuseDetected tok ts Rotated _ -> do -- Re-running the enrichment here is what makes a role change take
src/Shomei/Session/Domain.hs view
@@ -3,6 +3,9 @@ module Shomei.Session.Domain ( SessionStatus (..), SessionKind (..),+ sessionKindToText,+ sessionKindFromText,+ sessionInvolves, Session (..), NewSession (..), )@@ -30,6 +33,21 @@ deriving stock (Generic, Eq, Show) deriving anyclass (FromJSON, ToJSON) +-- | The one spelling of a session kind, shared by persistence and the introspection+-- @session_kind@ member so the stored value and the wire value cannot drift.+sessionKindToText :: SessionKind -> Text+sessionKindToText = \case+ InteractiveSession -> "interactive"+ MachineSession -> "machine"+ DelegatedSession -> "delegated"++sessionKindFromText :: Text -> Either Text SessionKind+sessionKindFromText = \case+ "interactive" -> Right InteractiveSession+ "machine" -> Right MachineSession+ "delegated" -> Right DelegatedSession+ t -> Left ("unknown session kind: " <> t)+ data Session = Session { sessionId :: !SessionId, userId :: !UserId,@@ -81,3 +99,9 @@ } deriving stock (Generic, Eq, Show) deriving anyclass (FromJSON, ToJSON)++-- | Is this principal the session's subject or its delegated actor? Revoking a principal's+-- sessions uses this, so a suspended operator or revoked service account also loses the+-- delegated sessions in which it acts for somebody else.+sessionInvolves :: UserId -> Session -> Bool+sessionInvolves uid session = session.userId == uid || session.actor == Just uid
src/Shomei/Session/UnitOfWork/Store.hs view
@@ -21,6 +21,7 @@ NewSessionToken (..), RotationOutcome (..), persistNewSession,+ resetSecondFactors, rotateRefreshToken, completePasswordReset, completePasswordChange,@@ -31,10 +32,14 @@ import Effectful (Dispatch (..), DispatchOf, Eff, Effect, (:>)) import Effectful.Dispatch.Dynamic (send)+import Shomei.Account.Admin.Recovery.Domain (RecoveryActor, RecoveryCommand, RecoveryResult)+import Shomei.Account.Email.Domain (Email) import Shomei.Account.Password.Domain (PasswordHash) import Shomei.Audit.Event.Domain (AuthEvent)+import Shomei.Error (AuthError) import Shomei.Id (PasswordResetTokenId, RefreshTokenId, SessionId, UserId) import Shomei.Prelude+import Shomei.Session.Authentication.Guard (AuthenticationGuard) import Shomei.Session.Domain (NewSession, Session) import Shomei.Session.RefreshToken.Domain (NewRefreshToken, PersistedRefreshToken, RefreshTokenHash) @@ -60,6 +65,7 @@ -- confirmation. data RotationOutcome = Rotated !PersistedRefreshToken+ | RotationInvalid | RotationConflict deriving stock (Generic, Eq, Show) @@ -72,11 +78,13 @@ -- @UserRegistered@ + @SessionStarted@, login and MFA completion publish @LoginSucceeded@ + -- @SessionStarted@. The builder lets each caller author its own events in the workflow layer -- while the interpreter supplies the id.+ ResetUserSecondFactors :: RecoveryActor -> UserId -> RecoveryCommand -> UTCTime -> AuthUnitOfWork m (Either AuthError (RecoveryResult, Maybe Email)) PersistNewSession ::+ AuthenticationGuard -> NewSession -> NewSessionToken -> (SessionId -> [AuthEvent]) ->- AuthUnitOfWork m (Session, PersistedRefreshToken)+ AuthUnitOfWork m (Either AuthError (Session, PersistedRefreshToken)) -- | Mark the presented refresh token used, insert its replacement, and record the rotation -- event — atomically. The 'UTCTime' is the @used_at@ stamp for the token being retired. --@@ -119,11 +127,12 @@ -- | Atomically persist a new session, its first refresh token, and the events naming it. persistNewSession :: (AuthUnitOfWork :> es) =>+ AuthenticationGuard -> NewSession -> NewSessionToken -> (SessionId -> [AuthEvent]) ->- Eff es (Session, PersistedRefreshToken)-persistNewSession ns nst mkEvents = send (PersistNewSession ns nst mkEvents)+ Eff es (Either AuthError (Session, PersistedRefreshToken))+persistNewSession proofState ns nst mkEvents = send (PersistNewSession proofState ns nst mkEvents) -- | Atomically retire a refresh token and issue its replacement, or report a conflict. rotateRefreshToken ::@@ -171,3 +180,6 @@ -- Arguments are actor, target and the application clock timestamp. Returns the winner count. revokeUserSessionsWithAudit :: (AuthUnitOfWork :> es) => UserId -> UserId -> UTCTime -> Eff es Int revokeUserSessionsWithAudit actor target ts = send (RevokeUserSessionsWithAudit actor target ts)++resetSecondFactors :: (AuthUnitOfWork :> es) => RecoveryActor -> UserId -> RecoveryCommand -> UTCTime -> Eff es (Either AuthError (RecoveryResult, Maybe Email))+resetSecondFactors actor uid cmd ts = send (ResetUserSecondFactors actor uid cmd ts)
src/Shomei/Session/Workflow.hs view
@@ -30,6 +30,7 @@ import Data.Set qualified as Set import Data.Time (addUTCTime) import Effectful (Eff, (:>))+import Effectful.Error.Static (runErrorNoCallStack, throwError) import Shomei.Account.User.Domain (User (..)) import Shomei.Audit.Event.Domain qualified as Event import Shomei.Authorization.Claims.Domain (AuthClaims (..), Scope, mkExtraClaims, noExtraClaims)@@ -39,6 +40,7 @@ import Shomei.Error (AuthError (..)) import Shomei.Id (SessionId, UserId) import Shomei.Prelude+import Shomei.Session.Authentication.Guard (AuthenticationGuard, userGuard) import Shomei.Session.Domain (NewSession (..), Session (..), SessionKind (InteractiveSession), SessionStatus (SessionActive)) import Shomei.Session.Store (SessionStore, findSessionById) import Shomei.Session.Token.Domain (TokenPair (..))@@ -158,12 +160,13 @@ extraScopes :: !(Set Scope), -- | the person asked to stay signed in: the session lasts 'rememberedSessionTTL' instead of -- 'sessionTTL' and every token pair it yields reports @remembered@.- remember :: !Bool+ remember :: !Bool,+ authenticationGuard :: !(Maybe AuthenticationGuard) } deriving stock (Generic, Eq, Show) defaultSessionOptions :: SessionOptions-defaultSessionOptions = SessionOptions {oauthClientId = Nothing, extraScopes = Set.empty, remember = False}+defaultSessionOptions = SessionOptions {oauthClientId = Nothing, extraScopes = Set.empty, remember = False, authenticationGuard = Nothing} issueSession :: ( AuthUnitOfWork :> es,@@ -177,10 +180,8 @@ Bool -> User -> UTCTime ->- Eff es (SessionId, TokenPair)-issueSession cfg remember user ts = do- (sid, pair, _claims) <- issueSessionWith cfg defaultSessionOptions {remember} user ts- pure (sid, pair)+ Eff es (Either AuthError (SessionId, TokenPair))+issueSession cfg remember user ts = fmap (fmap (\(sid, pair, _) -> (sid, pair))) (issueSessionWith cfg defaultSessionOptions {remember} user ts) -- | 'issueSession' with the OAuth-specific knobs, and returning the claims it signed. --@@ -198,13 +199,14 @@ SessionOptions -> User -> UTCTime ->- Eff es (SessionId, TokenPair, AuthClaims)-issueSessionWith cfg opts user ts = do+ Eff es (Either AuthError (SessionId, TokenPair, AuthClaims))+issueSessionWith cfg opts user ts = runErrorNoCallStack do rawToken <- generateOpaqueToken tokHash <- hashRefreshToken rawToken let sessionExpiresAt = addUTCTime (if opts.remember then cfg.rememberedSessionTTL else cfg.sessionTTL) ts (session, _token) <-- persistNewSession+ either throwError pure =<< persistNewSession+ (fromMaybe (userGuard user) opts.authenticationGuard) NewSession { userId = user.userId, createdAt = ts,
src/Shomei/Test/InMemory.hs view
@@ -78,6 +78,7 @@ import Data.UUID qualified as UUID import Effectful (Eff, IOE, runEff, (:>)) import Effectful.Dispatch.Dynamic (interpret_)+import Shomei.Account.Admin.Recovery.Domain import Shomei.Account.Credential.Domain (Credential (..)) import Shomei.Account.Credential.Store (CredentialStore (..)) import Shomei.Account.LoginId.Domain (LoginId)@@ -106,7 +107,7 @@ import Shomei.Authorization.Claims.Domain (AuthClaims, Issuer (..), Permission (..), Role (..)) import Shomei.Authorization.Claims.Store (ClaimsDelta, ClaimsEnricher, emptyClaimsDelta, runClaimsEnricherNull, runClaimsEnricherPure) import Shomei.Authorization.Role.Store (RoleDefinition (..), RoleStore (..))-import Shomei.Error (AuthError (PasskeyLimitReached, SessionLimitReached), TokenError (..))+import Shomei.Error (AuthError (InvalidUserStatus, PasskeyLimitReached, SessionLimitReached, StaleAuthentication, UserNotFound), TokenError (..)) import Shomei.Id ( CeremonyId, LoginAttemptId,@@ -178,7 +179,8 @@ ServiceAccountStatus (..), ) import Shomei.ServiceAccount.Store (ServiceAccountStore (..))-import Shomei.Session.Domain (NewSession (..), Session (..), SessionKind (..), SessionStatus (..))+import Shomei.Session.Authentication.Guard (AuthenticationGuard (..))+import Shomei.Session.Domain (NewSession (..), Session (..), SessionKind (..), SessionStatus (..), sessionInvolves) import Shomei.Session.LoginAttempt.Domain ( AccountKey, AccountLockout (..),@@ -356,7 +358,8 @@ status = UserActive, emailVerifiedAt = Nothing, createdAt = w.clock,- updatedAt = w.clock+ updatedAt = w.clock,+ authenticationGeneration = 0 } liftIO (modifyWorld ref (#users %~ Map.insert uid u)) pure u@@ -453,8 +456,8 @@ RevokeAllUserSessions uid t -> liftIO ( atomicModifyIORef' ref \w ->- let winners = [s.sessionId | s <- Map.elems w.sessions, s.userId == uid, s.status == SessionActive]- in (w & #sessions %~ Map.map (\s -> if s.userId == uid then revoke t s else s), winners)+ let winners = [s.sessionId | s <- Map.elems w.sessions, sessionInvolves uid s, s.status == SessionActive]+ in (w & #sessions %~ Map.map (\s -> if sessionInvolves uid s then revoke t s else s), winners) ) ListSessionPage uid query -> liftIO do w <- readIORef ref@@ -634,7 +637,7 @@ -- a workflow authors ends up at the head. runAuthUnitOfWork :: (IOE :> es) => IORef World -> Eff (AuthUnitOfWork : es) a -> Eff es a runAuthUnitOfWork ref = interpret_ \case- PersistNewSession ns nst mkEvents -> do+ PersistNewSession proofState ns nst mkEvents -> do sid <- genSessionId rid <- genRefreshTokenId let session = mkSession sid ns@@ -649,21 +652,29 @@ persisted = mkPersisted rid newToken events = mkEvents sid liftIO- ( modifyWorld- ref- ( (#sessions %~ Map.insert sid session)- . (#refreshTokens %~ Map.insert rid persisted)- . (#refreshByHash %~ Map.insert nst.tokenHash rid)- . (#publishedEvents %~ (reverse events <>))- )+ ( atomicModifyIORef' ref \w ->+ if authenticationValid w ns.userId proofState ns.createdAt+ then+ ( w+ & #sessions+ %~ Map.insert sid session+ & #refreshTokens+ %~ Map.insert rid persisted+ & #refreshByHash+ %~ Map.insert nst.tokenHash rid+ & #publishedEvents+ %~ (reverse events <>),+ Right (session, persisted)+ )+ else (w, Left StaleAuthentication) )- pure (session, persisted) RotateRefreshToken presentedId usedAt newToken ev -> do rid <- genRefreshTokenId let persisted = mkPersisted rid newToken liftIO ( atomicModifyIORef' ref \w -> case Map.lookup presentedId w.refreshTokens of Just tok+ | not (maybe False (\s -> s.status == SessionActive && s.expiresAt > usedAt) (Map.lookup tok.sessionId w.sessions)) -> (w, RotationInvalid) | tok.status == RefreshTokenActive -> ( w & #refreshTokens@@ -713,10 +724,61 @@ & #publishedEvents %~ (reverse events <>) )+ ResetUserSecondFactors actor uid cmd ts ->+ liftIO+ ( atomicModifyIORef' ref \w ->+ case Map.lookup uid w.users of+ Nothing -> (w, Left UserNotFound)+ Just user | user.status /= UserActive -> (w, Left InvalidUserStatus)+ Just user ->+ let mine s = s.userId == uid+ winners = [s | s <- Map.elems w.sessions, mine s, s.status == SessionActive]+ userTokens = [t | t <- Map.elems w.refreshTokens, maybe False mine (Map.lookup t.sessionId w.sessions), t.status /= RefreshTokenRevoked]+ myCeremony PendingCeremony {userId} = userId == Just uid+ myTotp TotpCredential {userId} = userId == uid+ myCode RecoveryCode {userId} = userId == uid+ myAuthCode AuthorizationCode {userId} = userId == uid+ counts =+ RecoveryCounts+ (length (filter ((== uid) . pkUserId) (Map.elems w.passkeys)))+ (length (filter myTotp (Map.elems w.totpCredentials)))+ (length (filter myCode (Map.elems w.recoveryCodes)))+ (length (filter myCeremony (Map.elems w.pendingCeremonies)))+ (length winners)+ (length userTokens)+ (length (filter myAuthCode (Map.elems w.oauthCodes)))+ (length [t | t <- Map.elems w.passwordResetTokens, t.userId == uid, t.status == OneTimeTokenActive])+ events =+ Event.UserSecondFactorsReset (Event.UserSecondFactorsResetData uid actor cmd.caseReference counts ts)+ : [Event.SessionRevoked (Event.SessionRevokedData s.sessionId (recoveryActorUser actor) ts) | s <- winners]+ w' =+ w+ & #users+ %~ Map.insert uid (user & #authenticationGeneration %~ (+ 1))+ & #passkeys+ %~ Map.filter ((/= uid) . pkUserId)+ & #totpCredentials+ %~ Map.filter (not . myTotp)+ & #recoveryCodes+ %~ Map.filter (not . myCode)+ & #pendingCeremonies+ %~ Map.filter (not . myCeremony)+ & #oauthCodes+ %~ Map.filter (not . myAuthCode)+ & #passwordResetTokens+ %~ Map.map (\t -> if t.userId == uid && t.status == OneTimeTokenActive then t & #status .~ OneTimeTokenRevoked & #revokedAt .~ Just ts else t)+ & #sessions+ %~ Map.map (revokeUserSession uid ts)+ & #refreshTokens+ %~ Map.map (revokeUserRefreshToken w.sessions uid ts)+ & #publishedEvents+ %~ (reverse events <>)+ in (w', Right (RecoveryResult ts counts (isJust user.email && isJust user.emailVerifiedAt), if isJust user.emailVerifiedAt then user.email else Nothing))+ ) RevokeUserSessionsWithAudit actor uid ts -> liftIO ( atomicModifyIORef' ref \w ->- let winners = [s | s <- Map.elems w.sessions, s.userId == uid, s.status == SessionActive]+ let winners = [s | s <- Map.elems w.sessions, sessionInvolves uid s, s.status == SessionActive] ids = Set.fromList (map (.sessionId) winners) events = [Event.SessionRevoked (Event.SessionRevokedData s.sessionId (Just actor) ts) | s <- winners] in ( w@@ -758,7 +820,7 @@ | credential.userId == uid = credential & #passwordHash .~ h & #updatedAt .~ ts | otherwise = credential revokeUserSession uid t session- | session.userId == uid,+ | sessionInvolves uid session, session.status == SessionActive = revokeSessionAt t session | otherwise = session@@ -973,7 +1035,7 @@ runPasskeyStore :: (IOE :> es) => IORef World -> Eff (PasskeyStore : es) a -> Eff es a runPasskeyStore ref = interpret_ \case- CreatePasskey limit NewPasskeyCredential {userId, credentialId, userHandle, publicKey, signCounter, transports, label, createdAt} -> do+ CreatePasskey proofState limit NewPasskeyCredential {userId, credentialId, userHandle, publicKey, signCounter, transports, label, createdAt} -> do pid <- genPasskeyId let pc = PasskeyCredential@@ -990,9 +1052,12 @@ } liftIO ( atomicModifyIORef' ref \w ->- if limit < 1 || limit > 100 || length [p | p <- Map.elems w.passkeys, pkUserId p == userId] >= limit- then (w, Left PasskeyLimitReached)- else (w & #passkeys %~ Map.insert pid pc, Right pc)+ if not (authenticationValid w userId proofState createdAt)+ then (w, Left StaleAuthentication)+ else+ if limit < 1 || limit > 100 || length [p | p <- Map.elems w.passkeys, pkUserId p == userId] >= limit+ then (w, Left PasskeyLimitReached)+ else (w & #passkeys %~ Map.insert pid pc, Right pc) ) FindPasskeysByUser uid -> liftIO ((\w -> [p | p <- Map.elems w.passkeys, pkUserId p == uid]) <$> readIORef ref)@@ -1015,8 +1080,17 @@ runPendingCeremonyStore :: (IOE :> es) => IORef World -> Eff (PendingCeremonyStore : es) a -> Eff es a runPendingCeremonyStore ref = interpret_ \case- PutPendingCeremony pc ->- liftIO (modifyWorld ref (#pendingCeremonies %~ Map.insert (pcCeremonyId pc) pc))+ PutPendingCeremony pc@PendingCeremony {userId, authenticationGeneration, initiatingSession, createdAt} ->+ liftIO+ ( atomicModifyIORef' ref \w ->+ let valid = case (userId, authenticationGeneration) of+ (Nothing, _) -> True+ (Just uid, Just generation) -> authenticationValid w uid (AuthenticationGuard generation initiatingSession Nothing) createdAt+ _ -> False+ in if valid+ then (w & #pendingCeremonies %~ Map.insert (pcCeremonyId pc) pc, Right ())+ else (w, Left StaleAuthentication)+ ) TakePendingCeremony cid now' -> liftIO do atomicModifyIORef' ref \w -> case Map.lookup cid w.pendingCeremonies of Nothing -> (w, Nothing)@@ -1072,7 +1146,15 @@ liftIO ( modifyWorld ref- (#serviceAccounts %~ Map.adjust (\sa -> sa & #status .~ ServiceAccountRevoked & #revokedAt .~ Just t) sid)+ ( \w ->+ let backing = (\ServiceAccount {userId} -> userId) <$> Map.lookup sid w.serviceAccounts+ held s = s.status == SessionActive && s.kind /= InteractiveSession && maybe False (`sessionInvolves` s) backing+ in w+ & #serviceAccounts+ %~ Map.adjust (\sa -> sa & #status .~ ServiceAccountRevoked & #revokedAt .~ Just t) sid+ & #sessions+ %~ Map.map (\s -> if held s then s & #status .~ SessionRevoked & #revokedAt .~ Just t else s)+ ) ) -- | Field accessors for the EP-5 OAuth-client records, for the same 'DuplicateRecordFields'@@ -1135,10 +1217,11 @@ -- racing consumes of one code, exactly one sees an unconsumed row. runOAuthCodeStore :: (IOE :> es) => IORef World -> Eff (OAuthCodeStore : es) a -> Eff es a runOAuthCodeStore ref = interpret_ \case- PutAuthorizationCode NewAuthorizationCode {codeHash, clientId, redirectUri, userId, scopes, nonce, codeChallenge, authTime, createdAt, expiresAt} -> do+ PutAuthorizationCode proofState NewAuthorizationCode {codeHash, clientId, redirectUri, userId, scopes, nonce, codeChallenge, authTime, createdAt, expiresAt} -> do let code = AuthorizationCode- { codeHash,+ { authenticationGeneration = Just proofState.generation,+ codeHash, clientId, redirectUri, userId,@@ -1151,7 +1234,12 @@ consumedAt = Nothing, sessionId = Nothing }- liftIO (modifyWorld ref (#oauthCodes %~ Map.insert codeHash code))+ liftIO+ ( atomicModifyIORef' ref \w ->+ if authenticationValid w userId proofState createdAt+ then (w & #oauthCodes %~ Map.insert codeHash code, Right ())+ else (w, Left StaleAuthentication)+ ) ConsumeAuthorizationCode h t -> liftIO ( atomicModifyIORef' ref \w ->@@ -1198,22 +1286,32 @@ -- encryption boundary is PostgreSQL-only (Decision Log). runTotpCredentialStore :: (IOE :> es) => IORef World -> Eff (TotpCredentialStore : es) a -> Eff es a runTotpCredentialStore ref = interpret_ \case- UpsertTotpEnrollment NewTotpCredential {totpCredentialId, userId, secret, createdAt} -> do+ UpsertTotpEnrollment proofState NewTotpCredential {totpCredentialId, userId, secret, createdAt} -> do let tc = TotpCredential- { totpCredentialId,+ { authenticationGeneration = Just proofState.generation,+ totpCredentialId, userId, secret, lastUsedCounter = Nothing, confirmedAt = Nothing, createdAt }- liftIO (modifyWorld ref (#totpCredentials %~ Map.insert userId tc))- pure tc+ liftIO+ ( atomicModifyIORef' ref \w ->+ if authenticationValid w userId proofState createdAt+ then (w & #totpCredentials %~ Map.insert userId tc, Right tc)+ else (w, Left StaleAuthentication)+ ) FindTotpByUser uid -> liftIO ((Map.lookup uid . (.totpCredentials)) <$> readIORef ref)- ConfirmTotp tcid t ->- liftIO (modifyWorld ref (#totpCredentials %~ Map.map (\c -> if tcId c == tcid then c & #confirmedAt .~ Just t else c)))+ ConfirmTotp uid proofState tcid t ->+ liftIO+ ( atomicModifyIORef' ref \w ->+ if authenticationValid w uid proofState t+ then (w & #totpCredentials %~ Map.map (\c -> if tcId c == tcid then c & #confirmedAt .~ Just t else c), Right ())+ else (w, Left StaleAuthentication)+ ) SetTotpLastUsedCounter tcid c -> liftIO ( casWorld ref \w ->@@ -1223,6 +1321,13 @@ Just (w & #totpCredentials %~ Map.insert uid (tc & #lastUsedCounter .~ Just c)) _ -> Nothing )+ RemoveTotpCredential uid proofState tcid ts ->+ liftIO+ ( atomicModifyIORef' ref \w ->+ if authenticationValid w uid proofState ts+ then (w & #totpCredentials %~ Map.filter (\tc -> tcId tc /= tcid || tc.userId /= uid), Right ())+ else (w, Left StaleAuthentication)+ ) DeleteTotpByUser uid -> liftIO (modifyWorld ref (#totpCredentials %~ Map.delete uid)) @@ -1246,7 +1351,7 @@ -- sees it unused. 'ReplaceRecoveryCodes' drops the user's whole set and inserts the new one. runRecoveryCodeStore :: (IOE :> es) => IORef World -> Eff (RecoveryCodeStore : es) a -> Eff es a runRecoveryCodeStore ref = interpret_ \case- ReplaceRecoveryCodes uid newCodes -> liftIO do+ ReplaceRecoveryCodes uid proofState ts newCodes -> liftIO do let fresh = [ ( nc.recoveryCodeId, RecoveryCode@@ -1259,9 +1364,10 @@ ) | nc <- newCodes ]- modifyWorld- ref- (#recoveryCodes %~ (\m -> Map.union (Map.fromList fresh) (Map.filter (\rc -> rcUserId rc /= uid) m)))+ atomicModifyIORef' ref \w ->+ if authenticationValid w uid proofState ts+ then (w & #recoveryCodes %~ (\m -> Map.union (Map.fromList fresh) (Map.filter (\rc -> rcUserId rc /= uid) m)), Right ())+ else (w, Left StaleAuthentication) ConsumeRecoveryCode uid h t -> liftIO ( casWorld ref \w ->@@ -1570,3 +1676,9 @@ . runCredentialStore ref . runRoleStore ref . runUserStore ref++authenticationValid :: World -> UserId -> AuthenticationGuard -> UTCTime -> Bool+authenticationValid w uid proofState ts =+ maybe False (\u -> u.status == UserActive && u.authenticationGeneration == proofState.generation) (Map.lookup uid w.users)+ && maybe True (\sid -> maybe False (\s -> s.userId == uid && s.status == SessionActive && s.expiresAt > ts) (Map.lookup sid w.sessions)) proofState.initiatingSession+ && maybe True (\pid -> maybe False ((== uid) . pkUserId) (Map.lookup pid w.passkeys)) proofState.assertedPasskey
test/Shomei/Account/Admin/WorkflowSpec.hs view
@@ -8,14 +8,17 @@ import Control.Concurrent.Async (mapConcurrently) import Control.Monad (replicateM) import Data.IORef (IORef, newIORef, readIORef)+import Data.Map.Strict qualified as Map import Data.Time (UTCTime (..), fromGregorian) import Effectful (Eff)+import Shomei.Account.Admin.Recovery import Shomei.Account.Admin.Workflow (deleteUser, reinstateUser, revokeOneSession, revokeUserSessions, suspendUser) import Shomei.Account.Email.Domain (mkEmail) import Shomei.Account.LoginId.Domain (LoginId, mkLoginId)+import Shomei.Account.Notification.Domain qualified as Notification import Shomei.Account.Password.Domain (PlainPassword (..)) import Shomei.Account.User.Domain (User (..), UserStatus (..))-import Shomei.Account.User.Store (findUserById)+import Shomei.Account.User.Store (findUserById, markUserEmailVerified) import Shomei.Audit.Event.Domain qualified as Event import Shomei.Authorization.Claims.Domain (Audience (..), Issuer (..)) import Shomei.Config (ShomeiConfig, defaultShomeiConfig)@@ -28,6 +31,7 @@ import Shomei.Session.LoginAttempt.Domain (AccountKey (..), ClientIp (..)) import Shomei.Session.Store (listSessionsForUser) import Shomei.Test.InMemory (World (..), emptyWorld, runInMemory)+import Shomei.Time.Store (now) import Test.Tasty (TestTree, testGroup) import Test.Tasty.HUnit (assertBool, assertFailure, testCase, (@?=)) @@ -35,7 +39,10 @@ tests = testGroup "Shomei.Account.Admin.Workflow"- [ testSuspendFlipsStatusRevokesSessionsAndRecordsActor,+ [ testRecoveryValidation,+ testRecoveryStateAndNotification,+ testRecoveryTargetStatus,+ testSuspendFlipsStatusRevokesSessionsAndRecordsActor, testConcurrentSuspendsAuditOnce, testStrictTransitions, testDeleteIsTerminal,@@ -234,3 +241,65 @@ sum <$> traverse (either (assertFailure . show) pure) results >>= (@?= 1) events <- (.publishedEvents) <$> readIORef ref length [() | Event.SessionRevoked _ <- events] @?= 1++testRecoveryValidation :: TestTree+testRecoveryValidation = testCase "recovery rejects missing identity assertion and unbounded or unsafe labels before writes" $ withWorld \ref -> do+ (user, _) <- runInMemory ref (signup cfg signupCmd) >>= either (assertFailure . show) pure+ before <- readIORef ref+ let invalid =+ [ (LocalOperator "ops", RecoveryCommand False "INC-1"),+ (LocalOperator "ops", RecoveryCommand True ""),+ (LocalOperator "ops", RecoveryCommand True (mconcat (replicate 129 "x"))),+ (LocalOperator "operator with spaces", RecoveryCommand True "INC-1"),+ (LocalOperator "ops", RecoveryCommand True "secret\nidentity-evidence"),+ (LocalOperator "ops", RecoveryCommand True "非ASCII")+ ]+ results <- mapM (\(actor, command) -> runInMemory ref (resetUserSecondFactors actor user.userId command)) invalid+ results @?= replicate (length invalid) (Left InvalidInput)+ after <- readIORef ref+ after.users @?= before.users+ after.sessions @?= before.sessions+ after.publishedEvents @?= before.publishedEvents+ after.sentNotifications @?= []++testRecoveryStateAndNotification :: TestTree+testRecoveryStateAndNotification = testCase "recovery preserves password/policy, invalidates sessions every time, and notifies only verified contacts" $ withWorld \ref -> do+ (user, _) <- runInMemory ref (signup cfg signupCmd) >>= either (assertFailure . show) pure+ before <- readIORef ref+ first <- runInMemory ref (resetUserSecondFactors (LocalOperator "ops.console") user.userId (RecoveryCommand True "INC-1")) >>= either (assertFailure . show) pure+ first.counts.sessionsRevoked @?= 1+ first.verifiedNotificationDestination @?= False+ after <- readIORef ref+ after.credsByLoginId @?= before.credsByLoginId+ after.sentNotifications @?= []+ fmap (.authenticationGeneration) (Map.lookup user.userId after.users) @?= Just 1+ runInMemory ref (now >>= markUserEmailVerified user.userId)+ second <- runInMemory ref (resetUserSecondFactors (AuthenticatedAdministrator user.userId) user.userId (RecoveryCommand True "INC-2")) >>= either (assertFailure . show) pure+ second.counts.sessionsRevoked @?= 0+ second.verifiedNotificationDestination @?= True+ final <- readIORef ref+ case final.sentNotifications of+ [Notification.SecondFactorsReset {email}] -> Just email @?= user.email+ other -> assertFailure ("expected established contact notice, got " <> show other)+ let resetEvents = [d | Event.UserSecondFactorsReset d <- final.publishedEvents]+ length resetEvents @?= 2+ map (.recoveryActor) resetEvents @?= [AuthenticatedAdministrator user.userId, LocalOperator "ops.console"]+ loginResult <- runInMemory ref (login cfg ctx loginCmd)+ case loginResult of+ Right (LoginComplete _ _) -> pure ()+ other -> assertFailure ("preserved password should work: " <> show other)++testRecoveryTargetStatus :: TestTree+testRecoveryTargetStatus = testCase "recovery refuses missing, suspended and deleted targets" $ withWorld \ref -> do+ missing <- genUserId+ absent <- runInMemory ref (resetUserSecondFactors (LocalOperator "ops") missing (RecoveryCommand True "INC-1"))+ absent @?= Left UserNotFound+ (user, _) <- runInMemory ref (signup cfg signupCmd) >>= either (assertFailure . show) pure+ _ <- runInMemory ref (suspendUser missing user.userId)+ suspended <- runInMemory ref (resetUserSecondFactors (LocalOperator "ops") user.userId (RecoveryCommand True "INC-1"))+ suspended @?= Left InvalidUserStatus+ _ <- runInMemory ref (deleteUser missing user.userId)+ deleted <- runInMemory ref (resetUserSecondFactors (LocalOperator "ops") user.userId (RecoveryCommand True "INC-1"))+ deleted @?= Left InvalidUserStatus+ world <- readIORef ref+ length [() | Event.UserSecondFactorsReset _ <- world.publishedEvents] @?= 0
test/Shomei/Account/Verification/WorkflowSpec.hs view
@@ -34,6 +34,7 @@ WebAuthnCredentialId (..), ) import Shomei.Passkey.Store (createPasskey)+import Shomei.Session.Authentication.Guard (AuthenticationGuard (..)) import Shomei.Session.Authentication.Workflow (login, refresh, signup) import Shomei.Session.Command (ClientContext (..), LoginCommand (..), ProofContext (..), RefreshCommand (..), SignupCommand (..)) import Shomei.Session.LoginAttempt.Domain (AccountKey (..), ClientIp (..))@@ -119,6 +120,7 @@ runInMemory ref ( createPasskey+ (AuthenticationGuard 0 Nothing Nothing) 20 NewPasskeyCredential { userId = uid,
test/Shomei/Audit/Event/CodecSpec.hs view
@@ -5,8 +5,7 @@ -- against the @event_type@/payload mapping drifting from the writer. -- -- If a new 'AuthEvent' constructor is added, add a case here (and the @event_type@ string is--- exercised by the writer's mapping). The @allEventTypes@ count assertion catches a missing--- constructor cheaply.+-- exercised by the writer's mapping). The vocabulary assertion checks these fixtures too. module Shomei.Audit.Event.CodecSpec (tests) where import Data.Aeson (ToJSON, toJSON)@@ -16,9 +15,10 @@ import Data.Text qualified as Text import Data.Time (UTCTime (..), fromGregorian, secondsToDiffTime) import Data.UUID qualified as UUID+import Shomei.Account.Admin.Recovery.Domain import Shomei.Account.Email.Domain (Email, emailText, mkEmail) import Shomei.Account.LoginId.Domain (LoginId, mkLoginId)-import Shomei.Audit.Event.Codec (reconstructAuthEvent)+import Shomei.Audit.Event.Codec (knownAuthEventTypes, projectAuthEvent, reconstructAuthEvent) import Shomei.Audit.Event.Domain import Shomei.Authorization.Claims.Domain (Role (..), Scope (..)) import Shomei.Config (ServiceAccountId (..))@@ -73,9 +73,14 @@ aliceLogin = either (error . show) id (mkLoginId (emailText aliceEmail)) -- | Assert that the event survives @project → toJSON → reconstruct@.-check :: (ToJSON a) => Text -> a -> AuthEvent -> TestTree+check :: (ToJSON a) => Text -> a -> AuthEvent -> (Text, TestTree) check ty dataRecord expected =- testCase (Text.unpack ty) (reconstructAuthEvent ty (toJSON dataRecord) @?= Right expected)+ ( ty,+ testCase (Text.unpack ty) do+ reconstructAuthEvent ty (toJSON dataRecord) @?= Right expected+ let (_, _, projected, _, _) = projectAuthEvent expected+ projected @?= ty+ ) -- Tests ---------------------------------------------------------------------- @@ -83,7 +88,7 @@ tests = testGroup "Shomei.Audit.Event.Codec"- [ testGroup "round-trips every constructor" roundTrips,+ [ testGroup "round-trips every constructor" (map snd roundTrips), testUnknownType, testConstructorCount, testOldLoginFailedDecodes,@@ -93,7 +98,7 @@ -- | One assertion per 'AuthEvent' constructor. The @event_type@ strings here MUST match -- 'Shomei.Audit.Publisher.Postgres.projectAuthEvent' verbatim.-roundTrips :: [TestTree]+roundTrips :: [(Text, TestTree)] roundTrips = [ let d = UserRegisteredData uid aliceLogin (Just aliceEmail) t0 in check "user_registered" d (UserRegistered d), let d = LoginSucceededData uid sid t0 in check "login_succeeded" d (LoginSucceeded d),@@ -110,6 +115,7 @@ let d = PasswordChangeFailedData uid t0 in check "password_change_failed" d (PasswordChangeFailed d), let d = UserSuspendedData uid (Just uid2) t0 in check "user_suspended" d (UserSuspended d), let d = UserDeletedData uid (Just uid2) t0 in check "user_deleted" d (UserDeleted d),+ let d = UserSecondFactorsResetData uid (LocalOperator "ops") "INC-1" (RecoveryCounts 1 1 10 1 1 1 0 0) t0 in check "user_second_factors_reset" d (UserSecondFactorsReset d), let d = UserReinstatedData uid (Just uid2) t0 in check "user_reinstated" d (UserReinstated d), let d = AccountLockedData (AccountKey "k-abc") (ClientIp "1.2.3.4") 5 t1 t0 in check "account_locked" d (AccountLocked d), let d = LoginThrottledData (ClientIp "1.2.3.4") 5 t0 in check "login_throttled" d (LoginThrottled d),@@ -165,10 +171,11 @@ Left _ -> pure () Right _ -> error "expected Left for unknown event_type" --- | Guard: the round-trip list must cover every 'AuthEvent' constructor (currently 42).+-- | The public vocabulary is unique and exactly matches the constructor fixtures. testConstructorCount :: TestTree-testConstructorCount =- testCase "covers all 42 AuthEvent constructors" (length roundTrips @?= 42)+testConstructorCount = testCase "known vocabulary matches every constructor fixture" do+ length knownAuthEventTypes @?= Set.size (Set.fromList knownAuthEventTypes)+ Set.fromList knownAuthEventTypes @?= Set.fromList (map fst roundTrips) -- | Historical rows contained the submitted login identifier verbatim. The new optional fields -- deliberately make those rows readable without reproducing that identifier in the typed event.
test/Shomei/Mfa/Totp/StoreSpec.hs view
@@ -11,7 +11,12 @@ import Data.Int (Int64) import Data.Maybe (isJust) import Data.Time (UTCTime (..), fromGregorian)+import Effectful (Eff, IOE, (:>))+import Shomei.Account.LoginId.Domain (mkLoginId)+import Shomei.Account.User.Domain (NewUser (..), User (..))+import Shomei.Account.User.Store (UserStore, createUser) import Shomei.Id (genRecoveryCodeId, genTotpCredentialId, genUserId)+import Shomei.Id qualified as Id import Shomei.Mfa.RecoveryCode.Store ( consumeRecoveryCode, countUnusedRecoveryCodes,@@ -26,6 +31,7 @@ setTotpLastUsedCounter, upsertTotpEnrollment, )+import Shomei.Session.Authentication.Guard (AuthenticationGuard (..)) import Shomei.Test.InMemory (World, emptyWorld, runInMemory) import Test.Tasty (TestTree, testGroup) import Test.Tasty.HUnit (testCase, (@?=))@@ -61,11 +67,11 @@ totpRoundTrip = do ref <- newWorld (created, found0, advanced, replayed, older, found1, found2) <- runInMemory ref do- u <- genUserId+ u <- newUserId tcid <- genTotpCredentialId- created <- upsertTotpEnrollment NewTotpCredential {totpCredentialId = tcid, userId = u, secret = rawSecret, createdAt = t0}+ created <- either (error . show) pure =<< upsertTotpEnrollment (AuthenticationGuard 0 Nothing Nothing) NewTotpCredential {totpCredentialId = tcid, userId = u, secret = rawSecret, createdAt = t0} found0 <- findTotpByUser u- confirmTotp tcid t0+ confirmTotp u (AuthenticationGuard 0 Nothing Nothing) tcid t0 advanced <- setTotpLastUsedCounter tcid 42 replayed <- setTotpLastUsedCounter tcid 42 older <- setTotpLastUsedCounter tcid 41@@ -84,11 +90,11 @@ totpReenrollReplaces = do ref <- newWorld (found, secondId) <- runInMemory ref do- u <- genUserId+ u <- newUserId tcid1 <- genTotpCredentialId- _ <- upsertTotpEnrollment NewTotpCredential {totpCredentialId = tcid1, userId = u, secret = rawSecret, createdAt = t0}+ _ <- either (error . show) pure =<< upsertTotpEnrollment (AuthenticationGuard 0 Nothing Nothing) NewTotpCredential {totpCredentialId = tcid1, userId = u, secret = rawSecret, createdAt = t0} tcid2 <- genTotpCredentialId- second <- upsertTotpEnrollment NewTotpCredential {totpCredentialId = tcid2, userId = u, secret = TotpSecret "09876543210987654321", createdAt = t0}+ second <- either (error . show) pure =<< upsertTotpEnrollment (AuthenticationGuard 0 Nothing Nothing) NewTotpCredential {totpCredentialId = tcid2, userId = u, secret = TotpSecret "09876543210987654321", createdAt = t0} found <- findTotpByUser u pure (found, second.totpCredentialId) -- Only one credential per user: the re-enrollment's id is what a lookup now returns.@@ -98,16 +104,16 @@ recoveryCas = do ref <- newWorld (countBefore, firstConsume, secondConsume, countAfter, countAfterReplace, oldConsume) <- runInMemory ref do- u <- genUserId+ u <- newUserId ids <- mapM (const genRecoveryCodeId) [1 :: Int, 2, 3] let mk i h = NewRecoveryCode {recoveryCodeId = i, codeHash = h, createdAt = t0}- replaceRecoveryCodes u (zipWith mk ids ["h1", "h2", "h3"])+ replaceRecoveryCodes u (AuthenticationGuard 0 Nothing Nothing) t0 (zipWith mk ids ["h1", "h2", "h3"]) countBefore <- countUnusedRecoveryCodes u firstConsume <- consumeRecoveryCode u "h1" t0 secondConsume <- consumeRecoveryCode u "h1" t0 countAfter <- countUnusedRecoveryCodes u ids2 <- mapM (const genRecoveryCodeId) [1 :: Int, 2]- replaceRecoveryCodes u (zipWith mk ids2 ["n1", "n2"])+ replaceRecoveryCodes u (AuthenticationGuard 0 Nothing Nothing) t0 (zipWith mk ids2 ["n1", "n2"]) countAfterReplace <- countUnusedRecoveryCodes u oldConsume <- consumeRecoveryCode u "h2" t0 pure (countBefore, firstConsume, secondConsume, countAfter, countAfterReplace, oldConsume)@@ -117,3 +123,11 @@ countAfter @?= 2 countAfterReplace @?= 2 oldConsume @?= False++-- Store fixtures use real users so user-row serialization has the same preconditions as SQL.+newUserId :: (UserStore :> es, IOE :> es) => Eff es Id.UserId+newUserId = do+ unique <- genUserId+ let lid = either (error . show) id (mkLoginId (Id.idText unique))+ user <- createUser (NewUser lid Nothing Nothing)+ pure user.userId
test/Shomei/Mfa/WorkflowSpec.hs view
@@ -38,6 +38,7 @@ WebAuthnCredentialId (..), ) import Shomei.Passkey.Store (createPasskey)+import Shomei.Session.Authentication.Guard (AuthenticationGuard (..)) import Shomei.Session.Authentication.Workflow (LoginResult (..), MfaChallenge (..), login, signup) import Shomei.Session.Command (ClientContext (..), LoginCommand (..), ProofContext (..), SignupCommand (..)) import Shomei.Session.LoginAttempt.Domain (AccountKey (..), AccountLockout (..), ClientIp (..))@@ -93,6 +94,7 @@ runInMemory ref ( createPasskey+ (AuthenticationGuard 0 Nothing Nothing) 20 NewPasskeyCredential { userId = uid,@@ -243,12 +245,12 @@ correct = totpCode 6 secret (totpCounter fixedTime) wrong = if correct == "000000" then "999999" else "000000" runInMemory ref do- _ <- upsertTotpEnrollment NewTotpCredential {totpCredentialId = tcid, userId = user.userId, secret, createdAt = fixedTime}- confirmTotp tcid fixedTime+ _ <- either (error . show) pure =<< upsertTotpEnrollment (AuthenticationGuard 0 Nothing Nothing) NewTotpCredential {totpCredentialId = tcid, userId = user.userId, secret, createdAt = fixedTime}+ confirmTotp user.userId (AuthenticationGuard 0 Nothing Nothing) tcid fixedTime replicateM_ 5 do- result <- runInMemory ref (removeTotp cfg proofContext user (RemoveWithCode wrong))+ result <- runInMemory ref (removeTotp cfg proofContext user Nothing (RemoveWithCode wrong)) result @?= Left TotpCodeInvalid- lockedResult <- runInMemory ref (removeTotp cfg proofContext user (RemoveWithCode correct))+ lockedResult <- runInMemory ref (removeTotp cfg proofContext user Nothing (RemoveWithCode correct)) lockedResult @?= Left TotpCodeInvalid remaining <- runInMemory ref (findTotpByUser user.userId) assertBool "the locked removal leaves the TOTP credential intact" (isJust remaining)
test/Shomei/OAuth/Authorize/WorkflowSpec.hs view
@@ -7,6 +7,9 @@ import Data.Set qualified as Set import Data.Text (Text) import Data.Time (UTCTime (..), addUTCTime, fromGregorian)+import Shomei.Account.LoginId.Domain (mkLoginId)+import Shomei.Account.User.Domain (NewUser (..), User (..))+import Shomei.Account.User.Store (createUser) import Shomei.Authorization.Claims.Domain (Audience (..), AuthClaims (..), Issuer (..), Scope (..)) import Shomei.Config (ShomeiConfig, defaultShomeiConfig) import Shomei.Id (SessionId, UserId, genOAuthClientId, genSessionId, genUserId, idText)@@ -88,7 +91,8 @@ runAuthorizeWithActor kind state storedActor claimActor = do ref <- newIORef (emptyWorld fixedTime) result <- runInMemory ref do- uid <- genUserId+ user <- createUser (NewUser (either (error . show) id (mkLoginId "authorize-fixture")) Nothing Nothing)+ let uid = user.userId actor <- if storedActor then Just <$> genUserId else pure Nothing session <- createSession
test/Shomei/OAuth/TokenGrant/WorkflowSpec.hs view
@@ -30,6 +30,7 @@ pkceChallengeFor, ) import Shomei.ServiceAccount.Secret (sha256Hex)+import Shomei.Session.Authentication.Guard (AuthenticationGuard (..)) import Shomei.Session.Authentication.Workflow (signup) import Shomei.Session.Command (SignupCommand (..)) import Shomei.Session.Token.Bearer (parseBearer)@@ -109,6 +110,7 @@ createdAt = fixedTime } putAuthorizationCode+ (AuthenticationGuard 0 Nothing Nothing) NewAuthorizationCode { codeHash = sha256Hex rawCode, clientId = client.clientId,
test/Shomei/OAuthCodeStoreSpec.hs view
@@ -21,10 +21,15 @@ import Data.Text (Text) import Data.Text qualified as Text import Data.Time (UTCTime (..), addUTCTime, fromGregorian)+import Effectful (Eff, IOE, (:>))+import Shomei.Account.LoginId.Domain (mkLoginId)+import Shomei.Account.User.Domain (NewUser (..), User (..))+import Shomei.Account.User.Store (UserStore, createUser) import Shomei.Audit.Event.Domain qualified as Event import Shomei.Authorization.Claims.Domain (Audience (..), AuthClaims (..), Issuer (..), Scope (..)) import Shomei.Config (ShomeiConfig, defaultShomeiConfig) import Shomei.Id (SessionId, UserId, genOAuthClientId, genSessionId, genUserId, idText)+import Shomei.Id qualified as Id import Shomei.OAuth.AuthorizationCode.Domain (AuthorizationCode (..), NewAuthorizationCode (..)) import Shomei.OAuth.AuthorizationCode.Store ( bindAuthorizationCodeSession,@@ -42,6 +47,7 @@ import Shomei.OAuth.Client.Domain (ClientType (..), NewOAuthClient (..), OAuthClient (..)) import Shomei.OAuth.Client.Store (createOAuthClient) import Shomei.ServiceAccount.Secret (sha256Hex)+import Shomei.Session.Authentication.Guard (AuthenticationGuard (..)) import Shomei.Session.Domain (NewSession (..), Session (..), SessionKind (InteractiveSession)) import Shomei.Session.Store (createSession) import Shomei.Test.InMemory (World (..), emptyWorld, runInMemory)@@ -159,8 +165,8 @@ consumeOnce = do ref <- newWorld (first', second') <- runInMemory ref do- uid <- genUserId- putAuthorizationCode (newCode uid (addUTCTime 60 t0) "hash-1")+ uid <- newUserId+ putAuthorizationCode (AuthenticationGuard 0 Nothing Nothing) (newCode uid (addUTCTime 60 t0) "hash-1") a <- consumeAuthorizationCode "hash-1" t0 b <- consumeAuthorizationCode "hash-1" t0 pure (a, b)@@ -172,9 +178,9 @@ bindAndFindConsumed = do ref <- newWorld (sid, found, expired) <- runInMemory ref do- uid <- genUserId+ uid <- newUserId sid <- genSessionId- putAuthorizationCode (newCode uid (addUTCTime 60 t0) "hash-bound")+ putAuthorizationCode (AuthenticationGuard 0 Nothing Nothing) (newCode uid (addUTCTime 60 t0) "hash-bound") _ <- consumeAuthorizationCode "hash-bound" t0 bindAuthorizationCodeSession "hash-bound" sid found <- findConsumedAuthorizationCode "hash-bound" t0@@ -187,8 +193,8 @@ expiredNeverConsumes = do ref <- newWorld result <- runInMemory ref do- uid <- genUserId- putAuthorizationCode (newCode uid (addUTCTime 60 t0) "hash-1")+ uid <- newUserId+ putAuthorizationCode (AuthenticationGuard 0 Nothing Nothing) (newCode uid (addUTCTime 60 t0) "hash-1") -- One second past the expiry. consumeAuthorizationCode "hash-1" (addUTCTime 61 t0) assertBool "an expired code must not consume" (isNothing result)@@ -209,7 +215,7 @@ runAuthorizeWithAllowed registeredScopes clientType params = do ref <- newWorld result <- runInMemory ref do- uid <- genUserId+ uid <- newUserId session <- createSession NewSession@@ -378,3 +384,11 @@ assertBool "'/' is not base64url" (not (isValidS256Challenge (Text.replicate 42 "a" <> "/"))) assertBool "'=' padding is not accepted" (not (isValidS256Challenge (Text.replicate 42 "a" <> "="))) assertBool "'-' and '_' are base64url" (isValidS256Challenge (Text.replicate 41 "a" <> "-_"))++-- Store fixtures use real users so user-row serialization has the same preconditions as SQL.+newUserId :: (UserStore :> es, IOE :> es) => Eff es Id.UserId+newUserId = do+ unique <- genUserId+ let lid = either (error . show) id (mkLoginId (Id.idText unique))+ user <- createUser (NewUser lid Nothing Nothing)+ pure user.userId
test/Shomei/Passkey/WorkflowSpec.hs view
@@ -114,7 +114,7 @@ enrollListRemove = do ref <- newWorld uid <- seedUser ref- (cid, opts) <- mustRight =<< runInMemory ref (beginPasskeyRegistration cfg uid)+ (cid, opts) <- mustRight =<< runInMemory ref (beginPasskeyRegistration cfg uid Nothing) pk <- mustRight =<< runInMemory ref (completePasskeyRegistration cfg uid cid (credentialJson (challengeOf opts)) (Just "YubiKey")) pkLabel pk @?= Just "YubiKey" -- list returns exactly the enrolled passkey@@ -130,7 +130,7 @@ ref <- newWorld uid <- seedUser ref otherUid <- genUserId- (cid, opts) <- mustRight =<< runInMemory ref (beginPasskeyRegistration cfg uid)+ (cid, opts) <- mustRight =<< runInMemory ref (beginPasskeyRegistration cfg uid Nothing) result <- runInMemory ref (completePasskeyRegistration cfg otherUid cid (credentialJson (challengeOf opts)) Nothing) result @?= Left PendingCeremonyNotFound @@ -146,7 +146,7 @@ consumedCeremony = do ref <- newWorld uid <- seedUser ref- (cid, opts) <- mustRight =<< runInMemory ref (beginPasskeyRegistration cfg uid)+ (cid, opts) <- mustRight =<< runInMemory ref (beginPasskeyRegistration cfg uid Nothing) _ <- mustRight =<< runInMemory ref (completePasskeyRegistration cfg uid cid (credentialJson (challengeOf opts)) Nothing) -- the ceremony was consumed by the first complete; a second is rejected again <- runInMemory ref (completePasskeyRegistration cfg uid cid (credentialJson (challengeOf opts)) Nothing)@@ -156,7 +156,7 @@ rejectedCredential = do ref <- newWorld uid <- seedUser ref- (cid, _opts) <- mustRight =<< runInMemory ref (beginPasskeyRegistration cfg uid)+ (cid, _opts) <- mustRight =<< runInMemory ref (beginPasskeyRegistration cfg uid Nothing) -- a credential whose challenge does not match the ceremony fails verification result <- runInMemory ref (completePasskeyRegistration cfg uid cid (credentialJson "not-the-challenge") Nothing) result @?= Left (WebAuthnCeremonyError WebAuthnChallengeMismatch)@@ -166,7 +166,7 @@ ref <- newWorld uid <- seedUser ref let limited = cfg {maxPasskeysPerUser = 1}- ceremonies <- forM [1 .. 2 :: Int] \_ -> mustRight =<< runInMemory ref (beginPasskeyRegistration limited uid)+ ceremonies <- forM [1 .. 2 :: Int] \_ -> mustRight =<< runInMemory ref (beginPasskeyRegistration limited uid Nothing) gate <- newEmptyMVar results <- forM ceremonies \(cid, opts) -> do done <- newEmptyMVar@@ -191,7 +191,7 @@ labelBoundary = do ref <- newWorld uid <- seedUser ref- (cid, opts) <- mustRight =<< runInMemory ref (beginPasskeyRegistration cfg uid)+ (cid, opts) <- mustRight =<< runInMemory ref (beginPasskeyRegistration cfg uid Nothing) let credential = credentialJson (challengeOf opts) bad <- runInMemory ref (completePasskeyRegistration cfg uid cid credential (Just (Text.replicate 129 "🔑"))) bad @?= Left InvalidInput
test/Shomei/PasskeyStoreSpec.hs view
@@ -17,7 +17,12 @@ import Data.Maybe (isNothing) import Data.Text (Text) import Data.Time (UTCTime (..), addUTCTime, fromGregorian)+import Effectful (Eff, IOE, (:>))+import Shomei.Account.LoginId.Domain (mkLoginId)+import Shomei.Account.User.Domain (NewUser (..), User (..))+import Shomei.Account.User.Store (UserStore, createUser) import Shomei.Id (CeremonyId, PasskeyId, UserId, genCeremonyId, genUserId)+import Shomei.Id qualified as Id import Shomei.Passkey.Ceremony.Store (putPendingCeremony, takePendingCeremony) import Shomei.Passkey.Domain ( CeremonyKind (..),@@ -38,6 +43,7 @@ findPasskeysByUserHandle, updatePasskeySignCounter, )+import Shomei.Session.Authentication.Guard (AuthenticationGuard (..)) import Shomei.Test.InMemory (World, emptyWorld, runInMemory) import Test.Tasty (TestTree, testGroup) import Test.Tasty.HUnit (assertBool, testCase, (@?=))@@ -123,9 +129,9 @@ createAndFind :: IO () createAndFind = do ref <- newWorld- uid <- genUserId+ uid <- runInMemory ref newUserId (created, byUser, byCred, byHandle) <- runInMemory ref do- created <- either (error . show) pure =<< createPasskey 20 (sampleNew uid)+ created <- either (error . show) pure =<< createPasskey (AuthenticationGuard 0 Nothing Nothing) 20 (sampleNew uid) byUser <- findPasskeysByUser uid byCred <- findPasskeyByCredentialId (WebAuthnCredentialId cid1) byHandle <- findPasskeysByUserHandle (UserHandle uh1)@@ -144,9 +150,9 @@ updateSignCounter :: IO () updateSignCounter = do ref <- newWorld- uid <- genUserId+ uid <- runInMemory ref newUserId (advanced, replayed, older, found) <- runInMemory ref do- created <- either (error . show) pure =<< createPasskey 20 (sampleNew uid)+ created <- either (error . show) pure =<< createPasskey (AuthenticationGuard 0 Nothing Nothing) 20 (sampleNew uid) advanced <- updatePasskeySignCounter (pkPasskeyId created) (SignatureCounter 7) t1 replayed <- updatePasskeySignCounter (pkPasskeyId created) (SignatureCounter 7) t1 older <- updatePasskeySignCounter (pkPasskeyId created) (SignatureCounter 6) t1@@ -159,24 +165,24 @@ countByUser :: IO () countByUser = do ref <- newWorld- uid <- genUserId- otherUid <- genUserId+ uid <- runInMemory ref newUserId+ otherUid <- runInMemory ref newUserId n <- runInMemory ref do- _ <- createPasskey 20 (sampleNew uid)+ _ <- createPasskey (AuthenticationGuard 0 Nothing Nothing) 20 (sampleNew uid) -- a second passkey for the same user (distinct credential id)- _ <- createPasskey 20 (sampleNewWithCred uid "cred-2")+ _ <- createPasskey (AuthenticationGuard 0 Nothing Nothing) 20 (sampleNewWithCred uid "cred-2") -- a third for a different user- _ <- createPasskey 20 (sampleNewWithCred otherUid "cred-3")+ _ <- createPasskey (AuthenticationGuard 0 Nothing Nothing) 20 (sampleNewWithCred otherUid "cred-3") countPasskeysByUser uid n @?= 2 userScopedDelete :: IO () userScopedDelete = do ref <- newWorld- uid <- genUserId- otherUid <- genUserId+ uid <- runInMemory ref newUserId+ otherUid <- runInMemory ref newUserId (afterWrongUser, afterOwner) <- runInMemory ref do- created <- either (error . show) pure =<< createPasskey 20 (sampleNew uid)+ created <- either (error . show) pure =<< createPasskey (AuthenticationGuard 0 Nothing Nothing) 20 (sampleNew uid) let pid = pkPasskeyId created deletePasskey otherUid pid -- wrong user: no-op afterWrongUser <- findPasskeyByCredentialId (WebAuthnCredentialId cid1)@@ -189,7 +195,9 @@ samplePending :: CeremonyId -> UTCTime -> PendingCeremony samplePending cid expiry = PendingCeremony- { ceremonyId = cid,+ { authenticationGeneration = Just 0,+ initiatingSession = Nothing,+ ceremonyId = cid, userId = Nothing, kind = RegistrationCeremony, optionsBlob = "{\"challenge\":\"abc\"}",@@ -221,3 +229,11 @@ pure (firstTake, afterTake) assertBool "expired take returns Nothing" (isNothing firstTake) assertBool "subsequent take also Nothing" (isNothing afterTake)++-- Store fixtures use real users so user-row serialization has the same preconditions as SQL.+newUserId :: (UserStore :> es, IOE :> es) => Eff es Id.UserId+newUserId = do+ unique <- genUserId+ let lid = either (error . show) id (mkLoginId (Id.idText unique))+ user <- createUser (NewUser lid Nothing Nothing)+ pure user.userId
test/Shomei/Session/Authentication/ConcurrencySpec.hs view
@@ -23,6 +23,7 @@ import Effectful (Eff, IOE, liftIO, (:>)) import Effectful.Dispatch.Dynamic (interpose, passthrough) import Shomei.Account.Email.Domain (Email, emailText, mkEmail)+import Shomei.Session.Authentication.Guard (AuthenticationGuard (..)) -- Qualified: several 'AuthError' constructors share names with 'SessionStatus' constructors. @@ -247,14 +248,16 @@ tcid <- genTotpCredentialId runInMemory ref do _ <-- upsertTotpEnrollment- NewTotpCredential- { totpCredentialId = tcid,- userId = user.userId,- secret,- createdAt = fixedTime- }- confirmTotp tcid fixedTime+ either (error . show) pure+ =<< upsertTotpEnrollment+ (AuthenticationGuard 0 Nothing Nothing)+ NewTotpCredential+ { totpCredentialId = tcid,+ userId = user.userId,+ secret,+ createdAt = fixedTime+ }+ confirmTotp user.userId (AuthenticationGuard 0 Nothing Nothing) tcid fixedTime ceremonies <- replicateM racers (loginExpectingTotpChallenge ref) let code = totpCode 6 secret (totpCounter fixedTime)
test/Shomei/Session/Authentication/WorkflowSpec.hs view
@@ -214,18 +214,20 @@ (user, _) <- expectRight =<< runInMemory ref (signup cfg (signupEmail aliceEmail strongPw Nothing)) let granted = Set.fromList [Scope "openid", Scope "kawa:read"] (_, oauthPair, _) <-- runInMemory- ref- ( issueSessionWith- cfg- SessionOptions- { oauthClientId = Just "oauthclient_test",- extraScopes = granted,- remember = False- }- user- fixedTime- )+ expectRight+ =<< runInMemory+ ref+ ( issueSessionWith+ cfg+ SessionOptions+ { oauthClientId = Just "oauthclient_test",+ extraScopes = granted,+ remember = False,+ authenticationGuard = Nothing+ }+ user+ fixedTime+ ) result <- runInMemory ref (refresh cfg (RefreshCommand oauthPair.refreshToken)) result @?= Left Err.RefreshTokenInvalid wrongClient <- runInMemory ref (refreshFrom (OAuthClientRefresh "oauthclient_other") cfg (RefreshCommand oauthPair.refreshToken))