Skip to content
A client for HaveIBeenPwned.com's compromised passwords API. Written in Swift, with no dependencies.
Swift Ruby
Branch: master
Clone or download
Pull request Compare This branch is even with 0x6A75616E:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Example
src
.gitignore
LICENSE
Package.swift
README.md
SwiftPwnedPasswords.podspec

README.md

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.

You can’t perform that action at this time.