Main.kt (2143B)
1 /* 2 * This file is part of LibEuFin. 3 * Copyright (C) 2025 Taler Systems S.A. 4 5 * LibEuFin is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU Affero General Public License as 7 * published by the Free Software Foundation; either version 3, or 8 * (at your option) any later version. 9 10 * LibEuFin is distributed in the hope that it will be useful, but 11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General 13 * Public License for more details. 14 15 * You should have received a copy of the GNU Affero General Public 16 * License along with LibEuFin; see the file COPYING. If not, see 17 * <http://www.gnu.org/licenses/> 18 */ 19 20 package tech.libeufin.ebisync 21 22 import io.ktor.client.* 23 import io.ktor.client.call.* 24 import io.ktor.client.request.* 25 import io.ktor.client.plugins.* 26 import io.ktor.client.plugins.api.* 27 import io.ktor.client.statement.* 28 import io.ktor.server.application.* 29 import io.ktor.http.* 30 import io.ktor.util.* 31 import tech.libeufin.ebics.* 32 import tech.libeufin.ebisync.* 33 import tech.libeufin.ebisync.db.Database 34 import tech.libeufin.ebisync.api.* 35 import tech.libeufin.ebisync.cli.* 36 import tech.libeufin.common.* 37 import tech.libeufin.common.api.* 38 import java.security.Key 39 import java.time.* 40 import java.time.format.DateTimeFormatter 41 import javax.crypto.Mac 42 import javax.crypto.spec.SecretKeySpec 43 import kotlinx.coroutines.runBlocking 44 import java.util.Base64 45 import com.github.ajalt.clikt.core.main 46 import kotlinx.serialization.Serializable 47 import kotlinx.serialization.Contextual 48 import java.nio.file.Path 49 import org.slf4j.Logger 50 import org.slf4j.LoggerFactory 51 52 53 fun main(args: Array<String>) { 54 setupSecurityProperties() 55 setupSecurityProperties() 56 LibeufinEbisync().main(args) 57 } 58 59 fun Application.ebisyncApi(auth: AuthMethod, client: EbicsClient, spa: Path) = talerApi(LoggerFactory.getLogger("libeufin-ebisync-api")) { 60 syncApi(auth, client, spa) 61 } 62 63 @Serializable 64 data class TaskStatus( 65 @Contextual 66 val last_successfull: Instant? = null, 67 @Contextual 68 val last_trial: Instant? = null 69 )