-
Notifications
You must be signed in to change notification settings - Fork 0
/
db.py
41 lines (28 loc) · 851 Bytes
/
db.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
41
import boto3
dynamodb = boto3.resource('dynamodb')
table = dynamodb.Table('application-key-management')
def save_keys(application_id, public_key, private_key):
table.put_item(
Item={
'applicationId': application_id,
'name': application_id,
'privateKey': private_key,
'pubKey': public_key
}
)
def get_public_key(application_id):
key = get_key_management(application_id)
public_key = key['pubKey']
return public_key
def get_private_key(application_id):
key = get_key_management(application_id)
private_key = key['privateKey']
return private_key
def get_key_management(application_id):
response = table.get_item(
Key={
'applicationId': application_id,
}
)
item = response['Item']
return item