Do not accept the separator in the local part

This commit is contained in:
Rodolphe Bréard 2023-08-25 10:13:50 +02:00
parent 72bc29ba66
commit 0dc94a7edd
4 changed files with 6 additions and 0 deletions

View file

@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- Secret keys are now restricted to 128 bits (16 bytes) or 256 bits (32 bytes)
- The local part cannot contain the separator
## [0.2.0] - 2023-08-11

View file

@ -43,6 +43,7 @@
"cameraNotReadable": "Camera not accessible (potentially already in use).",
"cameraOverconstrained": "Installed cameras are not suitable.",
"cameraStreamApiNotSupported": "Stream API is not supported in this browser.",
"localPartSeparator": "The local part cannot contain the separator.",
"unknown": "Unknown error."
}
},

View file

@ -43,6 +43,7 @@
"cameraNotReadable": "Caméra inaccessible (potentiellement déjà utilisée).",
"cameraOverconstrained": "Les caméras détectées ne sont pas compatibles.",
"cameraStreamApiNotSupported": "L'API du flux de données vidéo n'est pas supportée par ce navigateur.",
"localPartSeparator": "La partie locale ne peut pas contenir le séparateur.",
"unknown": "Erreur inconnue."
}
},

View file

@ -47,6 +47,9 @@ const addAccount = () => {
if (separator.value.length != 1) {
throw new Error('addAccount.error.invalidSeparator');
}
if (localPart.value.includes(separator.value)) {
throw new Error('addAccount.error.localPartSeparator');
}
const key = base64Decode(privateKey.value);
if (!authorizedKeyLengths.includes(key.length)) {
throw new Error('addAccount.error.invalidKeyLength');