2023-07-03 20:11:01 +02:00
|
|
|
// SPDX-FileCopyrightText: 2023 Paul Schaub <vanitasvitae@fsfe.org>
|
|
|
|
//
|
|
|
|
// SPDX-License-Identifier: Apache-2.0
|
|
|
|
|
2023-07-07 15:41:17 +02:00
|
|
|
package org.pgpainless.wot.dijkstra.sq.api
|
2023-07-03 20:11:01 +02:00
|
|
|
|
|
|
|
import org.pgpainless.wot.dijkstra.sq.Fingerprint
|
2023-07-07 15:41:17 +02:00
|
|
|
import org.pgpainless.wot.dijkstra.sq.Network
|
2023-07-03 20:11:01 +02:00
|
|
|
import org.pgpainless.wot.dijkstra.sq.ReferenceTime
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Web of Trust API, offering different operations.
|
|
|
|
*
|
2023-07-07 15:41:17 +02:00
|
|
|
* @param network initialized [Network] containing certificates as nodes and certifications as edges.
|
2023-07-03 20:11:01 +02:00
|
|
|
* @param trustRoots one or more [Fingerprints][Fingerprint] of trust-roots.
|
|
|
|
* @param gossip if true, consider all certificates as weakly trusted trust-roots
|
|
|
|
* @param certificationNetwork if true, all certifications are treated as delegations with infinite trust depth and no regular expressions
|
|
|
|
* @param trustAmount minimum trust amount
|
|
|
|
* @param referenceTime reference time at which the web of trust is evaluated
|
|
|
|
* @param knownNotationRegistry registry of known notations
|
|
|
|
*/
|
|
|
|
class WoTAPI(
|
2023-07-07 15:41:17 +02:00
|
|
|
val network: Network,
|
2023-07-03 20:11:01 +02:00
|
|
|
val trustRoots: List<Fingerprint>,
|
|
|
|
val gossip: Boolean = false,
|
|
|
|
val certificationNetwork: Boolean = false,
|
|
|
|
val trustAmount: Int = AuthenticationLevel.Fully.amount,
|
2023-07-07 15:41:17 +02:00
|
|
|
val referenceTime: ReferenceTime = ReferenceTime.now()
|
2023-07-03 20:11:01 +02:00
|
|
|
): AuthenticateAPI, IdentifyAPI, ListAPI, LookupAPI, PathAPI {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Secondary constructor, taking an [AuthenticationLevel] instead of an [Int].
|
|
|
|
*/
|
2023-07-07 15:41:17 +02:00
|
|
|
constructor(network: Network,
|
2023-07-03 20:11:01 +02:00
|
|
|
trustRoots: List<Fingerprint>,
|
|
|
|
gossip: Boolean = false,
|
|
|
|
certificationNetwork: Boolean = false,
|
|
|
|
trustAmount: AuthenticationLevel = AuthenticationLevel.Fully,
|
2023-07-07 15:41:17 +02:00
|
|
|
referenceTime: ReferenceTime = ReferenceTime.now()):
|
|
|
|
this(network,trustRoots, gossip,certificationNetwork, trustAmount.amount, referenceTime)
|
2023-07-03 20:11:01 +02:00
|
|
|
|
|
|
|
override fun authenticate(arguments: AuthenticateAPI.Arguments): AuthenticateAPI.Result {
|
|
|
|
TODO("Not yet implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun identify(arguments: IdentifyAPI.Arguments): IdentifyAPI.Result {
|
|
|
|
TODO("Not yet implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun list(): ListAPI.Result {
|
|
|
|
TODO("Not yet implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun lookup(arguments: LookupAPI.Arguments): LookupAPI.Result {
|
|
|
|
TODO("Not yet implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
override fun path(arguments: PathAPI.Arguments): PathAPI.Result {
|
|
|
|
TODO("Not yet implemented")
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|