encrypt static method

Future<String> encrypt({
  1. required String value,
  2. bool fAsSelf = false,
})

The encrypt function (uses CredProtectW from wincred.h) encrypts the specified credentials so that only the current security context can decrypt them. return string of the encrypted value.

FlutterWindowsVault.encrypt(
  // the value you want to encrypt
  value: '123456789',
  // fAsSelf: (this works only if encrypted is true) Set to TRUE to specify that the credentials are encrypted in the security context of the current process.
  // Set to FALSE to specify that credentials are encrypted in the security context of the calling thread security context.
  // default value is false.
  fAsSelf: false,
);

Implementation

static Future<String> encrypt({
  required String value,
  bool fAsSelf = false,
}) {
  assert(value.isNotEmpty);
  // assert(fAsSelf != null);
  return _channel.invokeMethod<String>('encrypt',
      {'value': value, 'fAsSelf': fAsSelf}).then((value) => value!);
}