Options
All
  • Public
  • Public/Protected
  • All
Menu

@ethercast/calculate-signature

This module provides the utility methods used by Ethercast to sign messages.

You can use this in a javascript or typescript project to easily validate message signature validity.

Index

Functions

calculateMessageSignature

  • calculateMessageSignature(messageBody: string, subscriptionSecret: string, version?: SignatureVersion): string
  • Calculate the signature for a message body using the subscription secret

    Parameters

    • messageBody: string

      body of the message

    • subscriptionSecret: string

      secret of the subscription

    • Default value version: SignatureVersion = SignatureVersion.sha512

      the version of the message signature (optional, defaults to sha512)

    Returns string

    the message signature

isValidSignature

  • isValidSignature(messageBody: string, subscriptionSecret: string, signature: string, version?: SignatureVersion): boolean
  • Returns true if the message body and secret return a matching signature

    Parameters

    • messageBody: string

      body of the message

    • subscriptionSecret: string

      subscription secret

    • signature: string
    • Default value version: SignatureVersion = SignatureVersion.sha512

      the version of the message signature (optional, defaults to sha512)

    Returns boolean

    true if the message is valid, false otherwise

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method

Generated using TypeDoc