@aptos-labs/ts-sdk
Version:
Aptos TypeScript SDK
38 lines • 1.9 kB
TypeScript
import type { WeierstrassPoint } from "@noble/curves/abstract/weierstrass.js";
import type { Fp2 } from "@noble/curves/abstract/tower.js";
import { Serializable, Serializer } from "../../../bcs/serializer.js";
import { Deserializer } from "../../../bcs/deserializer.js";
/** Domain separation tag for Id::from_verifying_key_and_ad. Must match Rust ID_HASH_DST. */
export declare const ID_HASH_DST: NodeJS.NonSharedUint8Array;
export declare class OneTimePad extends Serializable {
otp: Uint8Array;
constructor(otp: Uint8Array);
static fromSourceBytes(otpSource: Uint8Array): OneTimePad;
padKey(value: SymmetricKey): SymmetricKey;
serialize(serializer: Serializer): void;
static deserialize(deserializer: Deserializer): OneTimePad;
}
export declare class SymmetricCiphertext extends Serializable {
nonce: Uint8Array;
ctBody: Uint8Array;
constructor(nonce: Uint8Array, ctBody: Uint8Array);
serialize(serializer: Serializer): void;
static deserialize(deserializer: Deserializer): SymmetricCiphertext;
}
export declare class SymmetricKey extends Serializable {
key: Uint8Array;
constructor(key?: Uint8Array);
encrypt(msg: Serializable): SymmetricCiphertext;
serialize(serializer: Serializer): void;
static deserialize(deserializer: Deserializer): SymmetricKey;
}
export declare function hmacKdf(otpSource: Uint8Array): Uint8Array;
export declare function getRandomFr(): bigint;
/**
* Hash bytes to a field element in Fr. Used for Id and other hashes.
* @param input - bytes to hash (e.g. vk || BCS(associated_data) for Id)
* @param dst - optional domain separation tag; use ID_HASH_DST for Id::from_verifying_key_and_ad
*/
export declare function hashToFr(input: Uint8Array, dst?: Uint8Array): bigint;
export declare function hashG2Element(g2Element: WeierstrassPoint<Fp2>): WeierstrassPoint<bigint>;
//# sourceMappingURL=symmetric.d.ts.map