Skip to content

Instantly share code, notes, and snippets.

@whitetigle
Last active December 22, 2018 08:26
Show Gist options
  • Select an option

  • Save whitetigle/7d4b4376e02873b24515fdf2f6e56492 to your computer and use it in GitHub Desktop.

Select an option

Save whitetigle/7d4b4376e02873b24515fdf2f6e56492 to your computer and use it in GitHub Desktop.
// ts2fable 0.6.0-build.320
module rec Fable.Import.Bcrypt
open System
open Fable.Core
open Fable.Import.JS
[<Import("default", from="bcrypt")>]
let Bcrypt: IExports = jsNative
type [<AllowNullLiteral>] IExports =
/// <param name="rounds">The cost of processing the data. Default 10.</param>
/// <param name="minor">The minor version of bcrypt to use. Either 'a' or 'b'. Default 'b'.</param>
abstract genSaltSync: ?rounds: float * ?minor: string -> string
/// <param name="rounds">The cost of processing the data. Default 10.</param>
/// <param name="callback">A callback to be fire once the sald has been generated. Uses eio making it asynchronous.</param>
abstract genSalt: ?rounds: float * ?callback: (Error -> string -> unit) -> Promise<string>
/// <param name="rounds">The cost of processing the data. Default 10.</param>
/// <param name="minor">The minor version of bcrypt to use. Either 'a' or 'b'. Default 'b'.</param>
/// <param name="callback">A callback to be fire once the sald has been generated. Uses eio making it asynchronous.</param>
abstract genSalt: ?rounds: float * ?minor: string * ?callback: (Error -> string -> unit) -> Promise<string>
/// <param name="callback">A callback to be fire once the sald has been generated. Uses eio making it asynchronous.</param>
abstract genSalt: ?callback: (Error -> string -> unit) -> Promise<string>
/// <param name="data">The data to be encrypted.</param>
abstract hashSync: data: obj option * saltOrRounds: U2<string, float> -> string
/// <param name="data">The data to be encrypted.</param>
/// <param name="callback">A callback to be fired once the data has been encrypted. Uses eio making it asynchronous.</param>
abstract hash: data: obj option * saltOrRounds: U2<string, float> * ?callback: (Error -> string -> unit) -> Promise<string>
/// <param name="data">The data to be encrypted.</param>
/// <param name="encrypted">The data to be compared against.</param>
abstract compareSync: data: obj option * encrypted: string -> bool
/// <param name="data">The data to be encrypted.</param>
/// <param name="encrypted">The data to be compared against.</param>
/// <param name="callback">A callback to be fire once the data has been compared. Uses eio making it asynchronous.</param>
abstract compare: data: obj option * encrypted: string * ?callback: (Error -> bool -> unit) -> Promise<bool>
/// <summary>Return the number of rounds used to encrypt a given hash</summary>
/// <param name="encrypted">Hash from which the number of rounds used should be extracted.</param>
abstract getRounds: encrypted: string -> float
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment