github.com/s7techlab/cckit@v0.10.5/extensions/encryption/must.go (about) 1 package encryption 2 3 import ( 4 "github.com/hyperledger/fabric-protos-go/peer" 5 ) 6 7 // MustEncryptEvent helper for EncryptEvent. Panics in case of error. 8 func MustEncryptEvent(encKey []byte, event *peer.ChaincodeEvent) *peer.ChaincodeEvent { 9 encrypted, err := EncryptEvent(encKey, event) 10 if err != nil { 11 panic(err) 12 } 13 return encrypted 14 } 15 16 // MustDecryptEvent helper for DecryptEvent. Panics in case of error. 17 func MustDecryptEvent(encKey []byte, event *peer.ChaincodeEvent) *peer.ChaincodeEvent { 18 decrypted, err := DecryptEvent(encKey, event) 19 if err != nil { 20 panic(err) 21 } 22 23 return decrypted 24 }