Module: PassForge

Defined in:
lib/passforge.rb,
lib/passforge/batch.rb,
lib/passforge/pattern.rb,
lib/passforge/version.rb,
lib/passforge/analyzer.rb,
lib/passforge/charsets.rb,
lib/passforge/wordlist.rb,
lib/passforge/generator.rb,
lib/passforge/passphrase.rb,
lib/passforge/pronounceable.rb,
lib/passforge/breach_checker.rb

Overview

PassForge - A comprehensive password generation toolkit

Examples:

Generate a random password

PassForge.random(length: 16, symbols: true)

Generate a passphrase

PassForge.passphrase(words: 4, separator: '-')

Defined Under Namespace

Modules: Charsets, Wordlist Classes: Analyzer, Batch, BreachChecker, Error, Generator, Passphrase, Pattern, Pronounceable

Constant Summary collapse

VERSION =
"1.1.2"

Class Method Summary collapse

Class Method Details

.analyze(password) ⇒ Analyzer::Result

Analyze password strength

Parameters:

  • password (String)

    Password to analyze

Returns:



45
46
47
# File 'lib/passforge.rb', line 45

def self.analyze(password)
  Analyzer.analyze(password)
end

.batch(count, type = :random, **options) ⇒ Array<String>

Generate multiple passwords

Parameters:

  • count (Integer)

    Number of passwords

  • type (Symbol) (defaults to: :random)

    Type of password

  • options (Hash)

    Generation options

Returns:

  • (Array<String>)

    Generated passwords



75
76
77
# File 'lib/passforge.rb', line 75

def self.batch(count, type = :random, **options)
  Batch.generate(count, type, **options)
end

.breached?(password) ⇒ Hash

Check if password has been breached

Parameters:

  • password (String)

    Password to check

Returns:

  • (Hash)

    Breach information



52
53
54
# File 'lib/passforge.rb', line 52

def self.breached?(password)
  BreachChecker.check(password)
end

.passphrase(**options) ⇒ String

Generate a passphrase

Parameters:

  • options (Hash)

    Passphrase options

Returns:

  • (String)

    Generated passphrase



38
39
40
# File 'lib/passforge.rb', line 38

def self.passphrase(**options)
  Passphrase.generate(**options)
end

.pattern(pattern) ⇒ String

Generate password from pattern

Parameters:

  • pattern (String)

    Pattern string

Returns:

  • (String)

    Generated password



66
67
68
# File 'lib/passforge.rb', line 66

def self.pattern(pattern)
  Pattern.generate(pattern)
end

.personal(keywords, **options) ⇒ String

Generate a personalized password

Parameters:

  • keywords (Array<String>)

    Personal keywords

  • options (Hash)

    Generation options

Returns:

  • (String)

    Generated password



83
84
85
# File 'lib/passforge.rb', line 83

def self.personal(keywords, **options)
  Personal.generate(keywords, **options)
end

.pronounceable(**options) ⇒ String

Generate a pronounceable password

Parameters:

  • options (Hash)

    Generation options

Returns:

  • (String)

    Generated password



59
60
61
# File 'lib/passforge.rb', line 59

def self.pronounceable(**options)
  Pronounceable.generate(**options)
end

.random(length: 12, **options) ⇒ String

Generate a random password

Parameters:

  • length (Integer) (defaults to: 12)

    Length of the password

  • options (Hash)

    Generation options

Returns:

  • (String)

    Generated password



31
32
33
# File 'lib/passforge.rb', line 31

def self.random(length: 12, **options)
  Generator.generate(length, **options)
end