Skip to content

Add pumpx_signLimitOrder #3358

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

Merged
merged 6 commits into from
Apr 10, 2025
Merged

Conversation

kziemianek
Copy link
Member

Adds a rpc methods for signing arbitrary bytes.

@kziemianek kziemianek requested a review from a team April 10, 2025 11:43
Copy link

linear bot commented Apr 10, 2025

Copy link
Collaborator

@Kailai-Wang Kailai-Wang left a comment

Choose a reason for hiding this comment

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

Thanks!

Would you update apifox once it's merged?

Comment on lines +76 to +83
let Ok(token) =
jwt::decode::<AuthTokenClaims>(&params.auth_token, public_key.as_bytes())
else {
return Err(ErrorCode::ServerError(AUTH_VERIFICATION_FAILED_CODE).into());
};
if token.sub != "access" {
return Err(ErrorCode::ServerError(AUTH_VERIFICATION_FAILED_CODE).into());
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thank you

Shall we make a per task fn (like expected_auth_token_type() and add it as parameter to verify_auth) as it should be verified in most RPC methods?

Copy link
Collaborator

Choose a reason for hiding this comment

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

is it possible to reuse and keep alignment with other rpc calls?
Something like:

let wrapper: NativeTaskWrapper<NativeTask> = params.into();

if wrapper.task.require_auth() && verify_auth(ctx.clone(), &wrapper).await.is_err() {
return Err(ErrorCode::ServerError(AUTH_VERIFICATION_FAILED_CODE).into());
}

Copy link
Member Author

Choose a reason for hiding this comment

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

is it possible to reuse and keep alignment with other rpc calls? Something like:

let wrapper: NativeTaskWrapper<NativeTask> = params.into();

if wrapper.task.require_auth() && verify_auth(ctx.clone(), &wrapper).await.is_err() {
return Err(ErrorCode::ServerError(AUTH_VERIFICATION_FAILED_CODE).into());
}

Yes but that would require some time for rework.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Just copy/paste and change fields? can it help?
Like:

impl From<RequestJwtParams> for NativeTaskWrapper<NativeTask> {
	fn from(p: RequestJwtParams) -> Self {
		Self {
			task: NativeTask::PumpxRequestJwt(
				Identity::from_web2_account(p.user_email.as_str(), Web2IdentityType::Email),
				p.invite_code,
				p.google_code,
				p.language,
			),
			nonce: None,
			auth: Some(OmniAuth::Email(p.email_code)),
		}
	}
}

Copy link
Member Author

Choose a reason for hiding this comment

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

Nope, simple copy paste doesn't help in this case 😂

Copy link
Member Author

Choose a reason for hiding this comment

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

The main problem is that verify_auth function derives omni_account from sender Identity.
In case of JWT type: access sub field already contains omni_account.

@kziemianek
Copy link
Member Author

Thanks!

Would you update apifox once it's merged?

apifox should be already up to date 🙃

@kziemianek kziemianek enabled auto-merge (squash) April 10, 2025 12:18
@kziemianek kziemianek disabled auto-merge April 10, 2025 12:18
@kziemianek kziemianek enabled auto-merge (squash) April 10, 2025 12:18
@kziemianek kziemianek merged commit 9cfb55f into dev Apr 10, 2025
21 checks passed
@kziemianek kziemianek deleted the p-1450-add-omni-executor-rpc-method branch April 10, 2025 12:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants