add quite some bitwarden work
This commit is contained in:
@@ -24,23 +24,13 @@ class bitwardenUtils():
|
|||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, access_token, organization_id):
|
def __init__(self, __access_token, __organization_id):
|
||||||
self.access_token = access_token
|
self.__access_token = __access_token
|
||||||
self.organization_id = organization_id
|
self.__organization_id = __organization_id
|
||||||
client = BitwardenClient(
|
self.client.auth().login_access_token(self.__access_token, self.state_path)
|
||||||
client_settings_from_dict(
|
|
||||||
{
|
|
||||||
"apiUrl": os.getenv("API_URL", "https://bitwarden.tryton.geeraert.eu/api"),
|
|
||||||
"deviceType": DeviceType.SDK,
|
|
||||||
"identityUrl": os.getenv("IDENTITY_URL", "https://bitwarden.tryton.geeraert.eu/identity"),
|
|
||||||
"userAgent": "Python",
|
|
||||||
}
|
|
||||||
)
|
|
||||||
)
|
|
||||||
self.client.auth().login_access_token(self.access_token, self.state_path)
|
|
||||||
|
|
||||||
def create_project(self,project_name):
|
def create_project(self,project_name):
|
||||||
project = self.client.projects().create(self.organization_id, project_name)
|
project = self.client.projects().create(self.__organization_id, project_name)
|
||||||
return project.data.id
|
return project.data.id
|
||||||
|
|
||||||
def generate_strong_password(self):
|
def generate_strong_password(self):
|
||||||
@@ -49,7 +39,7 @@ class bitwardenUtils():
|
|||||||
|
|
||||||
def create_secret(self,project_id,secret_name,secret_value,description="description"):
|
def create_secret(self,project_id,secret_name,secret_value,description="description"):
|
||||||
secret = self.client.secrets().create(
|
secret = self.client.secrets().create(
|
||||||
self.organization_id,
|
self.__organization_id,
|
||||||
secret_name,
|
secret_name,
|
||||||
secret_value,
|
secret_value,
|
||||||
description,
|
description,
|
||||||
|
|||||||
Reference in New Issue
Block a user