@castleio/sdk 2.3.3 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +352 -31
- package/dist/index.d.mts +966 -0
- package/dist/index.d.ts +966 -8
- package/dist/index.js +1562 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1499 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +43 -37
- package/CHANGELOG.md +0 -199
- package/dist/Castle.d.ts +0 -36
- package/dist/Castle.js +0 -194
- package/dist/Castle.js.map +0 -1
- package/dist/api/api.module.d.ts +0 -1
- package/dist/api/api.module.js +0 -18
- package/dist/api/api.module.js.map +0 -1
- package/dist/api/services/api-approve-device.service.d.ts +0 -5
- package/dist/api/services/api-approve-device.service.js +0 -26
- package/dist/api/services/api-approve-device.service.js.map +0 -1
- package/dist/api/services/api-archive-list-item.service.d.ts +0 -5
- package/dist/api/services/api-archive-list-item.service.js +0 -26
- package/dist/api/services/api-archive-list-item.service.js.map +0 -1
- package/dist/api/services/api-authenticate.service.d.ts +0 -6
- package/dist/api/services/api-authenticate.service.js +0 -58
- package/dist/api/services/api-authenticate.service.js.map +0 -1
- package/dist/api/services/api-batch-upsert-list-items.service.d.ts +0 -5
- package/dist/api/services/api-batch-upsert-list-items.service.js +0 -26
- package/dist/api/services/api-batch-upsert-list-items.service.js.map +0 -1
- package/dist/api/services/api-count-list-items.service.d.ts +0 -5
- package/dist/api/services/api-count-list-items.service.js +0 -26
- package/dist/api/services/api-count-list-items.service.js.map +0 -1
- package/dist/api/services/api-create-list-item.service.d.ts +0 -5
- package/dist/api/services/api-create-list-item.service.js +0 -26
- package/dist/api/services/api-create-list-item.service.js.map +0 -1
- package/dist/api/services/api-create-list.service.d.ts +0 -5
- package/dist/api/services/api-create-list.service.js +0 -26
- package/dist/api/services/api-create-list.service.js.map +0 -1
- package/dist/api/services/api-delete-list.service.d.ts +0 -5
- package/dist/api/services/api-delete-list.service.js +0 -26
- package/dist/api/services/api-delete-list.service.js.map +0 -1
- package/dist/api/services/api-delete-user-data.service.d.ts +0 -5
- package/dist/api/services/api-delete-user-data.service.js +0 -26
- package/dist/api/services/api-delete-user-data.service.js.map +0 -1
- package/dist/api/services/api-fetch-all-lists.service.d.ts +0 -4
- package/dist/api/services/api-fetch-all-lists.service.js +0 -26
- package/dist/api/services/api-fetch-all-lists.service.js.map +0 -1
- package/dist/api/services/api-fetch-list-item.service.d.ts +0 -5
- package/dist/api/services/api-fetch-list-item.service.js +0 -26
- package/dist/api/services/api-fetch-list-item.service.js.map +0 -1
- package/dist/api/services/api-fetch-list.service.d.ts +0 -5
- package/dist/api/services/api-fetch-list.service.js +0 -26
- package/dist/api/services/api-fetch-list.service.js.map +0 -1
- package/dist/api/services/api-filter.service.d.ts +0 -5
- package/dist/api/services/api-filter.service.js +0 -57
- package/dist/api/services/api-filter.service.js.map +0 -1
- package/dist/api/services/api-get-device.service.d.ts +0 -5
- package/dist/api/services/api-get-device.service.js +0 -26
- package/dist/api/services/api-get-device.service.js.map +0 -1
- package/dist/api/services/api-get-devices-for-user.service.d.ts +0 -5
- package/dist/api/services/api-get-devices-for-user.service.js +0 -26
- package/dist/api/services/api-get-devices-for-user.service.js.map +0 -1
- package/dist/api/services/api-get-events-schema.service.d.ts +0 -5
- package/dist/api/services/api-get-events-schema.service.js +0 -26
- package/dist/api/services/api-get-events-schema.service.js.map +0 -1
- package/dist/api/services/api-group-events.service.d.ts +0 -5
- package/dist/api/services/api-group-events.service.js +0 -26
- package/dist/api/services/api-group-events.service.js.map +0 -1
- package/dist/api/services/api-log.service.d.ts +0 -5
- package/dist/api/services/api-log.service.js +0 -26
- package/dist/api/services/api-log.service.js.map +0 -1
- package/dist/api/services/api-report-device.service.d.ts +0 -5
- package/dist/api/services/api-report-device.service.js +0 -26
- package/dist/api/services/api-report-device.service.js.map +0 -1
- package/dist/api/services/api-request-user-data.service.d.ts +0 -5
- package/dist/api/services/api-request-user-data.service.js +0 -26
- package/dist/api/services/api-request-user-data.service.js.map +0 -1
- package/dist/api/services/api-risk.service.d.ts +0 -5
- package/dist/api/services/api-risk.service.js +0 -57
- package/dist/api/services/api-risk.service.js.map +0 -1
- package/dist/api/services/api-search-events.service.d.ts +0 -5
- package/dist/api/services/api-search-events.service.js +0 -26
- package/dist/api/services/api-search-events.service.js.map +0 -1
- package/dist/api/services/api-search-list-items.service.d.ts +0 -5
- package/dist/api/services/api-search-list-items.service.js +0 -26
- package/dist/api/services/api-search-list-items.service.js.map +0 -1
- package/dist/api/services/api-search-lists.service.d.ts +0 -5
- package/dist/api/services/api-search-lists.service.js +0 -26
- package/dist/api/services/api-search-lists.service.js.map +0 -1
- package/dist/api/services/api-track.service.d.ts +0 -5
- package/dist/api/services/api-track.service.js +0 -26
- package/dist/api/services/api-track.service.js.map +0 -1
- package/dist/api/services/api-unarchive-list-item.service.d.ts +0 -5
- package/dist/api/services/api-unarchive-list-item.service.js +0 -26
- package/dist/api/services/api-unarchive-list-item.service.js.map +0 -1
- package/dist/api/services/api-update-list-item.service.d.ts +0 -5
- package/dist/api/services/api-update-list-item.service.js +0 -26
- package/dist/api/services/api-update-list-item.service.js.map +0 -1
- package/dist/api/services/api-update-list.service.d.ts +0 -5
- package/dist/api/services/api-update-list.service.js +0 -26
- package/dist/api/services/api-update-list.service.js.map +0 -1
- package/dist/api/services/api.service.d.ts +0 -8
- package/dist/api/services/api.service.js +0 -40
- package/dist/api/services/api.service.js.map +0 -1
- package/dist/api/services/index.d.ts +0 -29
- package/dist/api/services/index.js +0 -46
- package/dist/api/services/index.js.map +0 -1
- package/dist/client-id/client-id.module.d.ts +0 -1
- package/dist/client-id/client-id.module.js +0 -18
- package/dist/client-id/client-id.module.js.map +0 -1
- package/dist/client-id/services/client-id-extract.service.d.ts +0 -4
- package/dist/client-id/services/client-id-extract.service.js +0 -12
- package/dist/client-id/services/client-id-extract.service.js.map +0 -1
- package/dist/client-id/services/index.d.ts +0 -1
- package/dist/client-id/services/index.js +0 -18
- package/dist/client-id/services/index.js.map +0 -1
- package/dist/command/command.module.d.ts +0 -1
- package/dist/command/command.module.js +0 -18
- package/dist/command/command.module.js.map +0 -1
- package/dist/command/services/command-approve-device.service.d.ts +0 -16
- package/dist/command/services/command-approve-device.service.js +0 -12
- package/dist/command/services/command-approve-device.service.js.map +0 -1
- package/dist/command/services/command-archive-list-item.service.d.ts +0 -16
- package/dist/command/services/command-archive-list-item.service.js +0 -12
- package/dist/command/services/command-archive-list-item.service.js.map +0 -1
- package/dist/command/services/command-authenticate.service.d.ts +0 -16
- package/dist/command/services/command-authenticate.service.js +0 -12
- package/dist/command/services/command-authenticate.service.js.map +0 -1
- package/dist/command/services/command-batch-upsert-list-items.service.d.ts +0 -16
- package/dist/command/services/command-batch-upsert-list-items.service.js +0 -12
- package/dist/command/services/command-batch-upsert-list-items.service.js.map +0 -1
- package/dist/command/services/command-count-list-items.service.d.ts +0 -16
- package/dist/command/services/command-count-list-items.service.js +0 -12
- package/dist/command/services/command-count-list-items.service.js.map +0 -1
- package/dist/command/services/command-create-list-item.service.d.ts +0 -16
- package/dist/command/services/command-create-list-item.service.js +0 -12
- package/dist/command/services/command-create-list-item.service.js.map +0 -1
- package/dist/command/services/command-create-list.service.d.ts +0 -16
- package/dist/command/services/command-create-list.service.js +0 -10
- package/dist/command/services/command-create-list.service.js.map +0 -1
- package/dist/command/services/command-delete-list.service.d.ts +0 -16
- package/dist/command/services/command-delete-list.service.js +0 -12
- package/dist/command/services/command-delete-list.service.js.map +0 -1
- package/dist/command/services/command-delete-user-data.service.d.ts +0 -16
- package/dist/command/services/command-delete-user-data.service.js +0 -10
- package/dist/command/services/command-delete-user-data.service.js.map +0 -1
- package/dist/command/services/command-fetch-all-lists.service.d.ts +0 -15
- package/dist/command/services/command-fetch-all-lists.service.js +0 -10
- package/dist/command/services/command-fetch-all-lists.service.js.map +0 -1
- package/dist/command/services/command-fetch-list-item.service.d.ts +0 -16
- package/dist/command/services/command-fetch-list-item.service.js +0 -12
- package/dist/command/services/command-fetch-list-item.service.js.map +0 -1
- package/dist/command/services/command-fetch-list.service.d.ts +0 -16
- package/dist/command/services/command-fetch-list.service.js +0 -12
- package/dist/command/services/command-fetch-list.service.js.map +0 -1
- package/dist/command/services/command-filter.service.d.ts +0 -16
- package/dist/command/services/command-filter.service.js +0 -12
- package/dist/command/services/command-filter.service.js.map +0 -1
- package/dist/command/services/command-generate.service.d.ts +0 -17
- package/dist/command/services/command-generate.service.js +0 -18
- package/dist/command/services/command-generate.service.js.map +0 -1
- package/dist/command/services/command-get-device.service.d.ts +0 -16
- package/dist/command/services/command-get-device.service.js +0 -12
- package/dist/command/services/command-get-device.service.js.map +0 -1
- package/dist/command/services/command-get-devices-for-user.service.d.ts +0 -16
- package/dist/command/services/command-get-devices-for-user.service.js +0 -12
- package/dist/command/services/command-get-devices-for-user.service.js.map +0 -1
- package/dist/command/services/command-get-events-schema.service.d.ts +0 -15
- package/dist/command/services/command-get-events-schema.service.js +0 -10
- package/dist/command/services/command-get-events-schema.service.js.map +0 -1
- package/dist/command/services/command-group-events.service.d.ts +0 -16
- package/dist/command/services/command-group-events.service.js +0 -10
- package/dist/command/services/command-group-events.service.js.map +0 -1
- package/dist/command/services/command-log.service.d.ts +0 -16
- package/dist/command/services/command-log.service.js +0 -12
- package/dist/command/services/command-log.service.js.map +0 -1
- package/dist/command/services/command-report-device.service.d.ts +0 -16
- package/dist/command/services/command-report-device.service.js +0 -12
- package/dist/command/services/command-report-device.service.js.map +0 -1
- package/dist/command/services/command-request-user-data.service.d.ts +0 -16
- package/dist/command/services/command-request-user-data.service.js +0 -10
- package/dist/command/services/command-request-user-data.service.js.map +0 -1
- package/dist/command/services/command-risk.service.d.ts +0 -16
- package/dist/command/services/command-risk.service.js +0 -12
- package/dist/command/services/command-risk.service.js.map +0 -1
- package/dist/command/services/command-search-events.service.d.ts +0 -16
- package/dist/command/services/command-search-events.service.js +0 -10
- package/dist/command/services/command-search-events.service.js.map +0 -1
- package/dist/command/services/command-search-list-items.service.d.ts +0 -16
- package/dist/command/services/command-search-list-items.service.js +0 -12
- package/dist/command/services/command-search-list-items.service.js.map +0 -1
- package/dist/command/services/command-search-lists.service.d.ts +0 -16
- package/dist/command/services/command-search-lists.service.js +0 -10
- package/dist/command/services/command-search-lists.service.js.map +0 -1
- package/dist/command/services/command-track.service.d.ts +0 -16
- package/dist/command/services/command-track.service.js +0 -12
- package/dist/command/services/command-track.service.js.map +0 -1
- package/dist/command/services/command-unarchive-list-item.service.d.ts +0 -16
- package/dist/command/services/command-unarchive-list-item.service.js +0 -12
- package/dist/command/services/command-unarchive-list-item.service.js.map +0 -1
- package/dist/command/services/command-update-list-item.service.d.ts +0 -16
- package/dist/command/services/command-update-list-item.service.js +0 -12
- package/dist/command/services/command-update-list-item.service.js.map +0 -1
- package/dist/command/services/command-update-list.service.d.ts +0 -16
- package/dist/command/services/command-update-list.service.js +0 -12
- package/dist/command/services/command-update-list.service.js.map +0 -1
- package/dist/command/services/index.d.ts +0 -29
- package/dist/command/services/index.js +0 -46
- package/dist/command/services/index.js.map +0 -1
- package/dist/configuration.d.ts +0 -32
- package/dist/configuration.js +0 -34
- package/dist/configuration.js.map +0 -1
- package/dist/constants.d.ts +0 -4
- package/dist/constants.js +0 -42
- package/dist/constants.js.map +0 -1
- package/dist/context/context.module.d.ts +0 -1
- package/dist/context/context.module.js +0 -18
- package/dist/context/context.module.js.map +0 -1
- package/dist/context/services/context-get-default.service.d.ts +0 -9
- package/dist/context/services/context-get-default.service.js +0 -34
- package/dist/context/services/context-get-default.service.js.map +0 -1
- package/dist/context/services/context-prepare.service.d.ts +0 -9
- package/dist/context/services/context-prepare.service.js +0 -15
- package/dist/context/services/context-prepare.service.js.map +0 -1
- package/dist/context/services/context-sanitize.service.d.ts +0 -7
- package/dist/context/services/context-sanitize.service.js +0 -19
- package/dist/context/services/context-sanitize.service.js.map +0 -1
- package/dist/context/services/index.d.ts +0 -3
- package/dist/context/services/index.js +0 -20
- package/dist/context/services/index.js.map +0 -1
- package/dist/core/core.module.d.ts +0 -1
- package/dist/core/core.module.js +0 -18
- package/dist/core/core.module.js.map +0 -1
- package/dist/core/services/core-generate-default-headers.service.d.ts +0 -7
- package/dist/core/services/core-generate-default-headers.service.js +0 -12
- package/dist/core/services/core-generate-default-headers.service.js.map +0 -1
- package/dist/core/services/core-generate-request-body.service.d.ts +0 -5
- package/dist/core/services/core-generate-request-body.service.js +0 -9
- package/dist/core/services/core-generate-request-body.service.js.map +0 -1
- package/dist/core/services/core-process-response.service.d.ts +0 -3
- package/dist/core/services/core-process-response.service.js +0 -61
- package/dist/core/services/core-process-response.service.js.map +0 -1
- package/dist/core/services/index.d.ts +0 -3
- package/dist/core/services/index.js +0 -20
- package/dist/core/services/index.js.map +0 -1
- package/dist/errors.d.ts +0 -36
- package/dist/errors.js +0 -88
- package/dist/errors.js.map +0 -1
- package/dist/failover/failover.module.d.ts +0 -1
- package/dist/failover/failover.module.js +0 -18
- package/dist/failover/failover.module.js.map +0 -1
- package/dist/failover/models/failover-strategy.d.ts +0 -6
- package/dist/failover/models/failover-strategy.js +0 -11
- package/dist/failover/models/failover-strategy.js.map +0 -1
- package/dist/failover/models/index.d.ts +0 -1
- package/dist/failover/models/index.js +0 -18
- package/dist/failover/models/index.js.map +0 -1
- package/dist/headers/headers.module.d.ts +0 -1
- package/dist/headers/headers.module.js +0 -18
- package/dist/headers/headers.module.js.map +0 -1
- package/dist/headers/services/headers-extract.service.d.ts +0 -9
- package/dist/headers/services/headers-extract.service.js +0 -30
- package/dist/headers/services/headers-extract.service.js.map +0 -1
- package/dist/headers/services/headers-get-cookie.service.d.ts +0 -3
- package/dist/headers/services/headers-get-cookie.service.js +0 -17
- package/dist/headers/services/headers-get-cookie.service.js.map +0 -1
- package/dist/headers/services/index.d.ts +0 -2
- package/dist/headers/services/index.js +0 -19
- package/dist/headers/services/index.js.map +0 -1
- package/dist/ips/ips.module.d.ts +0 -1
- package/dist/ips/ips.module.js +0 -18
- package/dist/ips/ips.module.js.map +0 -1
- package/dist/ips/services/index.d.ts +0 -1
- package/dist/ips/services/index.js +0 -18
- package/dist/ips/services/index.js.map +0 -1
- package/dist/ips/services/ips-extract.service.d.ts +0 -5
- package/dist/ips/services/ips-extract.service.js +0 -50
- package/dist/ips/services/ips-extract.service.js.map +0 -1
- package/dist/logger/logger.module.d.ts +0 -2
- package/dist/logger/logger.module.js +0 -19
- package/dist/logger/logger.module.js.map +0 -1
- package/dist/logger/models/index.d.ts +0 -1
- package/dist/logger/models/index.js +0 -18
- package/dist/logger/models/index.js.map +0 -1
- package/dist/logger/models/logging-parameters.d.ts +0 -7
- package/dist/logger/models/logging-parameters.js +0 -3
- package/dist/logger/models/logging-parameters.js.map +0 -1
- package/dist/logger/services/index.d.ts +0 -4
- package/dist/logger/services/index.js +0 -21
- package/dist/logger/services/index.js.map +0 -1
- package/dist/logger/services/logger-error-formatter.service.d.ts +0 -3
- package/dist/logger/services/logger-error-formatter.service.js +0 -10
- package/dist/logger/services/logger-error-formatter.service.js.map +0 -1
- package/dist/logger/services/logger-request-formatter.service.d.ts +0 -4
- package/dist/logger/services/logger-request-formatter.service.js +0 -16
- package/dist/logger/services/logger-request-formatter.service.js.map +0 -1
- package/dist/logger/services/logger-response-formatter.service.d.ts +0 -3
- package/dist/logger/services/logger-response-formatter.service.js +0 -10
- package/dist/logger/services/logger-response-formatter.service.js.map +0 -1
- package/dist/logger/services/logger.service.d.ts +0 -4
- package/dist/logger/services/logger.service.js +0 -25
- package/dist/logger/services/logger.service.js.map +0 -1
- package/dist/models/action.d.ts +0 -5
- package/dist/models/action.js +0 -10
- package/dist/models/action.js.map +0 -1
- package/dist/models/authenticate-result.d.ts +0 -18
- package/dist/models/authenticate-result.js +0 -3
- package/dist/models/authenticate-result.js.map +0 -1
- package/dist/models/device.d.ts +0 -3
- package/dist/models/device.js +0 -3
- package/dist/models/device.js.map +0 -1
- package/dist/models/events.d.ts +0 -17
- package/dist/models/events.js +0 -23
- package/dist/models/events.js.map +0 -1
- package/dist/models/index.d.ts +0 -8
- package/dist/models/index.js +0 -25
- package/dist/models/index.js.map +0 -1
- package/dist/models/list-item.d.ts +0 -15
- package/dist/models/list-item.js +0 -3
- package/dist/models/list-item.js.map +0 -1
- package/dist/models/list.d.ts +0 -11
- package/dist/models/list.js +0 -3
- package/dist/models/list.js.map +0 -1
- package/dist/models/risk-policy.d.ts +0 -9
- package/dist/models/risk-policy.js +0 -3
- package/dist/models/risk-policy.js.map +0 -1
- package/dist/models/signals.d.ts +0 -3
- package/dist/models/signals.js +0 -3
- package/dist/models/signals.js.map +0 -1
- package/dist/payload/models/address_payload.d.ts +0 -8
- package/dist/payload/models/address_payload.js +0 -3
- package/dist/payload/models/address_payload.js.map +0 -1
- package/dist/payload/models/device_payload.d.ts +0 -7
- package/dist/payload/models/device_payload.js +0 -3
- package/dist/payload/models/device_payload.js.map +0 -1
- package/dist/payload/models/event_payload.d.ts +0 -89
- package/dist/payload/models/event_payload.js +0 -29
- package/dist/payload/models/event_payload.js.map +0 -1
- package/dist/payload/models/event_response.d.ts +0 -346
- package/dist/payload/models/event_response.js +0 -51
- package/dist/payload/models/event_response.js.map +0 -1
- package/dist/payload/models/filter_payload.d.ts +0 -68
- package/dist/payload/models/filter_payload.js +0 -3
- package/dist/payload/models/filter_payload.js.map +0 -1
- package/dist/payload/models/index.d.ts +0 -11
- package/dist/payload/models/index.js +0 -28
- package/dist/payload/models/index.js.map +0 -1
- package/dist/payload/models/list-payload.d.ts +0 -26
- package/dist/payload/models/list-payload.js +0 -3
- package/dist/payload/models/list-payload.js.map +0 -1
- package/dist/payload/models/list_item_payload.d.ts +0 -45
- package/dist/payload/models/list_item_payload.js +0 -3
- package/dist/payload/models/list_item_payload.js.map +0 -1
- package/dist/payload/models/log_payload.d.ts +0 -42
- package/dist/payload/models/log_payload.js +0 -3
- package/dist/payload/models/log_payload.js.map +0 -1
- package/dist/payload/models/payload.d.ts +0 -15
- package/dist/payload/models/payload.js +0 -3
- package/dist/payload/models/payload.js.map +0 -1
- package/dist/payload/models/privacy_payload.d.ts +0 -8
- package/dist/payload/models/privacy_payload.js +0 -3
- package/dist/payload/models/privacy_payload.js.map +0 -1
- package/dist/payload/models/risk_payload.d.ts +0 -75
- package/dist/payload/models/risk_payload.js +0 -3
- package/dist/payload/models/risk_payload.js.map +0 -1
- package/dist/payload/payload.module.d.ts +0 -2
- package/dist/payload/payload.module.js +0 -19
- package/dist/payload/payload.module.js.map +0 -1
- package/dist/payload/services/index.d.ts +0 -1
- package/dist/payload/services/index.js +0 -18
- package/dist/payload/services/index.js.map +0 -1
- package/dist/payload/services/payload-prepare-service.d.ts +0 -13
- package/dist/payload/services/payload-prepare-service.js +0 -15
- package/dist/payload/services/payload-prepare-service.js.map +0 -1
- package/dist/validator/services/index.d.ts +0 -1
- package/dist/validator/services/index.js +0 -18
- package/dist/validator/services/index.js.map +0 -1
- package/dist/validator/services/validator-present.service.d.ts +0 -3
- package/dist/validator/services/validator-present.service.js +0 -15
- package/dist/validator/services/validator-present.service.js.map +0 -1
- package/dist/validator/validator.module.d.ts +0 -1
- package/dist/validator/validator.module.js +0 -18
- package/dist/validator/validator.module.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,60 +1,381 @@
|
|
|
1
1
|
# Castle SDK for Node
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
[](https://github.com/castle/castle-node/actions/workflows/test.yml)
|
|
4
|
+
[](https://github.com/castle/castle-node/actions/workflows/lint.yml)
|
|
5
|
+
[](https://www.npmjs.com/package/@castleio/sdk)
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
The official Node.js SDK for [Castle](https://castle.io). Castle analyzes user behavior in web and mobile apps to stop fraud before it happens.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
This package is a thin, dependency-light wrapper around the [Castle HTTP API](https://reference.castle.io). It exposes:
|
|
8
10
|
|
|
9
|
-
|
|
11
|
+
- **Risk assessment** — `POST /v1/risk`, `POST /v1/filter`
|
|
12
|
+
- **Event logging** — `POST /v1/log` (fire-and-forget, no verdict)
|
|
13
|
+
- **Lists & List Items** — full CRUD + search + count + batch
|
|
14
|
+
- **Privacy / GDPR** — `POST` and `DELETE /v1/privacy/users` (Article 15 & 17)
|
|
15
|
+
- **Events** (enterprise) — search, group, and schema
|
|
16
|
+
- **Webhook signature verification** — validate `X-Castle-Signature`
|
|
17
|
+
- **Secure mode** — sign user IDs sent from the browser
|
|
18
|
+
|
|
19
|
+
A full list of supported events and the JSON shape of every payload is documented at <https://reference.castle.io>.
|
|
20
|
+
|
|
21
|
+
## Requirements
|
|
10
22
|
|
|
11
|
-
|
|
23
|
+
- Node.js `>= 20` (the SDK uses the built-in global `fetch` / `AbortSignal`)
|
|
24
|
+
- A [Castle](https://dashboard.castle.io) API secret
|
|
25
|
+
|
|
26
|
+
The package ships both ESM and CommonJS builds, so both `import` and `require` work out of the box.
|
|
27
|
+
|
|
28
|
+
## Installation
|
|
12
29
|
|
|
13
|
-
|
|
30
|
+
```bash
|
|
31
|
+
npm install --save @castleio/sdk
|
|
32
|
+
```
|
|
14
33
|
|
|
15
34
|
```bash
|
|
16
35
|
yarn add @castleio/sdk
|
|
17
36
|
```
|
|
18
37
|
|
|
19
|
-
|
|
38
|
+
## Quick start
|
|
20
39
|
|
|
21
|
-
```
|
|
22
|
-
|
|
40
|
+
```js
|
|
41
|
+
import { Castle, ContextPrepareService } from '@castleio/sdk';
|
|
42
|
+
|
|
43
|
+
const castle = new Castle({ apiSecret: process.env.CASTLE_API_SECRET });
|
|
44
|
+
|
|
45
|
+
const context = ContextPrepareService.call(
|
|
46
|
+
req,
|
|
47
|
+
{ cookies: req.cookies },
|
|
48
|
+
castle.configuration
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const verdict = await castle.risk({
|
|
52
|
+
type: '$login',
|
|
53
|
+
status: '$succeeded',
|
|
54
|
+
request_token: req.body.castle_request_token,
|
|
55
|
+
user: { id: '12345', email: 'user@example.com' },
|
|
56
|
+
context,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
switch (verdict.policy?.action) {
|
|
60
|
+
case 'deny':
|
|
61
|
+
// block the user
|
|
62
|
+
break;
|
|
63
|
+
case 'challenge':
|
|
64
|
+
// send 2FA / additional verification
|
|
65
|
+
break;
|
|
66
|
+
default:
|
|
67
|
+
// allow
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
With CommonJS:
|
|
72
|
+
|
|
73
|
+
```js
|
|
74
|
+
const { Castle, ContextPrepareService } = require('@castleio/sdk');
|
|
23
75
|
```
|
|
24
76
|
|
|
77
|
+
`ContextPrepareService.call(request, options, configuration)` extracts the IP, headers, and client id that Castle needs from a Node `request` object. See [Advanced configuration](#advanced-configuration) for how header allow/deny lists and proxy chains are resolved.
|
|
78
|
+
|
|
25
79
|
## Configuration
|
|
26
80
|
|
|
27
|
-
|
|
81
|
+
The library is configured per `Castle` instance:
|
|
82
|
+
|
|
83
|
+
```js
|
|
84
|
+
import { Castle, FailoverStrategy } from '@castleio/sdk';
|
|
85
|
+
|
|
86
|
+
const castle = new Castle({
|
|
87
|
+
apiSecret: process.env.CASTLE_API_SECRET,
|
|
88
|
+
|
|
89
|
+
// Automatic verdict from `risk`/`filter` when Castle is unreachable or
|
|
90
|
+
// times out. One of FailoverStrategy.allow (default), .deny, .challenge.
|
|
91
|
+
failoverStrategy: FailoverStrategy.allow,
|
|
92
|
+
|
|
93
|
+
// Request timeout in milliseconds before the failover strategy kicks in.
|
|
94
|
+
timeout: 1500,
|
|
95
|
+
|
|
96
|
+
// Logs Castle API requests and responses; must respond to `info`.
|
|
97
|
+
logger: console,
|
|
98
|
+
});
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
### Config options
|
|
102
|
+
|
|
103
|
+
| Option | Type | Default | Description |
|
|
104
|
+
| ------------------- | ---------------------- | -------------------------- | --------------------------------------------------------------------------------------------------------------- |
|
|
105
|
+
| `apiSecret` | `string` | | API secret from the [dashboard](https://dashboard.castle.io/settings/general). |
|
|
106
|
+
| `timeout` | `number` | `1500` | Time in ms before returning the failover strategy. |
|
|
107
|
+
| `failoverStrategy` | `FailoverStrategy` | `FailoverStrategy.allow` | Automatic `risk` response on timeout: `allow`, `deny`, or `challenge`. |
|
|
108
|
+
| `logger` | `object` | | Logs Castle API requests/responses; must respond to `info`. |
|
|
109
|
+
| `doNotTrack` | `boolean` | `false` | When `true`, suppresses all requests and triggers failover on `risk`. Useful in development and testing. |
|
|
110
|
+
| `allowlisted` | `string[]` | `[]` | Strict header allow-list (see [Header allow/deny lists](#header-allowdeny-lists)). |
|
|
111
|
+
| `denylisted` | `string[]` | `[]` | Headers to always scrub, in addition to the always-blocked `Cookie` / `Authorization`. |
|
|
112
|
+
| `ipHeaders` | `string[]` | `[]` | Custom headers to read the client IP from (see [Client IP detection](#client-ip-detection)). |
|
|
113
|
+
| `trustedProxies` | `(string \| RegExp)[]` | `[]` | Known proxy IPs (strings or regexes). Pick this **or** `trustedProxyDepth`, never both. |
|
|
114
|
+
| `trustedProxyDepth` | `number` | `0` | Number of known trusted proxies in the chain. Pick this **or** `trustedProxies`, never both. |
|
|
115
|
+
| `trustProxyChain` | `boolean` | `false` | Trust the entire `X-Forwarded-For` chain. **Warning:** promiscuous — a malicious proxy can spoof the client IP. |
|
|
116
|
+
| `baseUrl` | `string` | `https://api.castle.io/v1` | Base Castle API URL. |
|
|
117
|
+
|
|
118
|
+
### Multi-environment / multi-tenant
|
|
119
|
+
|
|
120
|
+
Each `Castle` instance carries its own configuration, so multiple environments or tenants are just multiple instances:
|
|
121
|
+
|
|
122
|
+
```js
|
|
123
|
+
const castleTenantA = new Castle({
|
|
124
|
+
apiSecret: process.env.CASTLE_API_SECRET_TENANT_A,
|
|
125
|
+
});
|
|
126
|
+
const castleTenantB = new Castle({
|
|
127
|
+
apiSecret: process.env.CASTLE_API_SECRET_TENANT_B,
|
|
128
|
+
});
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
## Usage
|
|
132
|
+
|
|
133
|
+
All endpoints are async methods on a `Castle` instance.
|
|
134
|
+
|
|
135
|
+
### Risk
|
|
136
|
+
|
|
137
|
+
Evaluates high-risk events (logins, registrations, password resets, transactions). Returns a verdict (`policy.action`) plus risk scores and signals.
|
|
138
|
+
|
|
139
|
+
```js
|
|
140
|
+
await castle.risk({
|
|
141
|
+
type: '$login',
|
|
142
|
+
status: '$succeeded',
|
|
143
|
+
request_token: req.body.castle_request_token,
|
|
144
|
+
user: { id: '12345', email: 'user@example.com' },
|
|
145
|
+
context,
|
|
146
|
+
});
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Filter
|
|
150
|
+
|
|
151
|
+
Blocks bots and bad traffic early in the chain (typically registration). Same response shape as Risk.
|
|
152
|
+
|
|
153
|
+
```js
|
|
154
|
+
await castle.filter({
|
|
155
|
+
type: '$registration',
|
|
156
|
+
status: '$attempted',
|
|
157
|
+
request_token: req.body.castle_request_token,
|
|
158
|
+
params: { email: 'user@example.com' },
|
|
159
|
+
context,
|
|
160
|
+
});
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
### Log
|
|
164
|
+
|
|
165
|
+
Fire-and-forget event logging; no verdict is returned. Useful for events that should be visible in the dashboard but don't need a real-time decision.
|
|
166
|
+
|
|
167
|
+
```js
|
|
168
|
+
await castle.log({
|
|
169
|
+
type: '$profile_update',
|
|
170
|
+
status: '$succeeded',
|
|
171
|
+
user: { id: '12345' },
|
|
172
|
+
context,
|
|
173
|
+
});
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Lists & List Items
|
|
177
|
+
|
|
178
|
+
Lists let you organize users, IPs, transactions, or any custom property and use them in policies as allow/deny lists:
|
|
179
|
+
|
|
180
|
+
```js
|
|
181
|
+
const list = await castle.createList({
|
|
182
|
+
name: 'Trusted IPs',
|
|
183
|
+
color: 'green',
|
|
184
|
+
primary_field: 'ip.address',
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
await castle.createListItem({
|
|
188
|
+
list_id: list.id,
|
|
189
|
+
primary_value: '1.2.3.4',
|
|
190
|
+
author: { type: '$analyst_email', identifier: 'analyst@example.com' },
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
await castle.searchListItems({
|
|
194
|
+
list_id: list.id,
|
|
195
|
+
filters: [{ field: 'primary_value', op: '$eq', value: '1.2.3.4' }],
|
|
196
|
+
});
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
Available methods: `createList`, `fetchAllLists`, `fetchList`, `updateList`, `deleteList`, `searchLists`, `createListItem`, `batchUpdateListItems`, `fetchListItem`, `searchListItems`, `countListItems`, `updateListItem`, `archiveListItem`, `unarchiveListItem`.
|
|
200
|
+
|
|
201
|
+
### Privacy (GDPR)
|
|
202
|
+
|
|
203
|
+
Supports GDPR Articles 15 (right of access) and 17 (right to be forgotten) via `/v1/privacy/users`. Both take an `identifier` and `identifier_type` (`$id` or `$email`):
|
|
204
|
+
|
|
205
|
+
```js
|
|
206
|
+
await castle.requestUserData({
|
|
207
|
+
identifier: 'rhea@example.org',
|
|
208
|
+
identifier_type: '$email',
|
|
209
|
+
});
|
|
210
|
+
|
|
211
|
+
await castle.deleteUserData({
|
|
212
|
+
identifier: 'user_42',
|
|
213
|
+
identifier_type: '$id',
|
|
214
|
+
});
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Events (enterprise)
|
|
218
|
+
|
|
219
|
+
Query, group, and inspect the schema of stored events. Use `queryEvents`,
|
|
220
|
+
`groupEvents`, and `eventsSchema`:
|
|
221
|
+
|
|
222
|
+
```js
|
|
223
|
+
await castle.queryEvents({
|
|
224
|
+
filters: [
|
|
225
|
+
/* ... */
|
|
226
|
+
],
|
|
227
|
+
});
|
|
228
|
+
await castle.groupEvents({
|
|
229
|
+
filters: [],
|
|
230
|
+
group_by: { fields: [] },
|
|
231
|
+
columns: [],
|
|
232
|
+
});
|
|
233
|
+
await castle.eventsSchema();
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
`searchEvents` and `getEventsSchema` are also available as aliases of
|
|
237
|
+
`queryEvents` and `eventsSchema`.
|
|
238
|
+
|
|
239
|
+
### Webhook signature verification
|
|
240
|
+
|
|
241
|
+
Castle signs every webhook with an `X-Castle-Signature` header. Verify it against the **raw** request body before trusting the payload — `verifyWebhookSignature` throws a `WebhookVerificationError` on mismatch:
|
|
242
|
+
|
|
243
|
+
```js
|
|
244
|
+
import express from 'express';
|
|
245
|
+
import { WebhookVerificationError } from '@castleio/sdk';
|
|
246
|
+
|
|
247
|
+
const app = express();
|
|
248
|
+
|
|
249
|
+
// The signature is computed over the raw body, so capture it as a Buffer.
|
|
250
|
+
app.post(
|
|
251
|
+
'/castle/webhooks',
|
|
252
|
+
express.raw({ type: 'application/json' }),
|
|
253
|
+
(req, res) => {
|
|
254
|
+
try {
|
|
255
|
+
castle.verifyWebhookSignature(req.body, req.get('x-castle-signature'));
|
|
256
|
+
} catch (err) {
|
|
257
|
+
if (err instanceof WebhookVerificationError) {
|
|
258
|
+
return res.sendStatus(400);
|
|
259
|
+
}
|
|
260
|
+
throw err;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
const event = JSON.parse(req.body.toString());
|
|
264
|
+
// signature is valid; proceed
|
|
265
|
+
res.sendStatus(200);
|
|
266
|
+
}
|
|
267
|
+
);
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Secure mode
|
|
271
|
+
|
|
272
|
+
Secure mode signs the user id server-side so it can't be tampered with in the browser. Pass the signature to the client-side `castle.js` SDK:
|
|
273
|
+
|
|
274
|
+
```js
|
|
275
|
+
const signature = castle.secureModeSignature('user_123');
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
The signature is a hex HMAC-SHA256 of the user id keyed with your API secret.
|
|
28
279
|
|
|
29
|
-
|
|
280
|
+
## Advanced configuration
|
|
281
|
+
|
|
282
|
+
The defaults are good for most deployments. The options below only matter if you have a non-trivial proxy chain or strict header policies.
|
|
283
|
+
|
|
284
|
+
### Header allow/deny lists
|
|
285
|
+
|
|
286
|
+
By default the SDK sends every HTTP header except `Cookie` and `Authorization`. Castle uses these headers to fingerprint the request, so the broader the better.
|
|
30
287
|
|
|
31
288
|
```js
|
|
32
|
-
import {
|
|
289
|
+
import { DEFAULT_ALLOWLIST } from '@castleio/sdk';
|
|
290
|
+
|
|
291
|
+
const castle = new Castle({
|
|
292
|
+
apiSecret: process.env.CASTLE_API_SECRET,
|
|
33
293
|
|
|
34
|
-
|
|
294
|
+
// Always-blocked headers (in addition to Cookie/Authorization).
|
|
295
|
+
denylisted: ['X-Internal-Header'],
|
|
296
|
+
|
|
297
|
+
// Strict allow-list mode. Headers outside the list are sent with scrubbed
|
|
298
|
+
// values, except User-Agent which is always preserved. If you must use an
|
|
299
|
+
// allow list, we recommend starting from the curated default.
|
|
300
|
+
allowlisted: DEFAULT_ALLOWLIST,
|
|
301
|
+
});
|
|
35
302
|
```
|
|
36
303
|
|
|
37
|
-
|
|
304
|
+
Header names are case-insensitive and accept both `_` and `-` as separators. A leading `HTTP_` prefix is stripped automatically.
|
|
305
|
+
|
|
306
|
+
### Client IP detection
|
|
307
|
+
|
|
308
|
+
Castle needs the original client IP, not the IP of your proxy or load balancer. The SDK reads `X-Forwarded-For` and `Remote-Addr` by default; pick **one** of the strategies below depending on your infrastructure:
|
|
38
309
|
|
|
39
310
|
```js
|
|
40
|
-
const
|
|
311
|
+
const castle = new Castle({
|
|
312
|
+
apiSecret: process.env.CASTLE_API_SECRET,
|
|
41
313
|
|
|
42
|
-
|
|
314
|
+
// 1. Custom header (e.g. Cloudflare's Cf-Connecting-Ip).
|
|
315
|
+
ipHeaders: ['Cf-Connecting-Ip'],
|
|
316
|
+
|
|
317
|
+
// 2. Static, known proxy IPs.
|
|
318
|
+
trustedProxies: ['10.0.0.1'],
|
|
319
|
+
|
|
320
|
+
// 3. Ephemeral proxies but known chain depth.
|
|
321
|
+
trustedProxyDepth: 2,
|
|
322
|
+
|
|
323
|
+
// 4. Last resort: trust the entire X-Forwarded-For chain.
|
|
324
|
+
// Warning: vulnerable to header spoofing if a malicious proxy is in path.
|
|
325
|
+
trustProxyChain: false,
|
|
326
|
+
});
|
|
43
327
|
```
|
|
44
328
|
|
|
45
|
-
|
|
329
|
+
Pick **either** `trustedProxies` **or** `trustedProxyDepth`, never both. Private/loopback ranges in the exported `TRUSTED_PROXIES` constant are always considered trusted.
|
|
330
|
+
|
|
331
|
+
## Errors
|
|
332
|
+
|
|
333
|
+
All HTTP/API exceptions inherit from `APIError`. `ConfigurationError` (setup problems) and `WebhookVerificationError` (webhook signature mismatch) extend `Error` directly. The most useful ones:
|
|
334
|
+
|
|
335
|
+
| Class | Raised when |
|
|
336
|
+
| -------------------------- | ------------------------------------------------------- |
|
|
337
|
+
| `ConfigurationError` | The SDK is misconfigured (missing API secret, bad URL). |
|
|
338
|
+
| `BadRequestError` | `400` response. |
|
|
339
|
+
| `UnauthorizedError` | `401` — bad API secret. |
|
|
340
|
+
| `ForbiddenError` | `403` response. |
|
|
341
|
+
| `NotFoundError` | `404` response. |
|
|
342
|
+
| `InvalidParametersError` | `422` response with validation details. |
|
|
343
|
+
| `InvalidRequestTokenError` | `422` — the `request_token` is missing or invalid. |
|
|
344
|
+
| `RateLimitError` | `429` — back off and retry. |
|
|
345
|
+
| `InternalServerError` | `5xx` response from Castle. |
|
|
346
|
+
| `WebhookVerificationError` | A webhook signature did not match. |
|
|
347
|
+
|
|
348
|
+
The full list lives in [`src/errors.ts`](src/errors.ts).
|
|
349
|
+
|
|
350
|
+
## Upgrading to 3.0.0
|
|
351
|
+
|
|
352
|
+
`3.0.0` is a modernization release. The public API (the `Castle` class and its
|
|
353
|
+
methods) is unchanged — most projects can upgrade without code changes.
|
|
354
|
+
|
|
355
|
+
What changed:
|
|
356
|
+
|
|
357
|
+
- **Legacy endpoints removed.** `authenticate`, `track`, and the device
|
|
358
|
+
endpoints (`getDevice`, `getDevicesForUser`, `approveDevice`, `reportDevice`)
|
|
359
|
+
are gone — use `risk`, `filter`, and `log` instead. The matching payload types
|
|
360
|
+
(`Payload`, `DevicePayload`, `UserDevicePayload`, `AuthenticateResult`) were
|
|
361
|
+
removed too.
|
|
362
|
+
- If you previously used `reportDevice` / `approveDevice`, manage device
|
|
363
|
+
approvals and reports with the **Lists API** instead (e.g.
|
|
364
|
+
`createListItem` / `archiveListItem`). See
|
|
365
|
+
[Reporting devices using Lists](https://docs.castle.io/docs/reporting-devices-using-lists).
|
|
366
|
+
- **Node.js `>= 20` is now required.** The SDK uses the runtime's built-in
|
|
367
|
+
`fetch` and `AbortSignal` instead of `node-fetch` / `abort-controller`, which
|
|
368
|
+
are no longer dependencies.
|
|
369
|
+
- **Dual ESM + CommonJS build.** The package now exposes a proper `exports` map
|
|
370
|
+
with separate `import` and `require` entry points and type definitions. Deep
|
|
371
|
+
imports into `dist/` were never supported and remain unsupported; import from
|
|
372
|
+
the package root (`@castleio/sdk`).
|
|
373
|
+
- The `lodash.*` micro-dependencies were removed in favor of native JavaScript;
|
|
374
|
+
this is internal and does not affect behavior.
|
|
375
|
+
|
|
376
|
+
If you previously relied on a custom `overrideFetch`, it still works — pass any
|
|
377
|
+
`fetch`-compatible implementation.
|
|
378
|
+
|
|
379
|
+
## License
|
|
46
380
|
|
|
47
|
-
|
|
48
|
-
| ----------------- | ------------------ | -------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
49
|
-
| apiSecret | `string` | | API key which can be found in the Castle dashboard https://dashboard.castle.io/settings/general |
|
|
50
|
-
| timeout | `number` | 1500 | Time before returning the failover strategy. |
|
|
51
|
-
| allowlisted | `string[]` | [] | by default, the SDK sends all HTTP headers, except for Cookie and Authorization. <br/><br/> If you decide to use a allowlist, the SDK will:<br/>- always send the User-Agent header<br/>- send scrubbed values of non-allowlisted headers<br/>- send proper values of allowlisted headers.<br/><br/>We highly suggest using denylist instead of allowlist, so that Castle can use as many data points as possible to secure your users. If you want to use the allowlist, this is the minimal amount of headers we recommend: DEFAULT_ALLOWLIST |
|
|
52
|
-
| denylisted | `string[]` | [] | Denylisted headers take precedence over allowlisted elements. We always denylist Cookie and Authentication headers. If you use any other headers that might contain sensitive information, you should denylist them |
|
|
53
|
-
| failoverStrategy | `FailoverStrategy` | `FailoverStrategy.allow` | If the request to our service would for some reason time out, this is where you select the automatic response from `authenticate`. Options are `FailoverStrategy.allow`, `FailoverStrategy.deny`, `FailoverStrategy.challenge`. |
|
|
54
|
-
| logger | `any` | | Logs Castle API requests and responses, has to respond to `info` method. |
|
|
55
|
-
| doNotTrack | `boolean` | False | setting it to true turns off all requests and triggers automatic failover on `authenticate`. Used for development and testing. |
|
|
56
|
-
| ipHeaders | `string[]` | [] | Castle needs the original IP of the client, not the IP of your proxy or load balancer. The SDK will only trust the proxy chain as defined in the configuration.We try to fetch the client IP based on X-Forwarded-For or Remote-Addr headers in that order, but sometimes the client IP may be stored in a different header or order. The SDK can be configured to look for the client IP address in headers that you specify.<br/>Sometimes, Cloud providers do not use consistent IP addresses to proxy requests. In this case, the client IP is usually preserved in a custom header. <br/>Example: Cloudflare preserves the client request in the 'Cf-Connecting-Ip' header. |
|
|
57
|
-
| trustedProxies | `string[]` | [] | If the specified header or X-Forwarded-For default contains a proxy chain with public IP addresses, then you must choose only one of the following (but not both): <br/>1. The trusted_proxies value must match the known proxy IPs. This option is preferable if the IP is static. <br/>2. The trusted_proxy_depth value must be set to the number of known trusted proxies in the chain (see below).This option is preferable if the IPs are ephemeral, but the depth is consistent. <br/>Additionally to make X-Forwarded-For and other headers work better discovering client ip address,and not the address of a reverse proxy server, you can define trusted proxies which will help to fetch proper ip from those headers. <br/>In order to extract the client IP of the X-Forwarded-For header and not the address of a reverse proxy server, you must define all trusted public proxies you can achieve this by listing all the proxies ip defined by string or regular expressions in the trusted_proxies setting <br/> |
|
|
58
|
-
| trustedProxyDepth | `number` | 0 | ...or by providing number of trusted proxies used in the chain, (note that you must pick one approach over the other. either trustProxyChain orr trustedProxies) |
|
|
59
|
-
| trustProxyChain | `boolean` | False | If there is no possibility to define options above and there is no other header that holds the client IP, then you may set this option to True to trust all of the proxy IPs in X-Forwarded-For , _Warning_: this mode is highly promiscuous and could lead to wrongly trusting a spoofed IP if the request passes through a malicious proxy |
|
|
60
|
-
| baseUrl | `string` | `https://api.castle.io/v1` | base Castle API url |
|
|
381
|
+
Available as open source under the terms of the [MIT License](LICENSE).
|