From 0f7bda0942b4daf0c4c48c9938244e4b4de24ee0 Mon Sep 17 00:00:00 2001 From: Donovan Date: Mon, 24 Mar 2025 09:52:52 -0500 Subject: [PATCH] refactor docs --- docs/enrollment_diagram.md | 24 +++++++++---------- docs/login_diagram.md | 10 ++++---- docs/{ => scripts}/render_diagrams_md.py | 12 ++-------- .../enrollment_diagram.template.md | 0 .../{ => templates}/login_diagram.template.md | 0 requirements.txt | 3 ++- 6 files changed, 21 insertions(+), 28 deletions(-) rename docs/{ => scripts}/render_diagrams_md.py (90%) rename docs/{ => templates}/enrollment_diagram.template.md (100%) rename docs/{ => templates}/login_diagram.template.md (100%) diff --git a/docs/enrollment_diagram.md b/docs/enrollment_diagram.md index 0909c59..304fe77 100644 --- a/docs/enrollment_diagram.md +++ b/docs/enrollment_diagram.md @@ -12,26 +12,26 @@ sequenceDiagram Server->>Server: Create Signup Session Note over User,Server: Set nKode Server-->>-Client: signup_session_id, set_keypad, icons - Note left of Server: signup_session_id:
e029138e-fb64-49ea-a6bc-b6b5affbf263 - Note left of Server: set_keypad:
Key 0: [18 7 20 22 23]
Key 1: [12 13 8 28 29]
Key 2: [24 25 26 16 5]
Key 3: [ 6 19 2 10 11]
Key 4: [ 0 1 14 4 17]
+ Note left of Server: signup_session_id:
d7e50a75-d3ff-482a-b0e7-ce99c3838c1a + Note left of Server: set_keypad:
Key 0: [12 13 20 21 16]
Key 1: [ 6 1 14 9 4]
Key 2: [ 0 7 26 15 28]
Key 3: [24 19 2 27 10]
Key 4: [18 25 8 3 22]
Note left of Server: Icons:
[😀,😂,🥳,😍,🤓
😎,🥺,😡,😱,🤯
🥰,😴,🤔,🙃,😇
🤖,👽,👾,🐱,🐶
🦁,🐻,🐸,🐙,🦄
🌟,⚡,🔥,🍕,🎉] Client->>Client: Order Icons by keypad Client->>User: Display Keypad - Note left of Client: Key 0: ['🐱' '😡' '🦁' '🐸' '🐙']
Key 1: ['🤔' '🙃' '😱' '🍕' '🎉']
Key 2: ['🦄' '🌟' '⚡' '👽' '😎']
Key 3: ['🥺' '🐶' '🥳' '🥰' '😴']
Key 4: ['😀' '😂' '😇' '🤓' '👾']
- Note left of User: User icons: ['🐱' '🥳' '🐶' '⚡'] - User->>Client: Set Key Selection: [0, 3, 3, 2] - Client->>+Server: Set nKode:
e029138e-fb64-49ea-a6bc-b6b5affbf263
[0, 3, 3, 2] + Note left of Client: Key 0: ['🤔' '🙃' '🦁' '🐻' '👽']
Key 1: ['🥺' '😂' '😇' '🤯' '🤓']
Key 2: ['😀' '😡' '⚡' '🤖' '🍕']
Key 3: ['🦄' '🐶' '🥳' '🔥' '🥰']
Key 4: ['🐱' '🌟' '😱' '😍' '🐸']
+ Note left of User: User icons: ['🤓' '🐶' '🦄' '👽'] + User->>Client: Set Key Selection: [1, 3, 3, 0] + Client->>+Server: Set nKode:
d7e50a75-d3ff-482a-b0e7-ce99c3838c1a
[1, 3, 3, 0] Server->>Server: Disperse Set Keypad Note over User,Server: Confirm nKode Server-->>-Client: signup_session_id, confirm_keypad, icons - Note left of Server: signup_session_id:
e029138e-fb64-49ea-a6bc-b6b5affbf263 - Note left of Server: confirm_keypad:
Key 0: [ 6 7 8 16 17]
Key 1: [ 0 13 2 22 5]
Key 2: [24 19 14 28 23]
Key 3: [18 1 26 10 29]
Key 4: [12 25 20 4 11]
+ Note left of Server: signup_session_id:
d7e50a75-d3ff-482a-b0e7-ce99c3838c1a + Note left of Server: confirm_keypad:
Key 0: [ 6 13 8 15 10]
Key 1: [24 7 14 3 16]
Key 2: [12 25 2 9 28]
Key 3: [ 0 1 20 27 22]
Key 4: [18 19 26 21 4]
Client->>Client: Order Icons by keypad Client->>User: Display Keypad - Note left of Client: Key 0: ['🥺' '😡' '😱' '👽' '👾']
Key 1: ['😀' '🙃' '🥳' '🐸' '😎']
Key 2: ['🦄' '🐶' '😇' '🍕' '🐙']
Key 3: ['🐱' '😂' '⚡' '🥰' '🎉']
Key 4: ['🤔' '🌟' '🦁' '🤓' '😴']
- Note left of User: User icons: ['🐱' '🥳' '🐶' '⚡'] - User->>Client: Key Selection: [3, 1, 2, 3] - Client->>+Server: Confirm nKode:
e029138e-fb64-49ea-a6bc-b6b5affbf263
[3, 1, 2, 3] + Note left of Client: Key 0: ['🥺' '🙃' '😱' '🤖' '🥰']
Key 1: ['🦄' '😡' '😇' '😍' '👽']
Key 2: ['🤔' '🌟' '🥳' '🤯' '🍕']
Key 3: ['😀' '😂' '🦁' '🔥' '🐸']
Key 4: ['🐱' '🐶' '⚡' '🐻' '🤓']
+ Note left of User: User icons: ['🤓' '🐶' '🦄' '👽'] + User->>Client: Key Selection: [4, 4, 1, 1] + Client->>+Server: Confirm nKode:
d7e50a75-d3ff-482a-b0e7-ce99c3838c1a
[4, 4, 1, 1] Server->>Server: Create User Server-->>-Client: Success ``` \ No newline at end of file diff --git a/docs/login_diagram.md b/docs/login_diagram.md index b1e4506..1ae4167 100644 --- a/docs/login_diagram.md +++ b/docs/login_diagram.md @@ -10,13 +10,13 @@ sequenceDiagram Note left of User: email: user@example.com User->>Server: Submit Email Server->>Client: login_keypad, icons - Note left of Server: Login Keypad:
Key 0: [18 7 20 27 22 23]
Key 1: [12 13 8 3 28 29]
Key 2: [24 25 26 9 16 5]
Key 3: [ 6 19 2 21 10 11]
Key 4: [ 0 1 14 15 4 17]
+ Note left of Server: Login Keypad:
Key 0: [12 13 20 21 16 23]
Key 1: [ 6 1 14 9 4 29]
Key 2: [ 0 7 26 15 28 11]
Key 3: [24 19 2 27 10 5]
Key 4: [18 25 8 3 22 17]
Note left of Server: Icons:
[😀,😂,🥳,😍,🤓
😎,🥺,😡,😱,🤯
🥰,😴,🤔,🙃,😇
🤖,👽,👾,🐱,🐶
🦁,🐻,🐸,🐙,🦄
🌟,⚡,🔥,🍕,🎉] Client->>Client: Order Icons Client->>User: Display Keypad - Note left of Client: Key 0: ['🐱' '😡' '🦁' '🔥' '🐸' '🐙']
Key 1: ['🤔' '🙃' '😱' '😍' '🍕' '🎉']
Key 2: ['🦄' '🌟' '⚡' '🤯' '👽' '😎']
Key 3: ['🥺' '🐶' '🥳' '🐻' '🥰' '😴']
Key 4: ['😀' '😂' '😇' '🤖' '🤓' '👾']
- Note left of User: User passcode icons: ['🐱' '🥳' '🐶' '⚡'] - User->>Client: Selected Keys
[0, 3, 3, 2] - Client->>Server: Login:
email: user@example.com
selected_keys: [0, 3, 3, 2] + Note left of Client: Key 0: ['🤔' '🙃' '🦁' '🐻' '👽' '🐙']
Key 1: ['🥺' '😂' '😇' '🤯' '🤓' '🎉']
Key 2: ['😀' '😡' '⚡' '🤖' '🍕' '😴']
Key 3: ['🦄' '🐶' '🥳' '🔥' '🥰' '😎']
Key 4: ['🐱' '🌟' '😱' '😍' '🐸' '👾']
+ Note left of User: User passcode icons: ['🤓' '🐶' '🦄' '👽'] + User->>Client: Selected Keys
[1, 3, 3, 0] + Client->>Server: Login:
email: user@example.com
selected_keys: [1, 3, 3, 0] Server-->>Client: Success ``` \ No newline at end of file diff --git a/docs/render_diagrams_md.py b/docs/scripts/render_diagrams_md.py similarity index 90% rename from docs/render_diagrams_md.py rename to docs/scripts/render_diagrams_md.py index 6696a5c..ec97b54 100644 --- a/docs/render_diagrams_md.py +++ b/docs/scripts/render_diagrams_md.py @@ -11,14 +11,6 @@ from src.utils import select_keys_with_passcode_values def render_markdown_template(template_path, output_path, context): - """ - Render a Jinja2 markdown template with the given context and save to output_path. - - Args: - template_path (Path): Path to the template file - output_path (Path): Path where the rendered file will be saved - context (dict): Template variables - """ template_dir = template_path.parent template_file = template_path.name @@ -102,7 +94,7 @@ if __name__ == "__main__": "confirm_ordered_keypad": display_icons_keypad(ordered_confirm_icons.reshape(-1, keypad_size.numb_of_keys), keypad_size.numb_of_keys), "confirm_key_selection": selected_keys_confirm } - render_markdown_template(Path("./enrollment_diagram.template.md"), Path("./enrollment_diagram.md"), context) + render_markdown_template(Path("../templates/enrollment_diagram.template.md"), Path("../enrollment_diagram.md"), context) login_keypad = api.get_login_keypad(username, customer_id) selected_keys_login = select_keys_with_passcode_values(passcode_property_indices, login_keypad, keypad_size.props_per_key) @@ -116,4 +108,4 @@ if __name__ == "__main__": "selected_keys_login": str(selected_keys_login) } api.login(customer_id, username, selected_keys_login) - render_markdown_template(Path("./login_diagram.template.md"), Path("./login_diagram.md"), context) + render_markdown_template(Path("../templates/login_diagram.template.md"), Path("../login_diagram.md"), context) diff --git a/docs/enrollment_diagram.template.md b/docs/templates/enrollment_diagram.template.md similarity index 100% rename from docs/enrollment_diagram.template.md rename to docs/templates/enrollment_diagram.template.md diff --git a/docs/login_diagram.template.md b/docs/templates/login_diagram.template.md similarity index 100% rename from docs/login_diagram.template.md rename to docs/templates/login_diagram.template.md diff --git a/requirements.txt b/requirements.txt index dcd35dd..e7517e0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,5 @@ bcrypt~=4.1.3 numpy~=2.0.0 pytest~=8.2.2 -ipython~=8.25.0 \ No newline at end of file +ipython~=8.25.0 +jinja2~=3.1.4 \ No newline at end of file