Skip to content

Conversation

elliotBraem
Copy link

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • Commit messages follow the conventional commits spec
  • If this is a code change: I have written unit tests.
  • If this changes code in a published package: I have run pnpm changeset to create a changeset JSON document appropriate for this change.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

Moved over some things, started an example, started putting it in utils but I don't think it should go here in order to avoid circular dependencies and to utilize some shared types w/ existing signNep413Message.

I'm thinking of moving it to a verify.ts in signer, or maybe to crypto -- but creating a new @near-js/messages package sounds pretty clean and would follow transactions pattern.

Test Plan

I'll write some tests and an example.

Related issues/PRs

This was requested to accompany signNep413Message. I'm pulling logic from https://github.com/elliotBraem/near-sign-verify

Copy link

changeset-bot bot commented Jul 15, 2025

⚠️ No Changeset found

Latest commit: 7e626c6

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@@ -0,0 +1,68 @@
import {
SignedMessage,
Copy link
Author

Choose a reason for hiding this comment

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

I need this to be a shared type, could put it in types

SignedMessage + Nep413Message or just Message

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 for putting shared types on the types package

throw new Error(
`Cryptographic signature verification failed: ${error instanceof Error ? error.message : String(error)
}`,
);
Copy link
Author

Choose a reason for hiding this comment

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

near-sign-verify throws on failed verify, I think we should do this here too rather than returning a boolean because it forces the developer to handle it

Copy link
Contributor

Choose a reason for hiding this comment

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

completely agree

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

Successfully merging this pull request may close these issues.

3 participants