Skip to content
Snippets Groups Projects
Commit 3628e8c9 authored by Jake Taylor's avatar Jake Taylor
Browse files

added identity storage bindings calls

parent 11a672d0
Branches
Tags
2 merge requests!510Release,!257change structure of identities in api and bindings
......@@ -110,3 +110,32 @@ func GetFactsFromContact(marshaled []byte) ([]byte, error) {
}
return factsListMarshaled, nil
}
// StoreReceptionIdentity stores the given identity in Cmix storage with the given key
// This is the ideal way to securely store identities, as the caller of this function
// is only required to store the given key separately rather than the keying material
func StoreReceptionIdentity(key string, identity []byte, cmixId int) error {
cmix, err := cmixTrackerSingleton.get(cmixId)
if err != nil {
return err
}
receptionIdentity, err := xxdk.UnmarshalReceptionIdentity(identity)
if err != nil {
return err
}
return xxdk.StoreReceptionIdentity(key, receptionIdentity, cmix.api)
}
// LoadReceptionIdentity loads the given identity in Cmix storage with the given key
func LoadReceptionIdentity(key string, cmixId int) ([]byte, error) {
cmix, err := cmixTrackerSingleton.get(cmixId)
if err != nil {
return nil, err
}
storageObj, err := cmix.api.GetStorage().Get(key)
if err != nil {
return nil, err
}
return storageObj.Data, nil
}
File moved
......@@ -66,7 +66,11 @@ func ConnectWithAuthentication(recipient contact.Contact, e2eClient *xxdk.E2e,
// Build the authenticated connection and return
identity := e2eClient.GetReceptionIdentity()
return connectWithAuthentication(conn, timeStart, recipient, identity.Salt, identity.RSAPrivatePem,
privKey, err := identity.GetRSAPrivatePem()
if err != nil {
return nil, err
}
return connectWithAuthentication(conn, timeStart, recipient, identity.Salt, privKey,
e2eClient.GetRng(), e2eClient.GetCmix(), p)
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment