Skip to content

Commit

Permalink
add method to hash payload and test it
Browse files Browse the repository at this point in the history
  • Loading branch information
jonesmac committed Nov 14, 2024
1 parent 6026aed commit d7f74a6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sdk/src/androidTest/java/network/xyo/client/XyoPayloadTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,10 @@ class XyoPayloadTest {
assertNotNull(bwMirrored)
}
}

@Test
fun testHashing() {
val payload = TestConstants.debugPayload
assertEquals(payload.hash(), TestConstants.debugPayloadHash)
}
}
4 changes: 4 additions & 0 deletions sdk/src/main/java/network/xyo/client/payload/XyoPayload.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ open class XyoPayload(): Payload, XyoSerializable() {
throw XyoInvalidSchemaException(schema)
}
}

open fun hash(): String {
return sha256String(this)
}
}

0 comments on commit d7f74a6

Please sign in to comment.