mirror of
https://github.com/meshcore-dev/meshcore.js.git
synced 2026-04-20 22:13:49 +00:00
add export contact command
This commit is contained in:
parent
cf4e1ccd83
commit
12276302a7
3 changed files with 20 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 = {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue