-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: jsonld document loader service
- Loading branch information
1 parent
ec17cba
commit 0cb44c1
Showing
6 changed files
with
46 additions
and
10 deletions.
There are no files selected for viewing
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
19 changes: 19 additions & 0 deletions
19
src/main/kotlin/id/walt/credentials/jsonld/JsonLdDocumentLoaderService.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package id.walt.credentials.jsonld | ||
|
||
import com.apicatalog.jsonld.loader.DocumentLoader | ||
import id.walt.servicematrix.ServiceProvider | ||
import id.walt.servicematrix.ServiceRegistry | ||
import id.walt.services.WaltIdService | ||
|
||
abstract class JsonLdDocumentLoaderService: WaltIdService() { | ||
|
||
override val implementation: JsonLdDocumentLoaderService get() = serviceImplementation() | ||
|
||
abstract val documentLoader: DocumentLoader | ||
|
||
companion object : ServiceProvider { | ||
override fun getService() = ServiceRegistry.getService(JsonLdDocumentLoaderService::class) | ||
override fun defaultImplementation() = LocalJsonLdDocumentLoaderService() | ||
|
||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
src/main/kotlin/id/walt/credentials/jsonld/LocalJsonLdDocumentLoaderService.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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package id.walt.credentials.jsonld | ||
|
||
import com.apicatalog.jsonld.loader.DocumentLoader | ||
|
||
class LocalJsonLdDocumentLoaderService : JsonLdDocumentLoaderService() { | ||
override val documentLoader: DocumentLoader | ||
get() = VerifiableCredentialContexts.DOCUMENT_LOADER | ||
} |
9 changes: 9 additions & 0 deletions
9
src/main/kotlin/id/walt/credentials/jsonld/RemoteJsonLdDocumentLoaderService.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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package id.walt.credentials.jsonld | ||
|
||
import com.apicatalog.jsonld.loader.DocumentLoader | ||
import info.weboftrust.ldsignatures.jsonld.LDSecurityContexts | ||
|
||
class RemoteJsonLdDocumentLoaderService : JsonLdDocumentLoaderService() { | ||
override val documentLoader: DocumentLoader | ||
get() = LDSecurityContexts.DOCUMENT_LOADER | ||
} |
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
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