summaryrefslogtreecommitdiff
path: root/src/attach.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/attach.cpp')
-rw-r--r--src/attach.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/attach.cpp b/src/attach.cpp
index 3d351f8..887de38 100644
--- a/src/attach.cpp
+++ b/src/attach.cpp
@@ -75,11 +75,19 @@ void AttachService::handlePairingResult(Context & ctx, Stored<AttachIdentity> at
if (!key)
throw runtime_error("failed to load secret key");
- auto id = Identity::load(key->signAdd(att->identity).ref());
+ vector<StoredIdentityPart> parts = ctx.local()->identity()->extData();
+ parts.emplace_back(key->signAdd(att->identity));
+ filterAncestors(parts);
+
+ auto id = Identity::load(parts);
if (!id)
printf("New identity validation failed\n");
- auto rid = ctx.local().ref().storage().copy(*id->ref());
+ optional<Ref> tmpref = id->extRef();
+ if (not tmpref)
+ tmpref = id->modify().commit().extRef();
+
+ auto rid = ctx.local().ref().storage().copy(*tmpref);
id = Identity::load(rid);
auto owner = id->owner();