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

TRCL-3691 v4-client: Add signing function for push #233

Merged
merged 8 commits into from
Sep 13, 2024

Conversation

ruixhuang
Copy link
Contributor

Add native function to sign push notification token registration payload. Also add function to derive keys from mnemonic. This also fixes the function signCompliancePayload().

Copy link

linear bot commented Sep 12, 2024

# Conflicts:
#	v4-client-js/__native__/__ios__/v4-native-client.js
@@ -147,6 +147,12 @@ export async function connectWallet(mnemonic: string): Promise<string> {
globalThis.wallet = await LocalWallet.fromMnemonic(mnemonic, BECH32_PREFIX);
globalThis.nobleWallet = await LocalWallet.fromMnemonic(mnemonic, NOBLE_BECH32_PREFIX);

const { privateKey, publicKey } = deriveHDKeyFromMnemonic(mnemonic);
Copy link
Contributor

Choose a reason for hiding this comment

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

we are already setting the hdKey in deriveMnemomicFromEthereumSignature, are we able to use it?

This way we shouldn't need to make deriveHDKeyFromMnemonic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

deriveMnemomicFromEthereumSignature is called during onboarding only, and client stores the mnemonic. This is why the current compliance flow doesn't work since deriveMnemomicFromEthereumSignature is not called every time.

Copy link
Contributor

Choose a reason for hiding this comment

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

ohhh ok TIL

prashanDYDX
prashanDYDX previously approved these changes Sep 13, 2024
*
* @returns Priv/pub keys
*/
export const deriveHDKeyFromMnemonic = (
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: maybe we can call this from exportMnemonicAndPrivateKey

@ruixhuang ruixhuang merged commit 2b57638 into main Sep 13, 2024
5 checks passed
yogurtandjam pushed a commit that referenced this pull request Sep 16, 2024
* Add native function to sign push notification token registration payload

* Bump version

* Fix

* Clean up

* Clean up
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