forked from kryptco/kr
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpairing_persistence.go
37 lines (33 loc) · 1.08 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
package kr
const PAIRING_FILENAME = "pairing.json"
type persistedPairing struct {
EnclavePublicKey *[]byte
WorkstationPublicKey []byte
WorkstationSecretKey []byte
WorkstationName string
SNSEndpointARN *string
ApprovedUntil *int64
TrackingID *string
}
func pairingToPersisted(ps *PairingSecret) persistedPairing {
return persistedPairing{
EnclavePublicKey: ps.EnclavePublicKey,
WorkstationPublicKey: ps.WorkstationPublicKey,
WorkstationSecretKey: ps.workstationSecretKey,
WorkstationName: ps.WorkstationName,
SNSEndpointARN: ps.snsEndpointARN,
ApprovedUntil: ps.ApprovedUntil,
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,
ApprovedUntil: pp.ApprovedUntil,
trackingID: pp.TrackingID,
}
}