Add reusable two-factor verification for login and money operations (#32)
This commit is contained in:
1 parent
b7a58b1a87
commit
fb40f860d2
41 files changed
+2439
-43
No files matched your search
@@ -0,0 +1,20 @@
|
||||
import '../dto/two_factor.dart';
|
||||
import '../models/two_factor.dart';
|
||||
|
||||
abstract final class FactorMapper {
|
||||
static FactorSettings settings(FactorSettingsDTO dto) => FactorSettings(
|
||||
enabled: dto.enabled,
|
||||
target: dto.target,
|
||||
method: FactorMethod.values.byName(dto.method),
|
||||
);
|
||||
static FactorChallenge challenge(FactorChallengeDTO dto) => FactorChallenge(
|
||||
id: dto.id,
|
||||
purpose: FactorPurpose.values.byName(dto.purpose),
|
||||
operation: dto.operation,
|
||||
target: dto.target,
|
||||
expiresAt: dto.expiresAt,
|
||||
resendAt: dto.resendAt,
|
||||
method: FactorMethod.values.byName(dto.method),
|
||||
);
|
||||
static FactorGrant grant(FactorGrantDTO dto) => FactorGrant(dto.token);
|
||||
}
|
||||
Reference in new issue
Block a user