{"modulePath":"github.com/GoPlugin/libocr","version":"v0.1.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package config\n\n## Constants\n\n```go\nconst (\n\tOCR2OffchainConfigVersion = 2\n\tOCR3OffchainConfigVersion = 30\n)\n```\n\n```go\nconst SharedSecretSize = 16 // A 128-bit symmetric key\n\n```\n\n## Types\n\n```go\ntype EncryptedSharedSecret [SharedSecretSize]byte\n```\n\n```go\ntype OracleIdentity struct {\n\tOffchainPublicKey types.OffchainPublicKey\n\tOnchainPublicKey  types.OnchainPublicKey\n\tPeerID            string\n\tTransmitAccount   types.Account\n}\n```\n\n```go\ntype SharedSecretEncryptions struct {\n\t// (secret key chosen by dealer) * g, X25519 point\n\tDiffieHellmanPoint [curve25519.PointSize]byte\n\n\t// keccak256 of plaintext sharedSecret.\n\t//\n\t// Since SharedSecretEncryptions are shared through a smart contract, each\n\t// oracle will see the same SharedSecretHash. After decryption, oracles can\n\t// check their sharedSecret against SharedSecretHash to prevent the dealer\n\t// from equivocating\n\tSharedSecretHash common.Hash\n\n\t// Encryptions of the shared secret with one entry for each oracle. The\n\t// i-th oracle can recover the key as follows:\n\t//\n\t// 1. key := Keccak256(DH(DiffieHellmanPoint, process' secret key))[:16]\n\t// 2. sharedSecret := AES128DecryptBlock(key, Encryptions[i])\n\t//\n\t// See Decrypt for details.\n\tEncryptions []EncryptedSharedSecret\n}\n```\nSharedSecretEncryptions is the encryptions of SharedConfig.SharedSecret, using each oracle's SharedSecretEncryptionPublicKey.\n\nWe use a custom encryption scheme to be more space-efficient (compared to standard AEAD schemes, nacl crypto\\_box, etc...), which saves gas in transmission to the OCR2Aggregator.\n\n```go\nfunc XXXEncryptSharedSecret(\n\tkeys []types.ConfigEncryptionPublicKey,\n\tsharedSecret *[SharedSecretSize]byte,\n\trand io.Reader,\n) SharedSecretEncryptions\n```\nXXXEncryptSharedSecret constructs a SharedSecretEncryptions from a set of SharedSecretEncryptionPublicKeys, the sharedSecret, and a cryptographic randomness source\n\n```go\nfunc XXXEncryptSharedSecretInternal(\n\tpublicKeys []types.ConfigEncryptionPublicKey,\n\tsharedSecret *[SharedSecretSize]byte,\n\tsk *[32]byte,\n) SharedSecretEncryptions\n```\nXXXEncryptSharedSecretInternal constructs a SharedSecretEncryptions from a set of SharedSecretEncryptionPublicKeys, the sharedSecret, and an ephemeral secret key sk\n\n```go\nfunc (e SharedSecretEncryptions) Decrypt(oid commontypes.OracleID, k types.OffchainKeyring) (*[SharedSecretSize]byte, error)\n```\nDecrypt returns the sharedSecret\n\n```go\nfunc (e SharedSecretEncryptions) Equal(e2 SharedSecretEncryptions) bool\n```\n\n","path":"github.com/GoPlugin/libocr/offchainreporting2plus/internal/config","name":"config","synopsis":"","isRedistributable":true}
