Binance Web3 Connector JS
    Preparing search index...

    Function getWeb3Signature

    • Generates a Binance Web3 signature.

      The prehash is the concatenation of timestamp, method, requestPath, and body with no separators. The output is base64-encoded. Two key types are supported:

      1. HMAC-SHA256 using an apiSecret.
      2. Ed25519 using a privateKey.

      Parameters

      • configuration: SignerConfig

        Configuration object containing API secret or Ed25519 private key.

      • timestamp: string

        ISO-8601 timestamp matching the X-OC-TIMESTAMP header.

      • method: string

        Uppercase HTTP method (e.g. GET, POST).

      • requestPath: string

        URL path plus raw query string, exactly as sent on the wire.

      • body: string

        The raw request body, or '' for methods without a body.

      Returns string

      A base64-encoded signature for the X-OC-SIGN header.

      If neither apiSecret nor privateKey is provided.