mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 14:19:53 +01:00
Use matcher to discard prefix if present.
This commit is contained in:
@@ -46,8 +46,8 @@ class PendingContactFactoryImpl implements PendingContactFactory {
|
|||||||
private PublicKey parseHandshakeLink(String link) throws FormatException {
|
private PublicKey parseHandshakeLink(String link) throws FormatException {
|
||||||
Matcher matcher = LINK_REGEX.matcher(link);
|
Matcher matcher = LINK_REGEX.matcher(link);
|
||||||
if (!matcher.find()) throw new FormatException();
|
if (!matcher.find()) throw new FormatException();
|
||||||
link = matcher.group(); // Discard anything before or after the link
|
// Discard 'briar://' and anything before or after the link
|
||||||
if (link.startsWith("briar://")) link = link.substring(8);
|
link = matcher.group(2);
|
||||||
byte[] base32 = Base32.decode(link, false);
|
byte[] base32 = Base32.decode(link, false);
|
||||||
if (base32.length != RAW_LINK_BYTES) throw new AssertionError();
|
if (base32.length != RAW_LINK_BYTES) throw new AssertionError();
|
||||||
byte version = base32[0];
|
byte version = base32[0];
|
||||||
|
|||||||
Reference in New Issue
Block a user