wshs

package module
v0.0.0-...-ebf7294 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 21, 2020 License: MIT-0 Imports: 5 Imported by: 0

README

Secret Handshake for Websockets


The primary goal of this project is to create a new implementation of the Secure Scuttlebutt Secret Handshake in golang over websocket transport.

Secret Handshake Diagram

This project has some other goals:

  • favors readability/understandability over cleverness
  • favors usability/stability over speed
  • work over websockets
  • easily change the network key

Demo

You can run the demo like so:

$ cd examples/demo
$ ./server.sh &
[1] 24494
Running server...
$ ./client.sh 
Running client...
2020/01/21 00:56:29 Handshake Success: server
2020/01/21 00:56:29 Handshake Success: client
$ fg
./server.sh
$ ^C

Authors Note

This project was started in an effort to learn golang. The code in this project is heavily influenced by the secret handshake ssb protocol guide. I also thought it would be nice to somehow "plug-in" the secret handshake into current or future websocket-based projects. And here it is... I wrote it in such a way to help myself learn some golang, and help myself learn about ssb. Being more of a research project, i would expect bugs and awful code everywhere. Please submit a pull request or an issue if you find anything.

Inspired By:

Documentation

Index

Constants

View Source
const (
	// NetworkKeyString defaults to "dev"
	NetworkKeyString string = "dev"
)

Variables

View Source
var (
	// NetworkKeyBytes .
	NetworkKeyBytes = [32]byte{}
)

Functions

func CalculateNetworkKey

func CalculateNetworkKey(s string) [32]byte

CalculateNetworkKey from string

func GenerateEphemeralCurve25519KeyPair

func GenerateEphemeralCurve25519KeyPair() (pub, priv [32]byte)

GenerateEphemeralCurve25519KeyPair generates a curve25519 key pair which is designated for ephemeral usage per each handshake

func PrivateKeyToCurve25519

func PrivateKeyToCurve25519(e [64]byte) [32]byte

PrivateKeyToCurve25519 .

func PublicKeyToCurve25519

func PublicKeyToCurve25519(e [32]byte) [32]byte

PublicKeyToCurve25519 .

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL