Skip to content

Commit

Permalink
"enforce" encryption requirements
Browse files Browse the repository at this point in the history
  • Loading branch information
SammCheese committed Dec 17, 2022
1 parent ce53651 commit 3acbf63
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"discordID": "372148345894076416",
"github": "SammCheese"
},
"version": "1.0.1",
"version": "1.0.2",
"updater": {
"type": "github",
"id": "SammCheese/invisible-chat"
Expand Down
2 changes: 1 addition & 1 deletion src/components/DecryptionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ setTimeout(() => {

export function buildDecModal(msg: any) {
let secret: string = msg?.content;
let password: string;
let password: string = "password";
if (!TextInput || !Button) return;
if (!ModalRoot || !ModalContent || !ModalHeader || !ModalFooter) return;
const s = openModal!((props = msg) => (
Expand Down
20 changes: 18 additions & 2 deletions src/components/EncryptionModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,19 @@ setTimeout(() => {
export function buildEncModal() {
let secret: string;
let cover: string;
let password: string;
let password: string = "password";
let valid: boolean = false;
if (!TextInput || !Button) return;
if (!ModalRoot || !ModalContent || !ModalHeader || !ModalFooter) return;

function isValid() {
if (secret && cover && cover.match(/\w \w/)) {
valid = true;
} else {
valid = false;
} // Enforcing the 2 words, space is NOT a valid thing
}

const s = openModal!((props) => (
<ModalRoot {...props} size={ModalSize.MEDIUM}>
<ModalHeader>
Expand All @@ -35,21 +45,27 @@ export function buildEncModal() {
<TextInput
onChange={(e: string) => {
secret = e;
isValid();
}}></TextInput>
<div style={{ color: "gray" }}>Cover</div>
<div style={{ color: "gray" }}>Cover (2 or more Words!!)</div>
<TextInput
onChange={(e: string) => {
cover = e;
isValid();
}}></TextInput>
<div style={{ color: "gray" }}>Password</div>
<TextInput
defaultValue={"password"}
onChange={(e: string) => {
isValid();
password = e;
}}></TextInput>
</ModalContent>
<ModalFooter>
<Button
onClick={() => {
if (!valid) return;

const toSend = encrypt(secret, password, cover);
if (!toSend) return;

Expand Down

0 comments on commit 3acbf63

Please sign in to comment.