-
Notifications
You must be signed in to change notification settings - Fork 0
/
pairing_persistence.go
38 lines (33 loc) · 1.15 KB
/
pairing_persistence.go
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
package kr
const PAIRING_FILENAME = "pairing.json"
const ID_KRYPTONITE_FILENAME = "id_kryptonite.pub"
const PAIRING_TRANSFER_OLD_FILENAME = "pairing_transfer_old.json"
const PAIRING_TRANSFER_NEW_FILENAME = "pairing_transfer_new.json"
type persistedPairing struct {
EnclavePublicKey *[]byte
WorkstationPublicKey []byte
WorkstationSecretKey []byte
WorkstationName string
SNSEndpointARN *string
TrackingID *string
}
func pairingToPersisted(ps *PairingSecret) persistedPairing {
return persistedPairing{
EnclavePublicKey: ps.EnclavePublicKey,
WorkstationPublicKey: ps.WorkstationPublicKey,
WorkstationSecretKey: ps.workstationSecretKey,
WorkstationName: ps.WorkstationName,
SNSEndpointARN: ps.snsEndpointARN,
TrackingID: ps.trackingID,
}
}
func pairingFromPersisted(pp *persistedPairing) *PairingSecret {
return &PairingSecret{
EnclavePublicKey: pp.EnclavePublicKey,
WorkstationPublicKey: pp.WorkstationPublicKey,
workstationSecretKey: pp.WorkstationSecretKey,
WorkstationName: pp.WorkstationName,
snsEndpointARN: pp.SNSEndpointARN,
trackingID: pp.TrackingID,
}
}