polyauth

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package polyauth implements Polymarket CLOB authentication and signing helpers.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeAPISecret

func DecodeAPISecret(secret string) ([]byte, error)

DecodeAPISecret decodes a URL-safe base64 Polymarket API secret.

func GenerateKey

func GenerateKey() (string, error)

GenerateKey creates a new secp256k1 private key and returns it as hex.

func HMACSignature

func HMACSignature(secret string, timestamp int64, method, requestPath string, body []byte) (string, error)

HMACSignature signs a request with a base64-encoded Polymarket API secret.

func HMACSignatureBytes

func HMACSignatureBytes(secret []byte, timestamp int64, method, requestPath string, body []byte) string

HMACSignatureBytes signs a request with a decoded Polymarket API secret.

func L1Headers

func L1Headers(signer *Signer, chainID, timestamp, nonce int64) (map[string]string, error)

L1Headers returns Polymarket L1 headers for API-key creation and derivation.

func L2Headers

func L2Headers(signer *Signer, key string, secret []byte, passphrase string, timestamp int64, method, path string, body []byte) (map[string]string, error)

L2Headers returns Polymarket L2 headers for API-key authenticated requests.

func SignTypedData

func SignTypedData(signer *Signer, typedData apitypes.TypedData) (string, error)

SignTypedData signs EIP-712 typed data with signer.

Types

type Signer

type Signer struct {
	// contains filtered or unexported fields
}

func ParsePrivateKey

func ParsePrivateKey(raw string) (*Signer, error)

ParsePrivateKey parses a hex-encoded secp256k1 private key.

func (*Signer) Address

func (s *Signer) Address() common.Address

Address returns the Ethereum address for the signer.

func (*Signer) PrivateKey

func (s *Signer) PrivateKey() *ecdsa.PrivateKey

PrivateKey returns the underlying ECDSA private key.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL