-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: dummy auth storage which encapsulates keys
- Loading branch information
1 parent
5ed91cb
commit 87596bd
Showing
7 changed files
with
61 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
catalyst_voices/packages/catalyst_voices_services/lib/src/catalyst_voices_services.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
catalyst_voices/packages/catalyst_voices_services/lib/src/storage/dummy_auth_storage.dart
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import 'dart:async'; | ||
|
||
import 'package:catalyst_voices_services/src/storage/secure_storage.dart'; | ||
|
||
abstract interface class DummyAuthStorage { | ||
FutureOr<String?> readEmail(); | ||
|
||
FutureOr<void> writeEmail(String? value); | ||
|
||
FutureOr<String?> readPassword(); | ||
|
||
FutureOr<void> writePassword(String? value); | ||
|
||
Future<void> clear(); | ||
} | ||
|
||
final class SecureDummyAuthStorage extends SecureStorage | ||
implements DummyAuthStorage { | ||
static const _emailKey = 'email'; | ||
static const _passwordKey = 'password'; | ||
|
||
const SecureDummyAuthStorage({ | ||
super.secureStorage, | ||
}); | ||
|
||
@override | ||
FutureOr<String?> readEmail() => readString(key: _emailKey); | ||
|
||
@override | ||
FutureOr<void> writeEmail(String? value) { | ||
return writeString(value, key: _emailKey); | ||
} | ||
|
||
@override | ||
FutureOr<String?> readPassword() => readString(key: _passwordKey); | ||
|
||
@override | ||
FutureOr<void> writePassword(String? value) { | ||
return writeString(value, key: _passwordKey); | ||
} | ||
|
||
@override | ||
Future<void> clear() async { | ||
await writeEmail(null); | ||
await writePassword(null); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 0 additions & 4 deletions
4
...t_voices/packages/catalyst_voices_services/lib/src/storage/secure_storage_keys_const.dart
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters