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

Sign and verify message by ed25519 #1549

Open
Ja7ad opened this issue Oct 13, 2024 · 0 comments
Open

Sign and verify message by ed25519 #1549

Ja7ad opened this issue Oct 13, 2024 · 0 comments
Assignees
Labels
bug Something isn't working good first issue Good for newcomers www

Comments

@Ja7ad
Copy link
Contributor

Ja7ad commented Oct 13, 2024

Description

Currently SignMessageWithPrivateKey and VerifyMessage support bls private key.

pactus/www/grpc/utils.go

Lines 22 to 43 in 2bcb8d6

func (*utilServer) SignMessageWithPrivateKey(_ context.Context,
req *pactus.SignMessageWithPrivateKeyRequest,
) (*pactus.SignMessageWithPrivateKeyResponse, error) {
prvKey, err := bls.PrivateKeyFromString(req.PrivateKey)
if err != nil {
return nil, status.Error(codes.InvalidArgument, "invalid private key")
}
sig := prvKey.Sign([]byte(req.Message)).String()
return &pactus.SignMessageWithPrivateKeyResponse{
Signature: sig,
}, nil
}
func (*utilServer) VerifyMessage(_ context.Context,
req *pactus.VerifyMessageRequest,
) (*pactus.VerifyMessageResponse, error) {
sig, err := bls.SignatureFromString(req.Signature)
if err != nil {
return nil, status.Error(codes.InvalidArgument, "signature is invalid")
}

Ideal solution

Support BLS and ED25519 for sign and verify message.

Environment

  • Operation System: Linux
  • Pactus Version: v1.5.0
  • Go Version: v1.23.2
@Ja7ad Ja7ad added bug Something isn't working good first issue Good for newcomers www labels Oct 13, 2024
@Ja7ad Ja7ad added this to the v1.6.0 milestone Oct 30, 2024
@Ja7ad Ja7ad removed this from the v1.6.0 milestone Nov 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers www
Projects
None yet
Development

No branches or pull requests

2 participants