aboutsummaryrefslogtreecommitdiff
path: root/NK_C_API.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2018-03-02 11:41:13 +0100
committerSzczepan Zalega <szczepan@nitrokey.com>2018-03-02 11:41:13 +0100
commit379daf936caa7fc8d7311a5dda101edb40d35ca5 (patch)
tree2d186dec6976b12a9f7b37e589c02703275a30ef /NK_C_API.cc
parentd5486ba77235a874245fbee07a75cea89fa59ea2 (diff)
parentc3d615b659b608f3a1d624f6fc78c303efbe1f8e (diff)
downloadlibnitrokey-379daf936caa7fc8d7311a5dda101edb40d35ca5.tar.gz
libnitrokey-379daf936caa7fc8d7311a5dda101edb40d35ca5.tar.bz2
Merge branch 'wip-multiple_devices'
Allow to use multiple devices, iteratively. Storage only.
Diffstat (limited to 'NK_C_API.cc')
-rw-r--r--NK_C_API.cc21
1 files changed, 21 insertions, 0 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc
index f881caf..66bbcf9 100644
--- a/NK_C_API.cc
+++ b/NK_C_API.cc
@@ -608,6 +608,27 @@ extern "C" {
});
}
+ NK_C_API const char* NK_list_devices_by_cpuID() {
+ auto nm = NitrokeyManager::instance();
+ return get_with_string_result([&]() {
+ auto v = nm->list_devices_by_cpuID();
+ std::string res;
+ for (const auto a : v){
+ res += a+";";
+ }
+ if (res.size()>0) res.pop_back(); // remove last delimiter char
+ return strndup(res.c_str(), 8192); //this buffer size sets limit to over 200 devices ID's
+ });
+ }
+
+ NK_C_API int NK_connect_with_ID(const char* id) {
+ auto m = NitrokeyManager::instance();
+ return get_with_result([&]() {
+ return m->connect_with_ID(id) ? 1 : 0;
+ });
+ }
+
+
#ifdef __cplusplus
}