Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Variable type does not match #53

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Santatra00
Copy link

This is the "original" code
final key = await secureStorage.read(key: 'key');
final encryptionKey = base64Url.decode(key!);
print('Encryption key: $encryptionKey');
final encryptedBox= await Hive.openBox('vaultBox', encryptionCipher: HiveAesCipher(encryptionKey));
1- the variable encryptionKey is declared as final on top, so it could not be final
2- the variable encryptionKey is typed as String? so it does not match with the return of .decode() -> Uint8List
3- because of these, the example code does not work
I propose this :
encryptionKey = await secureStorage.read(key: 'key');
final key = base64Url.decode(encryptionKey!);
print('Encryption key: $key');
final encryptedBox= await Hive.openBox('vaultBox', encryptionCipher: HiveAesCipher(key));

This is the "original" code
final key = await secureStorage.read(key: 'key');
final encryptionKey = base64Url.decode(key!);
print('Encryption key: $encryptionKey');
final encryptedBox= await Hive.openBox('vaultBox', encryptionCipher: HiveAesCipher(encryptionKey));
 1- the variable encryptionKey is declared as final on top, so it could not be final
 2- the variable encryptionKey is typed as String? so it does not match with the return of .decode() -> Uint8List
 3- because of these, the example code does not work
I propose this : 
encryptionKey = await secureStorage.read(key: 'key');
  final key = base64Url.decode(encryptionKey!);
  print('Encryption key: $key');
  final encryptedBox= await Hive.openBox('vaultBox', encryptionCipher: HiveAesCipher(key));
@vercel
Copy link

vercel bot commented Sep 22, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
docs ✅ Ready (Inspect) Visit Preview Sep 22, 2022 at 7:35AM (UTC)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant