@aptos-labs/ts-sdk
Version:
Aptos TypeScript SDK
49 lines • 2.29 kB
TypeScript
import type { Fp2 } from "@noble/curves/abstract/tower.js";
import type { WeierstrassPoint } from "@noble/curves/abstract/weierstrass.js";
import { Serializable, Serializer } from "../../../bcs/serializer.js";
import { Deserializer } from "../../../bcs/deserializer.js";
import { SymmetricCiphertext, SymmetricKey } from "./symmetric.js";
/**
* Corresponds to the Rust type `aptos_batch_encryption::shared::ciphertext::BIBECiphertext`.
*/
export declare class BIBECiphertext extends Serializable {
id: bigint;
ctG2: WeierstrassPoint<Fp2>[];
paddedKey: SymmetricKey;
symmetricCiphertext: SymmetricCiphertext;
constructor(id: bigint, ctG2: WeierstrassPoint<Fp2>[], paddedKey: SymmetricKey, symmetricCiphertext: SymmetricCiphertext);
serialize(serializer: Serializer): void;
static deserialize(deserializer: Deserializer): BIBECiphertext;
}
/**
* Corresponds to the Rust type `aptos_batch_encryption::shared::ciphertext::Ciphertext`.
*/
export declare class Ciphertext extends Serializable {
vk: Uint8Array;
bibeCt: BIBECiphertext;
associatedDataBytes: Uint8Array;
signature: Uint8Array;
constructor(vk: Uint8Array, bibeCt: BIBECiphertext, associatedDataBytes: Uint8Array, signature: Uint8Array);
serialize(serializer: Serializer): void;
static deserialize(deserializer: Deserializer): Ciphertext;
}
/**
* Corresponds to the Rust type `aptos_batch_encryption::shared::encryption_key::EncryptionKey`.
*
* Deserialize from hex (API) -> bytes -> BCS -> EncryptionKey.
*/
export declare class EncryptionKey extends Serializable {
sigMpkG2: WeierstrassPoint<Fp2>;
tauG2: WeierstrassPoint<Fp2>;
constructor(sigMpkG2: WeierstrassPoint<Fp2>, tauG2: WeierstrassPoint<Fp2>);
serialize(serializer: Serializer): void;
static deserialize(deserializer: Deserializer): EncryptionKey;
private bibeEncrypt;
/**
* Encrypts a plaintext with associated data, producing a `Ciphertext`.
* Matches Rust: Id::from_verifying_key_and_ad(vk, associated_data) then CTEncrypt.
* The ciphertext Id must equal hash(vk || BCS(associated_data)) with ID_HASH_DST so the node can verify.
*/
encrypt(plaintext: Serializable, associatedData: Serializable): Ciphertext;
}
//# sourceMappingURL=ciphertext.d.ts.map