-
I am creating a custom signer (code is below) that uses an AWS KMS key to sign User Operations. When I submit a UserOperation I get an error saying Here is the custom signer: class SimpleKMSAccountSigner implements SmartAccountSigner {
// key_id and sub are used to identify the user and their associated KMS key
private key_id: string;
private sub: string;
private wallet_address: string;
signerType: string = "AWSKMS_SIGNER";
inner: string = "AWSKMS";
constructor(_key_id: string, _sub: string, _wallet_address: string) {
this.key_id = _key_id;
this.sub = _sub;
this.wallet_address = _wallet_address;
}
async signMessage( message: SignableMessage ): Promise<Hex> {
const eip191hash = viem.hashMessage(message);
const signerPayload = {
operation: 'sign_userop',
userop_hash: eip191hash,
key_id: this.key_id,
sub: this.sub
};
const signedPayload = await callSigningFunction(Buffer.from(JSON.stringify(signerPayload)));
return signedPayload as Hex;
};
async signTypedData(): Promise<Hex> {
throw new Error('Not implemented');
};
async getAddress(): Promise<Address> {
return this.wallet_address as Address;
}
} And here is the entire request body:
|
Beta Was this translation helpful? Give feedback.
Answered by
ebaizel
Jul 9, 2024
Replies: 1 comment
-
Of course, I resolved it right after opening this issue 😄 I needed to format the signature in Hex, so adding this line fixed it:
|
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
ebaizel
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Of course, I resolved it right after opening this issue 😄
I needed to format the signature in Hex, so adding this line fixed it:
return `0x${signedPayload}` as Hex;