File tree 1 file changed +29
-0
lines changed
src/test/scala/io/iohk/atala/prism/node/identity
1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ package io .iohk .atala .prism .node .identity
2
+
3
+ import org .scalatest .matchers .must .Matchers .convertToAnyMustWrapper
4
+ import org .scalatest .wordspec .AnyWordSpec
5
+ import io .iohk .atala .prism .node .crypto .CryptoUtils .Sha256Hash
6
+ import io .iohk .atala .prism .node .utils .Base64Utils
7
+
8
+ class PrismDidSpec extends AnyWordSpec {
9
+
10
+ " PrismDid library" should {
11
+
12
+ val canonicalSuffixHex = " 9b5118411248d9663b6ab15128fba8106511230ff654e7514cdcc4ce919bde9b"
13
+ val canonicalSuffix = Sha256Hash .fromHex(canonicalSuffixHex)
14
+ val encodedStateUsedBase64 =
15
+ " Cj8KPRI7CgdtYXN0ZXIwEAFKLgoJc2VjcDI1NmsxEiEDHpf-yhIns-LP3tLvA8icC5FJ1ZlBwbllPtIdNZ3q0jU"
16
+ val encodedStateUsed = Base64Utils .decodeURL(encodedStateUsedBase64)
17
+
18
+ val short = PrismDid .buildCanonical(canonicalSuffix)
19
+ val long = PrismDid .buildLongForm(canonicalSuffix, encodedStateUsed)
20
+
21
+ // HASHING
22
+ " asCanonical should work for long and short form dids" in {
23
+ canonicalSuffixHex mustBe short.asCanonical().suffix
24
+ canonicalSuffixHex mustBe long.asCanonical().suffix
25
+ }
26
+
27
+
28
+ }
29
+ }
You can’t perform that action at this time.
0 commit comments