hooks.constants.ts83 lines · main
| 1 | export const HOOKS_DEFINITIONS = [ |
| 2 | { |
| 3 | id: 'send-sms', |
| 4 | title: 'Send SMS hook', |
| 5 | subtitle: 'Will be called by Briven Auth each time an SMS message needs to be sent.', |
| 6 | entitlementKey: 'HOOK_SEND_SMS', |
| 7 | enabledKey: 'HOOK_SEND_SMS_ENABLED', |
| 8 | uriKey: 'HOOK_SEND_SMS_URI', |
| 9 | secretsKey: 'HOOK_SEND_SMS_SECRETS', |
| 10 | docSlug: 'send-sms-hook', |
| 11 | }, |
| 12 | { |
| 13 | id: 'send-email', |
| 14 | title: 'Send Email hook', |
| 15 | subtitle: 'Will be called by Briven Auth each time an email message needs to be sent.', |
| 16 | entitlementKey: 'HOOK_SEND_EMAIL', |
| 17 | enabledKey: 'HOOK_SEND_EMAIL_ENABLED', |
| 18 | uriKey: 'HOOK_SEND_EMAIL_URI', |
| 19 | secretsKey: 'HOOK_SEND_EMAIL_SECRETS', |
| 20 | docSlug: 'send-email-hook', |
| 21 | }, |
| 22 | { |
| 23 | id: 'custom-access-token-claims', |
| 24 | title: 'Customize Access Token (JWT) Claims hook', |
| 25 | subtitle: |
| 26 | 'Will be called by Briven Auth each time a new JWT is created. It should return the claims you wish to be present in the JWT.', |
| 27 | entitlementKey: 'HOOK_CUSTOM_ACCESS_TOKEN', |
| 28 | enabledKey: 'HOOK_CUSTOM_ACCESS_TOKEN_ENABLED', |
| 29 | uriKey: 'HOOK_CUSTOM_ACCESS_TOKEN_URI', |
| 30 | secretsKey: 'HOOK_CUSTOM_ACCESS_TOKEN_SECRETS', |
| 31 | docSlug: 'custom-access-token-hook', |
| 32 | }, |
| 33 | { |
| 34 | id: 'mfa-verification-attempt', |
| 35 | title: 'MFA Verification Attempt hook', |
| 36 | subtitle: |
| 37 | 'Will be called by Briven Auth each time a user tries to verify an MFA factor. Return a decision on whether to reject the attempt and future ones, or to allow the user to keep trying.', |
| 38 | entitlementKey: 'HOOK_MFA_VERIFICATION_ATTEMPT', |
| 39 | enabledKey: 'HOOK_MFA_VERIFICATION_ATTEMPT_ENABLED', |
| 40 | uriKey: 'HOOK_MFA_VERIFICATION_ATTEMPT_URI', |
| 41 | secretsKey: 'HOOK_MFA_VERIFICATION_ATTEMPT_SECRETS', |
| 42 | docSlug: 'mfa-verification-hook', |
| 43 | }, |
| 44 | { |
| 45 | id: 'password-verification-attempt', |
| 46 | title: 'Password Verification Attempt hook', |
| 47 | subtitle: |
| 48 | 'Will be called by Briven Auth each time a user tries to sign in with a password. Return a decision whether to allow the user to reject the attempt, or to allow the user to keep trying.', |
| 49 | entitlementKey: 'HOOK_PASSWORD_VERIFICATION_ATTEMPT', |
| 50 | enabledKey: 'HOOK_PASSWORD_VERIFICATION_ATTEMPT_ENABLED', |
| 51 | uriKey: 'HOOK_PASSWORD_VERIFICATION_ATTEMPT_URI', |
| 52 | secretsKey: 'HOOK_PASSWORD_VERIFICATION_ATTEMPT_SECRETS', |
| 53 | docSlug: 'password-verification-hook', |
| 54 | }, |
| 55 | { |
| 56 | id: 'before-user-created', |
| 57 | title: 'Before User Created hook', |
| 58 | subtitle: |
| 59 | 'Will be called by Briven Auth before creating a new user. Returning an error will prevent the user from being created.', |
| 60 | entitlementKey: 'HOOK_BEFORE_USER_CREATED', |
| 61 | enabledKey: 'HOOK_BEFORE_USER_CREATED_ENABLED', |
| 62 | uriKey: 'HOOK_BEFORE_USER_CREATED_URI', |
| 63 | secretsKey: 'HOOK_BEFORE_USER_CREATED_SECRETS', |
| 64 | docSlug: 'before-user-created-hook', |
| 65 | }, |
| 66 | ] as const |
| 67 | |
| 68 | export type HOOK_DEFINITION_TITLE = (typeof HOOKS_DEFINITIONS)[number]['title'] |
| 69 | |
| 70 | export interface Hook { |
| 71 | id: string |
| 72 | title: HOOK_DEFINITION_TITLE |
| 73 | subtitle: string |
| 74 | entitlementKey: string |
| 75 | enabled: boolean |
| 76 | enabledKey: string |
| 77 | uriKey: string |
| 78 | secretsKey: string |
| 79 | docSlug: string |
| 80 | method: |
| 81 | | { type: 'postgres'; schema: string; functionName: string } |
| 82 | | { type: 'https'; url: string; secret: string } |
| 83 | } |