Skip to content

Commit

Permalink
Merge branch 'v1.12' into sendgrid-dynamic-template
Browse files Browse the repository at this point in the history
  • Loading branch information
msfussell authored Jun 21, 2023
2 parents 809d6c6 + dd379f5 commit 8715f0c
Show file tree
Hide file tree
Showing 44 changed files with 1,166 additions and 199 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/link_validation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
run: |
python3 -m pip install --upgrade pip
pip3 install setuptools wheel twine tox mechanical-markdown
pip3 uninstall -y mistune
pip3 install mistune~=2.0.5 --no-cache-dir
- name: Check Markdown Files
run: |
for name in `find . -name "*.md"`; do echo -e "------\n$name" ; mm.py -l $name || exit 1 ;done
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/website-root.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Azure Static Web App Root
on:
push:
branches:
- v1.10
- v1.11
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- v1.10
- v1.11

jobs:
build_and_deploy_job:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ name: Azure Static Web App v1.9
on:
push:
branches:
- v1.11
- v1.12
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- v1.11
- v1.12

jobs:
build_and_deploy_job:
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ The following branches are currently maintained:

| Branch | Website | Description |
| ------------------------------------------------------------ | -------------------------- | ------------------------------------------------------------------------------------------------ |
| [v1.10](https://github.com/dapr/docs) (primary) | https://docs.dapr.io | Latest Dapr release documentation. Typo fixes, clarifications, and most documentation goes here. |
| [v1.11](https://github.com/dapr/docs/tree/v1.11) (pre-release) | https://v1-11.docs.dapr.io/ | Pre-release documentation. Doc updates that are only applicable to v1.11+ go here. |
| [v1.11](https://github.com/dapr/docs) (primary) | https://docs.dapr.io | Latest Dapr release documentation. Typo fixes, clarifications, and most documentation goes here. |
| [v1.12](https://github.com/dapr/docs/tree/v1.12) (pre-release) | https://v1-12.docs.dapr.io/ | Pre-release documentation. Doc updates that are only applicable to v1.12+ go here. |

For more information visit the [Dapr branch structure](https://docs.dapr.io/contributing/docs-contrib/contributing-docs/#branch-guidance) document.

Expand Down
11 changes: 7 additions & 4 deletions daprdocs/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Site Configuration
baseURL = "https://v1-11.docs.dapr.io"
baseURL = "https://v1-12.docs.dapr.io"
title = "Dapr Docs"
theme = "docsy"
disableFastRender = true
Expand Down Expand Up @@ -171,17 +171,20 @@ github_subdir = "daprdocs"
github_branch = "v1.11"

# Versioning
version_menu = "v1.11 (preview)"
version_menu = "v1.11 (latest)"
version = "v1.11"
archived_version = false
url_latest_version = "https://docs.dapr.io"

[[params.versions]]
version = "v1.11 (preview)"
version = "v1.12 (preview)"
url = "#"
[[params.versions]]
version = "v1.10 (latest)"
version = "v1.11 (latest)"
url = "https://docs.dapr.io"
[[params.versions]]
version = "v1.10"
url = "https://v1-10.docs.dapr.io"
[[params.versions]]
version = "v1.9"
url = "https://v1-9.docs.dapr.io"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,54 @@ Now that you've read about [Cryptography as a Dapr building block]({{< ref crypt

## Encrypt

Using the Dapr gRPC APIs in your project, you can encrypt a stream of data, such as a file.
{{< tabs "JavaScript" "Go" >}}

{{< tabs "Go" >}}
{{% codetab %}}

<!--JavaScript-->

Using the Dapr SDK in your project, with the gRPC APIs, you can encrypt data in a buffer or a string:

```js
// When passing data (a buffer or string), `encrypt` returns a Buffer with the encrypted message
const ciphertext = await client.crypto.encrypt(plaintext, {
// Name of the Dapr component (required)
componentName: "mycryptocomponent",
// Name of the key stored in the component (required)
keyName: "mykey",
// Algorithm used for wrapping the key, which must be supported by the key named above.
// Options include: "RSA", "AES"
keyWrapAlgorithm: "RSA",
});
```

The APIs can also be used with streams, to encrypt data more efficiently when it comes from a stream. The example below encrypts a file, writing to another file, using streams:

```js
// `encrypt` can be used as a Duplex stream
await pipeline(
fs.createReadStream("plaintext.txt"),
await client.crypto.encrypt({
// Name of the Dapr component (required)
componentName: "mycryptocomponent",
// Name of the key stored in the component (required)
keyName: "mykey",
// Algorithm used for wrapping the key, which must be supported by the key named above.
// Options include: "RSA", "AES"
keyWrapAlgorithm: "RSA",
}),
fs.createWriteStream("ciphertext.out"),
);
```

{{% /codetab %}}

{{% codetab %}}

<!--go-->

Using the Dapr SDK in your project, you can encrypt a stream of data, such as a file.

```go
out, err := sdkClient.Encrypt(context.Background(), rf, dapr.EncryptOptions{
// Name of the Dapr component (required)
Expand All @@ -35,18 +75,8 @@ out, err := sdkClient.Encrypt(context.Background(), rf, dapr.EncryptOptions{
})
```

{{% /codetab %}}

{{< /tabs >}}

The following example puts the `Encrypt` API in context, with code that reads the file, encrypts it, then stores the result in another file.

{{< tabs "Go" >}}

{{% codetab %}}

<!--go-->

```go
// Input file, clear-text
rf, err := os.Open("input")
Expand Down Expand Up @@ -81,18 +111,8 @@ if err != nil {
fmt.Println("Written", n, "bytes")
```

{{% /codetab %}}

{{< /tabs >}}

The following example uses the `Encrypt` API to encrypt a string.

{{< tabs "Go" >}}

{{% codetab %}}

<!--go-->

```go
// Input string
rf := strings.NewReader("Amor, ch’a nullo amato amar perdona, mi prese del costui piacer sì forte, che, come vedi, ancor non m’abbandona")
Expand Down Expand Up @@ -121,15 +141,41 @@ if err != nil {

## Decrypt

To decrypt a file, add the `Decrypt` gRPC API to your project.
{{< tabs "JavaScript" "Go" >}}

{{% codetab %}}

<!--JavaScript-->

Using the Dapr SDK, you can decrypt data in a buffer or using streams.

```js
// When passing data as a buffer, `decrypt` returns a Buffer with the decrypted message
const plaintext = await client.crypto.decrypt(ciphertext, {
// Only required option is the component name
componentName: "mycryptocomponent",
});

// `decrypt` can also be used as a Duplex stream
await pipeline(
fs.createReadStream("ciphertext.out"),
await client.crypto.decrypt({
// Only required option is the component name
componentName: "mycryptocomponent",
}),
fs.createWriteStream("plaintext.out"),
);
```

{{< tabs "Go" >}}
{{% /codetab %}}

{{% codetab %}}

<!--go-->

In the following example, `out` is a stream that can be written to file or read in memory, as in the examples above.
To decrypt a file, use the `Decrypt` gRPC API to your project.

In the following example, `out` is a stream that can be written to file or read in memory, as in the examples above.

```go
out, err := sdkClient.Decrypt(context.Background(), rf, dapr.EncryptOptions{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ metadata:
name: lockstore
spec:
type: lock.redis
version: v1
metadata:
- name: redisHost
value: localhost:6379
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ Place `subscription.yaml` in the same directory as your `pubsub.yaml` component.

Below are code examples that leverage Dapr SDKs to subscribe to the topic you defined in `subscription.yaml`.

{{< tabs Dotnet Java Python Go Javascript>}}
{{< tabs Dotnet Java Python Go JavaScript>}}

{{% codetab %}}

Expand Down
Loading

0 comments on commit 8715f0c

Please sign in to comment.