API Reference

Retrieves our public key

Get our Public Key, in .pem format, to verify the authenticity of our messages

Get our Public Key, in pem encoding, to verify the authenticity of our messages. The key is in ECDSA format.

At the moment, this is used exclusively to verify the authenticity of Webhook sent events.

We provide below examples on how you can parse the key and have it ready to be used in your project.

const apiUrl = "https://api.brla.digital:4567"
type PublicKeyRes struct {
  PublicKey string `json:"publicKey"`
}

req, _ := http.NewRequest("GET", apiUrl+"/v1/pubkey", nil)
req.Header.Set("Content-Type", "application/json")

resp, err := http.DefaultClient.Do(req)
if err != nil {
  log.Fatal(err)
}

pubKeyBytes, err := io.ReadAll(resp.Body)
if err != nil {
  log.Fatal(err)
}

var pubKeyData PublicKeyRes

err = json.Unmarshal(pubKeyBytes, &pubKeyData)
if err != nil {
  log.Fatal(err)
}

blockPub, _ := pem.Decode([]byte(pubKeyData.PublicKey))
if blockPub == nil {
  log.Fatal("failed parsing pub key")
}
pubKeyUntyped, err := x509.ParsePKIXPublicKey(blockPub.Bytes)
if err != nil {
  log.Fatal(err)
}
pubKey, ok := pubKeyUntyped.(*ecdsa.PublicKey)
if !ok {
  log.Fatal("pub key wrong type")
}
Language
URL
Click Try It! to start a request and see the response here!