-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restrict CORS for Builder Secret Keys (#31)
- Loading branch information
1 parent
d072300
commit addf813
Showing
5 changed files
with
81 additions
and
31 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
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/* eslint-disable */ | ||
// authcontrol v0.9.1 809804f85757ee407e93c191d6d5bfb75b82cb56 | ||
// authcontrol v0.9.1 6d8f688a98165b12e0ddfa4ecbaeb8bd7d7f92ac | ||
// -- | ||
// Code generated by [email protected] with typescript generator. DO NOT EDIT. | ||
// | ||
|
@@ -16,7 +16,7 @@ export const WebRPCVersion = "v1" | |
export const WebRPCSchemaVersion = "v0.9.1" | ||
|
||
// Schema hash generated from your RIDL schema | ||
export const WebRPCSchemaHash = "809804f85757ee407e93c191d6d5bfb75b82cb56" | ||
export const WebRPCSchemaHash = "6d8f688a98165b12e0ddfa4ecbaeb8bd7d7f92ac" | ||
|
||
type WebrpcGenVersions = { | ||
webrpcGenVersion: string; | ||
|
@@ -413,6 +413,19 @@ export class ProjectNotFoundError extends WebrpcError { | |
} | ||
} | ||
|
||
export class SecretKeyCorsDisallowedError extends WebrpcError { | ||
constructor( | ||
name: string = 'SecretKeyCorsDisallowed', | ||
code: number = 1009, | ||
message: string = `CORS disallowed. Admin API Secret Key can't be used from a web app.`, | ||
status: number = 0, | ||
cause?: string | ||
) { | ||
super(name, code, message, status, cause) | ||
Object.setPrototypeOf(this, SecretKeyCorsDisallowedError.prototype) | ||
} | ||
} | ||
|
||
|
||
export enum errors { | ||
WebrpcEndpoint = 'WebrpcEndpoint', | ||
|
@@ -435,6 +448,7 @@ export enum errors { | |
Geoblocked = 'Geoblocked', | ||
RateLimited = 'RateLimited', | ||
ProjectNotFound = 'ProjectNotFound', | ||
SecretKeyCorsDisallowed = 'SecretKeyCorsDisallowed', | ||
} | ||
|
||
export enum WebrpcErrorCodes { | ||
|
@@ -458,6 +472,7 @@ export enum WebrpcErrorCodes { | |
Geoblocked = 1006, | ||
RateLimited = 1007, | ||
ProjectNotFound = 1008, | ||
SecretKeyCorsDisallowed = 1009, | ||
} | ||
|
||
export const webrpcErrorByCode: { [code: number]: any } = { | ||
|
@@ -481,6 +496,7 @@ export const webrpcErrorByCode: { [code: number]: any } = { | |
[1006]: GeoblockedError, | ||
[1007]: RateLimitedError, | ||
[1008]: ProjectNotFoundError, | ||
[1009]: SecretKeyCorsDisallowedError, | ||
} | ||
|
||
export type Fetch = (input: RequestInfo, init?: RequestInit) => Promise<Response> | ||
|
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