Skip to content

Commit

Permalink
refactor(types): add explicit type to all exported symbols
Browse files Browse the repository at this point in the history
  • Loading branch information
panva committed Mar 29, 2024
1 parent f4b0e24 commit c66c595
Show file tree
Hide file tree
Showing 10 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion docs/variables/clockSkew.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

[💗 Help the project](https://github.com/sponsors/panva)

`Const` **clockSkew**: typeof [`clockSkew`](clockSkew.md)
`Const` **clockSkew**: unique `symbol`
2 changes: 1 addition & 1 deletion docs/variables/clockTolerance.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

[💗 Help the project](https://github.com/sponsors/panva)

`Const` **clockTolerance**: typeof [`clockTolerance`](clockTolerance.md)
`Const` **clockTolerance**: unique `symbol`
2 changes: 1 addition & 1 deletion docs/variables/customFetch.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[💗 Help the project](https://github.com/sponsors/panva)

`Const` **customFetch**: typeof [`customFetch`](customFetch.md)
`Const` **customFetch**: unique `symbol`

When configured on an interface that extends [HttpRequestOptions](../interfaces/HttpRequestOptions.md), that's every `options`
parameter for functions that trigger HTTP Requests, this replaces the use of global fetch. As a
Expand Down
2 changes: 1 addition & 1 deletion docs/variables/expectNoNonce.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[💗 Help the project](https://github.com/sponsors/panva)

`Const` **expectNoNonce**: typeof [`expectNoNonce`](expectNoNonce.md)
`Const` **expectNoNonce**: unique `symbol`

Use this as a value to [processAuthorizationCodeOpenIDResponse](../functions/processAuthorizationCodeOpenIDResponse.md) `expectedNonce` parameter to
indicate no `nonce` ID Token claim value is expected, i.e. no `nonce` parameter value was sent
Expand Down
2 changes: 1 addition & 1 deletion docs/variables/expectNoState.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[💗 Help the project](https://github.com/sponsors/panva)

`Const` **expectNoState**: typeof [`expectNoState`](expectNoState.md)
`Const` **expectNoState**: unique `symbol`

Use this as a value to [validateAuthResponse](../functions/validateAuthResponse.md) `expectedState` parameter to indicate no
`state` parameter value is expected, i.e. no `state` parameter value was sent with the
Expand Down
2 changes: 1 addition & 1 deletion docs/variables/skipAuthTimeCheck.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[💗 Help the project](https://github.com/sponsors/panva)

`Const` **skipAuthTimeCheck**: typeof [`skipAuthTimeCheck`](skipAuthTimeCheck.md)
`Const` **skipAuthTimeCheck**: unique `symbol`

Use this as a value to [processAuthorizationCodeOpenIDResponse](../functions/processAuthorizationCodeOpenIDResponse.md) `maxAge` parameter to
indicate no `auth_time` ID Token claim value check should be performed.
2 changes: 1 addition & 1 deletion docs/variables/skipStateCheck.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[💗 Help the project](https://github.com/sponsors/panva)

`Const` **skipStateCheck**: typeof [`skipStateCheck`](skipStateCheck.md)
`Const` **skipStateCheck**: unique `symbol`

DANGER ZONE

Expand Down
2 changes: 1 addition & 1 deletion docs/variables/skipSubjectCheck.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[💗 Help the project](https://github.com/sponsors/panva)

`Const` **skipSubjectCheck**: typeof [`skipSubjectCheck`](skipSubjectCheck.md)
`Const` **skipSubjectCheck**: unique `symbol`

DANGER ZONE

Expand Down
2 changes: 1 addition & 1 deletion docs/variables/useMtlsAlias.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

[💗 Help the project](https://github.com/sponsors/panva)

`Const` **useMtlsAlias**: typeof [`useMtlsAlias`](useMtlsAlias.md)
`Const` **useMtlsAlias**: unique `symbol`

When combined with [customFetch](customFetch.md) (to use a Fetch API implementation that supports client
certificates) this can be used to target FAPI 2.0 profiles that utilize Mutual-TLS for either
Expand Down
18 changes: 9 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,8 @@ interface JWK {
readonly [parameter: string]: JsonValue | undefined
}

export const clockSkew = Symbol()
export const clockTolerance = Symbol()
export const clockSkew: unique symbol = Symbol()
export const clockTolerance: unique symbol = Symbol()

/**
* When configured on an interface that extends {@link HttpRequestOptions}, that's every `options`
Expand Down Expand Up @@ -280,7 +280,7 @@ export const clockTolerance = Symbol()
* })
* ```
*/
export const customFetch = Symbol()
export const customFetch: unique symbol = Symbol()

/**
* When combined with {@link customFetch} (to use a Fetch API implementation that supports client
Expand Down Expand Up @@ -344,7 +344,7 @@ export const customFetch = Symbol()
*
* @see [RFC 8705 - OAuth 2.0 Mutual-TLS Client Authentication and Certificate-Bound Access Tokens](https://www.rfc-editor.org/rfc/rfc8705.html)
*/
export const useMtlsAlias = Symbol()
export const useMtlsAlias: unique symbol = Symbol()

/**
* Authorization Server Metadata
Expand Down Expand Up @@ -2288,7 +2288,7 @@ async function getPublicSigKeyFromIssuerJwksUri(
*
* @see [OpenID Connect Core 1.0](https://openid.net/specs/openid-connect-core-1_0.html#UserInfoResponse)
*/
export const skipSubjectCheck = Symbol()
export const skipSubjectCheck: unique symbol = Symbol()

function getContentType(response: Response) {
return response.headers.get('content-type')?.split(';')[0]
Expand Down Expand Up @@ -2879,13 +2879,13 @@ export interface ClientCredentialsGrantResponse {
* indicate no `nonce` ID Token claim value is expected, i.e. no `nonce` parameter value was sent
* with the authorization request.
*/
export const expectNoNonce = Symbol()
export const expectNoNonce: unique symbol = Symbol()

/**
* Use this as a value to {@link processAuthorizationCodeOpenIDResponse} `maxAge` parameter to
* indicate no `auth_time` ID Token claim value check should be performed.
*/
export const skipAuthTimeCheck = Symbol()
export const skipAuthTimeCheck: unique symbol = Symbol()

/**
* (OpenID Connect only) Validates Authorization Code Grant Response instance to be one coming from
Expand Down Expand Up @@ -3904,14 +3904,14 @@ function getURLSearchParameter(parameters: URLSearchParams, name: string): strin
* [draft-bradley-oauth-jwt-encoded-state-09](https://datatracker.ietf.org/doc/html/draft-bradley-oauth-jwt-encoded-state-09).
* It is expected you'll validate such `state` value yourself.
*/
export const skipStateCheck = Symbol()
export const skipStateCheck: unique symbol = Symbol()

/**
* Use this as a value to {@link validateAuthResponse} `expectedState` parameter to indicate no
* `state` parameter value is expected, i.e. no `state` parameter value was sent with the
* authorization request.
*/
export const expectNoState = Symbol()
export const expectNoState: unique symbol = Symbol()

/**
* Validates an OAuth 2.0 Authorization Response or Authorization Error Response message returned
Expand Down

0 comments on commit c66c595

Please sign in to comment.