@foxt/js-srp
Version:
js-srp modified to add support for the SRP implementation used by Apple's iCloud.com
63 lines (62 loc) • 1.56 kB
TypeScript
import { Hash } from "./util.js";
interface PrimeField {
g: bigint;
N: bigint;
n: number;
}
export declare enum Mode {
RFC2945 = 0,
SRPTools = 1,
GoSRP = 2,
GSA = 3
}
export declare class Srp {
readonly m: Mode;
readonly h: Hash;
readonly pf: PrimeField;
constructor(m: Mode, h: Hash, bits?: number);
hashInt(buf: Uint8Array): Promise<bigint>;
verifier(I: Uint8Array, p: Uint8Array, salt?: Uint8Array): Promise<Verifier>;
newClient(I: Uint8Array, p: Uint8Array, a?: bigint): Promise<Client>;
}
export declare class Verifier {
readonly i: Uint8Array;
readonly s: Uint8Array;
readonly v: Uint8Array;
readonly h: Hash;
readonly pf: PrimeField;
constructor(fields: {
i: Uint8Array;
s: Uint8Array;
v: Uint8Array;
h: Hash;
pf: PrimeField;
});
encode(): [string, string];
}
export declare class Client {
readonly s: Srp;
readonly i: Uint8Array;
p: Uint8Array;
readonly a: bigint;
readonly A: bigint;
readonly k: bigint;
private _K;
_M: Uint8Array;
get K(): Uint8Array;
get M(): Uint8Array;
constructor(fields: {
s: Srp;
i: Uint8Array;
p: Uint8Array;
a: bigint;
A: bigint;
k: bigint;
});
credentials(): string;
parseServerCredentials(srv: string): [Uint8Array, Uint8Array];
generate(salt: Uint8Array, B: Uint8Array): Promise<string>;
generateM2(): Promise<Uint8Array>;
serverOk(proof: string): Promise<boolean>;
}
export {};