chore: cleanup some eventTypes and unused variables

This commit is contained in:
td 2023-06-27 13:46:39 +05:30
parent bfda82bb45
commit 538865f62a
No known key found for this signature in database
GPG Key ID: F6D9E9BF14C7D103
3 changed files with 8 additions and 10 deletions

View File

@ -233,7 +233,6 @@ class KeyVerification {
canceled ||
{KeyVerificationState.error, KeyVerificationState.done}.contains(state);
String? chosenMethod;
// qr stuff
QRCode? qrCode;
String? randomSharedSecretForQRCode;
@ -293,7 +292,6 @@ class KeyVerification {
/// qr, send the qrData you just scanned
Future<void> continueVerification(String type,
{Uint8List? qrDataRawBytes}) async {
chosenMethod = type;
bool qrChecksOut = false;
if (possibleMethods.contains(type)) {
if (qrDataRawBytes != null) {
@ -411,7 +409,7 @@ class KeyVerification {
setState(KeyVerificationState.askAccept);
break;
case 'm.key.verification.ready':
case EventTypes.KeyVerificationReady:
if (deviceId == '*') {
_deviceId = payload['from_device']; // gotta set the real device id
transactionId ??= eventId ?? payload['transaction_id'];
@ -498,7 +496,7 @@ class KeyVerification {
}
if (!(await verifyLastStep([
EventTypes.KeyVerificationRequest,
'm.key.verification.ready',
EventTypes.KeyVerificationReady,
]))) {
return; // abort
}
@ -642,7 +640,7 @@ class KeyVerification {
}
}
// we need to send a ready event
await send('m.key.verification.ready', {
await send(EventTypes.KeyVerificationReady, {
'methods': copyKnownVerificationMethods,
});
// setup QRData from incoming request (outgoing ready)
@ -1129,7 +1127,7 @@ class _KeyVerificationMethodQRReciprocate extends _KeyVerificationMethod {
switch (type) {
case EventTypes.KeyVerificationStart:
if (!(await request.verifyLastStep([
'm.key.verification.ready',
EventTypes.KeyVerificationReady,
EventTypes.KeyVerificationRequest,
]))) {
return; // abort
@ -1248,7 +1246,7 @@ class _KeyVerificationMethodSas extends _KeyVerificationMethod {
switch (type) {
case EventTypes.KeyVerificationStart:
if (!(await request.verifyLastStep([
'm.key.verification.ready',
EventTypes.KeyVerificationReady,
EventTypes.KeyVerificationRequest,
EventTypes.KeyVerificationStart
]))) {
@ -1262,7 +1260,7 @@ class _KeyVerificationMethodSas extends _KeyVerificationMethod {
break;
case EventTypes.KeyVerificationAccept:
if (!(await request.verifyLastStep([
'm.key.verification.ready',
EventTypes.KeyVerificationReady,
EventTypes.KeyVerificationRequest
]))) {
return;

View File

@ -518,7 +518,7 @@ void main() async {
.handleEventUpdate(EventUpdate(
content: {
'event_id': req2.transactionId,
'type': 'm.key.verification.ready',
'type': EventTypes.KeyVerificationReady,
'content': {
'methods': [EventTypes.Sas],
'from_device': 'SOMEOTHERDEVICE',

View File

@ -51,7 +51,7 @@ void main() async {
}
await req1.client.encryption!.keyVerificationManager.handleToDeviceEvent(
ToDeviceEvent(
type: 'm.key.verification.ready',
type: EventTypes.KeyVerificationReady,
sender: req2.client.userID!,
content: {
'from_device': req2.client.deviceID,