mirror of
https://github.com/Skylar-Tech/node-red-contrib-matrix-chat.git
synced 2025-07-08 11:41:07 -06:00
- Verification process is successful but not complete
This commit is contained in:
parent
86640a1d79
commit
1337d25631
@ -123,10 +123,29 @@ module.exports = function(RED) {
|
||||
} else {
|
||||
try {
|
||||
data.on('change', async function() {
|
||||
console.log("VERIFIER EVENT CHANGE", this.phase);
|
||||
// VerificationPhase {
|
||||
// /** Initial state: no event yet exchanged */
|
||||
// Unsent = 1,
|
||||
//
|
||||
// /** An `m.key.verification.request` event has been sent or received */
|
||||
// Requested = 2,
|
||||
//
|
||||
// /** An `m.key.verification.ready` event has been sent or received, indicating the verification request is accepted. */
|
||||
// Ready = 3,
|
||||
//
|
||||
// /** An `m.key.verification.start` event has been sent or received, choosing a verification method */
|
||||
// Started = 4,
|
||||
//
|
||||
// /** An `m.key.verification.cancel` event has been sent or received at any time before the `done` event, cancelling the verification request */
|
||||
// Cancelled = 5,
|
||||
//
|
||||
// /** An `m.key.verification.done` event has been **sent**, completing the verification request. */
|
||||
// Done = 6,
|
||||
// }
|
||||
console.log("[Verification Start] VERIFIER EVENT CHANGE", this.phase);
|
||||
var that = this;
|
||||
if(this.phase === Phase.Started) {
|
||||
console.log("VERIFIER EVENT PHASE STARTED");
|
||||
console.log("[Verification Start] VERIFIER EVENT PHASE STARTED");
|
||||
let verifierCancel = function(){
|
||||
let verifyRequestId = that.targetDevice.userId + ':' + that.targetDevice.deviceId;
|
||||
if(verificationRequests.has(verifyRequestId)) {
|
||||
@ -142,9 +161,16 @@ module.exports = function(RED) {
|
||||
const sasEventPromise = new Promise(resolve =>
|
||||
data.verifier.once("show_sas", resolve)
|
||||
);
|
||||
console.log("VERIFIER VERIFY");
|
||||
await data.verifier.verify();
|
||||
console.log("WAITING FOR SHOW SAS EVENT");
|
||||
console.log("[Verification Start] Starting verification");
|
||||
data.verifier.verify()
|
||||
.then(function() {
|
||||
console.log("[Verification Start] verify() success");
|
||||
}).catch(function(e) {
|
||||
console.log("[Verification Start] verify() error", e);
|
||||
msg.error = e;
|
||||
node.send([null, msg]);
|
||||
});
|
||||
console.log("[Verification Start] WAITING FOR SHOW SAS EVENT");
|
||||
const sasEvent = await sasEventPromise;
|
||||
|
||||
console.log("SHOW SAS", sasEvent);
|
||||
@ -175,15 +201,17 @@ module.exports = function(RED) {
|
||||
}
|
||||
});
|
||||
|
||||
console.log("STARTING VERIFICATION");
|
||||
console.log("[Verification Start] Starting verification");
|
||||
try {
|
||||
console.log("[Verification Start] Accepting..");
|
||||
await data.accept();
|
||||
console.log(`[Verification] beginKeyVerification (methods=${data.methods[0]}, targetDevice=${data.targetDevice})`);
|
||||
await data.beginKeyVerification(
|
||||
data.methods[0],
|
||||
data.targetDevice
|
||||
);
|
||||
} catch(e) {
|
||||
console.log("OOPS SOMETHING BROKE", e);
|
||||
console.log("[Verification Start] VERIFICATION ERROR", e);
|
||||
}
|
||||
} catch(e) {
|
||||
console.log("ERROR", e);
|
||||
|
Loading…
x
Reference in New Issue
Block a user