Comment on page
Client code examples
val clientService = ClientService()
val masterKey = "123456".toByteArray()
clientService.createMasterKey(masterKey)
val masterKey = "123456".toByteArray()
clientService.unlockWithMasterKey(masterKey)
clientService.setupSessionService()
val newSession = clientService.sessionService.createSession("sess01")
clientService.sessionService.selectSession(newSession.sessionId)
clientService.setup()
val providerUrl = "http://localhost:7000"
val result = clientService.edvService.createEdv(providerUrl)
println("Created EDV ${res.edvId} at $providerUrl")
clientService.documentService.create("documentId123", "the content".toByteArray())
clientService.documentService.update("documentId123", "new content".toByteArray())
val result = clientService.documentService.load(edvId, documentId).toString() // or .toBytes()
clientService.documentService.delete("documentId123")
val results = clientService.documentService.search(edvId, "keyword")
results.forEach { println(it) }
val results = clientService.indexService.getDocuments(edvId)
results.forEach { println(it) }
val results = clientService.indexService.getTree()
results.forEach { println(it) }
clientService.edvService.notificationsConnect(edvId) { event ->
println("Received notification from EDV $edvId: " +
"Document ${event.documentId} was ${event.operation.name}" +
" by ${event.invoker}.")
}
clientService.edvService.notificationsDisconnect()
val jwe = sessionService.export(sessionService.sessionId)
println("Session export (it's encrypted with the masterkey): $jwe")