dart-spectre/lib/src/scope.dart

45 lines
820 B
Dart

import "template.dart";
enum Scope {
authentication,
identification,
recovery,
}
Template scopeDefaultTemplate(Scope scope) {
switch (scope) {
case Scope.identification:
return Template.name;
case Scope.recovery:
return Template.phrase;
case Scope.authentication:
default:
return Template.long;
}
}
abstract class Scoper {
String scope(Scope scope);
}
class SimpleScoper implements Scoper {
final String _key;
SimpleScoper(this._key);
@override
String scope(Scope scope) {
switch (scope) {
case Scope.identification:
return "$_key.login";
case Scope.recovery:
return "$_key.answer";
case Scope.authentication:
default:
return _key;
}
}
}
var defaultScoper = SimpleScoper("com.lyndir.masterpassword");