fix: use macv2 for correct base64 encoding
This commit is contained in:
parent
8c74fae354
commit
8b3776aed2
|
|
@ -1238,7 +1238,10 @@ class QRCode {
|
|||
|
||||
const knownKeyAgreementProtocols = ['curve25519-hkdf-sha256', 'curve25519'];
|
||||
const knownHashes = ['sha256'];
|
||||
const knownHashesAuthentificationCodes = ['hkdf-hmac-sha256'];
|
||||
const knownHashesAuthentificationCodes = [
|
||||
'hkdf-hmac-sha256.v2',
|
||||
'hkdf-hmac-sha256',
|
||||
];
|
||||
|
||||
class _KeyVerificationMethodSas extends _KeyVerificationMethod {
|
||||
_KeyVerificationMethodSas({required super.request});
|
||||
|
|
@ -1396,6 +1399,8 @@ class _KeyVerificationMethodSas extends _KeyVerificationMethod {
|
|||
if (possibleMessageAuthenticationCodes.isEmpty) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// intersect should make sure we choose v2 over the dep'd one
|
||||
messageAuthenticationCode = possibleMessageAuthenticationCodes.first;
|
||||
final possibleAuthenticationTypes = _intersect(
|
||||
knownAuthentificationTypes,
|
||||
|
|
@ -1560,7 +1565,9 @@ class _KeyVerificationMethodSas extends _KeyVerificationMethod {
|
|||
}
|
||||
|
||||
String _calculateMac(String input, String info) {
|
||||
if (messageAuthenticationCode == 'hkdf-hmac-sha256') {
|
||||
if (messageAuthenticationCode == 'hkdf-hmac-sha256.v2') {
|
||||
return sas!.calculate_mac_fixed_base64(input, info);
|
||||
} else if (messageAuthenticationCode == 'hkdf-hmac-sha256') {
|
||||
return sas!.calculate_mac(input, info);
|
||||
} else {
|
||||
throw Exception('Unknown message authentification code');
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ dependencies:
|
|||
js: ^0.6.3
|
||||
markdown: ^7.1.1
|
||||
mime: ">=1.0.0 <3.0.0"
|
||||
olm: ^2.0.2
|
||||
olm: ^3.1.0
|
||||
random_string: ^2.3.1
|
||||
sdp_transform: ^0.3.2
|
||||
slugify: ^2.0.0
|
||||
|
|
|
|||
Loading…
Reference in New Issue