# @theorchard/backend-m2m-token-manager

## 0.9.0

### Minor Changes

- PP-1385 Update ImpersonationM2MTokenManager to perform retries when generating an Impersonation JWT. This handles when Auth0 returns 429 (Too Many Requests), 502, 503, 504 HTTP Status Codes, which are indicative of Auth0 having too much load, and needing clients to back-off.
- Update the getBackoffWithFullJitter (private method) to return in milliseconds unit
- Update the Auth0TokenException to take ErrorOptions as opposed to a detail string

## 0.8.0

### Minor Changes

- PP-1201: Enable injecting a Logger to M2MTokenManager.

The `M2MTokenManager` constructor now accepts an optional `logger` parameter that
implements the `Logger` interface. If not provided, a `ConsoleLogger` is used by default.
This allows clients to integrate their own logging implementations for better observability of
token management operations.

## 0.7.2

### Patch Changes

- MAINT: Internal fix to for the FakeTimer used in unit tests.

## 0.7.1

### Patch Changes

- Add helper functions for calculating backoff and backoff with jitter

## 0.7.0

### Patch Changes

- PP-1209 Create impersonationM2MAuthorizationLink and createImpersonationM2MAuthorizationContextSetter for use with ApolloClient.

## 0.6.0

### Minor Changes

- PP-1209 Add ImpersonationM2MTokenManager class, and unit tests

## 0.5.0

### Minor Changes

- PP-1209 Add generateJwtTokenWithImpersonation helper function. This is used to call the Auth0 /oauth/token endpoint to get an impersonation jwt

## 0.4.0

### Minor Changes

- PP-1209 Add ClientCredentialsSchema and OAuthTokenSchema classes, including unit tests

## 0.3.0

### Minor Changes

- MAINT: Extend M2MTokenManager to support using a custom cache key. This is useful when the cache is shared by two machines, each with their own M2MTokenManager

## 0.2.2

### Patch Changes

- PLATFORM-4550 Update ICache interface to allow get to return undefined result

## 0.2.1

### Patch Changes

- MAINT: Bump ts-jest to get patched versions of brace-expansion and @babel/helpers

## 0.2.0

### Minor Changes

- PP-939 Add an ContextSetter for Apollo Graphql Clients to hydrate a context's headers an Dedicated M2M JWT Token as the Authorization header bearer token.

## 0.1.11

### Patch Changes

- PP-936 Add generic ICache interface type. It has async methods for get and set, and would allow us to wrap another cache library like redis-node to use with the M2MTokenManager

## 0.1.10

### Patch Changes

- PP-936 Update M2MTokenManager to use in-memory cache using a Map obj

## 0.1.9

### Patch Changes

- PP-936 Add basic M2MTokenManager.getTokenString implementation

## 0.1.8

### Patch Changes

- PP-936 Introduce the params and class for M2MTokenManager. Implement generateSecretName fn, and throw exception for other fns to be supported

## 0.1.7

### Patch Changes

- Migrate to Biome2

## 0.1.6

### Patch Changes

- PP-992 Fixup configs. This ensures ES2022 is used for building the packages, and that jest recognizes the tsconfig file's settings.

## 0.1.5

### Patch Changes

- MAINT: Update backend-m2m-token-manager to reflect the package has a dependency on the zod package

## 0.1.4

### Patch Changes

- Include M2MTokenType.

## 0.1.3

### Patch Changes

- Update packages to use a biome.json configuration that uses space-indent instead of tab-indent.

## 0.1.2

### Patch Changes

- Include index.ts. This is required for the package to work when imported by clients.

## 0.1.1

### Patch Changes

- Add a readme
