-
Notifications
You must be signed in to change notification settings - Fork 403
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(oauth-provider): add onAccountAddAuthorizedClient hook
- Loading branch information
1 parent
1f32320
commit c4d53b7
Showing
13 changed files
with
266 additions
and
185 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { Client } from '../client/client.js' | ||
import { DeviceId } from '../device/device-id.js' | ||
import { ClientAuth } from '../token/token-store.js' | ||
import { Awaitable } from '../util/awaitable.js' | ||
import { Account } from './account-store.js' | ||
// https://github.com/typescript-eslint/typescript-eslint/issues/8902 | ||
// eslint-disable-next-line | ||
import { AccountStore } from './account-store.js' | ||
|
||
/** | ||
* Allows disabling the call to {@link AccountStore.addAuthorizedClient} based | ||
* on the account, client and clientAuth (not all these info are available to | ||
* the store method). | ||
*/ | ||
export type AccountAddAuthorizedClient = ( | ||
client: Client, | ||
data: { | ||
deviceId: DeviceId | ||
account: Account | ||
clientAuth: ClientAuth | ||
}, | ||
) => Awaitable<boolean> | ||
|
||
export type AccountHooks = { | ||
onAccountAddAuthorizedClient?: AccountAddAuthorizedClient | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Jwks } from '@atproto/jwk' | ||
import { | ||
OAuthClientId, | ||
OAuthClientMetadata, | ||
} from '@atproto/oauth-client-metadata' | ||
import { Awaitable } from '../util/awaitable.js' | ||
|
||
/** | ||
* Use this to alter, override or validate the client metadata & jwks returned | ||
* by the client store. | ||
* | ||
* @throws {InvalidClientMetadataError} if the metadata is invalid | ||
* @see {@link InvalidClientMetadataError} | ||
*/ | ||
export type ClientDataHook = ( | ||
clientId: OAuthClientId, | ||
data: { metadata: OAuthClientMetadata; jwks?: Jwks }, | ||
) => Awaitable<void> | ||
|
||
export type ClientHooks = { | ||
onClientData?: ClientDataHook | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.