mirror of
ssh://git.janware.com/janware/proj/jw-pkg
synced 2026-04-24 17:23:36 +02:00
lib.ProcFilterGpg: Add module
Add a ProcFilter implementation for decrypting GPG blobs. It needs an ExecContext passed to __init__() in order to run /usr/bin/gpg. Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
parent
411bfd41ca
commit
d70454b32a
1 changed files with 28 additions and 0 deletions
28
src/python/jw/pkg/lib/ProcFilterGpg.py
Normal file
28
src/python/jw/pkg/lib/ProcFilterGpg.py
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
from typing import TYPE_CHECKING
|
||||||
|
|
||||||
|
from .ProcFilter import ProcFilter
|
||||||
|
from .base import Result
|
||||||
|
|
||||||
|
if TYPE_CHECKING:
|
||||||
|
from .ExecContext import ExecContext
|
||||||
|
|
||||||
|
class ProcFilterGpg(ProcFilter):
|
||||||
|
|
||||||
|
def __init__(self, ec: ExecContext) -> None:
|
||||||
|
self.__ec = ec
|
||||||
|
|
||||||
|
async def _run(self, data: bytes) -> Result:
|
||||||
|
return await self.__ec.run([
|
||||||
|
"gpg",
|
||||||
|
'--batch',
|
||||||
|
'--yes',
|
||||||
|
'--quiet',
|
||||||
|
'--no-tty',
|
||||||
|
'--decrypt',
|
||||||
|
],
|
||||||
|
cmd_input = data,
|
||||||
|
throw = True
|
||||||
|
)
|
||||||
Loading…
Add table
Add a link
Reference in a new issue