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

0.0.32 • Public • Published

Installation

npm install --save @types/srp

Summary

This package contains type definitions for srp (https://github.com/mozilla/node-srp).

Details

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

index.d.ts

/// <reference types="bignum" />
/// <reference types="node" />

import * as BigNum from "bignum";

export = SRP;

declare namespace SRP {
    export interface Params {
        N_length_bits: number;
        N: BigNum;
        g: BigNum;
        hash: string;
    }

    export var params: {
        [bits: string]: Params;
    };

    /**
     * The verifier is calculated as described in Section 3 of [SRP-RFC].
     * We give the algorithm here for convenience.
     *
     * The verifier (v) is computed based on the salt (s), user name (I),
     * password (P), and group parameters (N, g).
     *
     *         x = H(s | H(I | ":" | P))
     *         v = g^x % N
     *
     * @param {Params} params group parameters, with .N, .g, .hash
     * @param {Buffer} salt salt
     * @param {Buffer} I user identity
     * @param {Buffer} P user password
     *
     * @returns {Buffer}
     */
    export function computeVerifier(params: Params, salt: Buffer, I: Buffer, P: Buffer): Buffer;

    /**
     * Generate a random key.
     *
     * @param {number} bytes length of key (default=32)
     * @param {function} callback function to call with err,key
     */
    export function genKey(bytes: number, callback: (error: Error, key: Buffer) => void): void;

    /**
     * Generate a random 32-byte key.
     *
     * @param {function} callback function to call with err,key
     */
    export function genKey(callback: (error: Error, key: Buffer) => void): void;

    export class Client {
        constructor(params: Params, salt: Buffer, identity: Buffer, password: Buffer, secret1: Buffer);
        computeA(): Buffer;
        setB(B: Buffer): void;
        computeM1(): Buffer;
        checkM2(M2: Buffer): void;
        computeK(): Buffer;
    }

    export class Server {
        constructor(params: Params, verifier: Buffer, secret2: Buffer);
        computeB(): Buffer;
        setA(A: Buffer): void;
        checkM1(M1: Buffer): Buffer;
        computeK(): Buffer;
    }
}

Additional Details

Credits

These definitions were written by .

Readme

Keywords

none

Package Sidebar

Install

npm i @types/srp

Weekly Downloads

10

Version

0.0.32

License

MIT

Unpacked Size

6.43 kB

Total Files

5

Last publish

Collaborators

  • types