How to use ShareTransferModule properly?

The doc recently has been updated to say that ShareTransferModule is now the replacement module over storage module for react native.
I am trying to follow the given sample code snippet but get an error.

Here is the snippet:

      const requests = await (tKey.modules.shareTransfer as ShareTransferModule).lookForRequests();
          const newShare = await tKey.generateNewShare();
          const s = await tKey.outputShareStore(newShare.newShareIndex)

          await (tKey.modules.shareTransfer as ShareTransferModule).approveRequest(requests[0], s);

And here is the error:
[ShareTransferError: Missing current enc key]

  • SDK Version:
    @tkey/default”: “^9.0.1”,
    @tkey/security-questions”: “^9.0.0”,
    @tkey/service-provider-base”: “^9.0.0”,
    @tkey/share-serialization”: “^9.0.1”,
    @tkey/share-transfer”: “^9.0.0”,
    @tkey/storage-layer-torus”: “^9.0.0”,
    @tkey/web-storage”: “^9.0.0”,
    @toruslabs/customauth-react-native-sdk”: “^4.0.1”,
    @toruslabs/react-native-web-browser”: “^1.1.0”,

Forgot to mention that the call to approveRequest threw an exception. The exception message was mentioned above (missing current enc key).

@a-ha Thanks for your patience.

Your issue has been submitted to our team. We will get back with further updates once more information becomes available.

I have the same issue. Any update?

Hey @a-ha @piv0vip

Please follow the below code snippet to approve requested shared using ShareTransferModule.

const requests = await(tKey.modules.shareTransfer as ShareTransferModule).lookForRequests();
let shareToShare;
try {
  shareToShare = await(tKey.modules.webStorage as WebStorageModule).getDeviceShare();
} catch (err) {
  console.error("No on device share found. Generating a new share");
  const newShare = await tKey.generateNewShare();
  shareToShare = newShare.newShareStores[newShare.newShareIndex.toString("hex")];
}
await(tKey.modules.shareTransfer as ShareTransferModule).approveRequest(requests[0], shareToShare);

Learn more here.