Skip to content

Commit

Permalink
Adjusting jwt documentation examples
Browse files Browse the repository at this point in the history
Signed-off-by: iquirino <[email protected]>
  • Loading branch information
iquirino committed Aug 15, 2023
1 parent ac9f258 commit d39c554
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions internal/impl/crypto/jwt_sign.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,10 @@ func registerSignJwtMethod(m signJwtMethodSpec) error {
func registerSignJwtMethods() error {
dummySecretHMAC := "dont-tell-anyone"
dummySecretRSA := `-----BEGIN RSA PRIVATE KEY-----
...
... signature data ...
-----END RSA PRIVATE KEY-----`
dummySecretECDSA := `-----BEGIN EC PRIVATE KEY-----
...
... signature data ...
-----END EC PRIVATE KEY-----`

for _, m := range []signJwtMethodSpec{
Expand Down
24 changes: 12 additions & 12 deletions website/docs/guides/bloblang/methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ root.foo = this.foo.lowercase()

Parses a claims object from a JWT string encoded with ES256. This method does not validate JWT claims.

Introduced in version v4.20.0.
Introduced in version v4.19.0.


#### Parameters
Expand All @@ -456,7 +456,7 @@ dp0Gta53G35VerNDgUUXmp78J2kfh4qLdh0XtmOMI587tCaqjvDAXfs//w==

Parses a claims object from a JWT string encoded with ES384. This method does not validate JWT claims.

Introduced in version v4.20.0.
Introduced in version v4.19.0.


#### Parameters
Expand All @@ -481,7 +481,7 @@ MHYwEAYHKoZIzj0CAQYFK4EEACIDYgAERoz74/B6SwmLhs8X7CWhnrWyRrB13AuU

Parses a claims object from a JWT string encoded with ES512. This method does not validate JWT claims.

Introduced in version v4.20.0.
Introduced in version v4.19.0.


#### Parameters
Expand Down Expand Up @@ -2512,7 +2512,7 @@ root = this.foo.merge(this.bar)

Hash and sign an object representing JSON Web Token (JWT) claims using ES256.

Introduced in version v4.20.0.
Introduced in version v4.19.0.


#### Parameters
Expand All @@ -2524,7 +2524,7 @@ Introduced in version v4.20.0.

```coffee
root.signed = this.claims.sign_jwt_es256("""-----BEGIN EC PRIVATE KEY-----
...
... signature data ...
-----END EC PRIVATE KEY-----""")

# In: {"claims":{"sub":"user123"}}
Expand All @@ -2535,7 +2535,7 @@ root.signed = this.claims.sign_jwt_es256("""-----BEGIN EC PRIVATE KEY-----

Hash and sign an object representing JSON Web Token (JWT) claims using ES384.

Introduced in version v4.20.0.
Introduced in version v4.19.0.


#### Parameters
Expand All @@ -2547,7 +2547,7 @@ Introduced in version v4.20.0.

```coffee
root.signed = this.claims.sign_jwt_es384("""-----BEGIN EC PRIVATE KEY-----
...
... signature data ...
-----END EC PRIVATE KEY-----""")

# In: {"claims":{"sub":"user123"}}
Expand All @@ -2558,7 +2558,7 @@ root.signed = this.claims.sign_jwt_es384("""-----BEGIN EC PRIVATE KEY-----

Hash and sign an object representing JSON Web Token (JWT) claims using ES512.

Introduced in version v4.20.0.
Introduced in version v4.19.0.


#### Parameters
Expand All @@ -2570,7 +2570,7 @@ Introduced in version v4.20.0.

```coffee
root.signed = this.claims.sign_jwt_es512("""-----BEGIN EC PRIVATE KEY-----
...
... signature data ...
-----END EC PRIVATE KEY-----""")

# In: {"claims":{"sub":"user123"}}
Expand Down Expand Up @@ -2656,7 +2656,7 @@ Introduced in version v4.18.0.

```coffee
root.signed = this.claims.sign_jwt_rs256("""-----BEGIN RSA PRIVATE KEY-----
...
... signature data ...
-----END RSA PRIVATE KEY-----""")

# In: {"claims":{"sub":"user123"}}
Expand All @@ -2679,7 +2679,7 @@ Introduced in version v4.18.0.

```coffee
root.signed = this.claims.sign_jwt_rs384("""-----BEGIN RSA PRIVATE KEY-----
...
... signature data ...
-----END RSA PRIVATE KEY-----""")

# In: {"claims":{"sub":"user123"}}
Expand All @@ -2702,7 +2702,7 @@ Introduced in version v4.18.0.

```coffee
root.signed = this.claims.sign_jwt_rs512("""-----BEGIN RSA PRIVATE KEY-----
...
... signature data ...
-----END RSA PRIVATE KEY-----""")

# In: {"claims":{"sub":"user123"}}
Expand Down

0 comments on commit d39c554

Please sign in to comment.