mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Implement contact manager methods for pending contacts.
This commit is contained in:
@@ -59,17 +59,18 @@ public interface ContactManager {
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the static link that needs to be sent to the contact to be added.
|
||||
* Returns the handshake link that needs to be sent to a contact we want
|
||||
* to add.
|
||||
*/
|
||||
String getHandshakeLink() throws DbException;
|
||||
|
||||
/**
|
||||
* Requests a new contact to be added via the given {@code link}.
|
||||
* Adds a new pending contact identified by the given handshake link.
|
||||
*
|
||||
* @param link The link received from the contact we want to add.
|
||||
* @param link The handshake link received from the contact we want to add.
|
||||
* @param alias The alias the user has given this contact.
|
||||
*/
|
||||
void addPendingContact(String link, String alias)
|
||||
PendingContact addPendingContact(String link, String alias)
|
||||
throws DbException, FormatException;
|
||||
|
||||
/**
|
||||
@@ -78,10 +79,9 @@ public interface ContactManager {
|
||||
Collection<PendingContact> getPendingContacts() throws DbException;
|
||||
|
||||
/**
|
||||
* Removes a {@link PendingContact} that is in state
|
||||
* {@link PendingContactState FAILED}.
|
||||
* Removes a {@link PendingContact}.
|
||||
*/
|
||||
void removePendingContact(PendingContactId pendingContact) throws DbException;
|
||||
void removePendingContact(PendingContactId p) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the contact with the given ID.
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package org.briarproject.bramble.api.contact;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public interface HandshakeLinkConstants {
|
||||
|
||||
/**
|
||||
* The current version of the handshake link format.
|
||||
*/
|
||||
int FORMAT_VERSION = 0;
|
||||
|
||||
/**
|
||||
* The length of a base32-encoded handshake link in bytes, excluding the
|
||||
* 'briar://' prefix.
|
||||
*/
|
||||
int BASE32_LINK_BYTES = 53;
|
||||
|
||||
/**
|
||||
* The length of a raw handshake link in bytes, before base32 encoding.
|
||||
*/
|
||||
int RAW_LINK_BYTES = 33;
|
||||
|
||||
/**
|
||||
* Regular expression for matching handshake links, including or excluding
|
||||
* the 'briar://' prefix.
|
||||
*/
|
||||
Pattern LINK_REGEX =
|
||||
Pattern.compile("(briar://)?([a-z2-7]{" + BASE32_LINK_BYTES + "})");
|
||||
|
||||
/**
|
||||
* Label for hashing handshake public keys to calculate their identifiers.
|
||||
*/
|
||||
String ID_LABEL = "org.briarproject.bramble/HANDSHAKE_KEY_ID";
|
||||
}
|
||||
Reference in New Issue
Block a user