Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: initialize new package for signers #1

Open
wants to merge 4 commits into
base: development
Choose a base branch
from

Conversation

avasisht23
Copy link

@avasisht23 avasisht23 commented Nov 7, 2023

Pull Request Checklist

  • Did you add new tests and confirm existing tests pass? (yarn test)
  • Did you update relevant docs? (docs are found in the site folder, see guidleines below)
  • Do your commits follow the Conventional Commits standard?
  • Does your PR title also follow the Conventional Commits standard?
  • If you have a breaking change, is it [correctly reflected in your commit message](https://www.conventionalcommits.org/en/v1.0.0/#examples? (e.g. feat!: breaking change)
  • Did you run lint (yarn lint:check) and fix any issues? (yarn lint:fix)
  • Is the base branch you're merging into development and not main?

@avasisht23
Copy link
Author

avasisht23 commented Nov 7, 2023

Current dependencies on/for this PR:

This stack of pull requests is managed by Graphite.

Copy link

Updated dependencies detected. Learn more about Socket for GitHub ↗︎

Packages Version New capabilities Transitives Size Publisher
viem 1.17.2...1.18.8 None +0/-0 5.63 MB jmoxey

@moldy530
Copy link
Collaborator

moldy530 commented Nov 7, 2023

any reason not to just do this directly in the aa-sdk? we could even have a branch called aa-signers if we want to stage changes further?


export interface User<UserDetails> {
id: string;
details: UserDetails;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's drop this

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

id + details, or just details?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just details, since we have a getDetails method

@@ -0,0 +1,26 @@
import type { Hash, Hex, SignTypedDataParameters } from "viem";

export interface SmartAccountSigner<Inner, AuthParams, UserDetails> {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this should live in aa-core still. if this is here, then devs will ALWAYS need to install aa-signers which shouldn't be a requirement if devs want to bring their own in the end

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm good point. that makes sense.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is actually more in line with how we did accounts

@avasisht23
Copy link
Author

avasisht23 commented Nov 7, 2023

any reason not to just do this directly in the aa-sdk? we could even have a branch called aa-signers if we want to stage changes further?

chatted live yesterday in sync: https://alchemyinsights.slack.com/archives/C04RHSDSP9U/p1699297061008119?thread_ts=1699074100.738799&cid=C04RHSDSP9U

tl;dr: this is a breaking change and requires 3rd party contributions. ideally this all gets in before merging to development. as we build out with turnkey/magic/lit, we don't want to hint to the other signers that we're partnering with them by having their impls in first.

that said, we could just merge in our own impls using the docs and then reach out to signers after to tweak. is that what you mean?

@moldy530
Copy link
Collaborator

moldy530 commented Nov 7, 2023

Yea that's fine if we don't want to merge it into the development branch because it's a breaking change. Let's create a new branch called aa-signer in the main repo and use that as the base branch for all this dev. it'll be easier to track changes and get contributions

@denniswon
Copy link

Is the notion of User ”ALWAYS” relevant for signer?

Then what about Local signers, Wallet Signers?

I think we should align on the goal of having a separate aa-signer package.

In my opinion, it should be:

  1. signer type for telemetry should not rely on arbitrary strings
  2. there should be more dedicated process/place for 3rd party partners/signers to integrate with aa-sdk

@avasisht23
Copy link
Author

Is the notion of User ”ALWAYS” relevant for signer?

agreed, it's not. as I've been playing with integrating magic, I've realized this. let's discuss tomorrow.

right now I have something like this in aa-core/signer/types.ts to account for distinction between AuthSigner and Signer:

import type { Hash, Hex } from "viem";
import type { SignTypedDataParams } from "../account/types.js";

export interface AuthSmartAccountSigner<Inner, AuthParams, UserDetails>
  extends SmartAccountSigner {
  inner: Inner;
  user: SmartAccountUser<UserDetails> | undefined;

  authenticateUser: (params: AuthParams) => Promise<UserDetails>;

  getUserDetails: () => Promise<UserDetails>;
}

export interface SmartAccountSigner {
  signerType: string;

  getAddress: () => Promise<Hash>;

  signMessage: (msg: Uint8Array | Hex | string) => Promise<Hex>;

  signTypedData: (params: SignTypedDataParams) => Promise<Hex>;
}

export interface SmartAccountUser<UserDetails> {
  id: string | undefined;

  isAuthenticated: () => Promise<boolean>;

  getDetails: () => Promise<UserDetails>;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants