Ethers: AegisSigner
A AegisSigner connects to a Aegis Server Wallet
over https, and allows all normal Signer operations
protected by the server wallet.
Installing
# Install the extension pacakge
$ npm install @caigou-xyz/aegis-js
Usage
new AegisClient(signKeyPair, endpoint) => AegisClient
Create a new AegisClient connected to a Aegis Server Wallet via https
new AegisSigner(aegisClient, address, provider?) => Signer
Create a new AegisSigner connected to a Aegis Client
and optionally connected to the blockchain using provider
.
import {AegisClient, AegisSigner} from "@caigou-xyz/aegis-js";
// Generate a new keypair
const signKeyPair = nacl.sign.keyPair();
// or Use a known keypair
const signKeyPairBase64 = "0veYb4RYXn/yr2SjPBf3jadn8bxIJqdFHmiwXPnV4sGlwzfzS931kLlaAqNl/xk3ey4Qs2ygPuTTiZyqi1Vagg==";
const signKeyPair = nacl.sign.keyPair.fromSecretKey(naclUtil.decodeBase64(signKeyPairBase64));
// Create a new AegisClient connected to the Aegis Server Wallet
const aegisClient = new AegisClient(signKeyPair, "http://localhost:8080");
// Create a new Account
const { address } = await aegisClient.create();
const signer = new AegisSigner(aegisClient, address, provider);
License
MIT License.