secure_enclave 0.0.3+rev1 copy "secure_enclave: ^0.0.3+rev1" to clipboard
secure_enclave: ^0.0.3+rev1 copied to clipboard

outdated

Apple Secure Enclave implementaton for Flutter

secure_enclave #

Apple Secure Enclave implementaton for Flutter

How to Use #

Create Key:

  void createKey(AccessControl accessControl ){
    _secureEnclavePlugin.createKey(
        accessControl: accessControl
    ).then((result){
      if(result.error == null){
        // success
      } else {
        showError(result);
      }
    });
  }

Check Key:

  void checkKey(String tag){
    _secureEnclavePlugin.checkKey(tag).then((value){
      // value is true or false...
    });
  }

Encrypt:

Uint8List encrypted = Uint8List(0);

void encrypt(String message, String tag) {
  _secureEnclavePlugin.encrypt(
      message: message,
      tag: tag).then((result) => setState(() {
    if (result.error == null) {
      encrypted = result.value ?? Uint8List(0);
    } else {
      showError(result);
    }
  }));
}

decrypt:

String decrypted = "";

void decrypt(Uint8List message, String tag, String? password) {
  _secureEnclavePlugin.decrypt(
      message: message,
      tag: tag,
      password: password).then((result) => setState(() {
    if (result.error == null) {
      decrypted = result.value ?? "";
    } else {
      showError(result);
    }
  }));
}

get base64EncodedString public Key:

  String publicKey = "";

void getPublicKey(String tag) {
  _secureEnclavePlugin.getPublicKey(tag: tag).then((result) {
    if (result.error == null) {
      publicKey = result.value ?? "";
    } else {
      showError(result);
    }
  });
}

Encrypt and use custom base64EncodedString public Key:

be aware that the tag and the required public key is valid. Otherwise, it will throw error. For safety, use encrypt function without custom public key

  Uint8List encryptedWithPublicKey = Uint8List(0);

void encryptWithPublicKey(String message) {
  _secureEnclavePlugin.encryptWithPublicKey(
      message: message,
      publicKeyString: publicKey).then((result) => setState(() {
    if (result.error == null) {
      encryptedWithPublicKey = result.value ?? Uint8List(0);
    } else {
      showError(result);
    }
  }));
}
10
likes
0
points
156
downloads

Publisher

verified publisheranggaaryas.my.id

Weekly Downloads

Apple Secure Enclave implementaton for Flutter

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, json_annotation, plugin_platform_interface

More

Packages that depend on secure_enclave