@istvan.xyz/phc-format
Version:
An implementation of the PHC format.
38 lines (35 loc) • 1.19 kB
text/typescript
/**
* Generates a PHC string using the data provided.
* @param {Object} opts Object that holds the data needed to generate the PHC
* string.
* @param {string} opts.id Symbolic name for the function.
* @param {Number} [opts.version] The version of the function.
* @param {Object} [opts.params] Parameters of the function.
* @param {Buffer} [opts.salt] The salt as a binary buffer.
* @param {Buffer} [opts.hash] The hash as a binary buffer.
* @return {string} The hash string adhering to the PHC format.
*/
declare function serialize(opts: {
id: string;
version?: number;
params?: {
[key: string]: string | Uint8Array | number;
};
salt?: Uint8Array;
hash?: Uint8Array;
}): string;
/**
* Parses data from a PHC string.
* @param {string} phcString A PHC string to parse.
* @return {Object} The object containing the data parsed from the PHC string.
*/
declare function deserialize(phcString: string): {
id?: string | undefined;
version?: number | undefined;
params?: {
[key: string]: unknown;
} | undefined;
salt?: Uint8Array | undefined;
hash?: Uint8Array | undefined;
};
export { deserialize, serialize };