1
1
# Dapr Crypto Example with go-sdk
2
2
3
- ## Step
3
+ ## Steps
4
4
5
5
### Prepare
6
6
7
7
- Dapr installed
8
8
9
9
> In order to run this sample, make sure that OpenSSL is available on your system.
10
10
11
+ ### Running
11
12
12
- This sample requires a private RSA key and a 256-bit symmetric (AES) key. We will generate them using OpenSSL:
13
+ 1 . This sample requires a private RSA key and a 256-bit symmetric (AES) key. We will generate them using OpenSSL:
14
+
15
+ <!-- STEP
16
+ name: Generate crypto
17
+ expected_stderr_lines:
18
+ output_match_mode: substring
19
+ background: false
20
+ sleep: 5
21
+ timeout_seconds: 30
22
+ -->
13
23
14
24
``` bash
15
25
mkdir -p keys
@@ -21,19 +31,21 @@ openssl rand -out keys/symmetric-key-256 32
21
31
22
32
<!-- END_STEP -->
23
33
24
- 3 . Run the Go service app with Dapr:
34
+ 2 . Run the Go service app with Dapr:
25
35
26
36
<!-- STEP
27
- name: Run crypto service
37
+ name: Run crypto example
28
38
expected_stdout_lines:
29
39
- '== APP == Encrypted the message, got 856 bytes'
30
40
- '== APP == Decrypted the message, got 24 bytes'
31
41
- '== APP == The secret is "passw0rd"'
32
- - '== APP == Wrote decrypted data to encrypted.out'
42
+ - '== APP == Wrote encrypted data to encrypted.out'
33
43
- '== APP == Wrote decrypted data to decrypted.out.jpg'
34
44
- "Exited App successfully"
35
45
expected_stderr_lines:
36
46
output_match_mode: substring
47
+ sleep: 30
48
+ timeout_seconds: 90
37
49
-->
38
50
39
51
``` bash
@@ -44,20 +56,13 @@ dapr run --app-id crypto --resources-path ./components/ -- go run .
44
56
45
57
### Cleanup
46
58
47
- <!-- STEP
48
- expected_stdout_lines:
49
- - '✅ app stopped successfully: crypto'
50
- expected_stderr_lines:
51
- name: Shutdown dapr
52
- -->
59
+ ` ctrl + c ` to stop execution
53
60
54
61
``` bash
55
62
dapr stop --app-id crypto
56
63
(lsof -i:8080 | grep crypto) | awk ' {print $2}' | xargs kill
57
64
```
58
65
59
- <!-- END_STEP -->
60
-
61
66
## Result
62
67
63
68
``` shell
0 commit comments