MCPcopy Create free account
hub / github.com/google/go-cloud / DecryptDecode

Function DecryptDecode

runtimevar/runtimevar.go:484–495  ·  view source on GitHub ↗

DecryptDecode returns a decode function that can be passed to NewDecoder when decoding an encrypted message (https://godoc.org/gocloud.dev/secrets). post defaults to BytesDecode. An optional decoder can be passed in to do further decode operation based on the decrypted message.

(k *secrets.Keeper, post Decode)

Source from the content-addressed store, hash-verified

482// post defaults to BytesDecode. An optional decoder can be passed in to do
483// further decode operation based on the decrypted message.
484func DecryptDecode(k *secrets.Keeper, post Decode) Decode {
485 return func(ctx context.Context, b []byte, obj any) error {
486 decrypted, err := k.Decrypt(ctx, b)
487 if err != nil {
488 return err
489 }
490 if post == nil {
491 return BytesDecode(ctx, decrypted, obj)
492 }
493 return post(ctx, decrypted, obj)
494 }
495}
496
497// DecoderByName returns a *Decoder based on decoderName.
498//

Callers 3

ExampleDecryptDecodeFunction · 0.92
maybeDecryptFunction · 0.85
TestDecryptDecoderFunction · 0.85

Calls 2

BytesDecodeFunction · 0.85
DecryptMethod · 0.65

Tested by 2

ExampleDecryptDecodeFunction · 0.74
TestDecryptDecoderFunction · 0.68