Skip to content

docs: improve contextOrHash parameter documentation #574

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

Conversation

rube-de
Copy link
Contributor

@rube-de rube-de commented Apr 18, 2025

Enhance the documentation for the sign() and verify() functions in Sapphire.sol to clarify how the contextOrHash parameter should be used with different signing algorithms:

  • Correct the expected hash size for Secp384r1PrehashedSha384 from 32 bytes to 48 bytes
  • Add detailed explanations of parameter behavior for each algorithm type
  • Explicitly document that Sr25519 signatures MUST use "substrate" as the context for compatibility with Substrate off-chain signing using { withType: true }
  • Add clear code examples showing proper usage for different algorithms
  • Maintain consistent documentation between sign() and verify() functions

Copy link

netlify bot commented Apr 18, 2025

Deploy Preview for oasisprotocol-sapphire-paratime canceled.

Name Link
🔨 Latest commit 0abb3ff
🔍 Latest deploy log https://app.netlify.com/sites/oasisprotocol-sapphire-paratime/deploys/6810d98ad02f9400089f38c1

@rube-de rube-de force-pushed the rube/331-docs-better-document-the-usagebehavior-of-contextorhash-for-sign-and-verify branch 3 times, most recently from 61fb588 to a2a7e96 Compare April 18, 2025 18:07
@rube-de rube-de marked this pull request as ready for review April 18, 2025 18:38
@rube-de rube-de requested a review from matevz April 18, 2025 18:38
Copy link
Member

@matevz matevz left a comment

Choose a reason for hiding this comment

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

Good job, thanks!

@rube-de rube-de force-pushed the rube/331-docs-better-document-the-usagebehavior-of-contextorhash-for-sign-and-verify branch from a2a7e96 to 6e1d840 Compare April 28, 2025 13:58
Enhance the documentation for the `sign()` and `verify()` functions in Sapphire.sol to clarify how the `contextOrHash` parameter should be used with different signing algorithms:

- Correct the expected hash size for Secp384r1PrehashedSha384 from 32 bytes to 48 bytes
- Add detailed explanations of parameter behavior for each algorithm type
- Explicitly document that Sr25519 signatures MUST use "substrate" as the context for compatibility with Substrate off-chain signing using { withType: true }
- Add clear code examples showing proper usage for different algorithms
- Maintain consistent documentation between sign() and verify() functions
@rube-de rube-de force-pushed the rube/331-docs-better-document-the-usagebehavior-of-contextorhash-for-sign-and-verify branch from 6e1d840 to 0abb3ff Compare April 29, 2025 13:52
@rube-de rube-de merged commit b245ffd into main Apr 29, 2025
15 checks passed
@rube-de rube-de deleted the rube/331-docs-better-document-the-usagebehavior-of-contextorhash-for-sign-and-verify branch April 29, 2025 14:10
github-actions bot added a commit that referenced this pull request Apr 29, 2025
…be/331-docs-better-document-the-usagebehavior-of-contextorhash-for-sign-and-verify

docs: improve contextOrHash parameter documentation b245ffd
github-actions bot added a commit that referenced this pull request Apr 29, 2025
…ube/331-docs-better-document-the-usagebehavior-of-contextorhash-for-sign-and-verify

docs: improve contextOrHash parameter documentation b245ffd
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.

docs: Better document the usage/behavior of contextOrHash for .sign() and .verify()
2 participants