-
-
Save jkbbwr/a17238759c2936853b99 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.jetbrains.spek.api.*; | |
import works.credits.core.Credentials | |
import works.credits.core.toByteString | |
class CredentialsSpec : Spek() { init { | |
given("Credential generated from existing signing key bytes.") { | |
val bytes = byteArrayOf(-120, 41, 66, 63, -49, -122, -3, -40, 64, -48, -43, 88, -127, -58, -51, 62, | |
-16, 18, 8, 2, 25, -4, 49, -45, 56, -42, 116, -86, -90, 59, -101, 97) | |
val creds = Credentials.fromSigningKeyBytes(bytes) | |
on("signing some data") { | |
val data = "testing" | |
val sig = creds.sign(data.toByteArray()) | |
it("should match expected signature") { | |
val expected = byteArrayOf(-60, -119, -31, 44, 104, 31, 76, -90, -89, -118, -76, 28, -62, | |
73, 67, 40, 21, -37, -120, 21, -68, 112, -114, 8, 53, -74, -83, -73, 48, -108, 70, | |
-58, 96, 55, -89, 112, 108, 70, 98, 97, 98, 80, -26, -99, 100, 37, -125, 22, 52, | |
-43, -96, 85, -115, 93, 51, 106, -18, 115, -74, -72, 34, 104, -33, 2 | |
).toByteString() | |
shouldEqual(expected, sig) | |
} | |
} | |
} | |
}} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment