Encrypt plaintexts for simple obfuscation, like database cursors. It is used in StramingFast.
Encode a proto message into an opaque element:
cursor := pb.Cursor{Id: "123"}
payload, err := proto.Marshal(&cursor)
if err != nil { panic(err) }
out := opaque.Encode(payload)
// out == "xE77fJ_z6Z7UXwyx-e0kWqTtdc4yRR8vAEnvaUQSx96y"
Decode opaque element into a proto message:
payload, err := opaque.Decode("xE77fJ_z6Z7UXwyx-e0kWqTtdc4yRR8vAEnvaUQSx96y")
if err != nil { panic(fmt.Errorf("invalid cursor: %w", err)) }
cursor := pb.Cursor{}
err := proto.Unmarshal(payload, &cursor)
if err != nil { panic(err) }
// out == pb.Cursor{Id: "123"}
Issues and PR in this repo related strictly to the opaque library.
Report any protocol-specific issues in their respective repositories
Please first refer to the general StreamingFast contribution guide, if you wish to contribute to this code base.
This codebase uses unit tests extensively, please write and run tests.