You are reading content from Scuttlebutt
@mix %2qEtYbJ/tAiFuXHYgdfou7BvERxtIF7Cdq3NmjkSF4w=.sha256

Revokable Shards

@dominic proposed a way to 'revoke' shards here %eYqUfFj... , but I didn't fully understand the process, so I'm going to have a go at expanding on it in this thread

@mix %FqzUVRypFQw6/YIdPt8g6NF35pcWxjIGgJkDmM+We7U=.sha256

Something like:

Alice sends a request to Bob, "hi Bob, can you look after a secret share for me?" Bob replies "yes, encrypt it to this ephemeral public key bob_e". Bob's stores this key on disk, for now. Alice also generates an ephemeral key, alice_e and encrypts the share, sending bob alice_e.public, secretbox(share_bob, alice_e*bob_e) then deletes alice_e's private key. (note: alice sends the public key she used to bob, he'll need that to decrypt the share)

I think I see the intention of this, but I've got tangled on which keys are being used where.
I'm assuming all keys are assymetric, so there's alice_e.public and alice_e.private.

Re-writing the story with more detail it might then look like :

  1. Alice ask Bob, "hi Bob, can you look after a secret share for me?"
  2. Bob replies "yes, encrypt it to this ephemeral public key bob_e.public". Bob's stores bob_e.public and bob_e.private keys on disk, for now.
  3. Alice also generates an ephemeral key-pair, alice_e.public, alice_e.private and then sends Bob:
    • secretbox(share_for_bob, alice_e.public*bob_e.public) (encrypted share)
    • alice_e.public (he'll need that to decrypt the share)
  4. Alice then deletes her ephemeral alice_e.private

Things I don't understand:

  • I can see where alice_e.private is ever used
  • aren't all of the keys that were used to make the secretbox key (alice_e.public*bob_e.public) now on the log? .. making it not the ephemeral
@dan %gXlyWgqh1c/9rQ3c59WlOCF20kYBN+BV7/sVb4BobyA=.sha256

cc: @keks @arj @cryptix @Powersource as I know they sometimes geek out on these details!

User has not chosen to be hosted publicly
@Dominic %bX3ly2zMXW5AI1bMPYrWkLpAfsr4sF+PU1NynohjjQg=.sha256

That is correct.
Important to know: NEVER use the same nonce twice with the same key.
It's okay to use the same key again, if the nonce is different. Nonce means "Number, used ONCE", btw.

I'd also add to your example:

// alice does this:
const boxed = secretBox(message, nonce, scalarMult(alice_e.secretKey, bob_e.publicKey))
// forget the secret key, now alice can't decrypt the message anymore.
alice_e.secretKey.fill(0)

// bob does this:
const unboxed = secretBoxOpen(boxed, nonce, scalarMult(bob_e.secretKey, alice_e.publicKey))
// forget the secret key, now bob can't decrypt the message anymore.
bob_e.secretKey.fill(0)

Once you have deleted the secret key, even if your computer is later compromised, they can't get the key.
(note: it might not work if your computer was already compromised, because the compromiser could change the code so it doesn't delete the secret key)

@mix %H3lDxv81s7dTz6aiyn0hF4rhOrthOKnqDFXY75bnP/g=.sha256

thanks for the example @peg + @dominic.

I don't understand how this code works. Have tried reading docs but haven't been able to find anything that really helps (npm libsodium-wrapper, libsodium.org

Educated guess and then testing for myself I can see that

scalarMult(alice_e.secretKey, bob_e.publicKey) ===  scalarMult(bob_e.secretKey, alice_e.publicKey)

Is scalarMult then just a function which is defined to always have this property?

I'm kinda tempted to go down that rabbit hole and just understand what is happening with the maths, but not sure how wise that is

User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@dan %F0AGdjRro7OLdSSpjzMN6U6oPV6QIjEAByVurpqUrhA=.sha256

I've been waiting to cypherlink this again!

Diffie-Hellman key exchange explained with paint!

User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@mix %+uFMzNf5oMuvhGnXftYn5F8eH0JQNwVdhRjOSklyQWM=.sha256
Voted [@mix](@ye+QM09iPcDJD6YvQYjoQc7sLF/IFhmNbEqgdzQo3lQ=.ed25519) > Is scalarMu
@mix %+/Z9dhMpRuUsLUXya5T/BLMU32XzagiYWSXKEBrHyT8=.sha256
Voted [@peg](@vEJe4hdnbHJl549200IytOeA3THbnP0oM+JQtS1u+8o=.ed25519) > what im a
@mix %Tz37k2D8hr4Hvcs5/uO+XQ5sBtAfri+1PGPMJsti3ys=.sha256

Aside: hey @peg we've got code syntax highlighting in patchbay now.

activate it by doing e.g. ```js to start a code block

User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@mix %VuisU0qLI6gRobgRbonL2muxkYZkbXSPv63kQCLORpg=.sha256
Voted ## Some thoughts for implementing 'ephemeral returned shards' ![3090736823
@mix %KfQLbuRZ3fzMW7OoWJh3v0Zm+teCoDc+LqCMJJfQ/B4=.sha256

hey @peg note I've shifted scuttle-dark-crystal to using sodium-friends/sodium-native. There's a clearly marked commit relevant to this to see all the changes.

I think I might be leaning to not directly using scuttle-invite. It feels like we have a very specific use case and we're trying to flex something general to fit. I like the idea of invites, I also just think it's fine to not use it. We've already been a little locked in because we assumed building around requesting returns, when we've identified that that's a more a nice-to-have path and the more general case is wanting to be able to not HAVE TO have requests.

@dan %ueujz7LuwB5R+D/8awrSmzrjobg+g5OcvXBH7ADK8As=.sha256
Voted ## Some thoughts for implementing 'ephemeral returned shards' ![3090736823
@dan %fKXLcz7KX2L6PR8806Ej4UbhhxtSGLNh4rKvec+7ZIg=.sha256
Voted ps: [@keks](@YXkE3TikkY4GFMX3lzXUllRkNTbj5E+604AkaO1xbz8=.ed25519) thanks
@dan %9FIKyAoXS1bsk2ZIr6zTmGz9gqFbD3RIRPO0v2Lt77k=.sha256
Voted hey [@peg](@vEJe4hdnbHJl549200IytOeA3THbnP0oM+JQtS1u+8o=.ed25519) note I've
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@dan %nYQ1i8DW1A6QX6YjbGNBLN8cqE0Xd66B2ybkKOe6kqk=.sha256
Voted [@keks](@YXkE3TikkY4GFMX3lzXUllRkNTbj5E+604AkaO1xbz8=.ed25519) i've had [a
@mix %tY2RyJiu8BnPnRMUZ1gKn1OtwPpcG6qraWsOBx3H4Xs=.sha256

I changed to sodium-native @peg because @mikey (who is far senior as me as a programmer) pointed out it was more up to date, maintained, and better documented than chloride. I also had a bad time using other wrappers, and I know and trust the people using and maintaining this sodium-native.

Sorry to hear you had to write helper functions, I don't know enough to comment on that

@mix %eCyLQt50gQC8PbmzymJSEmuHY1Y+L009ZratHju88Rk=.sha256

Code you wrote seems to make sense @peg. I notice I'm reviewing something which we said was a "do it later thing" so maybe I shouldn't spend too much time on this.
I'd arrange the functions a little differently, like I feel like the boxing and unboxing are a little muddled with databases storage - I think there should be raw box/ unbox internally then publicly there should be "create" "delete" and "read" or something which is about creating an ephemeral keypair, dropping it, and using it to read something (give it the dbKey and a message). Seperating these things should make them easier to test too

I see you've written minimal tests which is a good plan.

here : https://github.com/ameba23/ephemeral_keys/blob/master/index.js#L63 you're making keys that you're not using (other than to wipe them!)

@mikey %s6It0dzF7QwqMHBdy+UbedXIRJNtWO/cVerNIbNjdJ0=.sha256

to echo what @mix says, i recommended using the sodium-friends ecosystem because it's actively maintained by our open source friends (e.g. Dat project maintainers), well-documented, and performant.

from the sodium-friends/sodium-native docs:

All methods exposed are more or less a direct translation of the libsodium c-api. This means that most data types are buffers and you have to manage allocating return values and passing them in as arguments intead of receiving them as return values.

This makes this API harder to use than other libsodium wrappers out there, but also means that you'll be able to get a lot of perf / memory improvements as you can do stuff like inline encryption / decryption, re-use buffers etc.

This also makes this library useful as a foundation for more high level crypto abstractions that you want to make.

it's intentionally low-level, so your preferred high-level abstractions can be decoupled from the solid low-level foundation, i think writing helper functions for your situation is a good thing!

i also notice that the crypto module powering Scuttlebutt, chloride, is now powered by sodium-friends underneath: sodium-chloride. so that's another option to use, however it's undocumented and it's only a simple wrapper to be compatible with a previous abstraction so Dominic didn't have to re-write other code.

@mikey %FCvBV+WXD0oXrK8K4P2f6gPftD4VpeX0k9Md++qdR2E=.sha256

oh yeah, i forgot to mention: a major motivation for using sodium-friends/sodium-native is that it has prebuilt binaries (using prebuild) so you can install without having to compile from source (which is especially helpful when cross-building app releases for multiple operating systems).

@dan %TB2BoA+duuOglbdnk6hty46jegSp9yxyfGkkm4lh6CQ=.sha256
Voted Code you wrote seems to make sense [@peg](@vEJe4hdnbHJl549200IytOeA3THbnP0o
@dan %fvOgKBmSOQp0pOlNFQhxCBYbnA05oaarZgOito+7c8I=.sha256
Voted oh yeah, i forgot to mention: a major motivation for using [`sodium-friends
@dan %bb5FmtaM2QLnHMDpy/eEHkCdjPA25DksKQ4hLaT4qHw=.sha256
Voted I changed to `sodium-native` [@peg](@vEJe4hdnbHJl549200IytOeA3THbnP0oM+JQtS
@dan %7T6JEYkUq9Sn8IanmyLK+bwnbAK1FC+aei0Ivg1IxCM=.sha256
Voted to echo what [@mix](@ye+QM09iPcDJD6YvQYjoQc7sLF/IFhmNbEqgdzQo3lQ=.ed25519)
@dan %NnAXHebdaaQGl7kglH05eu2Eicg7ENLUoj4MoZJWH+E=.sha256
Voted [@peg](@vEJe4hdnbHJl549200IytOeA3THbnP0oM+JQtS1u+8o=.ed25519) I'm no JS exp
@mix %cG61zjISKOJExzeCZyrPYyyEf98UYm7oVXrqtvcMW1A=.sha256
Voted to echo what [@mix](@ye+QM09iPcDJD6YvQYjoQc7sLF/IFhmNbEqgdzQo3lQ=.ed25519)
@mix %oq5pk/U97MNH+MhellQj7vSglgHg4vRAL8YxgnTvBhI=.sha256
Voted oh yeah, i forgot to mention: a major motivation for using [`sodium-friends
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@dan %mQWvj3bb5f8mBqfcp6XzxNYWRIk8KzOxG4+GNHJZxR4=.sha256
Voted [@dinosaur](@6ilZq3kN0F+dXFHAPjAwMm87JEb/VdB+LC9eIMW3sa0=.ed25519) ok grea
@dan %rUT9Gm7qDjCfqfd+sJlgV8xqgHot+2MnXrpct6zJxhc=.sha256
Voted [@peg](@vEJe4hdnbHJl549200IytOeA3THbnP0oM+JQtS1u+8o=.ed25519) > is there a
@dan %4AbxG7coDlFm44S0XzAIgPpMoeFYyaZpCHxp3BJNilw=.sha256
Voted [@keks](@YXkE3TikkY4GFMX3lzXUllRkNTbj5E+604AkaO1xbz8=.ed25519) thanks for
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@Dominic %wG2JswMbR8Q44eeGHanVjjgd+5o/+SYGEASO4QgrGZU=.sha256

@keks if it's possible that a*b == c*d, is it possible that a == c & d != d? i.e. can a*b = a*d? who can construct c*d? do you have to have one of the private keys of a, b? or do you have to know a*b?

on chloride vs sodium-friends. I've been meaning to rewrite secret-handshake and pull-box-stream to use sodium-friends. The perf difference would probably not be measurable except maybe in pull-box-stream, because the difference is just some memory allocations. But, I very much like the idea of something like this being closer to the C api, so that one set of documentation applies. in libsodium, you pass a pointer to where you want the output, and in chloride it's allocated and returned. Also, in C libsodium you must pass a length for each input. node buffers have that as a property, so it's not necessary.

@dan %HA3Rcp9Zx0RS8QQB4U1hcictoM0cpR8WehKCDHZ0AAw=.sha256
Voted [@keks](@YXkE3TikkY4GFMX3lzXUllRkNTbj5E+604AkaO1xbz8=.ed25519) if it's poss
@dan %Nhl+6kDoNl7nxxxFtFw7pVMkqHW5SY/dnM7msqV6nLo=.sha256
Voted Oh, fogot about your last question: > Basically, if this is stronger than
@dan %+hNr60eA7nlUmVfvXGU9JXundaZ0ko2OW+eTIk0UFvo=.sha256
Voted [@peg](@vEJe4hdnbHJl549200IytOeA3THbnP0oM+JQtS1u+8o=.ed25519) oh, I see. L
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@dan %iehSGdsLUWDhrBmdtxy0ietp6q5V9FGbkPIvbRM1Zvw=.sha256
Voted [@Dominic](@EMovhfIrFk4NihAKnRNhrfRaqIhBv1Wj8pTxJNgvCCY=.ed25519) > is it
@dan %XB6w3sF4kmDCsOMd3yUQgzPgMf+hDblZxUhsSJr47Qg=.sha256
Voted [@peg](@vEJe4hdnbHJl549200IytOeA3THbnP0oM+JQtS1u+8o=.ed25519) > it appears
@dan %R9v7ETSsGhAAo1oRRv/mTCwAYaEZxwnbHCctyTloiVA=.sha256
Voted wow this conversation is getting pretty interesting. i'd love to try thi
@mix %92vZQhIVyRyydFjrkfb1FgYaTQ72TAHBKbGtniXkZ60=.sha256

@peg you could ask @mafintosh on Twitter potentially. mmm Github issue it probably a better idea though. If you need help getting in touch he's in FoaF (friend of a friend) range

@dan %lhbD2FKaAMul9hapV4NyYBoX8rgiOqRwvxNFQOaGra0=.sha256
Voted [@peg](@vEJe4hdnbHJl549200IytOeA3THbnP0oM+JQtS1u+8o=.ed25519) you could ask
@dan %rJh4ipV+r4yxN1c1IZwd5BYkAAcQNZTnY4Q+nz2f7Pc=.sha256
Voted > Nor are any variants of HMAC. actually i think hmac is `crypto_auth`, wh
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@mix %IsVvA/GVboNTEVqj6hXwOnu2WXfw1nAa0K9h7H53sN0=.sha256
Voted So thanks to Emil Bay and [@keks](@YXkE3TikkY4GFMX3lzXUllRkNTbj5E+604AkaO1x
User has not chosen to be hosted publicly
@dan %xMOJiLPIDVr0FcBqF+7wokjeKpDt9Ye4BLhDEjh3p08=.sha256
Voted So thanks to Emil Bay and [@keks](@YXkE3TikkY4GFMX3lzXUllRkNTbj5E+604AkaO1x
User has not chosen to be hosted publicly
@dan %0J0YVe4oV1NzWsNsVROxyBLwxDqxPKGsIPoAc+199Vg=.sha256
Voted I've made some changes based on [@keks](@YXkE3TikkY4GFMX3lzXUllRkNTbj5E+604
@dan %HhmHKT5aaTdf34Qk3CULOkW6hn8nIQGsxK2prCwbczA=.sha256

crypto-weenies.gif

crypto weenie in action!

@dan %K66/CqXJyeEToyuA4PZVhbZ66rWmrU6KSQvIz5HfTzQ=.sha256
Voted Hm, patchbay crashed and my draft is gone... When I wrote `blake2b(key=x m
@mix %Jw5bdgkmeCPG1ncwZs7RCHDVmqm40PE+rzVV9wUyqbs=.sha256
Voted I've made some changes based on [@keks](@YXkE3TikkY4GFMX3lzXUllRkNTbj5E+604
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@dan %J6W15+hqeT2eK6J11+eSwxXDk+qsLkexOtMSJL2Ltns=.sha256
Voted [@emilbayes](@E1nsSSKlOKELaNv+2D/qADA3Kswc0r6yAQ8zdwIOPEU=.ed25519) thank
@dan %HmuMoeYO4VR9RpyzgZ5sTN9mOvvKHAY5wYMf42scFbg=.sha256
Voted Hi! I can't comment on the design of what you guys are doing, but just on s
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@dan %uECZ06K/k4shWgs0w0wNE8rQwXQrqMsyyzmHxx4y9y0=.sha256
Voted [@emilbayes](@E1nsSSKlOKELaNv+2D/qADA3Kswc0r6yAQ8zdwIOPEU=.ed25519) > Happ
@dan %OVGTTzcB18screW3Bk/eoQxiB/zP0CF6rLNS/IAP0hs=.sha256
Voted [@peg](@vEJe4hdnbHJl549200IytOeA3THbnP0oM+JQtS1u+8o=.ed25519) You can conv
@cryptix %J6VQJlVciyFUkwHCzDn7C0XQD7ltddlVTURYO76dX3U=.sha256
Voted [@peg](@vEJe4hdnbHJl549200IytOeA3THbnP0oM+JQtS1u+8o=.ed25519) You can conv
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@cel %oiu4uGahJph+E+KcZtpTdrGFXSiyeFd0ODi9y0pVAo0=.sha256
Voted > So if i've understood right, your proposal is that we refer to each other
@dan %R6QINCO53YbzPMqnMEGGYCIQy+uDJieStbt9SU4/sSk=.sha256
Voted > So if i've understood right, your proposal is that we refer to each other
@dan %PJe8yDL0w22n5mDyegNyq60GO1Nt/ZocmVsBbnXYnPo=.sha256
Voted [@keks](@YXkE3TikkY4GFMX3lzXUllRkNTbj5E+604AkaO1xbz8=.ed25519) aha! now
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
User has not chosen to be hosted publicly
@Dominic %n6d7GT4K974a0Fe605BRisBqjR5W4t7qcwisq/4sGCI=.sha256

@peg you are ameba23 on github right? I checked and I noticed you where "member" of ssbc,
I changed you to "owner" so that you can change the name your self.

(note, everyone is added as owners, because only owners can add more members.
It doesn't mean the policy is total anarchy, but it means there isn't a technical barrier to the social process)

@dan %kZbkGNKXMvS47YVI8gtv0G30f/9SKSHICp9AD1WHS9M=.sha256
Voted > Is anybody an organisation owner of github/ssbc? ah i see many people ar
@dan %WZBaOX+8nBRG7kN0sgRmieNGGMIkEyH0sJt0Vc9gaWM=.sha256
Voted Since https://github.com/ssbc/ephemeral-keys is now an ssb-server plugin ra
@dan %Emgiud98tOp0wLEvWDq6eLEhbhlUTDgpdRMdtTEmvO0=.sha256
Voted So returned shards in dark crystal will now be encrypted with ephemeral ke
@kieran %GhETB2PCWGnQD7qnNuUVaAlxSJVOR+pH2v/qDu3eDRI=.sha256
Voted So returned shards in dark crystal will now be encrypted with ephemeral ke
@kieran %jQTJf3mFoqaRgneFxgeTk95tkilygMJWfIffg278eUM=.sha256
Voted @peg you are ameba23 on github right? I checked and I noticed you where "me
@kieran %KQWBgXVZMJTdr4nMwfxLZ1aDtv396dg8jBaIDnWf38M=.sha256

@mix not sure if this message passed you by, I only just saw it! https://github.com/blockades/scuttle-dark-crystal/pull/44

Join Scuttlebutt now