@types/elgamal
TypeScript icon, indicating that this package has built-in type declarations

0.3.3 • Public • Published

Installation

npm install --save @types/elgamal

Summary

This package contains type definitions for elgamal (https://github.com/kripod/elgamal.js).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/elgamal.

index.d.ts

import { BigInteger as BigInt } from "jsbn";

export default class ElGamal {
    p: BigInt;
    g: BigInt;
    y: BigInt;
    x: BigInt;
    static generateAsync(primeBits?: number): Promise<ElGamal>;
    constructor(
        p: BigInt | string | number,
        g: BigInt | string | number,
        y: BigInt | string | number,
        x: BigInt | string | number,
    );
    encryptAsync(m: BigInt | string | number, k?: BigInt | string | number): Promise<EncryptedValue>;
    decryptAsync(m: EncryptedValue): Promise<DecryptedValue>;
}

export { BigInt };

export class DecryptedValue {
    bi: BigInt;
    constructor(m: BigInt | string | number);
    toString(): string;
}

export class EncryptedValue {
    a: BigInt;
    b: BigInt;
    constructor(a: BigInt, b: BigInt);
    multiply(encryptedValue: EncryptedValue): EncryptedValue;
}

export namespace Utils {
    const BIG_TWO: BigInt;
    function getRandomNbitBigIntAsync(bits: number): Promise<BigInt>;
    function getRandomBigIntAsync(min: BigInt, max: BigInt): Promise<BigInt>;
    function getBigPrimeAsync(bits: number): Promise<BigInt>;
    function parseBigInt(obj: BigInt | string | number): BigInt | null;
}

export class MissingPrivateKeyError extends Error {}

Additional Details

  • Last updated: Mon, 06 Nov 2023 22:41:05 GMT
  • Dependencies: @types/jsbn

Credits

These definitions were written by Yu-Hsi Chiang.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/elgamal

Weekly Downloads

4

Version

0.3.3

License

MIT

Unpacked Size

5.06 kB

Total Files

5

Last publish

Collaborators

  • types