This describes a list of applications that offer users already vetted by an approved trust organisation, access to the dhamana-protocol. Communication between PoA Apps and the dhamana-protocol server backend is double encrypted to reduced chances of a middle man attack.
In the Dhamana Protocol overview the PoA app are at the top layer.
Certicates used below are fake and are just required to test for server connection.
// Copyright (c) 2023 Migwi Ndung'u
// See LICENSE for details.
package main
import (
"crypto/tls"
"io"
"log"
"net/http"
"time"
)
const clientKey = `-----BEGIN PRIVATE KEY-----
MIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQC1tovRQXY4Ni4l
Gqk0dm4uNSAimpP/Px7ABlw23nTkGvixnfpZZtYKrKYPLQvBPvQso7xeftuCgrly
H46BzbR8JVUfarP1VpTMlZIQVnJw0++B3u0/ddgHJucaU/03OkuMpCOqfqabFz1M
GS95wdSCScuZQtJP/MW25KwM+zdU52e/gQSN2dO0JyNkDvn26XbqbyJJ6TYVJWVB
H7W4sBR1xjQU2YNTnUKhxsld4lumFuOAFWTOPuhac+H9ydSHOWa+EhQrGccvEHjU
Pmh2xFkxljo0eJEdsbi6aDzmHGLpsnjZwjbkywd0V15tq70XkYSbtnKaf8ph4r+9
i5NXikO/AgMBAAECggEALpeT2h/S1C7wPgtL/2uubKKqjrTb5cKle88lrdv0VNil
k8VR/8Jid3I1UgbW0MH3kcqZ7hDQ7/Hc4uo8fAPmlz5rSRbu9aUxmhNv1EiWJ1/w
NXiXlIH+1jafYxzN/G8yF+muS3UV+wZGbVC335xXhOCvF6kOi/vgJjkT9HAli9sr
FmgKtit+A5sotFXmqCVB0EROYPmzj8j90SEeaMHdMGqJ8Vj/1q67BLAE/f2awB5U
tCR4eFwE4zSq2D5xBb1cL+L8IBors+Tp1jzPyhpK7GpOPWu+xjt8LGKdUcqx7mdF
Bi0bazBXcWEv8TbsLczLP7kHZIoLc9ufXkTp8YqxoQKBgQDdXGn7EqmLE/xfRErD
LutdcWe6CCVx6I9pbTpC3TnpVr4TtCyora89Pd09ShTdGvLQEVEdgxN2YpeKYL3C
j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-----
`
func main() {
cert, err := tls.X509KeyPair([]byte(clientCert), []byte(clientKey))
if err != nil {
log.Fatalf("server: loadkeys: %s", err)
}
tr := &http.Transport{
MaxIdleConns: 10,
IdleConnTimeout: 30 * time.Second,
DisableCompression: true,
TLSClientConfig: &tls.Config{
Certificates: []tls.Certificate{cert},
InsecureSkipVerify: true,
},
}
client := &http.Client{Transport: tr}
resp, err := client.Get("https://127.0.0.1:30443")
if err != nil {
log.Fatalf("request err : %v", err)
}
data, err := io.ReadAll(resp.Body)
if err != nil {
log.Fatalf("reading the request body failed: %v", err)
}
log.Printf("client: %s", string(data))
}
On running this with a server on https://127.0.0.1:30443 you should get the following response to confirm connection to the dhamana-protocol server.
2023/08/29 00:23:20 client: "Pi encrypted 715b48145c501951595355505d194050475a135a5d4251595d5d40021301705647585b5d600c7d527f615760417f63477d5a696045610348437f470d790757"