Commit 4b46b134 authored by Jaromil's avatar Jaromil
Browse files

fix iot demos to use directly MSG class

parent c133dd3a
......@@ -19,7 +19,7 @@ payload_schema = SCHEMA.Record {
data = read_json(DATA) -- TODO: data_schema validation
keys = read_json(KEYS, keys_schema)
header = msgunpack( base64(data.header) )
header = MSG.unpack( base64(data.header) )
dashkey = ECDH.new()
dashkey:private( base64(keys.community_seckey) )
......@@ -33,4 +33,4 @@ validate(payload, payload_schema)
-- print("Header:")
-- content(msgunpack(payload.header) )
print(JSON.encode(msgunpack(payload.text) ))
print(JSON.encode(MSG.unpack(payload.text) ))
......@@ -49,9 +49,9 @@ header['community_id'] = keys['community_id']
-- The output is a table with crypto contents which is standard for
-- zenroom's functions encrypt/decrypt: .checksum .header .iv .text
output = encrypt(devkey,
output = encrypt(devkey,
base64(keys.community_pubkey),
msgpack(payload), msgpack(header))
MSG.pack(payload), MSG.pack(header))
output = map(output, O.to_base64)
output.zenroom = VERSION
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment