jdtron / twet

A client in go for twtxt -- the decentralised, minimalist microblogging service https://twtxt.readthedocs.org/en/stable/
MIT License
9 stars 4 forks source link

Adding Hash to tweet #3

Closed tkanos closed 2 years ago

tkanos commented 2 years ago

In order to produce repliable tweets we need to generate hash on tweets like :

2022-09-18T11:22:44-04:00   (#xuqtqzq)  hello world!

So I fixed it (I have not refactored the code).

tkanos commented 2 years ago

If you decide to merge, can you create a tag for it, in order to be able to install like :

go install github.com/jdtron/twet@latest

Thanks,

prologic commented 2 years ago

@tkanos Why close the PR? Are you going to put up a different one? 🤔

tkanos commented 2 years ago

Because that PR was adding Hash to tweets, but apparently a Tweet (that is not a reply) doesn't need to have hash IF it has the same algorithm that all the others. So the real fix will maybe be to fix the algorithm that create Hash. removing the hashes of the text.

prologic commented 2 years ago

Yup! See Twt Hash Extension, specifically:

Each twt’s hash is calculated using its author, timestamp and contents. The author feed URL (see below, it is not necessarily identical to the URL which is being retrieved), RFC 3339 formatted timestamp and twt text are joined with line feeds:

<twt author feed URL> "\n"
<twt timestamp in RFC 3339> "\n"
<twt text>

This UTF-8 encoded string is Blake2b hashed with 256 bits and Base32 encoded without padding. After converting to lower case the last seven characters make up the twt hash.