beenpwned4s


License

License

MIT
GroupId

GroupId

io.onema
ArtifactId

ArtifactId

beenpwned4s_2.12
Last Version

Last Version

0.1.0
Release Date

Release Date

Type

Type

jar
Description

Description

beenpwned4s
beenpwned4s
Project URL

Project URL

https://github.com/onema/beenpwned4s
Project Organization

Project Organization

io.onema
Source Code Management

Source Code Management

https://github.com/onema/beenpwned4s

Download beenpwned4s_2.12

How to add to project

<!-- https://jarcasting.com/artifacts/io.onema/beenpwned4s_2.12/ -->
<dependency>
    <groupId>io.onema</groupId>
    <artifactId>beenpwned4s_2.12</artifactId>
    <version>0.1.0</version>
</dependency>
// https://jarcasting.com/artifacts/io.onema/beenpwned4s_2.12/
implementation 'io.onema:beenpwned4s_2.12:0.1.0'
// https://jarcasting.com/artifacts/io.onema/beenpwned4s_2.12/
implementation ("io.onema:beenpwned4s_2.12:0.1.0")
'io.onema:beenpwned4s_2.12:jar:0.1.0'
<dependency org="io.onema" name="beenpwned4s_2.12" rev="0.1.0">
  <artifact name="beenpwned4s_2.12" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.onema', module='beenpwned4s_2.12', version='0.1.0')
)
libraryDependencies += "io.onema" % "beenpwned4s_2.12" % "0.1.0"
[io.onema/beenpwned4s_2.12 "0.1.0"]

Dependencies

compile (3)

Group / Artifact Type Version
org.scala-lang : scala-library jar 2.12.8
com.lihaoyi : requests_2.12 jar 0.1.7
io.onema : json-extensions_2.12 jar 0.5.0

test (2)

Group / Artifact Type Version
org.scalatest : scalatest_2.12 jar 3.0.5
org.scalamock : scalamock_2.12 jar 4.1.0

Project Modules

There are no modules declared in this project.

Beenpwned4s

Scala client for the "Have I Been Pwned API v2" https://haveibeenpwned.com/API/v2

Install

Example

Find if an email is Pwned:

import io.onema.beenpwned4s.PwnedClient

val client = PwnedClient()
if(client.isEmailBreached("[email protected]")) {
  println("Email is pwned")
} else {
  println("Email is not pwned")
}

val emailResults: Option[Seq[PwnedClient.Breach]] = client.getEmailBreached("[email protected]")
emailResults.isDefined
println(s"The email has been pwned ${emailResults.get.length} times")

Find if the password is Pwned:

import io.onema.beenpwned4s.PwnedClient

val client = PwnedClient()
if(client.isPasswordPwned("password")) {
  println("Password is pwned")
} else {
  println("Password is not pwned")
}

val passwordResult: Option[PwnedClient.HashPwned] = client.getPasswordPwned("password")
passwordResult.isDefined
passwordResult.foreach(p => {
  println(s"The password-hash suffix ${p.hashSuffix} has been pwned ${p.count} times")
})

Versions

Version
0.1.0