|
|
@@ -56,7 +56,7 @@ class Secret:
|
|
|
|
|
|
@classmethod
|
|
|
def from_line(cls, line: str):
|
|
|
- type_, *args = line.split(",")
|
|
|
+ name, type_, *args = line.split(",")
|
|
|
match type_:
|
|
|
case "file":
|
|
|
sub_class = SecretFile
|
|
|
@@ -65,7 +65,7 @@ class Secret:
|
|
|
case "keepass-attachment":
|
|
|
sub_class = SecretKeepassAttachment
|
|
|
|
|
|
- return sub_class.from_line(*args)
|
|
|
+ return sub_class.from_line(name, *args)
|
|
|
|
|
|
@classmethod
|
|
|
def read_sources(cls, hostname: str, login: str) -> list["Secret"]:
|
|
|
@@ -87,8 +87,8 @@ class SecretKeepassAttachment(Secret):
|
|
|
subprocess.run(args, input=value.encode())
|
|
|
|
|
|
@classmethod
|
|
|
- def from_line(cls, key, attachment):
|
|
|
- return cls(name=key, key=key, mode=0o0400, attachment=attachment)
|
|
|
+ def from_line(cls, name: str, key: str, attachment: str):
|
|
|
+ return cls(name=name, key=key, mode=0o0400, attachment=attachment)
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
@@ -103,8 +103,8 @@ class SecretKeepassAttribute(Secret):
|
|
|
subprocess.run(args, input=value.encode())
|
|
|
|
|
|
@classmethod
|
|
|
- def from_line(cls, key, attribute):
|
|
|
- return cls(name=key, key=key, mode=0o0400, attribute=attribute)
|
|
|
+ def from_line(cls, name: str, key: str, attribute: str):
|
|
|
+ return cls(name=name, key=key, mode=0o0400, attribute=attribute)
|
|
|
|
|
|
|
|
|
@dataclass
|
|
|
@@ -117,9 +117,9 @@ class SecretFile(Secret):
|
|
|
subprocess.run(args)
|
|
|
|
|
|
@classmethod
|
|
|
- def from_line(cls, path: str):
|
|
|
+ def from_line(cls, name: str, path: str):
|
|
|
path = Path(path).expanduser()
|
|
|
- return cls(host_path=path, name=path.name, mode=0o0400)
|
|
|
+ return cls(host_path=path, name=name, mode=0o0400)
|
|
|
|
|
|
|
|
|
@dataclass
|