lighter.api_key
Documentation for eth_defi.lighter.api_key Python module.
Native Lighter API-key generation.
This module replaces the lighter-sdk dependency for the one operation the
Lagoon deployer needs: generating a secret scalar and deriving its public key.
It deliberately does not implement Lighter transaction signing, API
authentication, nonce management or order submission.
The arithmetic is a small, non-constant-time Python port of the ECgFp5 public
key derivation in poseidon_crypto at commit
ca0ad1bc8dfe822c61ba7556d1d4d5bcc2ea4a26 (Apache-2.0), as used by
lighter-go. It is suitable for one-off local key creation during deployment,
not for a general-purpose cryptography API.
Module Attributes
Degree of the Goldilocks extension field used by ECgFp5. |
|
Prime order of the ECgFp5 group from |
Functions
|
Generate a Lighter API-key pair for deployment registration. |
Classes
A locally generated Lighter API-key pair. |
- EXTENSION_DEGREE = 5
Degree of the Goldilocks extension field used by ECgFp5.
- ECGFP5_SCALAR_ORDER = 1067993516717146951041484916571792702745057740581727230159139685185762082554198619328292418486241
Prime order of the ECgFp5 group from
curve/ecgfp5/scalar_field.go.
- class LighterApiKey
Bases:
objectA locally generated Lighter API-key pair.
The private scalar is intentionally excluded from
repr(). Store it only in an explicitly secret-bearing deployment report.
- generate_lighter_api_key(api_key_index=4)
Generate a Lighter API-key pair for deployment registration.
Uses Python’s cryptographic random source for a non-zero scalar and derives only its public key locally. The caller must register the public key on L1 before using the private key for Lighter trading.
- Parameters
api_key_index (int) – Lighter API-key slot in the user range 4 through 254.
- Returns
A private/public API-key pair. Its private key is not included in
repr().- Return type