ma

package module
v0.7.6 Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2024 License: GPL-3.0 Imports: 0 Imported by: 10

README

Go reference implementation

Provided are the tools and and structs to interact with SPACE through . However this library can be used for any purpose. It is not tied to SPACE by design.

Development specs will reside in https://github.com/bahner/ma. But the specs are mostly written as an afterthought. This code is the spec.

To understand the need for 間 I commend Alan Kay's talk at OOPSLA 1997 to you. It is brilliant, thought provoking, inspiring and highly entertaining.

A success criterium for this project would be if he looked at the code and described it as: Mostly harmless.

So what is it? It's almost, but not quite, entirely unlike DID and DIDComm over libp2 pubsub. Another important point made by Kay is that each object should have a URL and an IP. 間 provides that by leveraging DID's which express IPNS identities and uses pubsub over IPFS ..

The envelope contains the encrypted message and the key. The message is a DID Document. The key is the key to unlock the message. The DID Document is signed by the sender. And is structured, so the receiver can parse it for it's intended purpose.

Go language

I intended to create the prototype entirely in Elixir, but libp2p in Elixir is not as mature as in Go.

I have never written a single line of Go before, so this is a learning experience for me. I wrote the required IPFS, IPNS and IPLD libraries for Elixir. But a libp2p implementation is not feasible in the foreseeable future. At least for one person. So I decided to do it in Go.

These structs and functions are the result of that decision. They will be consumed by another project - go-space - which is an erlang node that will be used to communicate with the Go 間 tools and integrate with the MOO that I am building in Elixir.

did

The did sub-package contains the structs and functions to build and work with DID documents. I did look at other did-implementations, but they were too complicated for me, so I decided to write my own.

These packages do not provide for publication or retrieval of the documents. Live interactions with these entities should be consumed by other software using this library. It is intended to be as lightweight, clean and stable as possible.

I will not add unneeded functionality to this package at the moment. It started as more of a full implementation of the DID spec, but I have decided to keep it as simple as possible.

If need be it should be relatively easy to extend, as it's been endowed with a version number.

Message

The message struct is also meant to be as stable as possible. It is the struct that is used to create messages to be sent on 間. The envelope consists of a an encrypted payload and the key to unlock it.

As noted above the code is the spec for now, but we'll get to that. RSN.

2023-11-25: bahner

Documentation

Index

Constants

View Source
const (

	// Just our name
	NAME        = "ma"
	PROPER_NAME = "間"

	// Ma version
	VERSION = "0.0.1"

	// The did prefix to use
	DID_PREFIX = "did:" + NAME + ":"

	// The rendezvous string used for peer discovery in libp2p.
	RENDEZVOUS = "/" + NAME + "/" + VERSION

	// BLAKE3 label for symmetric key generation.
	BLAKE3_LABEL    = NAME
	BLAKE3_SUM_SIZE = 32 // 256 bits

	// Message constants
	MESSAGE_TYPE           = "/ma/message/" + VERSION
	ENVELOPE_MESSAGE_TYPE  = "/ma/message/envelope/" + VERSION
	BROADCAST_MESSAGE_TYPE = "/ma/message/broadcast/" + VERSION

	BROADCAST_TOPIC = BROADCAST_MESSAGE_TYPE

	MESSAGE_DEFAULT_CONTENT_TYPE = "text/plain"

	// API
	DEFAULT_IPFS_API_MULTIADDR = "/ip4/127.0.0.1/tcp/45005" // Default to Brave browser, Kubo is /ip4/127.0.0.1/tcp/5001
	ENV_PREFIX                 = "GO_MA"
)

Variables

This section is empty.

Functions

This section is empty.

Types

This section is empty.

Directories

Path Synopsis
did
doc
key
set

Jump to

Keyboard shortcuts

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