signer._signTypedData no working in autotask for injected Relayer

Hey there,

I am trying to use the autotask suite and call signer._signTypedData. When I used the apiRelayer from my local machine the code is running fine, but once I push to the autotask, the signature fails with TypeError: signer._signTypedData is not a function. Is this a problem with the autotaskRelayer relative to the apiRelayer? Any help would be appreciated

:1234: Code to reproduce

export async function handler(event: any) {
  //set Provider and signer
  const provider = new DefenderRelayProvider(event);
  const signer = new DefenderRelaySigner(event, provider);
...
signature = await signer._signTypedData(
          signingStep.data.domain,
          signingStep.data.types,
          signingStep.data.value
        );

:computer: Environment

Works fine in local development with API_KEY and API_SECRET, but not working from autotask deployment with the autotask directly connected to a Relayer.

Hey @Jason_Maier

I replied to you here, but the TLDR is that I've sent a PR solving the issue and is being deployed this week.

Best!

Hey @Jason_Maier,

We just released a new Defender version that includes the ability to execute the signTypedData inside the Defender Autotask. I apologize for the delay with this as we didn't notice it wasn't included in the Autotask environment.

Here's a minimal script using the feature within an Autotask:

const { DefenderRelaySigner, DefenderRelayProvider } = require('defender-relay-client/lib/ethers');
const ethers = require('ethers');

// All properties on a domain are optional
const domain = {
  name: "Ether Mail",
  version: "1",
  chainId: 1,
  verifyingContract: "0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC",
};

// The named list of all type definitions
const types = {
  Person: [
    { name: "name", type: "string" },
    { name: "wallet", type: "address" },
  ],
  Mail: [
    { name: "from", type: "Person" },
    { name: "to", type: "Person" },
    { name: "contents", type: "string" },
  ],
};

// The data to sign
const value = {
  from: {
    name: "Cow",
    wallet: "0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826",
  },
  to: {
    name: "Bob",
    wallet: "0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB",
  },
  contents: "Hello, Bob!",
};

exports.handler = async function(event) {
  const provider = new DefenderRelayProvider(event);
  const signer = new DefenderRelaySigner(event, provider, { speed: 'fast' });

  const signerAddress = await signer.getAddress();

  const signature = await signer._signTypedData(domain, types, value);

  const verifiedAddress = ethers.utils.verifyTypedData(
    domain,
    types,
    value,
    signature
  );

  return ethers.utils.getAddress(signerAddress) ===
      ethers.utils.getAddress(verifiedAddress)
}

Hope this helps,
Best