19 lines
336 B
Python
19 lines
336 B
Python
import base64
|
|
import hvac
|
|
|
|
|
|
client = hvac.Client(
|
|
url='http://127.0.0.1:8200',
|
|
token='root'
|
|
)
|
|
|
|
def decrypt_token(ciphertext: str) -> str:
|
|
response = client.secrets.transit.decrypt_data(
|
|
name='push-tokens',
|
|
ciphertext=ciphertext
|
|
)
|
|
plaintext_b64 = response['data']['plaintext']
|
|
return base64.b64decode(plaintext_b64).decode()
|
|
|
|
|