mirror of
https://github.com/Skylar-Tech/node-red-contrib-matrix-chat.git
synced 2025-07-08 19:51:13 -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 {
|
} else {
|
||||||
try {
|
try {
|
||||||
data.on('change', async function() {
|
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;
|
var that = this;
|
||||||
if(this.phase === Phase.Started) {
|
if(this.phase === Phase.Started) {
|
||||||
console.log("VERIFIER EVENT PHASE STARTED");
|
console.log("[Verification Start] VERIFIER EVENT PHASE STARTED");
|
||||||
let verifierCancel = function(){
|
let verifierCancel = function(){
|
||||||
let verifyRequestId = that.targetDevice.userId + ':' + that.targetDevice.deviceId;
|
let verifyRequestId = that.targetDevice.userId + ':' + that.targetDevice.deviceId;
|
||||||
if(verificationRequests.has(verifyRequestId)) {
|
if(verificationRequests.has(verifyRequestId)) {
|
||||||
@ -142,9 +161,16 @@ module.exports = function(RED) {
|
|||||||
const sasEventPromise = new Promise(resolve =>
|
const sasEventPromise = new Promise(resolve =>
|
||||||
data.verifier.once("show_sas", resolve)
|
data.verifier.once("show_sas", resolve)
|
||||||
);
|
);
|
||||||
console.log("VERIFIER VERIFY");
|
console.log("[Verification Start] Starting verification");
|
||||||
await data.verifier.verify();
|
data.verifier.verify()
|
||||||
console.log("WAITING FOR SHOW SAS EVENT");
|
.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;
|
const sasEvent = await sasEventPromise;
|
||||||
|
|
||||||
console.log("SHOW SAS", sasEvent);
|
console.log("SHOW SAS", sasEvent);
|
||||||
@ -175,15 +201,17 @@ module.exports = function(RED) {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("STARTING VERIFICATION");
|
console.log("[Verification Start] Starting verification");
|
||||||
try {
|
try {
|
||||||
|
console.log("[Verification Start] Accepting..");
|
||||||
await data.accept();
|
await data.accept();
|
||||||
|
console.log(`[Verification] beginKeyVerification (methods=${data.methods[0]}, targetDevice=${data.targetDevice})`);
|
||||||
await data.beginKeyVerification(
|
await data.beginKeyVerification(
|
||||||
data.methods[0],
|
data.methods[0],
|
||||||
data.targetDevice
|
data.targetDevice
|
||||||
);
|
);
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log("OOPS SOMETHING BROKE", e);
|
console.log("[Verification Start] VERIFICATION ERROR", e);
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.log("ERROR", e);
|
console.log("ERROR", e);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user