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

Create @solana/offchain-message for signing and verifying offchain messages #1941

Open
steveluscher opened this issue Dec 5, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@steveluscher
Copy link
Collaborator

steveluscher commented Dec 5, 2023

Motivation

There's a protocol for signing non-transaction messages. Let's create @solana/offchain-message helpers to sign and verify messages with modern CryptoKeys.

Example use case

// This prepends the header and signs the message, returning a signature.
async function getOffchainMessageSignature(privateKeys: CryptoKey[], message: Uint8Array): Promise<Uint8Array[]>;

// This verifies the signature given a public key and a message.
async function verifyOffchainMessageSignature(message: Uint8Array, signature: Uint8Array, publicKeys: CryptoKey[]): Promise<boolean>;

Details

We can argue in the PR whether publicKey should be a CryptoKey or an Address, whether the return type of getOffchainMessageSignature() should be Uint8Array or Signature, but preferably not that message should be a string. Each decision that gets us further from JS primitives trades ergonomics for added dependencies.

The use case above is also missing details about configuring the message version, the application domain. Also, the decision needs to be made whether to auto-determine the message format or allow the user to explicitly choose a format then validate that the message conforms to the choice. Lots to chew on here.

Related Rust CLI PR: solana-labs/solana#27456

@steveluscher steveluscher added the enhancement New feature or request label Dec 5, 2023
@steveluscher steveluscher removed this from the Release Technology Preview 3 milestone Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant