Skip to content

Commit b731144

Browse files
autodoc updates (#1480)
Co-authored-by: lestrrat <[email protected]>
1 parent 8923c67 commit b731144

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

docs/03-jwe.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,12 @@ func Example_jwe_encrypt_json() {
196196
}
197197

198198
const payload = `Lorem ipsum`
199-
encrypted, err := jwe.Encrypt([]byte(payload), jwe.WithJSON(), jwe.WithKey(jwa.RSA_OAEP(), pubkey))
199+
encrypted, err := jwe.Encrypt(
200+
[]byte(payload),
201+
jwe.WithJSON(), // Toggle JSON serialization. Because there's only one key (recipient), this will produce Flattened JSON serialization
202+
jwe.WithLegacyHeaderMerging(false), // Disable legacy header merging
203+
jwe.WithKey(jwa.RSA_OAEP(), pubkey), // Public key for encryption
204+
)
200205
if err != nil {
201206
fmt.Printf("failed to encrypt payload: %s\n", err)
202207
return

0 commit comments

Comments
 (0)