Skip to content

streamingfast/opaque

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

StreamingFast Opaque library

reference License

Encrypt plaintexts for simple obfuscation, like database cursors. It is used in StramingFast.

Usage

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"}

Contributing

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.

License

Apache 2.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages