gotranseo / swift-pwned

Swift library for the Have I Been Pwned API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SwiftPwned

A Vapor/Swift library that checks the https://haveibeenpwned.com/passwords API (all credit to Troy Hunt).

Installation

SwiftPwned is available through SPM. To install it, simply add the following to your Package.swift file:

.package(url: "https://github.com/gotranseo/swift-pwned.git", from: "1.0.0")

Don't forget to also add it to dependencies array.

Configuration

In your configure.swift add the following code:

import SwiftPwned

services.register { c -> SwiftPwned in
    return try SwiftPwned(client: c.make())
}

Usage

let pwnedClient = try container.make(PwnedClient.self)
try pwnedClient.pwned(password: "password").wait() // true

Note: Don't actually use wait(), respond to the future appropriately.

About

Swift library for the Have I Been Pwned API


Languages

Language:Swift 100.0%