Skip to content

Commit

Permalink
fix: typos (#1145)
Browse files Browse the repository at this point in the history
* fix: typos

* fix: yaml typo
  • Loading branch information
maro114510 authored Jun 25, 2024
1 parent 84cf8ec commit 91cb085
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Changes-v2.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ key, err := jwk.FromRaw(rawKey)
// Algorithm() now returns jwa.KeyAlgorithm type. `jws.Sign()`
// and other function that receive JWK algorithm names accept
// this new type, so you can use the same key and do the following
// (previosly you needed to type assert)
// (previously you needed to type assert)
jws.Sign(payload, jws.WithKey(key.Algorithm(), key))

// If you need the specific type, type assert
Expand Down
2 changes: 1 addition & 1 deletion docs/04-jwk.md
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,7 @@ The [`jwk.Set()`](https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk#Set) meth

[`jwk.Set()`](https://pkg.go.dev/github.com/lestrrat-go/jwx/v2/jwk#Set) may not alter the Key Type (`kty`) field of a key.

the `jwk` package defines field key names for predefined keys as constants so you won't ever have to bang your head againt the wall after finding out that you have a typo.
the `jwk` package defines field key names for predefined keys as constants so you won't ever have to bang your head against the wall after finding out that you have a typo.

```go
key.Set(jwk.KeyIDKey, `my-awesome-key`)
Expand Down
2 changes: 1 addition & 1 deletion docs/99-faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ So, for example, a service like Google will sign their JWTs using their private

Often times we have people asking us about github.com/lestrrat-go/jwx/v2/jwt not being able to parse a token... except, they are not JWTs.

For example, when a provider says they will give you an "access token" ... well, it *may* be a JWT, but often times they are just some sort of string key (which will definitely parse if you pass it to `jwt.Parse`). Sometimes what you really want is stored in a different token, and it may be called an "ID token". Who knows, these things vary between implementation to implemention.
For example, when a provider says they will give you an "access token" ... well, it *may* be a JWT, but often times they are just some sort of string key (which will definitely parse if you pass it to `jwt.Parse`). Sometimes what you really want is stored in a different token, and it may be called an "ID token". Who knows, these things vary between implementation to implementation.

After all, the only thing we can say is that you should check that you are parsing.

Expand Down
4 changes: 2 additions & 2 deletions jwk/cache.go
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ type PostFetcher interface {
PostFetch(string, Set) (Set, error)
}

// PostFetchFunc is a PostFetcher based on a functon.
// PostFetchFunc is a PostFetcher based on a function.
type PostFetchFunc func(string, Set) (Set, error)

func (f PostFetchFunc) PostFetch(u string, set Set) (Set, error) {
Expand Down Expand Up @@ -217,7 +217,7 @@ func (c *Cache) Register(u string, options ...RegisterOption) error {
}
}

// Set the transfomer at the end so that nobody can override it
// Set the transformer at the end so that nobody can override it
hrropts = append(hrropts, httprc.WithTransformer(t))
return c.cache.Register(u, hrropts...)
}
Expand Down
2 changes: 1 addition & 1 deletion jwk/options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ interfaces:
ReadFileOption is a type of `Option` that can be passed to `jwk.ReadFile`
- name: RegisterOption
comment: |
RegisterOption desribes options that can be passed to `(jwk.Cache).Register()`
RegisterOption describes options that can be passed to `(jwk.Cache).Register()`
options:
- ident: HTTPClient
interface: FetchOption
Expand Down
2 changes: 1 addition & 1 deletion jwk/options_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions jwk/refresh_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -469,10 +469,10 @@ func TestErrorSink(t *testing.T) {
// timing issues can cause this to be non-deterministic...
// we'll say it's okay as long as we're in +/- 1 range
l := errSink.Len()
if !assert.True(t, l <= 7, "number of errors shold be less than or equal to 7 (%d)", l) {
if !assert.True(t, l <= 7, "number of errors should be less than or equal to 7 (%d)", l) {
return
}
if !assert.True(t, l >= 5, "number of errors shold be greather than or equal to 5 (%d)", l) {
if !assert.True(t, l >= 5, "number of errors should be greater than or equal to 5 (%d)", l) {
return
}
})
Expand Down
2 changes: 1 addition & 1 deletion jwk/whitelist.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func (w *RegexpWhitelist) Add(pat *regexp.Regexp) *RegexpWhitelist {
return w
}

// IsAlloed returns true if any of the patterns in the whitelist
// IsAllowed returns true if any of the patterns in the whitelist
// returns true.
func (w *RegexpWhitelist) IsAllowed(u string) bool {
for _, pat := range w.patterns {
Expand Down
4 changes: 2 additions & 2 deletions jws/jws_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ func TestSignMulti2(t *testing.T) {
require.NoError(t, err, "Verify succeeded")
require.Equal(t, payload, verified, "verified payload matches")

// XXX This actally doesn't really test much, but if there was anything
// XXX This actually doesn't really test much, but if there was anything
// wrong, the process should have failed well before reaching here
require.Equal(t, payload, m.Payload(), "message payload matches")
})
Expand Down Expand Up @@ -1453,7 +1453,7 @@ func TestJKU(t *testing.T) {
return
}
require.Equal(t, payload, decoded, `decoded payload should match`)
// XXX This actally doesn't really test much, but if there was anything
// XXX This actually doesn't really test much, but if there was anything
// wrong, the process should have failed well before reaching here
require.Equal(t, payload, m.Payload(), "message payload matches")
}
Expand Down
6 changes: 3 additions & 3 deletions jwt/options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ options:
interface: ValidateOption
argument_type: time.Duration
comment: |
WithTruncation speficies the amount that should be used when
WithTruncation specifies the amount that should be used when
truncating time values used during time-based validation routines.
By default time values are truncated down to second accuracy.
If you want to use sub-second accuracy, you will need to set
Expand Down Expand Up @@ -199,14 +199,14 @@ options:
argument_type: jwe.EncryptOption
comment: |
WithEncryptOption provides an escape hatch for cases where extra options to
`(jws.Serializer).Encrypt()` must be specified when usng `jwt.Sign()`. Normally you do not
`(jws.Serializer).Encrypt()` must be specified when using `jwt.Sign()`. Normally you do not
need to use this.
- ident: SignOption
interface: SignOption
argument_type: jws.SignOption
comment: |
WithSignOption provides an escape hatch for cases where extra options to
`jws.Sign()` must be specified when usng `jwt.Sign()`. Normally you do not
`jws.Sign()` must be specified when using `jwt.Sign()`. Normally you do not
need to use this.
- ident: Validator
interface: ValidateOption
Expand Down
6 changes: 3 additions & 3 deletions jwt/options_gen.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 91cb085

Please sign in to comment.