Skip to content

Instantly share code, notes, and snippets.

@rococtz
rococtz / encryption_one_to_many.js
Created September 9, 2021 08:08
encryption_one_to_many
// https://jsbin.com/rasuwilojo/6/edit?js,console
(async () => {
/////////////////////////////////////////////////////////////////
// Instead of logging in with actual users, we are
// going to generate SEA pairs which is basically the same thing
/////////////////////////////////////////////////////////////////
// User 1 encrypts one message
@rococtz
rococtz / simple_encryption.js
Created September 7, 2021 23:33
GUN_ENCRYPTION
///////////////////////////////////
// On my side - logged in as myself
///////////////////////////////////
var myPair = gun.user()._.sea;
// retrieve bob's user
var bob = gun.user(bobPublicKey);
// generate encryption secret using bob's epub and my pair
// this means only bob will be able to generate this secret
var secret = await SEA.secret(bob.epub, myPair)
// encrypt the data using the secret
#!/usr/bin/php
<?php
declare(strict_types = 1);
// require_once ('hhb_.inc.php');
hhb_init ();
if ($argc !== 3) {
fprintf ( STDERR, "usage: %s timestamp url\n", $argv [0] );
fprintf ( STDERR, "example: %s 20091012061648 http://www.p4w.se\n", $argv [0] );
die ( 1 );
}