2024-04-29 18:55:15 +03:00
|
|
|
import { EthEncryptedData } from '@metamask/eth-sig-util';
|
2024-10-26 21:54:31 +03:00
|
|
|
import { Signer, Wallet } from 'ethers';
|
2024-04-29 18:55:15 +03:00
|
|
|
import { EchoEvents, EncryptedNotesEvents } from './events';
|
|
|
|
import type { NetIdType } from './networkConfig';
|
|
|
|
export interface NoteToEncrypt {
|
|
|
|
address: string;
|
|
|
|
noteHex: string;
|
|
|
|
}
|
|
|
|
export interface DecryptedNotes {
|
|
|
|
blockNumber: number;
|
|
|
|
address: string;
|
|
|
|
noteHex: string;
|
|
|
|
}
|
|
|
|
export declare function packEncryptedMessage({ nonce, ephemPublicKey, ciphertext }: EthEncryptedData): string;
|
|
|
|
export declare function unpackEncryptedMessage(encryptedMessage: string): EthEncryptedData & {
|
|
|
|
messageBuff: string;
|
|
|
|
};
|
|
|
|
export interface NoteAccountConstructor {
|
|
|
|
netId: NetIdType;
|
|
|
|
blockNumber?: number;
|
|
|
|
recoveryKey?: string;
|
|
|
|
}
|
|
|
|
export declare class NoteAccount {
|
|
|
|
netId: NetIdType;
|
|
|
|
blockNumber?: number;
|
|
|
|
recoveryKey: string;
|
|
|
|
recoveryAddress: string;
|
|
|
|
recoveryPublicKey: string;
|
2024-10-26 21:54:31 +03:00
|
|
|
constructor({ netId, blockNumber, recoveryKey }: NoteAccountConstructor);
|
2024-04-29 18:55:15 +03:00
|
|
|
/**
|
|
|
|
* Intends to mock eth_getEncryptionPublicKey behavior from MetaMask
|
|
|
|
* In order to make the recoveryKey retrival from Echoer possible from the bare private key
|
|
|
|
*/
|
2024-10-26 21:54:31 +03:00
|
|
|
static getSignerPublicKey(signer: Signer | Wallet): Promise<string>;
|
2024-04-29 18:55:15 +03:00
|
|
|
getEncryptedAccount(walletPublicKey: string): {
|
|
|
|
encryptedData: EthEncryptedData;
|
|
|
|
data: string;
|
|
|
|
};
|
|
|
|
/**
|
|
|
|
* Decrypt Echoer backuped note encryption account with private keys
|
|
|
|
*/
|
2024-10-26 21:54:31 +03:00
|
|
|
decryptSignerNoteAccounts(signer: Signer | Wallet, events: EchoEvents[]): Promise<NoteAccount[]>;
|
2024-04-29 18:55:15 +03:00
|
|
|
decryptNotes(events: EncryptedNotesEvents[]): DecryptedNotes[];
|
|
|
|
encryptNote({ address, noteHex }: NoteToEncrypt): string;
|
|
|
|
}
|