mirror of
https://github.com/savoirfairelinux/opendht.git
synced 2026-11-08 04:21:51 +00:00
python: add binding for getLongId, getPublicKey
This commit is contained in:
1 parent
c139fc9791
commit
bf9561c4af
2 files changed
+21
No files matched your search
@@ -403,6 +403,10 @@ cdef class PublicKey(_WithID):
|
||||
h = InfoHash()
|
||||
h._infohash = self._key.get().getId()
|
||||
return h
|
||||
def getLongId(self):
|
||||
id = PkId()
|
||||
id._pkid = self._key.get().getLongId()
|
||||
return id
|
||||
def encrypt(self, bytes dat):
|
||||
cdef size_t d_len = len(dat)
|
||||
cdef cpp.uint8_t* d_ptr = <cpp.uint8_t*>dat
|
||||
@@ -423,6 +427,10 @@ cdef class Certificate(_WithID):
|
||||
if self._cert:
|
||||
h._infohash = self._cert.get().getId()
|
||||
return h
|
||||
def getLongId(self):
|
||||
id = PkId()
|
||||
id._pkid = self._cert.get().getLongId()
|
||||
return id
|
||||
def toString(self):
|
||||
return self._cert.get().toString().decode()
|
||||
def getName(self):
|
||||
@@ -555,6 +563,16 @@ cdef class DhtRunner(_WithID):
|
||||
if self.thisptr:
|
||||
h._infohash = self.thisptr.get().getId()
|
||||
return h
|
||||
def getLongId(self):
|
||||
h = PkId()
|
||||
if self.thisptr:
|
||||
h._pkid = self.thisptr.get().getPublicKey().get().getLongId()
|
||||
return h
|
||||
def getPublicKey(self):
|
||||
pk = PublicKey()
|
||||
if self.thisptr:
|
||||
pk._key = self.thisptr.get().getPublicKey()
|
||||
return pk
|
||||
def getNodeId(self):
|
||||
return self.thisptr.get().getNodeId().toString()
|
||||
def ping(self, SockAddr addr, done_cb=None):
|
||||
|
||||
@@ -125,12 +125,14 @@ cdef extern from "opendht/crypto.h" namespace "dht::crypto":
|
||||
cdef cppclass PublicKey:
|
||||
PublicKey()
|
||||
InfoHash getId() const
|
||||
PkId getLongId() const
|
||||
Blob encrypt(Blob data) const
|
||||
|
||||
cdef cppclass Certificate:
|
||||
Certificate()
|
||||
Certificate(string pem)
|
||||
InfoHash getId() const
|
||||
PkId getLongId() const
|
||||
string toString() const
|
||||
string getName() const
|
||||
void revoke(PrivateKey key, Certificate cert)
|
||||
@@ -271,6 +273,7 @@ cdef extern from "opendht/dhtrunner.h" namespace "dht":
|
||||
SockAddr bind6
|
||||
|
||||
InfoHash getId() const
|
||||
shared_ptr[PublicKey] getPublicKey() const
|
||||
InfoHash getNodeId() const
|
||||
void bootstrap(const_char*, const_char*)
|
||||
void bootstrap(const SockAddr&, DoneCallbackSimple done_cb)
|
||||
|
||||
Reference in new issue
Block a user