named-data / python-ndn

An NDN client library with AsyncIO support in Python 3
https://python-ndn.readthedocs.io/en/latest
Apache License 2.0
24 stars 17 forks source link

get data from firebase using python-ndn #67

Closed radara09 closed 1 year ago

radara09 commented 1 year ago

I make a server to retrieve data from firebase realtime database using the template from producer.py with some adjustment but I got error

Traceback (most recent call last):
  File "/home/ndn/py_ml/source/producer.py", line 18, in <module>
    app = NDNApp()
  File "/home/ndn/.local/lib/python3.10/site-packages/ndn/app.py", line 63, in __init__
    self.keychain = default_keychain(config['pib'], config['tpm'])
  File "/home/ndn/.local/lib/python3.10/site-packages/ndn/client_conf.py", line 106, in default_keychain
    pib = KeychainSqlite3(os.path.join(pib_loc, 'pib.db'), tpm)
  File "/home/ndn/.local/lib/python3.10/site-packages/ndn/security/keychain/keychain_sqlite3.py", line 474, in __init__
    cursor = self.conn.execute('SELECT tpm_locator FROM tpmInfo')
sqlite3.OperationalError: no such table: tpmInfo

I have tried running it on several versions of python and it still gives the same error

any recommendation to solve this thank you

zjkmxy commented 1 year ago

How did you create this database? If you create it using ndnsec, there should exist such table. The table tpmInfo only has one row and one record tpm_locator specifying the location of TPM. If you also put tpm into the firebase, you may want to write some code manually to load keys from TPM. In that case, you can put a dummy record in the table tpmInfo. KeychainSqlite3 will fetch this row but not use it to create a real TPM.

radara09 commented 1 year ago

I create the database firebase configuration using the frequently used way using the key file.

I lack information on how to use ndnsec, maybe there is a reference about connecting database using ndnsec.

zjkmxy commented 1 year ago

I create the database firebase configuration using the frequently used way using the key file.

I have no experience with firebase and do not know what do you mean by the key file. Please make sure the database scheme is exactly as described here:

https://github.com/named-data/ndn-cxx/blob/67bc114aa8a1dd64ce77af23ee29b0e1c87c8c5e/ndn-cxx/security/pib/impl/pib-sqlite3.cpp#L34-L187

If feasible, I suggest you use ndnsec to create it offline and upload.

radara09 commented 1 year ago

thanks now it's solved, I checked again the problem was from my configuration and not from the ndn