lea-improvement-proposals

Abstract

This LIP defines a standard interface for WebAssembly (WASM) modules that provide public-key cryptography functions. The LEA Public Key Module Interface (LEA-PKMI) specifies a set of required imports and exports that enable seamless integration of cryptographic modules for operations like key generation, signing, and verification within the LEA ecosystem. This standardization promotes interoperability, simplifies development, and allows for modular replacement of cryptographic implementations.

Motivation

As the LEA ecosystem grows, there is a need for a standardized way to perform public-key cryptography across different applications and environments. Without a defined interface, developers must write custom "glue code" for each specific cryptographic library, leading to duplicated effort, increased complexity, and a higher risk of implementation errors.

The LEA-PKMI provides a clear, minimal, and efficient contract between a host environment and a WASM-based cryptographic module. This allows developers to easily swap different modules (e.g., switching from an Ed25519 module to a different signature scheme) without changing the host application's code, fostering a more flexible and secure development environment.

Specification

Any WASM module compliant with LEA-PKMI MUST implement the following interface.

1. Imports

The module MUST import the following functions from the host environment under the env namespace.

2. Exports

The module MUST export the following memory and functions.

2.1. Memory

2.2. Allocator Functions

2.3. Constant Functions

2.4. Cryptographic Functions

These functions MUST return 0 on success and a non-zero integer on failure.

Rationale

The design of the LEA-PKMI prioritizes simplicity, security, and performance.

Backwards Compatibility

This LIP introduces a new standard and does not break any existing protocols. It is intended for new cryptographic modules developed for the LEA ecosystem. Existing modules would need to be updated to comply with this interface.

Security Considerations

This LIP is licensed under the MIT License.