@indra.ai/deva 1.5.41 → 1.5.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +182 -81
- package/package.json +3 -2
package/index.js
CHANGED
|
@@ -181,8 +181,10 @@ class Deva {
|
|
|
181
181
|
};
|
|
182
182
|
packet.a.hash = this.lib.hash(packet.a);
|
|
183
183
|
delete packet.hash;
|
|
184
|
-
packet.
|
|
185
|
-
|
|
184
|
+
packet.md5 = this.lib.hash(packet);
|
|
185
|
+
packet.sha256 = this.lib.hash(packet, 'sha256');
|
|
186
|
+
packet.sha512 = this.lib.hash(packet, 'sha512');
|
|
187
|
+
|
|
186
188
|
this.state('invalid', `${packet.q.meta.method}:${packet.id}`);
|
|
187
189
|
return packet;
|
|
188
190
|
}
|
|
@@ -529,7 +531,9 @@ class Deva {
|
|
|
529
531
|
}
|
|
530
532
|
|
|
531
533
|
// hash the question
|
|
532
|
-
packet.q.
|
|
534
|
+
packet.q.md5 = this.lib.hash(packet.q);
|
|
535
|
+
packet.q.sha256 = this.lib.hash(packet.q, 'sha256');
|
|
536
|
+
packet.q.sha512 = this.lib.hash(packet.q, 'sha512');
|
|
533
537
|
|
|
534
538
|
this.talk(config.events.question, this.lib.copy(packet)); // global question event make sure to copy data.
|
|
535
539
|
|
|
@@ -603,7 +607,10 @@ class Deva {
|
|
|
603
607
|
created: Date.now(), // set the created date for the answer
|
|
604
608
|
};
|
|
605
609
|
// create a hash for the answer and insert into answer meta.
|
|
606
|
-
packet_answer.
|
|
610
|
+
packet_answer.md5 = this.lib.hash(packet_answer);
|
|
611
|
+
packet_answer.sha256 = this.lib.hash(packet_answer, 'sha256');
|
|
612
|
+
packet_answer.sha512 = this.lib.hash(packet_answer, 'sha512');
|
|
613
|
+
|
|
607
614
|
packet.a = packet_answer; // set the packet.a to the packet_answer
|
|
608
615
|
this.talk(config.events.answer, this.lib.copy(packet)); // global talk event
|
|
609
616
|
|
|
@@ -677,7 +684,10 @@ class Deva {
|
|
|
677
684
|
packet_answer.text = result;
|
|
678
685
|
}
|
|
679
686
|
|
|
680
|
-
packet_answer.
|
|
687
|
+
packet_answer.md5 = this.lib.hash(packet_answer);
|
|
688
|
+
packet_answer.sha256 = this.lib.hash(packet_answer, 'sha256');
|
|
689
|
+
packet_answer.sha512 = this.lib.hash(packet_answer, 'sha512');
|
|
690
|
+
|
|
681
691
|
packet.a = packet_answer;
|
|
682
692
|
this.talk(config.events.answer, this.lib.copy(packet)); // global talk event
|
|
683
693
|
this.talk(`${agent.key}:ask:${packet.id}`, packet);
|
|
@@ -725,7 +735,10 @@ class Deva {
|
|
|
725
735
|
text: this._messages.init,
|
|
726
736
|
created: Date.now(),
|
|
727
737
|
}
|
|
728
|
-
data.
|
|
738
|
+
data.md5 = this.lib.hash(data);
|
|
739
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
740
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
741
|
+
|
|
729
742
|
return new Promise((resolve, reject) => {
|
|
730
743
|
this.events.setMaxListeners(this.maxListeners);
|
|
731
744
|
this._assignInherit().then(() => {
|
|
@@ -787,9 +800,17 @@ class Deva {
|
|
|
787
800
|
|
|
788
801
|
this.action('start', data.id);
|
|
789
802
|
const id = this.lib.uid();
|
|
790
|
-
|
|
803
|
+
|
|
804
|
+
delete data.md5;
|
|
805
|
+
delete data.sha256;
|
|
806
|
+
delete data.sha512;
|
|
807
|
+
|
|
791
808
|
data.value = 'start';
|
|
792
|
-
|
|
809
|
+
|
|
810
|
+
data.md5 = this.lib.hash(data);
|
|
811
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
812
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
813
|
+
|
|
793
814
|
const hasOnStart = this.onStart && typeof this.onStart === 'function' ? true : false;
|
|
794
815
|
|
|
795
816
|
this.state('start', data.id);
|
|
@@ -813,10 +834,17 @@ class Deva {
|
|
|
813
834
|
|
|
814
835
|
this.action('enter', data.id);
|
|
815
836
|
const hasOnEnter = this.onEnter && typeof this.onEnter === 'function' ? true : false;
|
|
816
|
-
|
|
837
|
+
|
|
838
|
+
delete data.md5;
|
|
839
|
+
delete data.sha256;
|
|
840
|
+
delete data.sha512;
|
|
841
|
+
|
|
817
842
|
data.value = 'enter';
|
|
818
|
-
data.hash = this.lib.hash(data);
|
|
819
843
|
|
|
844
|
+
data.md5 = this.lib.hash(data);
|
|
845
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
846
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
847
|
+
|
|
820
848
|
this.state('enter', data.id);
|
|
821
849
|
return hasOnEnter ? this.onEnter(data, resolve) : this.done(data, resolve)
|
|
822
850
|
}
|
|
@@ -838,10 +866,17 @@ class Deva {
|
|
|
838
866
|
|
|
839
867
|
this.action('done', data.id);
|
|
840
868
|
const hasOnDone = this.onDone && typeof this.onDone === 'function' ? true : false;
|
|
841
|
-
|
|
869
|
+
|
|
870
|
+
delete data.md5;
|
|
871
|
+
delete data.sha256;
|
|
872
|
+
delete data.sha512;
|
|
873
|
+
|
|
842
874
|
data.value = 'done';
|
|
843
|
-
data.hash = this.lib.hash(data);
|
|
844
875
|
|
|
876
|
+
data.md5 = this.lib.hash(data);
|
|
877
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
878
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
879
|
+
|
|
845
880
|
this.state('done', data.id);
|
|
846
881
|
return hasOnDone ? this.onDone(data, resolve) : this.ready(data, resolve);
|
|
847
882
|
}
|
|
@@ -860,10 +895,17 @@ class Deva {
|
|
|
860
895
|
|
|
861
896
|
this.action('ready', data.id);
|
|
862
897
|
const hasOnReady = this.onReady && typeof this.onReady === 'function';
|
|
863
|
-
|
|
898
|
+
|
|
899
|
+
delete data.md5;
|
|
900
|
+
delete data.sha256;
|
|
901
|
+
delete data.sha512;
|
|
902
|
+
|
|
864
903
|
data.value = 'ready';
|
|
865
|
-
data.hash = this.lib.hash(data);// hash the entire data before completeing.
|
|
866
904
|
|
|
905
|
+
data.md5 = this.lib.hash(data);
|
|
906
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
907
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
908
|
+
|
|
867
909
|
this.state('ready', data.id);
|
|
868
910
|
return hasOnReady ? this.onReady(data, resolve) : resolve(data);
|
|
869
911
|
}
|
|
@@ -878,18 +920,25 @@ class Deva {
|
|
|
878
920
|
describe: This function is used to relay into the finish state when resolving a question or data.
|
|
879
921
|
usage: this.finish(data, resolve)
|
|
880
922
|
***************/
|
|
881
|
-
finish(
|
|
882
|
-
this.zone('finish',
|
|
923
|
+
finish(data, resolve) {
|
|
924
|
+
this.zone('finish', data.id); // enter finish zone
|
|
883
925
|
if (!this._active) return resolve(this._messages.offline); //
|
|
884
926
|
|
|
885
|
-
this.action('finish',
|
|
927
|
+
this.action('finish', data.id); // start finish action
|
|
886
928
|
const hasOnFinish = this.onFinish && typeof this.onFinish === 'function';
|
|
887
|
-
delete packet.hash; // delete packet hash to update for finish time
|
|
888
|
-
packet.finish = Date.now(); // set the finish timestamp
|
|
889
|
-
packet.hash = this.lib.hash(packet); // rehash the packet;
|
|
890
929
|
|
|
891
|
-
|
|
892
|
-
|
|
930
|
+
delete data.md5;
|
|
931
|
+
delete data.sha256;
|
|
932
|
+
delete data.sha512;
|
|
933
|
+
|
|
934
|
+
data.finish = Date.now(); // set the finish timestamp
|
|
935
|
+
|
|
936
|
+
data.md5 = this.lib.hash(data);
|
|
937
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
938
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
939
|
+
|
|
940
|
+
this.state('finish', data.id); // set finish state
|
|
941
|
+
return hasOnFinish ? this.onFinish(data, resolve) : this.complete(data, resolve);
|
|
893
942
|
}
|
|
894
943
|
|
|
895
944
|
/**************
|
|
@@ -901,18 +950,24 @@ class Deva {
|
|
|
901
950
|
resolving a question or data.
|
|
902
951
|
usage: this.complete(data, resolve)
|
|
903
952
|
***************/
|
|
904
|
-
complete(
|
|
905
|
-
this.zone('complete',
|
|
953
|
+
complete(data, resolve) {
|
|
954
|
+
this.zone('complete', data.id);
|
|
906
955
|
if (!this._active) return Promise.resolve(this._messages.offline);
|
|
907
956
|
|
|
908
|
-
this.action('complete',
|
|
957
|
+
this.action('complete', data.id);
|
|
909
958
|
const hasOnComplete = this.onComplete && typeof this.onComplete === 'function';
|
|
910
|
-
delete packet.hash;
|
|
911
|
-
packet.complete = Date.now();// set the complete date on the whole packet.
|
|
912
|
-
packet.hash = this.lib.hash(packet);// hash the entire packet before complete.
|
|
913
959
|
|
|
914
|
-
|
|
915
|
-
|
|
960
|
+
delete data.md5;
|
|
961
|
+
delete data.sha256;
|
|
962
|
+
delete data.sha512;
|
|
963
|
+
|
|
964
|
+
data.complete = Date.now();// set the complete date on the whole data.
|
|
965
|
+
data.md5 = this.lib.hash(data);
|
|
966
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
967
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
968
|
+
|
|
969
|
+
this.state('complete', data.id);
|
|
970
|
+
return hasOnComplete ? this.onComplete(data, resolve) : resolve(data);
|
|
916
971
|
}
|
|
917
972
|
|
|
918
973
|
/**************
|
|
@@ -944,14 +999,17 @@ class Deva {
|
|
|
944
999
|
client: this.client(), // set the client
|
|
945
1000
|
created: Date.now(), // set the created date
|
|
946
1001
|
}
|
|
947
|
-
|
|
1002
|
+
|
|
1003
|
+
data.md5 = this.lib.hash(data);
|
|
1004
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1005
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1006
|
+
|
|
948
1007
|
// has stop function then set hasOnStop variable
|
|
949
1008
|
// if: has on stop then run on stop function or return exit function.
|
|
950
1009
|
this.state('stop', id); // set the state to stop
|
|
951
1010
|
return hasOnStop ? this.onStop(data) : this.exit()
|
|
952
1011
|
}
|
|
953
1012
|
|
|
954
|
-
|
|
955
1013
|
/**************
|
|
956
1014
|
func: exit
|
|
957
1015
|
params:
|
|
@@ -978,7 +1036,10 @@ class Deva {
|
|
|
978
1036
|
client: this.client(),
|
|
979
1037
|
created: Date.now(),
|
|
980
1038
|
}
|
|
981
|
-
|
|
1039
|
+
|
|
1040
|
+
data.md5 = this.lib.hash(data);
|
|
1041
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1042
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
982
1043
|
|
|
983
1044
|
this.state('exit', id); // set the state to stop
|
|
984
1045
|
// clear memory
|
|
@@ -1019,7 +1080,11 @@ class Deva {
|
|
|
1019
1080
|
text, // set the text value of the data
|
|
1020
1081
|
created: Date.now(), // set the data created date.
|
|
1021
1082
|
};
|
|
1022
|
-
|
|
1083
|
+
|
|
1084
|
+
data.md5 = this.lib.hash(data);
|
|
1085
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1086
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1087
|
+
|
|
1023
1088
|
this.talk(config.events.state, data); // broadcasat the state event
|
|
1024
1089
|
return data;
|
|
1025
1090
|
} catch (e) { // catch any errors
|
|
@@ -1041,7 +1106,11 @@ class Deva {
|
|
|
1041
1106
|
value: this._states,
|
|
1042
1107
|
created: Date.now(),
|
|
1043
1108
|
}
|
|
1044
|
-
|
|
1109
|
+
|
|
1110
|
+
data.md5 = this.lib.hash(data);
|
|
1111
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1112
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1113
|
+
|
|
1045
1114
|
this.state('return', `states:${id}`);
|
|
1046
1115
|
return data;
|
|
1047
1116
|
}
|
|
@@ -1070,7 +1139,11 @@ class Deva {
|
|
|
1070
1139
|
text,
|
|
1071
1140
|
created: Date.now(),
|
|
1072
1141
|
};
|
|
1073
|
-
|
|
1142
|
+
|
|
1143
|
+
data.md5 = this.lib.hash(data);
|
|
1144
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1145
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1146
|
+
|
|
1074
1147
|
this.talk(config.events.zone, data);
|
|
1075
1148
|
return data;
|
|
1076
1149
|
} catch (e) {
|
|
@@ -1088,7 +1161,8 @@ class Deva {
|
|
|
1088
1161
|
const id = this.lib.uid();
|
|
1089
1162
|
this.action('zones', id);
|
|
1090
1163
|
this.state('return', `zones:${id}`);
|
|
1091
|
-
|
|
1164
|
+
|
|
1165
|
+
const data = {
|
|
1092
1166
|
id, // set the uuid of the data
|
|
1093
1167
|
agent: this.agent(), // set the agent value
|
|
1094
1168
|
cleint: this.client(), // set the client value
|
|
@@ -1096,6 +1170,12 @@ class Deva {
|
|
|
1096
1170
|
value: this._zones, // set the list of zones
|
|
1097
1171
|
created: Date.now(), // set the created date of the object.
|
|
1098
1172
|
}
|
|
1173
|
+
|
|
1174
|
+
data.md5 = this.lib.hash(data);
|
|
1175
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1176
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1177
|
+
|
|
1178
|
+
return data
|
|
1099
1179
|
}
|
|
1100
1180
|
|
|
1101
1181
|
/**************
|
|
@@ -1116,6 +1196,7 @@ class Deva {
|
|
|
1116
1196
|
const msg_action = var_action || this._actions[value];
|
|
1117
1197
|
const msg = msg_action || action; // set the correct message
|
|
1118
1198
|
const text = extra ? `${msg} ${extra}` : msg; // set the text of the action
|
|
1199
|
+
|
|
1119
1200
|
const data = { // build the data object for the action.
|
|
1120
1201
|
id, // generate a guid for the action transmitssion.
|
|
1121
1202
|
agent: this.agent(), // the agent data to send with the action
|
|
@@ -1125,7 +1206,11 @@ class Deva {
|
|
|
1125
1206
|
text, // text of the action to send
|
|
1126
1207
|
created: Date.now(), // action time stamp
|
|
1127
1208
|
};
|
|
1128
|
-
|
|
1209
|
+
|
|
1210
|
+
data.md5 = this.lib.hash(data);
|
|
1211
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1212
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1213
|
+
|
|
1129
1214
|
this.talk(config.events.action, data); // talk the core action event
|
|
1130
1215
|
return data;
|
|
1131
1216
|
} catch (e) { // catch any errors that occur
|
|
@@ -1150,7 +1235,11 @@ class Deva {
|
|
|
1150
1235
|
value: this._actions, // set the value to the actions list
|
|
1151
1236
|
created: Date.now(), // set the data created date
|
|
1152
1237
|
};
|
|
1153
|
-
|
|
1238
|
+
|
|
1239
|
+
data.md5 = this.lib.hash(data);
|
|
1240
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1241
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1242
|
+
|
|
1154
1243
|
this.state('return', `actions:${id}`);
|
|
1155
1244
|
return data;
|
|
1156
1245
|
}
|
|
@@ -1178,7 +1267,11 @@ class Deva {
|
|
|
1178
1267
|
text, // set the text value
|
|
1179
1268
|
created: Date.now(), // set the creation date
|
|
1180
1269
|
};
|
|
1181
|
-
|
|
1270
|
+
|
|
1271
|
+
data.md5 = this.lib.hash(data);
|
|
1272
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1273
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1274
|
+
|
|
1182
1275
|
this.talk(config.events.feature, data); // talk the feature event with data
|
|
1183
1276
|
return data;
|
|
1184
1277
|
} catch (e) { // catch any errors
|
|
@@ -1204,7 +1297,11 @@ class Deva {
|
|
|
1204
1297
|
value: this._features, // set the value to the features list
|
|
1205
1298
|
created: Date.now(), // set the created date.
|
|
1206
1299
|
};
|
|
1207
|
-
|
|
1300
|
+
|
|
1301
|
+
data.md5 = this.lib.hash(data);
|
|
1302
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1303
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1304
|
+
|
|
1208
1305
|
this.state('return', `features:${id}`);
|
|
1209
1306
|
return data;
|
|
1210
1307
|
}
|
|
@@ -1234,7 +1331,11 @@ class Deva {
|
|
|
1234
1331
|
text,
|
|
1235
1332
|
created: Date.now(),
|
|
1236
1333
|
};
|
|
1237
|
-
|
|
1334
|
+
|
|
1335
|
+
data.md5 = this.lib.hash(data);
|
|
1336
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1337
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1338
|
+
|
|
1238
1339
|
this.talk(config.events.context, data);
|
|
1239
1340
|
return data;
|
|
1240
1341
|
} catch (e) {
|
|
@@ -1256,7 +1357,11 @@ class Deva {
|
|
|
1256
1357
|
value: this.vars.context || false,
|
|
1257
1358
|
created: Date.now(),
|
|
1258
1359
|
};
|
|
1259
|
-
|
|
1360
|
+
|
|
1361
|
+
data.md5 = this.lib.hash(data);
|
|
1362
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1363
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1364
|
+
|
|
1260
1365
|
this.state('return', `contexts:${id}`);
|
|
1261
1366
|
return data;
|
|
1262
1367
|
}
|
|
@@ -1269,10 +1374,14 @@ class Deva {
|
|
|
1269
1374
|
***************/
|
|
1270
1375
|
client() {
|
|
1271
1376
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1272
|
-
const
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1377
|
+
const data = this.lib.copy(this._client); // create a copy of the client data
|
|
1378
|
+
data.created = Date.now();
|
|
1379
|
+
|
|
1380
|
+
data.md5 = this.lib.hash(data);
|
|
1381
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1382
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1383
|
+
|
|
1384
|
+
return data; // return the copy of the client data.
|
|
1276
1385
|
}
|
|
1277
1386
|
|
|
1278
1387
|
/**************
|
|
@@ -1283,10 +1392,13 @@ class Deva {
|
|
|
1283
1392
|
***************/
|
|
1284
1393
|
agent() {
|
|
1285
1394
|
if (!this._active) return this._messages.offline; // check the active status
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1395
|
+
const data = this.lib.copy(this._agent); // create a copy of the agent data.
|
|
1396
|
+
data.created = Date.now();
|
|
1397
|
+
|
|
1398
|
+
data.md5 = this.lib.hash(data);
|
|
1399
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1400
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1401
|
+
return data; // return the copy of the agent data.
|
|
1290
1402
|
}
|
|
1291
1403
|
|
|
1292
1404
|
// FEATURE FUNCTIONS
|
|
@@ -1450,7 +1562,11 @@ class Deva {
|
|
|
1450
1562
|
text,
|
|
1451
1563
|
created: Date.now(),
|
|
1452
1564
|
}
|
|
1453
|
-
|
|
1565
|
+
|
|
1566
|
+
data.md5 = this.lib.hash(data);
|
|
1567
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1568
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1569
|
+
|
|
1454
1570
|
this.talk(config.events.prompt, data);
|
|
1455
1571
|
return data;
|
|
1456
1572
|
}
|
|
@@ -1469,7 +1585,11 @@ class Deva {
|
|
|
1469
1585
|
const data = this.lib.copy(this._core);
|
|
1470
1586
|
data.id = id;
|
|
1471
1587
|
data.created = Date.now();
|
|
1472
|
-
|
|
1588
|
+
|
|
1589
|
+
data.md5 = this.lib.hash(data);
|
|
1590
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1591
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1592
|
+
|
|
1473
1593
|
this.state('return', `core:${id}`);
|
|
1474
1594
|
return data;
|
|
1475
1595
|
}
|
|
@@ -1487,7 +1607,11 @@ class Deva {
|
|
|
1487
1607
|
const data = this.lib.copy(this._info);
|
|
1488
1608
|
data.id = id;
|
|
1489
1609
|
data.created = Date.now();
|
|
1490
|
-
|
|
1610
|
+
|
|
1611
|
+
data.md5 = this.lib.hash(data);
|
|
1612
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1613
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1614
|
+
|
|
1491
1615
|
this.state('return', `info:${id}`);
|
|
1492
1616
|
return data;
|
|
1493
1617
|
}
|
|
@@ -1516,32 +1640,6 @@ class Deva {
|
|
|
1516
1640
|
return `${this._agent.profile.name} active since ${dateFormat}`; // return final text string
|
|
1517
1641
|
}
|
|
1518
1642
|
|
|
1519
|
-
/******
|
|
1520
|
-
func: signature
|
|
1521
|
-
params:
|
|
1522
|
-
- data: the data to sign
|
|
1523
|
-
describe: function to provide a digital signature to data.
|
|
1524
|
-
******/
|
|
1525
|
-
signature(data) {
|
|
1526
|
-
if (!this._active) return this._messages.offline;
|
|
1527
|
-
const id = this.lib.uid();
|
|
1528
|
-
this.action('signature', id);
|
|
1529
|
-
|
|
1530
|
-
const client = this.client();
|
|
1531
|
-
const agent = this.agent();
|
|
1532
|
-
this.state('set', `signature:${id}`);
|
|
1533
|
-
const signature = {
|
|
1534
|
-
id,
|
|
1535
|
-
uid: this.lib.uid(true),
|
|
1536
|
-
name: client.profile.name,
|
|
1537
|
-
md5: this.lib.hash(data),
|
|
1538
|
-
sha256: this.lib.hash(data, 'sha256'),
|
|
1539
|
-
sha512: this.lib.hash(data, 'sha512'),
|
|
1540
|
-
date: Date.now(),
|
|
1541
|
-
};
|
|
1542
|
-
this.state('return', `signature:${id}`);
|
|
1543
|
-
return signature;
|
|
1544
|
-
}
|
|
1545
1643
|
/**************
|
|
1546
1644
|
func: help
|
|
1547
1645
|
params:
|
|
@@ -1636,7 +1734,10 @@ class Deva {
|
|
|
1636
1734
|
packet,
|
|
1637
1735
|
created: Date.now(),
|
|
1638
1736
|
}
|
|
1639
|
-
data.
|
|
1737
|
+
data.md5 = this.lib.hash(data);
|
|
1738
|
+
data.sha256 = this.lib.hash(data, 'sha256');
|
|
1739
|
+
data.sha512 = this.lib.hash(data, 'sha512');
|
|
1740
|
+
|
|
1640
1741
|
this.talk(config.events.error, this.lib.copy(data));
|
|
1641
1742
|
|
|
1642
1743
|
this.state('return', `error:${id}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@indra.ai/deva",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.43",
|
|
4
4
|
"description": "The Deva Core",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"copyright": "(c)2025 Quinn Michaels; All rights reserved.",
|
|
@@ -186,7 +186,8 @@
|
|
|
186
186
|
"insert": "👉 Insert",
|
|
187
187
|
"update": "👆 Update",
|
|
188
188
|
"delete": "🗑️ Delete",
|
|
189
|
-
"return": "🤿 Return"
|
|
189
|
+
"return": "🤿 Return",
|
|
190
|
+
"hash": "#️⃣ Hash"
|
|
190
191
|
},
|
|
191
192
|
"action": false,
|
|
192
193
|
"actions": {
|