A multiformats-inspired module for encoding cryptographic keypairs.
At a shell within your go module:
go get github.com/proofzero/go-multikeypair
go build
go test
Pseudo-golang for excercising the Encode and Decode API for a given hardcoded keypair of a given crypto algorithm:
// Keys:
private := []byte("Wn3Sf5Ke/3:PA:Tm{KCf59Wg6j%/g*#d")
public := []byte("cv-sB6?r*RW8vP5TuMSv_wvw#dV4nUP!@y%u@pmK!P-S2gYVLve!PfdC#kew5Q7U")
// Cypher:
code := multikeypair.ED_25519
name := multikeypair.Codes[ED_25519]
// Encode:
mk, err := multikeypair.Encode(private, public, code)
if err != nil {
panic(err)
}
// Decode:
kp, err := multikeypair.Decode(mk)
if err != nil {
panic(err)
}
Documentation is inline with code as comments. See tests in keypair_test.go
.
We would appreciate your help to make this a useful utility. For code contributions, please send a pull request. First outlining your proposed change in an issue or discussion thread to get feedback from other developers is a good idea for anything but small changes. Other ways to contribute include:
- making a feature request
- reporting a bug
- writing a test
- adding some documentation
- providing feedback on the project direction
- reporting your experience using it
For most things we will use GitHub issues and discussions, but feel free to join the project Matrix room to chat or ask questions.