99863c4d7b2a3ee8f7b0d0d3e3f924afe7d40fb8
Marco Ricci Move typing classes into se...

Marco Ricci authored 2 months ago

1) # SPDX-FileCopyrightText: 2024 Marco Ricci <m@the13thletter.info>
2) #
3) # SPDX-License-Identifier: MIT
4) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 1 month ago

5) """Common typing declarations for the parent module."""
Marco Ricci Move typing classes into se...

Marco Ricci authored 2 months ago

6) 
7) from __future__ import annotations
8) 
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 1 month ago

9) from typing import TypeGuard
10) 
Marco Ricci Support Python 3.10 and PyP...

Marco Ricci authored 2 months ago

11) from typing_extensions import (
Marco Ricci Fix style issues with ruff...

Marco Ricci authored 1 month ago

12)     Any,
13)     NotRequired,
14)     Required,
15)     TypedDict,
Marco Ricci Support Python 3.10 and PyP...

Marco Ricci authored 2 months ago

16) )
Marco Ricci Move typing classes into se...

Marco Ricci authored 2 months ago

17) 
18) import derivepassphrase
19) 
20) __author__ = derivepassphrase.__author__
21) __version__ = derivepassphrase.__version__
22) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 1 month ago

23) 
Marco Ricci Move typing classes into se...

Marco Ricci authored 2 months ago

24) class VaultConfigGlobalSettings(TypedDict, total=False):
25)     r"""Configuration for vault: global settings.
26) 
27)     Attributes:
28)         key:
29)             The base64-encoded ssh public key to use, overriding the
30)             master passphrase. Optional.
31)         phrase:
32)             The master passphrase. Optional.
33) 
34)     """
Marco Ricci Reformat everything with ruff

Marco Ricci authored 1 month ago

35) 
Marco Ricci Move typing classes into se...

Marco Ricci authored 2 months ago

36)     key: NotRequired[str]
37)     phrase: NotRequired[str]
38) 
39) 
40) class VaultConfigServicesSettings(VaultConfigGlobalSettings, total=False):
41)     r"""Configuration for vault: services settings.
42) 
43)     Attributes:
44)         notes:
45)             Optional notes for this service, to display to the user when
46)             generating the passphrase.
47)         length:
48)             Desired passphrase length.
49)         repeat:
50)             The maximum number of immediate character repetitions
51)             allowed in the passphrase.  Disabled if set to 0.
52)         lower:
53)             Optional constraint on ASCII lowercase characters.  If
54)             positive, include this many lowercase characters
55)             somewhere in the passphrase.  If 0, avoid lowercase
56)             characters altogether.
57)         upper:
58)             Same as `lower`, but for ASCII uppercase characters.
59)         number:
60)             Same as `lower`, but for ASCII digits.
61)         space:
62)             Same as `lower`, but for the space character.
63)         dash:
64)             Same as `lower`, but for the hyphen-minus and underscore
65)             characters.
66)         symbol:
67)             Same as `lower`, but for all other hitherto unlisted
68)             ASCII printable characters (except backquote).
69) 
70)     """
Marco Ricci Reformat everything with ruff

Marco Ricci authored 1 month ago

71) 
Marco Ricci Move typing classes into se...

Marco Ricci authored 2 months ago

72)     notes: NotRequired[str]
73)     length: NotRequired[int]
74)     repeat: NotRequired[int]
75)     lower: NotRequired[int]
76)     upper: NotRequired[int]
77)     number: NotRequired[int]
78)     space: NotRequired[int]
79)     dash: NotRequired[int]
80)     symbol: NotRequired[int]
81) 
82) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 1 month ago

83) _VaultConfig = TypedDict(
84)     '_VaultConfig',
85)     {'global': NotRequired[VaultConfigGlobalSettings]},
86)     total=False,
87) )
88) 
89) 
Marco Ricci Move typing classes into se...

Marco Ricci authored 2 months ago

90) class VaultConfig(TypedDict, _VaultConfig, total=False):
91)     r"""Configuration for vault.
92) 
93)     Usually stored as JSON.
94) 
95)     Attributes:
96)         global (NotRequired[VaultConfigGlobalSettings]):
97)             Global settings.
98)         services (Required[dict[str, VaultConfigServicesSettings]]):
99)             Service-specific settings.
100) 
101)     """
Marco Ricci Reformat everything with ruff

Marco Ricci authored 1 month ago

102) 
Marco Ricci Move typing classes into se...

Marco Ricci authored 2 months ago

103)     services: Required[dict[str, VaultConfigServicesSettings]]
104) 
Marco Ricci Reformat everything with ruff

Marco Ricci authored 1 month ago

105)