sunguru98 / bounty-verify-offchain-message

Repo for bounty on Gib Work

Home Page:https://app.gib.work/r/A4Qlndvq/bounty-verify-offchain-message

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Bounty: Verify Offchain Message

Description

The goal of this project is to make a TypeScript implementation of off-chain message signing that's compatible with the solana cli.

This allows people to verify keypairs they can access with the solana cli without having to import that keypair into a wallet.

Expected flow:

  1. We use TypeScript to create a message and a command to sign it.
  2. The user executes the command to sign the message and the signature is printed to the console.
  3. The user can then use the solana cli to verify the signature.
  4. We can use the TypeScript implementation to verify the signature as well.

Steps 2 and 3 are already implemented in the solana cli. We need to implement steps 1 and 4.

Implementation

This project implements a basic setup that prompts for the public key and prints the instructions.

You can run this using the following command:

pnpm build && pnpm start

The logic must be implemented in the files ./src/lib/create-challenge.ts and ./src/lib/verify-signature.ts.

Both files have a test suite that must be implemented and pass, as well as a complete test in ./src/e2e.spec.ts.

You can use the fixture keypair in ./src/fixtures/test-keypair.json to sign the messages in your tests.

Example using solana cli

This example uses the fixture keypair in ./src/fixtures/test-keypair.json to sign the message test.

$ solana sign-offchain-message -k ./src/fixtures/test-keypair.json 'test'
3pWh55arC5NykkrQS1g2JFJAjZRULPB6jamE9sCsMQ99HcgA462ji4yZHekczgupPcoAFhw3P7XdYfsMcbDv2Rjd

To verify the signature using the solana cli:

$ solana verify-offchain-signature -k ./src/fixtures/test-keypair.json 'test' 3pWh55arC5NykkrQS1g2JFJAjZRULPB6jamE9sCsMQ99HcgA462ji4yZHekczgupPcoAFhw3P7XdYfsMcbDv2Rjd
Signature is valid

The goal is to make a TypeScript implementation compatible with the solana cli to let people verify keypairs the want to access with solana cli, not by importing the keypair to a wallet.

Sources and references

About

Repo for bounty on Gib Work

https://app.gib.work/r/A4Qlndvq/bounty-verify-offchain-message


Languages

Language:TypeScript 100.0%