1 package net.pterodactylus.sone.freenet.wot
3 import net.pterodactylus.sone.freenet.plugin.*
6 * Connector for the web of trust plugin.
8 interface WebOfTrustConnector {
11 * Loads all own identities from the Web of Trust plugin.
13 * @return All own identity
14 * @throws WebOfTrustException if the own identities can not be loaded
16 @Throws(WebOfTrustException::class)
17 fun loadAllOwnIdentities(): Set<OwnIdentity>
20 * Loads all identities that the given identities trusts with a score of
21 * more than 0 and the (optional) given context.
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
28 @Throws(PluginException::class)
29 fun loadTrustedIdentities(ownIdentity: OwnIdentity, context: String? = null): Set<Identity>
32 * Adds the given context to the given identity.
34 * @param ownIdentity The identity to add the context to
35 * @param context The context to add
36 * @throws PluginException if an error occured talking to the Web of Trust plugin
38 @Throws(PluginException::class)
39 fun addContext(ownIdentity: OwnIdentity, context: String)
42 * Removes the given context from the given identity.
44 * @param ownIdentity The identity to remove the context from
45 * @param context The context to remove
46 * @throws PluginException if an error occured talking to the Web of Trust plugin
48 @Throws(PluginException::class)
49 fun removeContext(ownIdentity: OwnIdentity, context: String)
52 * Sets the property with the given name to the given value.
54 * @param ownIdentity The identity to set the property on
55 * @param name The name of the property to set
56 * @param value The value to set
57 * @throws PluginException if an error occured talking to the Web of Trust plugin
59 @Throws(PluginException::class)
60 fun setProperty(ownIdentity: OwnIdentity, name: String, value: String)
63 * Removes the property with the given name.
65 * @param ownIdentity The identity to remove the property from
66 * @param name The name of the property to remove
67 * @throws PluginException if an error occured talking to the Web of Trust plugin
69 @Throws(PluginException::class)
70 fun removeProperty(ownIdentity: OwnIdentity, name: String)
73 * Pings the Web of Trust plugin. If the plugin can not be reached, a
74 * [PluginException] is thrown.
76 * @throws PluginException if the plugin is not loaded
78 @Throws(PluginException::class)
82 * Stops the web of trust connector.