-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
44 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Decoder - 2. Features | ||
## 2.3. Cryptography | ||
### cryptography.js | ||
Encryption replaces each letter by its corresponding term and decryption replaces each term by its corresponding letter. Letters and terms entries can be found in [`cryptographyEntries.js`](/src/js/cryptographyEntries.js). Cryptography has validations and alert to inform invalid input text. When valid, input text is cleared and output text is shown with copy option. When invalid, the output is cleared and hidden. | ||
|
||
### Method `cryptography` | ||
- `cryptography.data`: Returns both cryptography keys and its result according to the `target` button passed as parameter, which can be *encrypt* or *decrypt*. Reverts entries if *decrypt* is the target. Replaces input text using the cryptography keys as `regEx` of `replace` method to get the output text. | ||
- `cryptography.validate`: Returns `true` if input text is valid or `false` if invalid, according to `target` parameter's button. | ||
- `validations`: Sub-method of conditions, each one returning `true` or an error message. Sets the error message and alerts it to screen reader, or restores the initial message and removes the alert. | ||
- `cryptography.submit`: Validates input text according to `target` parameter's button. Toggles output section elements to show or hide resulting text and CSS error class on input field's parent element. If valid, alerts success message to screen reader, clears input text and focus on copy button to easily copy output text to clipboard. | ||
- `cryptography.init`: Attaches `cryptography.submit` to the buttons responsible for encrypt and decrypt. | ||
|
||
### Method `input` | ||
- `input.toggleSectionFocus`: Toggles CSS class for focus styles on input field parent element. | ||
- `input.clearError`: Restores initial input field message and removes accessibility attribute and CSS error class from parent element. | ||
- `input.set`: Attaches `input.toggleSectionFocus` and `input.clearError` methods to input field events. | ||
|
||
<br> | ||
|
||
### [🡨 previous](/docs/en/feature-translation.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Decoder - 2. Funcionalidades | ||
## 2.3. Criptografia | ||
### cryptography.js | ||
Criptografia substitui cada letra por seu termo correspondente e descriptografia substitui cada termo por sua letra correspondente. As entradas de letras e termos podem ser encontradas em [`cryptographyEntries.js`](/src/js/cryptographyEntries.js). Criptografia possui validações e alerta para informar texto de entrada inválido. Quando válido, o texto de entrada é limpo e o texto de saída é mostrado com opção de copiá-lo. Quando inválido, a saída é limpa e ocultada. | ||
|
||
### Método `cryptography` | ||
- `cryptography.data`: Retorna ambas chaves de criptografia e seu resultado de acordo com o botão `target` passado como parâmetro, que pode ser *criptografar* ou *descriptografar*. Reverte entradas se *descriptografar* for o alvo. Substitui o texto de entrada usando as chaves de criptografia como `regEx` do método `replace` para obter o texto de saída. | ||
- `cryptography.validate`: Retorna `true` se o texto de entrada for válido ou `false` se inválido, de acordo com o botão do parâmetro `target`. | ||
- `validations`: Submétodo de condições, cada uma retornando `true` ou uma mensagem de erro. Define a mensagem de erro e alerta-a para o leitor de tela ou restaura a mensagem inicial e remove o alerta. | ||
- `cryptography.submit`: Valida o texto de entrada de acordo com o botão do parâmetro `target`. Alterna os elementos da seção de saída para mostrar ou ocultar o texto resultante e a classe de erro CSS no elemento pai do campo de entrada. Se válido, alerta a mensagem de sucesso para o leitor de tela, limpa o texto de entrada e foca o botão copiar para copiar facilmente o texto de saída para a área de transferência. | ||
- `cryptography.init`: Anexa `cryptography.submit` aos botões responsáveis por criptografar e descriptografar. | ||
|
||
### Método `input` | ||
- `input.toggleSectionFocus`: Alterna classe CSS para estilos de foco no elemento pai do campo de entrada. | ||
- `input.clearError`: Restaura mensagem inicial do campo de entrada e remove atributo de acessibilidade e classe CSS de erro do elemento pai. | ||
- `input.set`: Anexa os métodos `input.toggleSectionFocus` e `input.clearError` a eventos do campo de entrada. | ||
|
||
<br> | ||
|
||
### [🡨 anterior](/docs/pt/feature-translation.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters