Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use encrytped data in example as recommended in Privacy and Security section #1290

Closed
wants to merge 4 commits into from
Closed
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 31 additions & 3 deletions cloudevents/spec.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ data.
- [Event Data](#event-data)
- [Size Limits](#size-limits)
- [Privacy & Security](#privacy-and-security)
- [Example](#example)
- [Example](#examples)

## Overview

Expand Down Expand Up @@ -608,9 +608,9 @@ Consider the following to prevent inadvertent leakage especially when leveraging
Protocol level security SHOULD be employed to ensure the trusted and secure
exchange of CloudEvents.

## Example
## Examples

The following example shows a CloudEvent serialized as JSON:
### Example of a CloudEvent with extension fields

```JSON
{
Expand All @@ -626,3 +626,31 @@ The following example shows a CloudEvent serialized as JSON:
"data" : "<much wow=\"xml\"/>"
}
```

### Example of a CloudEvent with encrypted data

The following example shows a CloudEvent serialized as JSON with line-breaks
for display purposes only:

```
{
"specversion" : "1.0",
"type" : "PAYMENT.AUTHORIZATION.CREATED",
"source" : "https://paymentprocessor.example.com/",
"subject" : "c7bbb040-d458-4d47-82a8-45413f9f2d33",
"id" : "a978702e-ef48-4032-ac18-a057e0104076",
"time" : "2024-05-30T17:31:00Z",
"datacontenttype" : "application/jose",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, my bad

"data" : "eyJhbGciOiJSU0EtT0FFUCIsImVuYyI6IkEyNTZHQ00ifQ.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be "data_base64"?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, because the contenttype defines what data is.
I think data_base64 is a short hand for contenttype base64 and a data field.
The contenttype in this example "application/jose" is correct.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, data_base64 doesn't mean that the content-type is base64, rather, it just means that the data serialization within this CE uses base64 rather than raw JSON. For example, it's possible to have content-type be application/json but then use data_base64 to serialize your json even if the json is as simple as {} (e.g. e30K)

OKOawDo13gRp2ojaHV7LFpZcgV7T6DVZKTyKOMTYUmKoTCVJRgckCL9kiMT03JGe
ipsEdY3mx_etLbbWSrFr05kLzcSr4qKAq7YN7e9jwQRb23nfa6c9d-StnImGyFDb
Sv04uVuxIp5Zms1gNxKKK2Da14B8S4rzVRltdYwam_lDp5XnZAYpQdb76FdIKLaV
mqgfwX7XWRxv2322i-vDxRfqNzo_tETKzpVLzfiwQyeyPGLBIO56YJ7eObdv0je8
1860ppamavo35UgoRdbYaBcoh9QcfylQr66oc6vFWXRcZ_ZT2LawVCWTIy3brGPi
6UklfCpIMfIjf7iGdXKHzg.
48V1_ALb6US04U3b.
5eym8TW_c8SuK0ltJ3rpYIzOeDQz7TALvtu6UG9oMo4vpzs9tX_EFShS8iB7j6ji
SdiwkIr3ajwQzaBtQD_A.
XFBoMYUZodetZdvTiFvSkQ"
}
```
Loading