Skip to content

Commit 8fbb065

Browse files
authored
Merge pull request #26 from cryptlex/huzaif/host-prod-metadata
feat: added GetHostProductMetadata() function
2 parents 3647c0f + 3b2b3a1 commit 8fbb065

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

cryptlex/lexfloatclient/lexfloatclient.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -353,6 +353,28 @@ def GetHostFeatureEntitlement(feature_name):
353353
else:
354354
raise LexFloatClientException(status)
355355

356+
@staticmethod
357+
def GetHostProductMetadata(key):
358+
"""Gets the value of the product metadata.
359+
360+
Args:
361+
key (str): metadata key to retrieve the value
362+
363+
Raises:
364+
LexFloatClientException
365+
366+
Returns:
367+
str: value of metadata for the key
368+
"""
369+
cstring_key = LexFloatClientNative.get_ctype_string(key)
370+
buffer_size = 4096
371+
buffer = LexFloatClientNative.get_ctype_string_buffer(buffer_size)
372+
status = LexFloatClientNative.GetHostProductMetadata(
373+
cstring_key, buffer, buffer_size)
374+
if status != LexFloatStatusCodes.LF_OK:
375+
raise LexFloatClientException(status)
376+
return LexFloatClientNative.byte_to_string(buffer.value)
377+
356378
@staticmethod
357379
def GetHostLicenseMetadata(key):
358380
"""Get the value of the license metadata field associated with the

cryptlex/lexfloatclient/lexfloatclient_native.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,10 @@ def byte_to_string(input):
171171
GetHostFeatureEntitlement.argtypes = [CSTRTYPE, STRTYPE, c_uint32]
172172
GetHostFeatureEntitlement.restype = c_int
173173

174+
GetHostProductMetadata = library.GetHostProductMetadata
175+
GetHostProductMetadata.argtypes = [CSTRTYPE, STRTYPE, c_uint32]
176+
GetHostProductMetadata.restype = c_int
177+
174178
GetHostLicenseMetadata = library.GetHostLicenseMetadata
175179
GetHostLicenseMetadata.argtypes = [CSTRTYPE, STRTYPE, c_uint32]
176180
GetHostLicenseMetadata.restype = c_int

0 commit comments

Comments
 (0)