@@ -8,23 +8,23 @@ internal class ApiKeyVerifierTest {
8
8
9
9
@Test
10
10
fun `Should be able to verify api key with same secret` () {
11
- val verifier = ApiKeyVerifier (" secret" .toByteArray() )
12
- val enc = verifier.generate(" apikey" .toByteArray() )
13
- assertTrue { verifier.verify(" apikey" .toByteArray(), enc ) }
11
+ val verifier = ApiKeyVerifier (" secret" )
12
+ val enc = verifier.generate(" apikey" )
13
+ assertTrue { verifier.verify( enc, " apikey" ) }
14
14
}
15
15
16
16
@Test
17
17
fun `Should not be able to verify api if key has changed key with same secret` () {
18
- val verifier = ApiKeyVerifier (" secret" .toByteArray() )
19
- val enc = verifier.generate(" apikey" .toByteArray() )
20
- assertFalse { verifier.verify(" Apikey" .toByteArray(), enc ) }
18
+ val verifier = ApiKeyVerifier (" secret" )
19
+ val enc = verifier.generate(" apikey" )
20
+ assertFalse { verifier.verify( enc, " Apikey" ) }
21
21
}
22
22
23
23
@Test
24
24
fun `Should not be able to verify api if with secret changed` () {
25
- val generator = ApiKeyVerifier (" another secret" .toByteArray() )
26
- val enc = generator.generate(" apikey" .toByteArray() )
27
- val verifier = ApiKeyVerifier (" secret" .toByteArray() )
28
- assertFalse { verifier.verify(" apikey" .toByteArray(), enc ) }
25
+ val generator = ApiKeyVerifier (" another secret" )
26
+ val enc = generator.generate(" apikey" )
27
+ val verifier = ApiKeyVerifier (" secret" )
28
+ assertFalse { verifier.verify(enc, " apikey" ) }
29
29
}
30
30
}
0 commit comments