summaryrefslogtreecommitdiff
path: root/src/identity.cpp
diff options
context:
space:
mode:
authorRoman Smrž <roman.smrz@seznam.cz>2020-07-29 22:37:37 +0200
committerRoman Smrž <roman.smrz@seznam.cz>2020-07-29 22:37:37 +0200
commitd785003e9979068acc40a679f6470bd28f38fa01 (patch)
treed529b0f24bcf13c387a7e04640135ca3f3e50449 /src/identity.cpp
parent90021e1d335efac1017562c1d5dee43e99580319 (diff)
Add owner signature for owned identity
This signature is required and verified, but was not properly added by the builder on commit.
Diffstat (limited to 'src/identity.cpp')
-rw-r--r--src/identity.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/identity.cpp b/src/identity.cpp
index 7364a8b..d7dd1f9 100644
--- a/src/identity.cpp
+++ b/src/identity.cpp
@@ -117,8 +117,18 @@ Identity Identity::Builder::commit() const
throw runtime_error("failed to load secret key");
auto sdata = key->sign(idata);
+ if (idata->owner) {
+ if (auto okey = SecretKey::load((*idata->owner)->data->keyIdentity))
+ sdata = okey->signAdd(sdata);
+ else
+ throw runtime_error("failed to load secret key");
+ }
+
+ auto p = Identity::Priv::validate({ sdata });
+ if (!p)
+ throw runtime_error("failed to validate committed identity");
- return Identity(Identity::Priv::validate({ sdata }));
+ return Identity(std::move(p));
}
void Identity::Builder::name(const string & val)