File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 1+ import TCPConnection from "../src/connection/tcp_connection.js" ;
2+ import NodeJSSerialConnection from "../src/connection/nodejs_serial_connection.js" ;
3+ import { BufferUtils } from "../src/index.js" ;
4+
5+ // create connection
6+ const connection = new TCPConnection ( "10.1.0.75" , 5000 ) ;
7+ // const connection = new NodeJSSerialConnection("/dev/cu.usbmodem14401");
8+
9+ // wait until connected
10+ connection . on ( "connected" , async ( ) => {
11+
12+ // we are now connected
13+ console . log ( "Connected" ) ;
14+
15+ // sign data
16+ try {
17+ const signature = await connection . sign ( Buffer . from ( "test" ) ) ;
18+ const signatureHex = BufferUtils . bytesToHex ( signature ) ;
19+ console . log ( signatureHex ) ;
20+ } catch ( e ) {
21+ console . log ( "failed to sign" , e ) ;
22+ }
23+
24+ // disconnect
25+ await connection . close ( ) ;
26+
27+ } ) ;
28+
29+ // connect to meshcore device
30+ await connection . connect ( ) ;
You can’t perform that action at this time.
0 commit comments