You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, when using obfuscation, you can only use static final, not static const.
This also makes sense since static const values will be calculated in compile time which is not what you want since you obviously want the values obfuscated :)
However, this should of course be properly documented. I will propose a PR soon.
You're welcome!
Yes, you are completely right! However, keys are only one of the many possibilities of env-files.
For example, you could be creating an app that accesses some backend like JIRA, GitLab Issues or something else that can be hosted on different dedicated servers.
If you want to be able to customize the URL at compile time without editing the code, you can just edit the env-file directly. In this case, you do not even have to worry about obfuscating the URLs since they are not an inherent secret.
There are also many more possibilities for env files, e.g., defining paths of files, colors etc.
In all these cases, obfuscation is just a factor that will slow down your code.
That's why I opted for adding per-field obfuscation possibilities here: #4 (comment)
This allows users to obfuscate only some fields while others stay unobfuscated.
Also, it might be worth pointing out that your keys are not entirely unreadable.
However, this obfuscation gives your attackers a bad time reading them from the resulting binary: frencojobs/envify#28 (comment)
Getting this error now... any ideas?
Const variables must be initialized with a constant value.
Try changing the initializer to be a constant expression.
Thanks
`
// lib/env/env.dart
import 'package:envied/envied.dart';
part 'env.g.dart';
@envied(path: '.env.dev')
abstract class Env {
@EnviedField(varName: 'KEY_ONE', obfuscate: true)
static const keyOne = _Env.keyOne;
@EnviedField(varName: 'KEY_TWO', obfuscate: true)
static const keyTwo = _Env.keyTwo;
}
`
The text was updated successfully, but these errors were encountered: