🚧 Load ALL identities instead of only trusted ones
[Sone.git] / src / main / kotlin / net / pterodactylus / sone / freenet / wot / WebOfTrustConnector.kt
1 package net.pterodactylus.sone.freenet.wot
2
3 import net.pterodactylus.sone.freenet.plugin.*
4
5 /**
6  * Connector for the web of trust plugin.
7  */
8 interface WebOfTrustConnector {
9
10         /**
11          * Loads all own identities from the Web of Trust plugin.
12          *
13          * @return All own identity
14          * @throws WebOfTrustException if the own identities can not be loaded
15          */
16         @Throws(WebOfTrustException::class)
17         fun loadAllOwnIdentities(): Set<OwnIdentity>
18
19         /**
20          * Loads all identities that the given identities trusts with a score of
21          * more than 0 and the (optional) given context.
22          *
23          * @param ownIdentity The own identity
24          * @param context The context to filter, or `null`
25          * @return All trusted identities
26          * @throws PluginException if an error occured talking to the Web of Trust plugin
27          */
28         @Throws(PluginException::class)
29         fun loadTrustedIdentities(ownIdentity: OwnIdentity, context: String? = null): Set<Identity>
30
31         /**
32          * Loads all identities known to the given own identity that have the (optional) given context.
33          *
34          * @param ownIdentity The own identity
35          * @param context The context to filter, or `null`
36          * @return All trusted identities
37          * @throws PluginException if an error occured talking to the Web of Trust plugin
38          */
39         fun loadAllIdentities(ownIdentity: OwnIdentity, context: String? = null): Set<Identity>
40
41         /**
42          * Adds the given context to the given identity.
43          *
44          * @param ownIdentity The identity to add the context to
45          * @param context The context to add
46          * @throws PluginException if an error occured talking to the Web of Trust plugin
47          */
48         @Throws(PluginException::class)
49         fun addContext(ownIdentity: OwnIdentity, context: String)
50
51         /**
52          * Removes the given context from the given identity.
53          *
54          * @param ownIdentity The identity to remove the context from
55          * @param context The context to remove
56          * @throws PluginException if an error occured talking to the Web of Trust plugin
57          */
58         @Throws(PluginException::class)
59         fun removeContext(ownIdentity: OwnIdentity, context: String)
60
61         /**
62          * Sets the property with the given name to the given value.
63          *
64          * @param ownIdentity The identity to set the property on
65          * @param name The name of the property to set
66          * @param value The value to set
67          * @throws PluginException if an error occured talking to the Web of Trust plugin
68          */
69         @Throws(PluginException::class)
70         fun setProperty(ownIdentity: OwnIdentity, name: String, value: String)
71
72         /**
73          * Removes the property with the given name.
74          *
75          * @param ownIdentity The identity to remove the property from
76          * @param name The name of the property to remove
77          * @throws PluginException if an error occured talking to the Web of Trust plugin
78          */
79         @Throws(PluginException::class)
80         fun removeProperty(ownIdentity: OwnIdentity, name: String)
81
82         /**
83          * Pings the Web of Trust plugin. If the plugin can not be reached, a
84          * [PluginException] is thrown.
85          *
86          * @throws PluginException if the plugin is not loaded
87          */
88         @Throws(PluginException::class)
89         fun ping()
90
91         /**
92          * Stops the web of trust connector.
93          */
94         fun stop() = Unit
95
96 }