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

Verify signature #23

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

Conversation

Hirama
Copy link

@Hirama Hirama commented Sep 27, 2024

Added VerifyTransactionSignature function:

  • Verifies the signature of a SignedTransaction.
  • Uses Borsh serialization and SHA-256 hashing.
  • Supports ED25519 key type for verification.

Example usage:


import (
    "fmt"
    "github.com/aurora-is-near/near-api-go/near"
)

func main() {
    var signedTx *near.SignedTransaction
    // Initialize signedTx...

    isValid, err := near.VerifyTransactionSignature(signedTx)
    if err != nil {
        fmt.Println("Error:", err)
    } else if isValid {
        fmt.Println("Signature is valid.")
    } else {
        fmt.Println("Signature is invalid.")
    }
}

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.

1 participant