Sign Message

Sign Message

Overview

The Sign Message node is designed to cryptographically sign a message using an Ed25519 private key. This is useful in scenarios where you need to prove the authenticity of a message or verify its origin, such as in blockchain applications, secure messaging, or API integrations that require signed payloads.

Practical examples:

  • Signing messages for NEAR Protocol transactions.
  • Generating signatures for secure API requests.
  • Proving authorship or integrity of data before sending it to another service.

Properties

Name Type Meaning
Private Key to Sign String The Ed25519 private key used to generate the signature.
Message to Sign String The plain text message that will be signed with the provided key.

Output

The node outputs a JSON object with the following fields:

Field Description
signature The base64-encoded digital signature of the input message, generated using the private key.
publicKey The public key (as a string) corresponding to the private key used for signing.

Example output:

{
  "signature": "base64-encoded-signature",
  "publicKey": "ed25519:abc123..."
}

Dependencies

  • External Libraries:
    • near-api-js (for Ed25519 key management and signing)
    • js-base64 (for encoding the signature)
  • No external services or API keys are required.

Troubleshooting

Common issues:

  • Invalid Private Key: If the private key is not a valid Ed25519 key, the node will throw an error.
  • Empty Message: If the message field is empty, the signature will not be meaningful.
  • Error Handling:
    • If "Continue On Fail" is enabled, errors for individual items will be added to the output with an error field.
    • Otherwise, the workflow will stop and display the error.

Common error messages:

  • "Invalid private key": Ensure the private key is correctly formatted and valid for Ed25519.
  • "Cannot read property 'sign' of undefined": Indicates an issue with the key parsing; check the private key value.

Links and References

Discussion