-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathcreate_new_keypair.py
40 lines (26 loc) · 1017 Bytes
/
create_new_keypair.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
"""
Example script showing the new async API with keypair reset (delete old keypair, set new one)
04.11.2021 Octavio Simone
"""
from dracoon import DRACOON
import asyncio
async def main():
baseURL = 'https://dracoon.team'
client_id = 'XXXXXXXXXXXXXXXXXXXXXX'
client_secret = 'XXXXXXXXXXXXXXXXXXXXXXXXXXX'
dracoon = DRACOON(base_url=baseURL, client_id=client_id, client_secret=client_secret)
connection = await dracoon.connect()
print(dracoon.client.connected)
res = await dracoon.user.delete_user_keypair()
print(res)
secret = 'VerySecret123!' # replace with own secret
res = await dracoon.user.set_user_keypair(secret)
"""
You can explicitly set a version using:
res = await account.set_user_keypair(secret=secret, version=UserKeyPairVersion.RSA4096)
res = await account.set_user_keypair(secret=secret, version=UserKeyPairVersion.RSA2048)
"""
print(res)
await dracoon.logout()
if __name__ == '__main__':
asyncio.run(main())