Skip to main content

constructor(config: SDKConfig)

Initializes a new instance of the Aeon Signer. This is the entry point for using the AeonSigner class. You must provide either an EVM private key as a Buffer or an ethers.js Wallet instance.

Parameters

  • config: SDKConfig - The configuration object for the SDK.
    • privateKey: Buffer (Optional) - The EVM private key as a Buffer. This key is used to derive all necessary cryptographic material for interacting with Aeon’s systems and supported blockchains.
    • wallet: ethers.Wallet (Optional) - An ethers.js Wallet instance. The SDK will use the private key from this wallet.
One of privateKey or wallet must be provided.

Usage

import { AeonSigner } from "@aeon-protocol/aeon-sdk";
import { Wallet } from "ethers";

// Option 1: Initialize with a private key buffer
const privateKeyHex = "your-private-key-hex-without-0x"; // Replace with your actual private key
const privateKeyBuffer = Buffer.from(privateKeyHex, "hex");
const signerFromBuffer = new AeonSigner({ privateKey: privateKeyBuffer });

// Option 2: Initialize with an ethers.js Wallet
const wallet = new Wallet(privateKeyHex); // Or use Wallet.createRandom(), or from mnemonic etc.
const signerFromWallet = new AeonSigner({ wallet });

console.log(
  "AeonSigner initialized successfully using buffer:",
  signerFromBuffer
);
console.log(
  "AeonSigner initialized successfully using wallet:",
  signerFromWallet
);

Details

The constructor initializes the AeonSigner instance by taking the provided EVM private key (either directly as a Buffer or from an ethers.js Wallet). This EVM private key is fundamental to the signer’s identity and operations within the Aeon ecosystem:
  1. Sui Address Derivation: The SDK uses this EVM private key to sign a specific personal message (an off-chain signature). The resulting signature is then used to deterministically derive a Sui address. This derived Sui address serves multiple critical purposes:
    • User Share Encryption: When user key shares are distributed to this AeonSigner instance, they are encrypted using a public key associated with this derived Sui address. This ensures that only this AeonSigner (with access to the original EVM private key) can decrypt and use its key shares.
    • Capability Holding on Sui: User capabilities (caps), which grant permissions and access within Aeon workspaces (e.g., the ability to participate in signing, manage policies), are held by this derived Sui address on the Sui blockchain.
  2. Authorizing Workspace Invitations: The EVM private key (and by extension, the EVM address associated with it) is used to authorize the acceptance of workspace invitations. Specifically, when signer.signAcceptWorkspaceMessage(workspaceId) is called, the AeonSigner will internally use the EVM key to sign a message. This signature proves ownership of the EVM address to which the invitation and its associated capabilities were issued, allowing the SDK to redeem these capabilities from a registration holder contract on behalf of the user.