aboutsummaryrefslogtreecommitdiff
path: root/NK_C_API.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2016-09-08 16:05:11 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2016-09-08 16:48:36 +0200
commitbcbb54f49fad3f4bb3e8e6aca081d9d300e74d2b (patch)
treee11e0a7458d7aae9e484722550c60292b3a6d9ba /NK_C_API.cc
parent49de98994f234e93cc37e2f01d2927a05880a7e7 (diff)
downloadlibnitrokey-bcbb54f49fad3f4bb3e8e6aca081d9d300e74d2b.tar.gz
libnitrokey-bcbb54f49fad3f4bb3e8e6aca081d9d300e74d2b.tar.bz2
Function for getting device's serial number in hex. Fixes #33
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NK_C_API.cc')
-rw-r--r--NK_C_API.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/NK_C_API.cc b/NK_C_API.cc
index b755c70..6265215 100644
--- a/NK_C_API.cc
+++ b/NK_C_API.cc
@@ -175,6 +175,15 @@ extern const char * NK_status() {
});
}
+extern const char * NK_device_serial_number(){
+ auto m = NitrokeyManager::instance();
+ return get_with_string_result([&](){
+ string && s = m->get_serial_number();
+ char * rs = strdup(s.c_str());
+ clear_string(s);
+ return rs;
+ });
+}
extern uint32_t NK_get_hotp_code(uint8_t slot_number) {
return NK_get_hotp_code_PIN(slot_number, "");