mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-08 22:13:48 +01:00
publish LeaseSet with store hash
This commit is contained in:
parent
5d69bb7383
commit
b6b5bb3f75
3 changed files with 6 additions and 1 deletions
|
@ -279,7 +279,7 @@ namespace i2p
|
||||||
if (!leaseSet) return nullptr;
|
if (!leaseSet) return nullptr;
|
||||||
auto m = NewI2NPShortMessage ();
|
auto m = NewI2NPShortMessage ();
|
||||||
uint8_t * payload = m->GetPayload ();
|
uint8_t * payload = m->GetPayload ();
|
||||||
memcpy (payload + DATABASE_STORE_KEY_OFFSET, leaseSet->GetIdentHash (), 32);
|
memcpy (payload + DATABASE_STORE_KEY_OFFSET, leaseSet->GetStoreHash (), 32);
|
||||||
payload[DATABASE_STORE_TYPE_OFFSET] = leaseSet->GetStoreType (); // LeaseSet or LeaseSet2
|
payload[DATABASE_STORE_TYPE_OFFSET] = leaseSet->GetStoreType (); // LeaseSet or LeaseSet2
|
||||||
htobe32buf (payload + DATABASE_STORE_REPLY_TOKEN_OFFSET, replyToken);
|
htobe32buf (payload + DATABASE_STORE_REPLY_TOKEN_OFFSET, replyToken);
|
||||||
size_t size = DATABASE_STORE_HEADER_SIZE;
|
size_t size = DATABASE_STORE_HEADER_SIZE;
|
||||||
|
|
|
@ -904,6 +904,8 @@ namespace data
|
||||||
i2p::crypto::ChaCha20 (outerPlainText, lenOuterPlaintext, keys1, keys1 + 32, outerPlainText); // encrypt Layer 1
|
i2p::crypto::ChaCha20 (outerPlainText, lenOuterPlaintext, keys1, keys1 + 32, outerPlainText); // encrypt Layer 1
|
||||||
// signature
|
// signature
|
||||||
blindedSigner->Sign (m_Buffer, offset, m_Buffer + offset);
|
blindedSigner->Sign (m_Buffer, offset, m_Buffer + offset);
|
||||||
|
// store hash
|
||||||
|
m_StoreHash.reset (new IdentHash (blindedKey.GetStoreHash ()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -236,6 +236,7 @@ namespace data
|
||||||
{ return GetBufferLen () == other.GetBufferLen () && !memcmp (GetBuffer (), other.GetBuffer (), GetBufferLen ()); };
|
{ return GetBufferLen () == other.GetBufferLen () && !memcmp (GetBuffer (), other.GetBuffer (), GetBufferLen ()); };
|
||||||
|
|
||||||
virtual uint8_t GetStoreType () const { return NETDB_STORE_TYPE_LEASESET; };
|
virtual uint8_t GetStoreType () const { return NETDB_STORE_TYPE_LEASESET; };
|
||||||
|
virtual const IdentHash& GetStoreHash () const { return GetIdentHash (); }; // differ from ident hash for encrypted LeaseSet2
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
@ -261,11 +262,13 @@ namespace data
|
||||||
size_t GetBufferLen () const { return m_BufferLen; };
|
size_t GetBufferLen () const { return m_BufferLen; };
|
||||||
|
|
||||||
uint8_t GetStoreType () const { return m_Buffer[0]; };
|
uint8_t GetStoreType () const { return m_Buffer[0]; };
|
||||||
|
const IdentHash& GetStoreHash () const { return m_StoreHash ? *m_StoreHash : LocalLeaseSet::GetStoreHash (); };
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint8_t * m_Buffer; // 1 byte store type + actual buffer
|
uint8_t * m_Buffer; // 1 byte store type + actual buffer
|
||||||
size_t m_BufferLen;
|
size_t m_BufferLen;
|
||||||
|
std::unique_ptr<IdentHash> m_StoreHash; // for encrypted
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue