Skip to content

A client for HaveIBeenPwned.com's compromised passwords API. Written in Swift, with no dependencies.

License

Notifications You must be signed in to change notification settings

cak/PwnedPasswords

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PwnedPasswords

License

PwnedPasswords implements a client for HaveIBeenPwned.com's Pwned Passwords API v2 in Swift.

  • Its only dependencies are Foundation and CommonCrypto.
  • Does not disclose the password being checked to third parties. Only the first 5 characters of the password sha1 hash are disclosed (See k-Anonymity.)
  • Can target iOS, macOS, tvOS, and watchOS.

Example

    PwnedPasswords.shared.check(password: "password1") { (result) in

        switch result {

            case .success( let count ):

                if count > 0 {
                
                  print( "This password has been found \(count) times in compromised accounts" )
                  
                } else {
                
                  print( "This password wasn't found to be compromised." )
                  
                }
                
            case .failure:

                print( "This password could not be checked at this time" )

        }

    }

Installation: CocoaPods

PwnedPasswords is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'SwiftPwnedPasswords'

Installation: Manual

Copy PwnedPasswords.swift to your project.

License

PwnedPasswords is available under the MIT license. See the LICENSE file for more info.

About

A client for HaveIBeenPwned.com's compromised passwords API. Written in Swift, with no dependencies.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Swift 91.5%
  • Ruby 8.5%