Vipul waghmare
Vipul waghmare

Reputation: 18

Getting error in flutter with webcryto: "package:webcrypto failed to attached finalizer"

This is for encryption from documentation of getStream. https://getstream.io/chat/docs/sdk/flutter/guides/end_to_end_chat_encryption/#dependencies

I am using webcrypto: ^0.5.2 as mentioned in the documentation.

Future<JsonWebKeyPair> generateKeys() async {
  final keyPair = await EcdhPrivateKey.generateKey(EllipticCurve.p256);
  final publicKeyJwk = await keyPair.publicKey.exportJsonWebKey();
  final privateKeyJwk = await keyPair.privateKey.exportJsonWebKey();

  return JsonWebKeyPair(
    privateKey: json.encode(privateKeyJwk),
    publicKey: json.encode(publicKeyJwk),
  );
}

I am getting error "package:webcrypto failed to attached finalizer" in the generateKey function

I have tried changing the version of webcrypto but I am still getting the error.

Upvotes: 0

Views: 172

Answers (1)

zorro
zorro

Reputation: 139

I was using flutter version 3.3.2 but I used webcrypto 0.5.2. Updated the version of webcrypto to 0.5.3(which has migration to flutter 3). After updating the version it worked for me.

Upvotes: 0

Related Questions