generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
efaa8ca
commit 92515b5
Showing
2 changed files
with
41 additions
and
50 deletions.
There are no files selected for viewing
79 changes: 30 additions & 49 deletions
79
bound/kt/src/test/kotlin/web5/sdk/dids/methods/web/DidWebTests.kt
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,37 @@ | ||
package web5.sdk.dids.methods.web | ||
|
||
import io.mockk.coEvery | ||
import io.mockk.every | ||
import io.mockk.mockk | ||
import io.mockk.mockkStatic | ||
import kotlinx.coroutines.runBlocking | ||
import org.junit.jupiter.api.AfterEach | ||
import org.junit.jupiter.api.BeforeEach | ||
import org.junit.jupiter.api.Test | ||
import org.junit.jupiter.api.Assertions.* | ||
import web5.sdk.dids.Document | ||
import web5.sdk.rust.DidJwk | ||
import web5.sdk.rust.RustCoreException | ||
|
||
class DidWebTests { | ||
|
||
// TODO: Did web resolution errors - https://github.com/TBD54566975/web5-rs/issues/272 | ||
// @Test | ||
// fun `can create did web from uri`() = runBlocking { | ||
// val didUri = "did:web:localhost:1234" | ||
// val resolvedDid = DidWeb(didUri) | ||
// | ||
// assertEquals("did:web:localhost:1234", resolvedDid.document!!.id) | ||
// } | ||
|
||
// @Test | ||
// fun `can create did web from url`() { | ||
// val didDocument = Document( | ||
// id = "did:web:localhost:1234", | ||
// context = listOf("https://www.w3.org/ns/did/v1"), | ||
// verificationMethod = listOf( | ||
// VerificationMethod( | ||
// id = "did:web:www.tbd.website#key-0", | ||
// type = "JsonWebKey", | ||
// controller = "did:web:www.tbd.website", | ||
// publicKeyJwk = PublicKeyJwk( | ||
// alg = "Ed25519", | ||
// kty = "OKP", | ||
// crv = "Ed25519", | ||
// x = "gNFtgCZhOYv00p48FHQYt4edkoBPOyw0oGAB20LrT0c" | ||
// ) | ||
// ) | ||
// ) | ||
// ) | ||
// | ||
// // TODO: Construct a resolution result the correct way | ||
// val resolutionResult = web5.sdk.dids.methods.jwk.DidJwk.resolve("did:jwk:eyJhbGciOiJFZDI1NTE5Iiwia3R5IjoiT0tQIiwiY3J2IjoiRWQyNTUxOSIsImQiOiJwR0tScHBWczlqYkhWYkZjNm5MTmZQZEN0RG9lOHV1VVNaNVMzX3VOWXpvIiwieCI6IjV5V0FBMkZBM25pMnJaSjh3NVVKMkxMdFZHN2lsYU0wRkc1ZVYwXzZ4U3cifQ") | ||
|
||
@Test | ||
fun `can resolve did web uri`() { | ||
// Works if you host a local did web document You must host this json at http://localhost:1234/.well-known/did.json | ||
// val didDocumentJson = """ | ||
// { | ||
// "id":"did:web.tbd.website", | ||
// "@context":[ | ||
// "https://www.w3.org/ns/did/v1" | ||
// ], | ||
// "verificationMethod":[ | ||
// { | ||
// "id":"did:web:www.tbd.website#key-0", | ||
// "type":"JsonWebKey", | ||
// "controller":"did:web:www.tbd.website", | ||
// "publicKeyJwk":{ | ||
// "alg":"Ed25519", | ||
// "kty":"OKP", | ||
// "crv":"Ed25519", | ||
// "x":"gNFtgCZhOYv00p48FHQYt4edkoBPOyw0oGAB20LrT0c" | ||
// } | ||
// } | ||
// ] | ||
// } | ||
// """.trimIndent() | ||
// | ||
// mockkStatic("web5.sdk.dids.methods.web.DidWeb") | ||
// coEvery { DidWeb.resolve("did:web:localhost:1234") } returns resolutionResult | ||
// val didUri = "did:web:localhost%3A1234" | ||
// val resolvedDid = DidWeb.resolve(didUri) | ||
// | ||
// val didWebResolutionResult = DidWeb.resolve("did:web:localhost:1234") | ||
// assertEquals("did:web:localhost:1234", didWebResolutionResult.document!!.id) | ||
// } | ||
} | ||
// assertEquals(resolvedDid.document!!.id, "did:web:www.tbd.website") | ||
} | ||
} |
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