You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When actually implementing the ApiKeyProvider, several type issues were discovered. This PR fixes:
The api_key providers entrypoint is exported so it can be imported directly
RuntError options are optional, and the empty {} can be omitted
ListApiKeys takes in a limit/offset value
ApiKeyProvider passes back an AuthenticatedContext, to prevent unecessary non-null assertions
The index exports all the values from shared, not just the types
overrideHandler?: (context: ProviderContext)=>Promise<false|WorkerResponse>;// Any routes the provider wants to fully implement. Return false for any route not handled
27
32
isApiKey(context: ProviderContext): boolean;// Returns true if the auth token appears to be an API key (whether or not it is valid)
28
33
validateApiKey(context: ProviderContext): Promise<Passport>;// Ensure the API key is valid, and returns the Passport. Raise an error otherwise
getApiKey: (context: AuthenticatedProviderContext,id: string)=>Promise<ApiKey>;// Returns the API key matching the specific api key id
36
+
listApiKeys: (context: AuthenticatedProviderContext,request: ListApiKeysRequest)=>Promise<ApiKey[]>;// Return a list of all API keys for a user
37
+
revokeApiKey: (context: AuthenticatedProviderContext,id: string)=>Promise<void>;// set the revoked flag for an API key, such that it will no longer be valid
38
+
deleteApiKey: (context: AuthenticatedProviderContext,id: string)=>Promise<void>;// Delete an API key from the database
0 commit comments