use Seq.has in ToptSecret.verify
This commit is contained in:
parent
bbbc135c37
commit
1e7211def1
|
@ -54,7 +54,7 @@ trait Lilaisms
|
|||
|
||||
@inline implicit def toPimpedTryList[A](l: List[Try[A]]) = new PimpedTryList(l)
|
||||
@inline implicit def toPimpedList[A](l: List[A]) = new PimpedList(l)
|
||||
@inline implicit def toPimpedSeq[A](l: List[A]) = new PimpedSeq(l)
|
||||
@inline implicit def toPimpedSeq[A](l: Seq[A]) = new PimpedSeq(l)
|
||||
@inline implicit def toPimpedByteArray(ba: Array[Byte]) = new PimpedByteArray(ba)
|
||||
|
||||
@inline implicit def toPimpedOption[A](a: Option[A]) = new PimpedOption(a)
|
||||
|
|
|
@ -35,7 +35,7 @@ case class TotpSecret(secret: Array[Byte]) extends AnyVal {
|
|||
|
||||
def verify(token: TotpToken): Boolean = {
|
||||
val period = System.currentTimeMillis / 30000
|
||||
(-TotpSecret.window to TotpSecret.window).map(skew => totp(period + skew)).contains(token.value)
|
||||
(-TotpSecret.window to TotpSecret.window).map(skew => totp(period + skew)).has(token)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue