1
0
Fork 0
mirror of https://github.com/pgpainless/pgpainless.git synced 2024-11-15 17:02:06 +01:00

Refactoring - package names

Move Query, PairPriorityQueue, Root and Roots to wot.query
Move other classes in .sq to wot.network
Move filter package to query.filter
This commit is contained in:
Paul Schaub 2023-07-09 11:13:14 +02:00
parent 3c4088a89e
commit 73f0976857
Signed by: vanitasvitae
GPG key ID: 62BEE9264BF17311
51 changed files with 103 additions and 101 deletions

View file

@ -11,8 +11,8 @@ import org.pgpainless.wot.KeyRingCertificateStore
import org.pgpainless.wot.WebOfTrust
import org.pgpainless.wot.api.WoTAPI
import org.pgpainless.wot.cli.subcommands.*
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.dijkstra.sq.ReferenceTime
import org.pgpainless.wot.network.Fingerprint
import org.pgpainless.wot.network.ReferenceTime
import pgp.cert_d.PGPCertificateStoreAdapter
import pgp.cert_d.subkey_lookup.InMemorySubkeyLookupFactory
import pgp.certificate_store.PGPCertificateStore

View file

@ -6,8 +6,8 @@ package org.pgpainless.wot.cli.subcommands
import org.pgpainless.wot.api.AuthenticateAPI
import org.pgpainless.wot.cli.WotCLI
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.dijkstra.sq.Path
import org.pgpainless.wot.network.Fingerprint
import org.pgpainless.wot.network.Path
import picocli.CommandLine
import picocli.CommandLine.Command
import picocli.CommandLine.Parameters

View file

@ -2,7 +2,7 @@ package org.pgpainless.wot.cli.subcommands
import org.junit.jupiter.api.Test
import org.pgpainless.wot.api.AuthenticateAPI
import org.pgpainless.wot.dijkstra.sq.*
import org.pgpainless.wot.network.*
import java.text.SimpleDateFormat
import kotlin.test.assertEquals

View file

@ -17,8 +17,8 @@ import org.pgpainless.policy.Policy
import org.pgpainless.signature.SignatureUtils
import org.pgpainless.signature.consumer.SignatureVerifier
import org.pgpainless.signature.subpackets.SignatureSubpacketsUtil
import org.pgpainless.wot.dijkstra.sq.*
import org.pgpainless.wot.dijkstra.sq.ReferenceTime.Companion.now
import org.pgpainless.wot.network.*
import org.pgpainless.wot.network.ReferenceTime.Companion.now
import org.pgpainless.wot.util.CertificationFactory.Companion.fromCertification
import org.pgpainless.wot.util.CertificationFactory.Companion.fromDelegation
import org.slf4j.LoggerFactory

View file

@ -6,11 +6,11 @@ package org.pgpainless.wot.util
import org.bouncycastle.openpgp.PGPSignature
import org.pgpainless.signature.subpackets.SignatureSubpacketsUtil
import org.pgpainless.wot.dijkstra.sq.Node
import org.pgpainless.wot.dijkstra.sq.Edge
import org.pgpainless.wot.dijkstra.sq.Depth
import org.pgpainless.wot.dijkstra.sq.RegexSet
import org.pgpainless.wot.dijkstra.sq.RegexSet.Companion.fromExpressionList
import org.pgpainless.wot.network.Node
import org.pgpainless.wot.network.Edge
import org.pgpainless.wot.network.Depth
import org.pgpainless.wot.network.RegexSet
import org.pgpainless.wot.network.RegexSet.Companion.fromExpressionList
class CertificationFactory {

View file

@ -5,9 +5,9 @@ import org.bouncycastle.openpgp.PGPSignature
import org.pgpainless.algorithm.RevocationStateType
import org.pgpainless.key.OpenPgpFingerprint
import org.pgpainless.key.info.KeyRingInfo
import org.pgpainless.wot.dijkstra.sq.Node
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.dijkstra.sq.RevocationState
import org.pgpainless.wot.network.Node
import org.pgpainless.wot.network.Fingerprint
import org.pgpainless.wot.network.RevocationState
interface PGPDSL {

View file

@ -7,9 +7,9 @@ package org.pgpainless.wot
import org.bouncycastle.openpgp.PGPPublicKeyRing
import org.pgpainless.key.OpenPgpFingerprint
import org.pgpainless.wot.dijkstra.sq.EdgeSet
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.dijkstra.sq.Network
import org.pgpainless.wot.network.EdgeSet
import org.pgpainless.wot.network.Fingerprint
import org.pgpainless.wot.network.Network
import org.pgpainless.wot.testfixtures.TestCertificateStores
import org.pgpainless.wot.testfixtures.WotTestVectors
import kotlin.test.assertEquals

View file

@ -2,13 +2,13 @@ package org.pgpainless.wot
import org.junit.jupiter.api.Test
import org.pgpainless.PGPainless
import org.pgpainless.wot.dijkstra.Query
import org.pgpainless.wot.dijkstra.sq.Roots
import org.pgpainless.wot.dijkstra.filter.IdempotentCertificationFilter
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.dijkstra.sq.Network
import org.pgpainless.wot.dijkstra.sq.Path
import org.pgpainless.wot.dijkstra.sq.Root
import org.pgpainless.wot.query.Query
import org.pgpainless.wot.query.Roots
import org.pgpainless.wot.query.filter.IdempotentCertificationFilter
import org.pgpainless.wot.network.Fingerprint
import org.pgpainless.wot.network.Network
import org.pgpainless.wot.network.Path
import org.pgpainless.wot.query.Root
import java.io.File
private const val DEPTH_UNCONSTRAINED = 255

View file

@ -11,7 +11,7 @@ import org.pgpainless.key.protection.SecretKeyRingProtector
import org.pgpainless.signature.subpackets.CertificationSubpackets
import org.pgpainless.signature.subpackets.CertificationSubpackets.Callback
import org.pgpainless.wot.KeyRingCertificateStore
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.network.Fingerprint
import pgp.certificate_store.PGPCertificateStore
interface AdHocVectors {

View file

@ -4,8 +4,8 @@
package org.pgpainless.wot.api
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.dijkstra.sq.Paths
import org.pgpainless.wot.network.Fingerprint
import org.pgpainless.wot.network.Paths
/**
* Authenticate a binding.

View file

@ -4,8 +4,8 @@
package org.pgpainless.wot.api
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.dijkstra.sq.Paths
import org.pgpainless.wot.network.Fingerprint
import org.pgpainless.wot.network.Paths
interface IdentifyAPI {

View file

@ -4,7 +4,7 @@
package org.pgpainless.wot.api
import org.pgpainless.wot.dijkstra.sq.Paths
import org.pgpainless.wot.network.Paths
interface ListAPI {

View file

@ -4,7 +4,7 @@
package org.pgpainless.wot.api
import org.pgpainless.wot.dijkstra.sq.Paths
import org.pgpainless.wot.network.Paths
interface LookupAPI {

View file

@ -4,7 +4,7 @@
package org.pgpainless.wot.api
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.network.Fingerprint
interface PathAPI {

View file

@ -4,9 +4,9 @@
package org.pgpainless.wot.api
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.dijkstra.sq.Network
import org.pgpainless.wot.dijkstra.sq.ReferenceTime
import org.pgpainless.wot.network.Fingerprint
import org.pgpainless.wot.network.Network
import org.pgpainless.wot.network.ReferenceTime
/**
* Web of Trust API, offering different operations.

View file

@ -1,5 +0,0 @@
// SPDX-FileCopyrightText: 2023 Heiko Schaefer <heiko@schaefer@name>
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra;

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.sq
package org.pgpainless.wot.network
/**
* Depth of a trust signature.

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.sq
package org.pgpainless.wot.network
import java.util.*

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.sq
package org.pgpainless.wot.network
/**
* A [EdgeSet] is a set of [Certifications][Edge] made by the same issuer, on the same

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.sq
package org.pgpainless.wot.network
class Fingerprint(fingerprint: String) : Comparable<Fingerprint> {

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.sq
package org.pgpainless.wot.network
/**
* A network consists of nodes, and edgeSet between them.

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.sq
package org.pgpainless.wot.network
import java.util.*

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.sq
package org.pgpainless.wot.network
import kotlin.math.min

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.sq
package org.pgpainless.wot.network
/**
* List of individual [Paths][Path].

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.sq
package org.pgpainless.wot.network
import java.util.*

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.sq
package org.pgpainless.wot.network
import java.util.regex.Pattern

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.sq
package org.pgpainless.wot.network
import java.util.*
import kotlin.math.abs

View file

@ -1,4 +1,4 @@
package org.pgpainless.wot.dijkstra
package org.pgpainless.wot.query
import java.util.PriorityQueue

View file

@ -2,10 +2,10 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra
package org.pgpainless.wot.query
import org.pgpainless.wot.dijkstra.filter.*
import org.pgpainless.wot.dijkstra.sq.*
import org.pgpainless.wot.network.*
import org.pgpainless.wot.query.filter.*
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import java.util.Date

View file

@ -2,7 +2,9 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.sq
package org.pgpainless.wot.query
import org.pgpainless.wot.network.Fingerprint
data class Root(val fingerprint: Fingerprint, val amount: Int) {

View file

@ -2,7 +2,9 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.sq
package org.pgpainless.wot.query
import org.pgpainless.wot.network.Fingerprint
/**
* A set of `Root`s (that can be used as the basis for authentication lookups).

View file

@ -2,10 +2,10 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.filter
package org.pgpainless.wot.query.filter
import org.pgpainless.wot.dijkstra.sq.Edge
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.network.Edge
import org.pgpainless.wot.network.Fingerprint
class CapCertificateFilter() : CertificationFilter {

View file

@ -2,11 +2,11 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.filter
package org.pgpainless.wot.query.filter
import org.pgpainless.wot.dijkstra.sq.Edge
import org.pgpainless.wot.dijkstra.sq.Depth
import org.pgpainless.wot.dijkstra.sq.RegexSet
import org.pgpainless.wot.network.Edge
import org.pgpainless.wot.network.Depth
import org.pgpainless.wot.network.RegexSet
/**
* Current effective values for `depth`, `amount` and `regexps`.

View file

@ -2,9 +2,9 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.filter
package org.pgpainless.wot.query.filter
import org.pgpainless.wot.dijkstra.sq.Edge
import org.pgpainless.wot.network.Edge
/**
* A filter that chains multiple filters together.

View file

@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.filter
package org.pgpainless.wot.query.filter
/**
* A no-op filter.

View file

@ -2,11 +2,11 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.filter
package org.pgpainless.wot.query.filter
import org.pgpainless.wot.dijkstra.sq.Edge
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.dijkstra.sq.Path
import org.pgpainless.wot.network.Edge
import org.pgpainless.wot.network.Fingerprint
import org.pgpainless.wot.network.Path
class SuppressCertificationFilter() : CertificationFilter {
// A certification's trust amount will be suppressed by this amount.

View file

@ -2,10 +2,10 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.filter
package org.pgpainless.wot.query.filter
import org.pgpainless.wot.dijkstra.sq.Edge
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.network.Edge
import org.pgpainless.wot.network.Fingerprint
/**
* A filter that suppresses some capacity of an issuer.

View file

@ -2,10 +2,10 @@
//
// SPDX-License-Identifier: Apache-2.0
package org.pgpainless.wot.dijkstra.filter
package org.pgpainless.wot.query.filter
import org.pgpainless.wot.dijkstra.sq.Edge
import org.pgpainless.wot.dijkstra.sq.Depth
import org.pgpainless.wot.network.Edge
import org.pgpainless.wot.network.Depth
/**
* A filter that treats every certification as a trust signature with unconstrained depth,

View file

@ -4,6 +4,7 @@
package org.pgpainless.wot.dijkstra
import org.pgpainless.wot.query.Cost
import kotlin.test.Test
class CostTest {

View file

@ -6,10 +6,9 @@ package org.pgpainless.wot.dijkstra
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import org.pgpainless.wot.dijkstra.sq.Depth
import org.pgpainless.wot.dijkstra.sq.Depth.Companion.auto
import org.pgpainless.wot.dijkstra.sq.Depth.Companion.limited
import org.pgpainless.wot.dijkstra.sq.Depth.Companion.unconstrained
import org.pgpainless.wot.network.Depth.Companion.auto
import org.pgpainless.wot.network.Depth.Companion.limited
import org.pgpainless.wot.network.Depth.Companion.unconstrained
import kotlin.test.*
class DepthTest {

View file

@ -6,7 +6,7 @@ package org.pgpainless.wot.dijkstra
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import org.pgpainless.wot.dijkstra.sq.*
import org.pgpainless.wot.network.*
import java.util.*
import kotlin.test.assertEquals
import kotlin.test.assertTrue

View file

@ -1,10 +1,10 @@
package org.pgpainless.wot.dijkstra
import org.junit.jupiter.api.Test
import org.pgpainless.wot.dijkstra.sq.Node
import org.pgpainless.wot.dijkstra.sq.Edge
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.dijkstra.sq.RevocationState
import org.pgpainless.wot.network.Node
import org.pgpainless.wot.network.Edge
import org.pgpainless.wot.network.Fingerprint
import org.pgpainless.wot.network.RevocationState
import java.util.*
import kotlin.test.assertEquals

View file

@ -1,7 +1,7 @@
package org.pgpainless.wot.dijkstra
import org.junit.jupiter.api.Test
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.network.Fingerprint
import kotlin.test.assertEquals
import kotlin.test.assertFalse

View file

@ -4,7 +4,7 @@
package org.pgpainless.wot.dijkstra
import org.pgpainless.wot.dijkstra.sq.*
import org.pgpainless.wot.network.*
import java.util.*
/**
@ -126,7 +126,7 @@ interface NetworkDSL {
* Set the reference time of the builder to now.
*/
fun Network.Builder.now(): Network.Builder {
return setReferenceTime(ReferenceTime.now())
return setReferenceTime(org.pgpainless.wot.network.ReferenceTime.now())
}
fun Network.getEdgesFor(issuer: Fingerprint, target: Fingerprint): EdgeSet? {

View file

@ -5,10 +5,10 @@
package org.pgpainless.wot.dijkstra
import org.junit.jupiter.api.Test
import org.pgpainless.wot.dijkstra.sq.Fingerprint
import org.pgpainless.wot.dijkstra.sq.Network.Companion.empty
import org.pgpainless.wot.dijkstra.sq.ReferenceTime.Companion.now
import org.pgpainless.wot.dijkstra.sq.RegexSet
import org.pgpainless.wot.network.Fingerprint
import org.pgpainless.wot.network.Network.Companion.empty
import org.pgpainless.wot.network.ReferenceTime.Companion.now
import org.pgpainless.wot.network.RegexSet
import kotlin.test.assertEquals
import kotlin.test.assertTrue

View file

@ -2,8 +2,8 @@ package org.pgpainless.wot.dijkstra
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import org.pgpainless.wot.dijkstra.sq.*
import java.util.*
import org.pgpainless.wot.network.Depth
import org.pgpainless.wot.network.Path
import kotlin.test.assertEquals
import kotlin.test.assertTrue

View file

@ -2,8 +2,9 @@ package org.pgpainless.wot.dijkstra
import org.junit.jupiter.api.Test
import org.junit.jupiter.api.assertThrows
import org.pgpainless.wot.dijkstra.sq.*
import java.util.*
import org.pgpainless.wot.network.Depth
import org.pgpainless.wot.network.Path
import org.pgpainless.wot.network.Paths
import kotlin.test.assertEquals
class PathsTest: NetworkDSL {

View file

@ -1,5 +1,6 @@
package org.pgpainless.wot.dijkstra
import org.pgpainless.wot.query.PairPriorityQueue
import kotlin.test.Test
import kotlin.test.assertEquals

View file

@ -1,7 +1,7 @@
package org.pgpainless.wot.dijkstra
import org.junit.jupiter.api.Test
import org.pgpainless.wot.dijkstra.sq.RegexSet
import org.pgpainless.wot.network.RegexSet
import kotlin.test.assertFalse
import kotlin.test.assertTrue

View file

@ -1,8 +1,8 @@
package org.pgpainless.wot.dijkstra
import org.junit.jupiter.api.Test
import org.pgpainless.wot.dijkstra.sq.ReferenceTime
import org.pgpainless.wot.dijkstra.sq.RevocationState
import org.pgpainless.wot.network.ReferenceTime
import org.pgpainless.wot.network.RevocationState
import java.util.*
import kotlin.test.assertFalse
import kotlin.test.assertTrue

View file

@ -1,5 +1,6 @@
package org.pgpainless.wot.dijkstra.sq
import org.pgpainless.wot.network.RegexSet
import kotlin.test.Test
class RegexSetTest {