aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjuerg <juerg@google.com>2023-07-10 07:06:20 -0700
committerCopybara-Service <copybara-worker@google.com>2023-07-10 07:07:38 -0700
commita078fcd86a7082f9d12a3ba90b92a9e70d704859 (patch)
tree349d79a929b974773c8cef97658d74b798cc1c5e
parent0bc4e25cd6e21862629247f3c632d4874d536573 (diff)
downloadtink-a078fcd86a7082f9d12a3ba90b92a9e70d704859.tar.gz
Add documentation marks to JWT tests in golang.
PiperOrigin-RevId: 546861456
-rw-r--r--go/jwt/jwt_test.go6
1 files changed, 6 insertions, 0 deletions
diff --git a/go/jwt/jwt_test.go b/go/jwt/jwt_test.go
index 1d31df286..97a3201f3 100644
--- a/go/jwt/jwt_test.go
+++ b/go/jwt/jwt_test.go
@@ -27,6 +27,7 @@ import (
"github.com/google/tink/go/keyset"
)
+// [START jwt-signature-example]
func Example_signAndVerify() {
// A private keyset created with
// "tinkey create-keyset --key-template=JWT_RS256_2048_F4 --out private_keyset.cfg".
@@ -138,6 +139,8 @@ func Example_signAndVerify() {
// Output: example subject
}
+// [END jwt-signature-example]
+
func Example_verifyWithJWKS() {
// A signed token with the subject 'example subject', audience 'example audience'.
// and expiration on 2023-03-23.
@@ -197,6 +200,7 @@ func Example_verifyWithJWKS() {
// Output: example subject
}
+// [START jwt-mac-example]
func Example_computeMACAndVerify() {
// Generate a keyset handle.
handle, err := keyset.NewHandle(jwt.HS256Template())
@@ -250,3 +254,5 @@ func Example_computeMACAndVerify() {
fmt.Println(extractedCustomClaim)
// Output: my custom claim
}
+
+// [END jwt-mac-example]