UNPKG

identity-based-encryption-bn254

Version:

![build](https://github.com/randa-mu/identity-based-encryption-bn254/actions/workflows/build.yml/badge.svg)

31 lines (30 loc) 1.22 kB
import { Fp } from "@noble/curves/abstract/tower"; import { ProjPointType } from "@noble/curves/abstract/weierstrass"; import { Ciphertext, G2, IbeOpts } from "./crypto"; export declare class IBE { private opts; constructor(opts?: IbeOpts); createIdentity(bytes: Uint8Array): Identity; createDecryptionKey(secretKey: SecretKey | Uint8Array, identity: Identity): DecryptionKey; isValidDecryptionKey(publicKey: PublicKey | Uint8Array, decryptionKey: DecryptionKey | Uint8Array, identity: Identity | Uint8Array): boolean; encrypt(message: Uint8Array, identity: Identity, publicKey: PublicKey): Ciphertext; decrypt(ciphertext: Ciphertext, decryptionKey: DecryptionKey | Uint8Array): Uint8Array; static parsePublicKey(bytes: Uint8Array): PublicKey; static parseDecryptionKey(bytes: Uint8Array): DecryptionKey; static parseSecretKey(sk: Uint8Array | bigint): SecretKey; static createSecretKey(): SecretKey; static createPublicKey(secretKey: SecretKey): PublicKey; } export type SecretKey = { sk: bigint; }; export type Identity = { m: Uint8Array; i: ProjPointType<Fp>; }; export type PublicKey = { p: G2; }; export type DecryptionKey = { bytes: Uint8Array; };