add export contact command

This commit is contained in:
liamcottle 2025-02-15 20:45:07 +13:00
parent cf4e1ccd83
commit 12276302a7
3 changed files with 20 additions and 0 deletions

View file

@ -154,6 +154,17 @@ class Connection extends EventEmitter {
await this.sendToRadioFrame(data.toBytes());
}
// provide a public key to export that contact
// not providing a public key will export local identity as a contact instead
async sendCommandExportContact(pubKey = null) {
const data = new BufferWriter();
data.writeByte(Constants.CommandCodes.ExportContact);
if(pubKey){
data.writeBytes(pubKey); // 32 bytes
}
await this.sendToRadioFrame(data.toBytes());
}
onFrameReceived(frame) {
// emit received frame

View file

@ -28,6 +28,7 @@ class Constants {
SetAdvertLatLon: 14,
RemoveContact: 15,
ShareContact: 16,
ExportContact: 17,
}
static ResponseCodes = {
@ -42,6 +43,7 @@ class Constants {
ChannelMsgRecv: 8,
CurrTime: 9,
NoMoreMessages: 10,
ExportContact: 11,
}
static PushCodes = {