Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support typescript #10

Open
zuohuadong opened this issue Nov 28, 2018 · 1 comment
Open

support typescript #10

zuohuadong opened this issue Nov 28, 2018 · 1 comment

Comments

@zuohuadong
Copy link

No description provided.

@awhitford
Copy link

Inspired by simonepri/upash#13, you could try this:

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

declare module "@phc/argon2" {
  type PHCstring = string;

  namespace Argon2 {
    /**
     * Gets the list of all identifiers supported by this hashing function.
     */
    function identifiers(): string[];

    /**
     * Computes the hash string of the given password in the PHC format using argon2 package.
     * @returns a hash with the PHC string format (see https://github.com/P-H-C/phc-string-format/blob/master/phc-sf-spec.md)
     */
    function hash(
      password: string,
      options?: { [key: string]: any }
    ): Promise<PHCstring>;

    /**
     * Determines whether or not the hash stored inside the PHC formatted string matches the hash generated for the password provided.
     */
    function verify(phcString: PHCstring, password: string): Promise<boolean>;
  }

  export = Argon2;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants