ChanServ changed the topic of #picolisp to: PicoLisp language | Channel Log: https://irclog.whitequark.org/picolisp/ | Check also http://www.picolisp.com for more information
orivej has quit [Ping timeout: 260 seconds]
tankf33der has quit [Ping timeout: 272 seconds]
tankf33der has joined #picolisp
michelp has quit [Ping timeout: 272 seconds]
michelp has joined #picolisp
orivej has joined #picolisp
rob_w has joined #picolisp
mtsd has joined #picolisp
Regenaxer has left #picolisp [#picolisp]
Regenaxer has joined #picolisp
mtsd has quit [Quit: Leaving]
wineroots has quit [Ping timeout: 265 seconds]
orivej has quit [Ping timeout: 246 seconds]
orivej has joined #picolisp
Regenaxer has left #picolisp [#picolisp]
Regenaxer has joined #picolisp
Regenaxer has left #picolisp [#picolisp]
Regenaxer has joined #picolisp
Blukunfando has quit [Ping timeout: 256 seconds]
<Regenaxer> tankf33der, perhaps you have an idea: I want to write a *web push client* using openssl
<Regenaxer> Do you know an example?
<Regenaxer> it is ECDH and Prime p256dh
<Regenaxer> Basically two tasks:
<Regenaxer> — Generate p256dh, encoded in URL safe base64
<Regenaxer> — Decrypt payload with the private key
<tankf33der> uh
<tankf33der> never heart of this push
<Regenaxer> What I want to do is
<Regenaxer> Server side example is
<Regenaxer> I want to receive push notifications from Mastodon here in my IRC client
<Regenaxer> Everything works so far
<Regenaxer> just the public key sending, and the decryption of the received notification, is missing
<Regenaxer> I'd like to use it without encryption
<Regenaxer> as the transfer is ssl anyway
<Regenaxer> but encryption cannot be avoided it seems
<tankf33der> yea, they expect encryption
<Regenaxer> T
<Regenaxer> Basically a good thing, but overkill in my use case
<Regenaxer> Not difficult, *if* one knows how to do it ;)
<Regenaxer> I succeeded to generate pub and priv key with openssl from the example in the above blog
<Regenaxer> But what is "URL safe" base64?
<Regenaxer> normal base64?
<Regenaxer> And how to decrypt the message with the priv key?
<tankf33der> i will to google the subject
* beneroth would be interested
<beneroth> I looked just a tiny bit into it, then went with curl
<beneroth> Regenaxer, no idea about "URL safe" base64, but maybe without ";" or so?
<beneroth> its kinda bullshit, because url-encoding rules are quite clear I would think...
<beneroth> there is a NPM package with the name: https://www.npmjs.com/package/url-safe-base64
<beneroth> Regenaxer, lol it is as I thought.
<beneroth> base64, but replace + with _, / with - and = percent-encoded to %3d
<beneroth> or leave ending = away if length of token is fixed anyway
<beneroth> so basically people don't understand that URL fundamentally persist of multiple parts with complete different encodings, they cannot deal with, and the few instances where they meet this fact as an obstacle they invent additional standards to make the mixture of different formats even bigger
Blukunfando has joined #picolisp
<Regenaxer> thanks beneroth! :)
<Regenaxer> I think I can use the public key I generated from the example
<Regenaxer> So main problem is how do decrypt the notification message with the corresponding private key
<Regenaxer> Concerning the "URL safe": It is bullshit already because this is a POST transaction
<beneroth> Regenaxer, see also https://en.wikipedia.org/wiki/JSON_Web_Token
<beneroth> it's the hottest fashion, that JWT stuff
<Regenaxer> I think I have the token
<Regenaxer> I obtained from the OAuth with the Mastserver
<Regenaxer> I can read private timelines etc
<beneroth> token = base64urlEncoding(header) + '.' + base64urlEncoding(payload) + '.' + base64urlEncoding(signature)
<Regenaxer> What I need now is just the push
<beneroth> ah ok
<beneroth> you use openssl via (native) ?
<Regenaxer> not here
<Regenaxer> The rest of the Mastodon is just TLS
<beneroth> so piped tunnel software?
<Regenaxer> No, very simple
<Regenaxer> GET and POST
<Regenaxer> plus @lib/json.l
<Regenaxer> and 'ssl' or 'curl'
<Regenaxer> for GET I use 'ssl'
<Regenaxer> Experimenting with http://ix.io/2EsX
<Regenaxer> btw, I improved lib/json.l in pil21 a little
<Regenaxer> in fact my first real use case of @lib/json.l
<beneroth> woah, (ssl) is new to me 0.o
<Regenaxer> oh :)
<beneroth> so wrapper for bin/ssl
<beneroth> I see
<Regenaxer> yeah, simple
<Regenaxer> same in pil64
<beneroth> yeah I see
<Regenaxer> But 'ssl' supports only GET
<Regenaxer> so I use 'curl' too
<beneroth> I would like something like this, but I want additionally to extract certificates and TLS metadata.
<beneroth> so I guess I should then do a custom version of bin/ssl ?
<Regenaxer> I would not overload it
<Regenaxer> 'curl' does everything, no?
<beneroth> curl is useful. but should be updated all the time, had some security issues over time...
<Regenaxer> I see
<Regenaxer> yeah, better be in control
<beneroth> I'm using curl, yeah. bin/ssl I only have in use for replica
<Regenaxer> T, that's the main use
<Regenaxer> BTW, ssl for replication is also improved a little in pil21
<beneroth> how so?
<Regenaxer> before, it read the file, truncated, and tried to send
<Regenaxer> but if ssl is killed with -15, data would be lost
<beneroth> I see
<Regenaxer> So now it keeps the file
<Regenaxer> and truncates it later
<beneroth> good!
<Regenaxer> Critical only in PilBox I think
<Regenaxer> Normal servers will kill with -15
<Regenaxer> oh
<Regenaxer> above I meant -9
<beneroth> well on servers too, because if something weird happens than surely server also gets a power hard shutdown
<Regenaxer> cause Android kills apps with -9 !!
<beneroth> yeah I understand
<beneroth> oh
<beneroth> nice
<Regenaxer> yeah
<beneroth> battery saving "feature" eh?
<Regenaxer> Just stupid I think
<beneroth> what is happening with the new DB journaling data during a replica sending attempt? ending up in a new file?
<Regenaxer> In PilBox it is also not critical
<Regenaxer> if PilBox is closed, ssl continues to run
<Regenaxer> but if the battery would run out meanwhile ...
<Regenaxer> I use the same file
<Regenaxer> After sending, it is truncated from the beginning
<beneroth> so the truncate is not a full truncate but guaranteed to only delete what is sent?
<Regenaxer> yes
<beneroth> ah ok
<Regenaxer> so there is a very short moment still dangerous
<beneroth> there is? how so?
<Regenaxer> read + truncate + write rest
<Regenaxer> a few msecs
<beneroth> ah I'm afraid about 1) read 2) db writes more 3) truncate
<Regenaxer> no db involved
<beneroth> slow network connections may prolong the send step for quite long time, I would expect
<Regenaxer> yes
<Regenaxer> but no problem
<Regenaxer> the file just gets bigger
<Regenaxer> Only important that it is not killed *after* trunc and *before* write
<Regenaxer> (or partial write)
<beneroth> I don't understand: read + truncate + write rest
<beneroth> ok.. who is writing here to where?
<beneroth> replica to network? or db to file?
<Regenaxer> No, ssl sends replication data to server
<Regenaxer> if successful, it reads the fifo/xxx, and must delete the part which was sent
<Regenaxer> the file may have grown meanwhile
<beneroth> yes
<Regenaxer> But delete from the beginning is not possibll
<beneroth> yes
<Regenaxer> so I read the whoue file again, trunc the file
<Regenaxer> and write back the new part
<beneroth> I see
<Regenaxer> Cannot be done atomically
<Regenaxer> but takes only a few ms
<Regenaxer> So if the battery goes off at that moment, the replication is bad later
<Regenaxer> The DB is ok cause of transaction log
<beneroth> not losing data, but sending same data multiple times?
<beneroth> is the risk?
<Regenaxer> this can happen, but is ok
<Regenaxer> the journal has block
<Regenaxer> s
<beneroth> ah okay
<Regenaxer> can be transmitted and written remotely as often as needed
orivej has quit [Ping timeout: 246 seconds]
<Regenaxer> I never saw a case where an Android device switched off because of battery failure
<Regenaxer> I suspect Android powers down cleanly before it is completely empty
<beneroth> hahaha
<beneroth> I'm not so sure
<Regenaxer> ;)
<beneroth> I regularly used my older Samsung Android down to 2% battery. and a few times it shutdown (I think it shutdown..but unsure)
<Regenaxer> yes, but there must be a small safety margin
<Regenaxer> otherwise the memory and the battery may damage
<Regenaxer> Probably 0% is not zero
<Regenaxer> (let's hope so ;n
tankf33der has quit [Quit: Connection closed for inactivity]
rob_w has quit [Quit: Leaving]
orivej has joined #picolisp
wineroots has joined #picolisp
orivej has quit [Ping timeout: 256 seconds]
orivej has joined #picolisp