ValidateNumber now accepts pubkeys instead of phone numbers. This allows starting a conversation with a pubkey.

pull/3/head
sachaaaaa 7 years ago
parent b043a469a2
commit c1d6e6113f

@ -645,14 +645,13 @@
validateNumber() {
if (this.isPrivate()) {
const regionCode = storage.get('regionCode');
const number = libphonenumber.util.parseNumber(this.id, regionCode);
if (number.isValidNumber) {
this.set({ id: number.e164 });
if (StringView.base64ToBytes(this.id).byteLength == 33)
{
this.set({ id: this.id });
return null;
}
return number.error || 'Invalid phone number';
return 'Invalid ID';
}
return null;

Loading…
Cancel
Save