So what are some good alternatives to GitHub, that are not based in USA?
I like the minimal feel of sourcehut but it seem you have to pay if you want your, not just submit patches to others repos. But they also got IRC bouncer and mailing-lists included. Codeberg also looks appealing being based in Germany.
My take on the discussion to introduce an ?
operator in Go š No. For so many reasons.
@prologic@twtxt.net Or databag self-hosted on a RaspberryPi you can throw on a corner of your basement (or a small vps if one is willing to pay for threema) and never look back. The hardest part is getting others to at least test anything other than the already mainstream apps.
FINALLY!! Got #Caddy server up and running and got rid of nginx proxy manager and Mysql database containers š„³š„³š„³
Für heute reicht es dann auch mal. Neue Funktionen:
- Login-Bereich
- Wechsler zwischen Zeitachse und Unterhaltung
- Paginierung nur noch, wenn benƶtigt
- Twtxt-Parsing optimiert (Parser-Plugins für: Youtube, iFrames, Bilder, ErwƤhnungen, kaputtes HTML, ā¦)
- unter der Haube aufgerƤumt
Die bisher verwendeten ext. Bibliotheken sind:
@aelaraji@aelaraji.com Iāve been noticing the same, so I opened an issue now (https://github.com/sorenpeter/timeline/issues/55) and then we will have to look into it.
I updated the specification with base64, Curve25519 and more examples: https://github.com/tanrax/twtxt-direct-message-extension
my first thought is that encrypting messages with Elliptic keys is not as easy as with RSA, although I tried doing something similar a few months ago with ECIES
https://github.com/eapl-gemugami/owl/blob/main/src/app/controller/ecies_demo.php
interesting idea. Iām not personally interested on having DM conversations on twtxt
(for now), although I see the community could be interested in.
Iād suggest to enable the Discussion section in your Github repo to receive comments, as we did for timeline
https://github.com/sorenpeter/timeline/discussions
I want to share a little idea for a new extension with the goal of adding direct messages in #twtxt https://github.com/tanrax/twtxt-direct-message-extension
Tolle Wurst: vTuner hat den Support für das Küchenradio (Sagem - My Dual Radio 700) eingestellt. Die Subdomain sagem.vtuner.com ist nicht mehr.
Mal gucken, wie ich mit einer DNS-Umleitung und YCast wieder Klang in die Kiste kriege. Es wƤre schade um das GerƤt, welches einwandfrei funktioniert.
Thx @sorenpeter@darch.dk. Yepp, Yellow CMS is great! I stumbled across your extension and became aware of Twtxt and Timeline. Now Iām onto building my own little TwtxtReader.
@prologic@twtxt.net I canāt register with GitHub, nor make Pull Requests. Would it be possible to enable this? Maybe this repository could be on GitHub to promote it and increase collaboration.
oh also out of boredom i hosted glance even though i have no need for a dashboard lol. itās really cute though
i self hosted the soft serve git server cuz i felt like it. itās sooo cute i love everything charm CLI does
ssh -p 24010 soft.git.girlonthemoon.xyz
@kat@yarn.girlonthemoon.xyz To improve you shell programming skills, I highly recommend to check out shellcheck
: https://github.com/koalaman/shellcheck It points out common errors and gives some suggestions on how to improve the code. Some details in shell scripting are very tricky to get right at first. Even after decades of shell programming, I run into ācorner casesā every now and then.
E.g. in getlyr
ās line 7 it warns:
echo -e $(gum style --italic --foreground "#f4b8e4" "'$artist', '$song'")
^-- SC2046: Quote this to prevent word splitting.
For more information:
https://www.shellcheck.net/wiki/SC2046 -- Quote this to prevent word splitt...
Most likely not all that problematic in this application, but itās good to know about this underlying concept. Word splitting is basically splitting tokens on whitespace, this can lead to interesting consequences as illustrated by this little code:
$ echo $(echo "Hello World")
Hello World
$ echo "$(echo "Hello World")"
Hello World
In the first case the shells sees two whitespace-separated tokens or arguments for the echo
command. This basically becomes echo Hello World
. So, echo
joins them by a single space. In the second one it sees one argument for the echo
command, so echo
simply echos this single argument that contains three spaces.
My client is twet which i grabbed at https://github.com/jdtron/twet
I just used screego to help a family member with their Windows PC. Flawless experience! š
StackExchange/dnscontrol: Infrastructure as code for DNS! šš Now this looks might interesting⦠I might look into this for managing my own domains and DNS. I note that my current registrar isnāt on the list of supported registrars, oh well, I donāt like OnlyDomains⢠much anyway. Anyone familiar with these regisrars?
- AWS Route 53
- CSC Global
- CentralNic Reseller (formerly RRPProxy)
- DNSOVERHTTPS
- Dzynadot
- easyname
- Gandi
- HEXONET
- hosting.de
- Internet.bs
- INWX
- Namecheap
- Name.com
- OpenSRS
- OVH
- Realtime Register
ever heard of our lord and savior nb ? š
@kat@yarn.girlonthemoon.xyz https://github.com/klaudiosinani/taskbook
I was looking for an #mpd/#rofi script and stumbled upon this repo adi1090x/rofi, it is just 𤤠DELICIOUS! ⦠and a great reference/kick starter for making my own.
@prologic@twtxt.net mediacms! itās janky yeah but it does the job ultimately (even if sometimes videos donāt encode and i gotta do some weird python venv shit to force the encode lolā¦)
i like this little ideas utility iāve been using like i keep pulling up the idea table to see what iāve added and it makes me wanna start one of them like the CLI app i wanna write in golang with charmbraceletās bubbletea even though i only have a vague idea of what i want in a CLI app
i had ideas for my fancy new idea table list (https://github.com/IonicaBizau/idea) that iāve fallen in love with but i forgot what they wereā¦
@kat@yarn.girlonthemoon.xyz this is that telnet zine cms by the way, itās epic https://github.com/caraesten/dial_a_zine
really wanna make an ssh zine app inspired by a telnet zine cms i found on github. iām gonna probably go ahead with the telnet zine idea i have if i can get people for it but if i could build my own ssh mirror for it with golang and the charmbracelet wish library thatād be epic
this is sooo cute and so fun i got it for timer stuff bc lord knows i need a timer on my computer and now iām staring at animated ASCII cats that kiss https://github.com/poetaman/arttime
iāve transitioned text editors from nano (yeah i know) to micro and god micro is just so much better i did not know there was a CLI text editor i could use with sensible keyboard shortcuts that did not leave me feeling like iām typing nuclear codes to do simple tasks like saving and editing
nick = _@domain.tld
in the twtxt.txt?
Iāve implemented Use only nick as handle if nick and domain is the same Ā· sorenpeter/timeline@8c12444
See it live at:
- nick = domain: https://darch.dk/timeline/profile?url=https://eapl.me/tw.txt
- nick ā domain: https://darch.dk/timeline/profile?url=https://twtxt.net/user/prologic/twtxt.txt
- no nick, use domain: https://darch.dk/timeline/profile?url=https://akkartik.name/twtxt.txt
Iām not sure I like the leading @
thouā¦
If NICK = DOMAIN then only show @DOMAIN
So instead of @eapl.me@eapl.me it will just be @eapl.me
Why not nostr way? https://github.com/nostr-protocol/nips/blob/master/05.md#showing-just-the-domain-as-an-identifier
@prologic@twtxt.net Well I just mirrored yarndās JSON in my webfinger endpoint and lookup, so not much else to do for standardization.
And for people who donāt like PHP you can always just go with Added WebFinger support to my email address using one rewrite rule and one static file. or simply putting a static JSON in place for .well-know/webfinger
BTW Iām watching that darch has already worked on that, interesting https://github.com/sorenpeter/timeline/blob/main/_webfinger-endpoint/.well-known/webfinger/index.php
One benefit with bluesky is your username is also a website. And not a clunky URL with slashes and such. I wish twtxt adopted that. I have advocated for webfinger to for twtxt to let us do something like it with usernames. Nostr has something like it
By default the bsky.social urls all redirect to their feeds like: hmpxvt.bsky.social
Many custom urls will redirect to some kind of linktree or just their feed cwebonline.com or la.bonne.petite.sour.is or if you are a major outlet just to your web presence like https://theonion.com⬠or https://netflix.com
Its just good SEO practice
Do all nostr addresses take you to the person if typed into a browser? That is the secret sauce.
No having to go to some random page first. no accounts. no apps to install. just direct to the person.
Have this bbs in my bookmarks. Live instance available in ssh://lowlife@45.79.250.220. Password is hightech
Grab this one and enhance it, @prologic@twtxt.net?
@aelaraji@aelaraji.com https://github.com/sorenpeter/timeline/commit/555baefcd0e75e6a281472994e8eb7ae9b5d2a1c
yep, my point is that the txt part is redundant for twtxt
Also a .txt file could be in any format, for example those plans from John Carmak are stored now as .txt -> https://github.com/ESWAT/john-carmack-plan-archive/blob/master/by_day/johnc_plan_19960218.txt
Although being named .plan was expected for them to work, if I recall correctly -> http://www.catb.org/jargon/html/P/plan-file.html
# nick = skinshafi
so... should I scream buuug ? š¤
@prologic@twtxt.net Twtxt wise, it was kind of disparate at first xD with no access to logs as you may have read on the alt-feed itself. But then, @sorenpeter@darch.dkās script came to the rescue ⦠like, just in time š Otherwise, everything else is fun as publicised, exploring and learning along the way.
My twtAgent.php
was turned off, so try again now. I have uploaded the code to: https://github.com/sorenpeter/twtAgent
Termux
same thing @doesnm uses and it worked š Media
@doesnm@doesnm.p.psf.lt No itās all good⦠Iāve just rebuilt it from master and it doesnāt look like anything is broken:
~/GitRepos> git clone https://github.com/plomlompom/htwtxt.git
Cloning into 'htwtxt'...
remote: Enumerating objects: 411, done.
remote: Total 411 (delta 0), reused 0 (delta 0), pack-reused 411 (from 1)
Receiving objects: 100% (411/411), 87.89 KiB | 430.00 KiB/s, done.
Resolving deltas: 100% (238/238), done.
~/GitRepos> cd htwtxt
master ~/GitRepos/htwtxt> go mod init htwtxt
go: creating new go.mod: module htwtxt
go: to add module requirements and sums:
go mod tidy
master ~/GitRepos/htwtxt> go mod tidy
go: finding module for package github.com/gorilla/mux
go: finding module for package golang.org/x/crypto/bcrypt
go: finding module for package gopkg.in/gomail.v2
go: finding module for package golang.org/x/crypto/ssh/terminal
go: found github.com/gorilla/mux in github.com/gorilla/mux v1.8.1
go: found golang.org/x/crypto/bcrypt in golang.org/x/crypto v0.29.0
go: found golang.org/x/crypto/ssh/terminal in golang.org/x/crypto v0.29.0
go: found gopkg.in/gomail.v2 in gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
go: finding module for package gopkg.in/alexcesaro/quotedprintable.v3
go: found gopkg.in/alexcesaro/quotedprintable.v3 in gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc
master ~/GitRepos/htwtxt> go build
master ~/GitRepos/htwtxt> ll
.rw-r--r-- aelaraji aelaraji 330 B Fri Nov 22 20:25:52 2024 ī§ go.mod
.rw-r--r-- aelaraji aelaraji 1.1 KB Fri Nov 22 20:25:52 2024 ī§ go.sum
.rw-r--r-- aelaraji aelaraji 8.9 KB Fri Nov 22 20:25:06 2024 ī§ handlers.go
.rwxr-xr-x aelaraji aelaraji 12 MB Fri Nov 22 20:26:18 2024 ļ htwtxt <-------- There's the binary ;)
.rw-r--r-- aelaraji aelaraji 4.2 KB Fri Nov 22 20:25:06 2024 ī§ io.go
.rw-r--r-- aelaraji aelaraji 34 KB Fri Nov 22 20:25:06 2024 ī LICENSE
.rw-r--r-- aelaraji aelaraji 8.5 KB Fri Nov 22 20:25:06 2024 ī§ main.go
.rw-r--r-- aelaraji aelaraji 5.5 KB Fri Nov 22 20:25:06 2024 ī README.md
drwxr-xr-x aelaraji aelaraji 4.0 KB Fri Nov 22 20:25:06 2024 ļ templates
htwtxt maybe, but i canāt built it (broken?)
Hey @sorenpeter@darch.dk what version of PHP do you run Timeline on?
@prologic@twtxt.net I recommend its Wikipedia entry is edited then, if you are completely certain.
āBluesky is a decentralized microblogging social media service primarily operated by Bluesky Social, PBC.ā
That I know of, you can run the PDS, and pretty much everything else.
Not sure that I really like where Microsoft is taking VSCode - it looks like soon it will be just another frontend for them to sell Github Copilot subscriptions.
@2024-10-08T19:36:38-07:00@a.9srv.net Thanks for the followup. I agrees with most of it - especially:
Please nobody suggest sticking the content type in more metadata. š
Yes, URL can be considered ugly, but they work and are understandable by both humans and machines. And its trivial for any client to hide the URLs used as reference in replies/treading.
Webfinger can be an add-on to help lookup people, and it can be made independent of the nick by just serving the same json regardless of the nick as people do with static sites and a as I implemented it on darch.dk (wf endpoint). Try RANDOMSTRING@darch.dk
on http://darch.dk/wf-lookup.php (wf lookup) or RANDOMSTRING@garrido.io
on https://webfinger.net
Same! Great joke!
@prologic@twtxt.net that ālittle database that couldā is simply amazing, isnāt it? I run Conduwuit (nevermind, this one is RocksDB), and GoToSocial using it as a backend, no issues. And, of course, sqlite is the database of choice for a lot of things under iOS.
So Iām a location based system, how exactly do I reply to one of these two Twts from @Yarns@search.twtxt.net ? š¤
2024-09-07T12:55:56Z š„³ NEW FEED: @<twtxt http://edsu.github.io/twtxt/twtxt.txt>
2024-09-07T12:55:56Z š„³ NEW FEED: @<kdy https://twtxt.kdy.ch/twtxt.txt>
Had to build a list of all feeds (that I follow) and all twts in them and there are two collisions already:
$ ./stats
Saw 58263 hashes
7fqcxaa
https://twtxt.net/user/justamoment/twtxt.txt
https://twtxt.net/user/prologic/twtxt.txt
ntnakqa
https://twtxt.net/user/prologic/twtxt.txt
https://twtxt.net/user/thecanine/twtxt.txt
Namely:
$ jenny -D https://twtxt.net/user/justamoment/twtxt.txt | grep 7fqcxaa
[7fqcxaa] [2022-12-28 04:53:30+00:00] [(#pmuqoca) @prologic@twtxt.net I checked the GitHub discussion, it became a request to join forces.
Do you plan on having them join?
Also for the name, how about:
- āprogitā or āprologitā (prologic official hard fork)
- āgit-stanceā (git instance)
- āGitTreeā (Gitea inspired, maybe to related)
- āGitomataā (git automata)
- āGit.Sourceā
- āForgorā (forgit is taken so I forgor) š¤£
- āSweetGitā (as salty chat)
- āPepper Gitā (other ingredients) š
- āGitHeartā (core of git with a GitHub sounding name)
- āGitTakaā (With music in mind)
Ok, enough fun⦠Hope this helps sprout some ideas from others if nothing is to your taste.]
$ jenny -D https://twtxt.net/user/prologic/twtxt.txt/5 | grep 7fqcxaa
[7fqcxaa] [2022-02-25 21:14:45+00:00] [(#bqq6fxq) Itās handled by blue Monday]
And:
$ jenny -D https://twtxt.net/user/thecanine/twtxt.txt | grep ntnakqa
[ntnakqa] [2022-01-23 10:24:09+00:00] [(#2wh7r4q) <a href="https://txt.sour.is/external?uri=https://twtxt.net/user/prologic/twtxt.txt">@prologic<em>@twtxt.net</em></a> I know, I was just hoping it might have also gotten fixed by that change, by some kind of backend miracles. š]
$ jenny -D https://twtxt.net/user/prologic/twtxt.txt/1 | grep ntnakqa
[ntnakqa] [2024-02-27 05:51:50+00:00] [(#otuupfq) <a href="https://txt.sour.is/external?uri=https://twtxt.net/user/shreyan/twtxt.txt">@shreyan<em>@twtxt.net</em></a> Ahh š]
I came across this Gallery Theme for Hugo, and @lyse@lyse.isobeef.org immediately came to mind. I think it would be a very fitting theme to use for all your photos, Lyse!
@sorenpeter@darch.dk !! I freaking love your Timeline ⦠I kind of have an justified PHP phobia š but, Iām definitely thinking about giving it a try!
/ME wondering if itās possible to use it locally just to read and manage my feed at first and then maybe make it publicly accessible later.
@xuu@txt.sour.is Thanks for the link. I found a pdf on one of the authorsā home pages: https://ahmadhassandebugs.github.io/assets/pdf/quic_www24.pdf . I wonder how the protocol was evaluated closer to the time it became a standard, and whether anything has changed. I wonder if network speeds have grown faster than CPU speeds since then. The paper says the performance is around the same below around 600 Mbps.
To be fair, I donāt think QUIC was ever expected to be faster for transferring a single stream of data. I think QUIC is supposed to reduce the impact of a dropped packet by making sure it only affects the stream itās part of. I imagine QUIC still has that advantage, and this paper is showing the other side of a tradeoff.
This tool, using age is pretty neat: https://github.com/ndavd/agevault. So simple, yet seemingly powerful!
oh dang. i think thats the go path not the github path.. missing the branch name. here is the pkg one: https://pkg.go.dev/github.com/quic-go/quic-go/http3
for http3 there is
Kinda cool tool for bringing together all your timeline based data across socials.
O meu novo salva-vidas na hora de montar um novo site #vuejs sem as tretas dos build systems: Vue3 Tiny Template, da inimitƔvel @b0rk@b0rk
Every time I start a Vue project, I get confused and waste 15 minutes reading the documentation and remembering how to set up Vue.
So this is a tiny template I made for myself so that I can avoid that next time. I donāt use a build process, instead it uses the CDN version of Vue and a single HTML / JS file.
There is, also, a small controversy going around for something that should have been a small change, but that Kling (SerenityOS, and Ladybird creator) handled quite badly: https://github.com/SerenityOS/serenity/pull/6814.
Seemingly small things like this divide, and have the potential to harm a project.
After that talk about the Ladybird browser the other day, I see this article just pop up:
Seems itās gaining some recognition and support, I hope it can gain traction as we sure as anything need some genuine alternatives.
s/(www\.)?youtube.com\/watch?v=([^?]+)/tubeproxy.mills.io/play/\1
for example? š¤
Have not tried any of them, but some of these seem to fit the bill:
Viddy, a modern watch(1) alternative with paging, visual diffs, and history: https://github.com/sachaos/viddy
@movq@www.uninformativ.de Maybe something for you: 7.css - A CSS framework for recreating Windows 7 UI
@prologic@twtxt.net and @bender@twtxt.net for a start a single user twtxt/yarn pod could look like this š
Just fleshed out the README for timeline at https://github.com/sorenpeter/timeline - Comments/corrections and PRs are welcome:)
Added support for #tag clouds and #search to timeline. Based on code from @dfaria.eu@dfaria.euš
Live at: http://darch.dk/timeline/?profile=https://darch.dk/twtxt.txt
Iām closing down neotxt.dk as a yarn pod. It will instead offer hosting of timeline or what ever other php stuff you want to run. To get started send me a poem to poem@neotxt.dk
It not that easy @xuu@txt.sour.is since I implemented webmentions in a different way that how it have been done in yarnd to work with txt-files. You can find the code in webmention_endpoint.php and new_twt.php at main Ā· sorenpeter/timeline
https://github.com/lwthiker/curl-impersonate added support for Edge and Safari a while ago and I didnāt realize. Very cool!
Just hacked together this small webfinger endpoint to be used as a companion with timeline: .well-known/webfinger/index.php at main Ā· sorenpeter/timeline
@shreyan@twtxt.net What do you mean when you say federation protocol?
Either use webfinger for identity like mastodon etc. or use ATproto from Bluesky (or both?)
We can use webmentions or create our own twt-mentions for notifying someones feed (WIP code at: https://github.com/sorenpeter/timeline/tree/webmention/views)
Iām not sure we need much else. I would not even bother with encryption since other platforms does that better, and for me twtxt/yarn/timeline is for making things public
@prologic@twtxt.net ahhh! Its the dark reader plugin breaking the page.
Feedback on why I didnāt choose Mattermost (lack of OIDC) Ā· mattermost/mattermost Ā· Discussion ā My discussions/feedback on Mattermostās decision to have certain useful and IMO should be standard features as paid-for features on a per-seat licensed basis. My primary argument is that if you offer a self-host(able) product and require additional features the free version does not have, you should not have to pay for a per-seat license for something you are footing the bill for in terms of Hardware/Compute and Maintenance/Support (havintg to operate it).
Happy Twixmas everyone (new word I just learned 2 min ago)
I have finally gotten around to implementing a gallery feature to timeline.
http://darch.dk/timeline/gallery?profile=https://yarn.stigatle.no/user/stigatle/twtxt.txt
There is still some hiccups, like the limited caching is making it difficult to make links back to older posts not working. Maybe @eapl.me@eapl.me you can help me with that?
This day one advantage of code was pretty neat looking.
https://twitter.com/gereleth/status/1730495736070938786?s=09
Code here: https://github.com/gereleth/aoc_python/blob/main/src/year2023/day01vis.py
Ahh I see how someone did it.
https://github.com/immannino/advent-of-go/blob/master/cmd/2023.go#L30-L40
Github is like Linkedin for Developers
Started the process of migrating from Github to Codeberg with my projects.
Neat.. Gitea cloud for a hosted alternative to github and gitlab. https://blog.gitea.com/gitea-cloud/
Gracias. Also the git repo now contain code that should actually work
@lyse@lyse.isobeef.org I wish more standardization around distributed issues and PRs within the repo ala git-bug was around for this. I see it has added some bridge tooling now.
How did I just find this program? Reptyr: Reparent a running program to a new terminal: https://github.com/nelhage/reptyr
tmux a
would just create a new session if there's no session already to attach to. I probably do that once a day.
@hecanjog@hecanjog.com I have a script for tmux that sets up a new if needed among other things.
http://github.com/brandur/tmux-extra
Works great with powerline.
Home | Tabby This is actually pretty cool and useful. Just tried this on my Mac locally of course and it seems to have quite good utility. What would be interesting for me would be to train it on my code and many projects š
@prologic@twtxt.net I always liked bit.
I am disappointed that a GUI app would not at least have screenshots.
pass
on my machine:
@abucci@anthony.buc.ci So.. The issue is that its showing the password by default? Would making an alias to always include the -c help? We can probably engage Jason with a PR to enable a more hardened approach when desired. Iāve spoken to him before and is generally a pretty open to ideas.
I found this app that was created by the gopass author that does copy by default and has a tui or GUI mode https://github.com/cortex/ripasso
@kdx@kdx.re: I suggest you to try twtwt client, itās also written in C: https://github.com/win0err/twtwt
@prologic@twtxt.net see where its used maybe that can help.
https://github.com/sour-is/ev/blob/main/app/peerfinder/http.go#L153
This is an upsert. So I pass a streamID which is like a globally unique id for the object. And then see how the type of the parameter in the function is used to infer the generic type. In the function it will create a new *Info and populate it from the datastore to pass to the function. The func will do its modifications and if it returns a nil error it will commit the changes.
The PA type contract ensures that the type fulfills the Aggregate interface and is a pointer to type at compile time.
I switched from twtxt client to twtwt (https://github.com/win0err/twtwt). Itās a pre-alpha version now, but it works pretty well and so much faster than the official twtxt client by @buckket@buckket.org. Feel free to check it out :-)
one that i think is pretty interesting is building up dependent constraints. see here.. it accepts a type but requires the use of a pointer to type.
https://github.com/sour-is/ev/blob/main/pkg/es/es.go#L315-L325
I started reading the proposal to introduce operator overloading in Go version 2 that I like to see: https://github.com/golang/go/issues/27605 Now a few hours later I ended up at this gem. Write a program that makes 2+2=5: https://codegolf.stackexchange.com/questions/28786/write-a-program-that-makes-2-2-5 There are some awesone solutions. :-)
$name$
and then dispatch the hashing or checking to its specific format.
Circling back to the IsPreferred method. A hasher can define its own IsPreferred method that will be called to check if the current hash meets the complexity requirements. This is good for updating the password hashes to be more secure over time.
func (p *Passwd) IsPreferred(hash string) bool {
_, algo := p.getAlgo(hash)
if algo != nil && algo == p.d {
// if the algorithm defines its own check for preference.
if ck, ok := algo.(interface{ IsPreferred(string) bool }); ok {
return ck.IsPreferred(hash)
}
return true
}
return false
}
https://github.com/sour-is/go-passwd/blob/main/passwd.go#L62-L74
example: https://github.com/sour-is/go-passwd/blob/main/pkg/argon2/argon2.go#L104-L133
$name$
and then dispatch the hashing or checking to its specific format.
Hold up now, that example hash doesnāt have a
$
prefix!
Well for this there is the option for a hash type to set itself as a fall through if a matching hash doesnāt exist. This is good for legacy password types that donāt follow the convention.
func (p *plainPasswd) ApplyPasswd(passwd *passwd.Passwd) {
passwd.Register("plain", p)
passwd.SetFallthrough(p)
}
https://github.com/sour-is/go-passwd/blob/main/passwd_test.go#L28-L31
$name$
and then dispatch the hashing or checking to its specific format.
Here is an example of usage:
func Example() {
pass := "my_pass"
hash := "my_pass"
pwd := passwd.New(
&unix.MD5{}, // first is preferred type.
&plainPasswd{},
)
_, err := pwd.Passwd(pass, hash)
if err != nil {
fmt.Println("fail: ", err)
}
// Check if we want to update.
if !pwd.IsPreferred(hash) {
newHash, err := pwd.Passwd(pass, "")
if err != nil {
fmt.Println("fail: ", err)
}
fmt.Println("new hash:", newHash)
}
// Output:
// new hash: $1$81ed91e1131a3a5a50d8a68e8ef85fa0
}
This shows how one would set a preferred hashing type and if the current version of ones password is not the preferred type updates it to enhance the security of the hashed password when someone logs in.
https://github.com/sour-is/go-passwd/blob/main/passwd_test.go#L33-L59