Enricher Aggregator
This Aggregator ensures that each enriched issue is sent to consumers only once
and with all its annotations from all the enrichers that ran on it.
If you are using multiple enrichers it is highly recommended you add this
aggregation step.
On top of aggregating, it can optionally append a signature to the message.
Signing
Signing is achieved using libsodium's
golang.org/x/crypto/nacl
sign
package.
The aggregator expects a base64 encoded, 64 byte private key to be provided as a
Task parameter. If the key is provided, each Enriched Result will have an
annotation named "JSON-Message-Signature"
. The value of
"JSON-Message-Signature"
will be the signed message serialised in JSON and
base64 encoded.
You can validate the signature by running
decoded, _ := base64.StdEncoding.DecodeString(issue.Annotations["JSON-Message-Signature"])
_, valid := sign.Open(nil, decoded, publicKey)
assert.True(t, valid)
A key set can be generated by running:
public, private, err := sign.GenerateKey(rand.Reader)
signKey = base64.StdEncoding.EncodeToString(private[:])