-
Notifications
You must be signed in to change notification settings - Fork 84
feat: Dynamically load poseidon-lite to reduce bundle size (~421KB) #850
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
base: main
Are you sure you want to change the base?
Changes from all commits
0df625c
069ba61
82505bd
461d8bd
4022c25
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -36,6 +36,10 @@ export class KeylessAccount extends AbstractKeylessAccount { | |
| * Use the static generator `create(...)` instead. | ||
| * Creates an instance of the KeylessAccount with an optional proof. | ||
| * | ||
| * **Important**: This constructor uses `KeylessPublicKey.createSync()` which requires | ||
| * poseidon-lite to already be loaded. Use `KeylessAccount.create()` (async) for the | ||
| * standard flow, or call `await ensurePoseidonLoaded()` before constructing/deserializing directly. | ||
| * | ||
| * @param args - The parameters for creating a KeylessAccount. | ||
| * @param args.address - Optional account address associated with the KeylessAccount. | ||
| * @param args.ephemeralKeyPair - The ephemeral key pair used in the account creation. | ||
|
|
@@ -64,7 +68,7 @@ export class KeylessAccount extends AbstractKeylessAccount { | |
| jwt: string; | ||
| verificationKeyHash?: HexInput; | ||
| }) { | ||
| const publicKey = KeylessPublicKey.create(args); | ||
| const publicKey = KeylessPublicKey.createSync(args); | ||
| super({ publicKey, ...args }); | ||
| this.publicKey = publicKey; | ||
|
Comment on lines
70
to
73
|
||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using
FederatedKeylessPublicKey.createSync()in the constructor meansFederatedKeylessAccount.deserialize()(and any direct construction) will now fail unless poseidon-lite has already been loaded. Consider adding explicit docs on this, and/or an async deserialization/factory API that preloads poseidon viaensurePoseidonLoaded()before constructing.