@workos-inc/node 8.0.0-beta.1 → 8.0.0-beta.2
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/lib/actions/actions.cjs +1 -0
- package/lib/actions/actions.cjs.map +1 -1
- package/lib/actions/actions.js +1 -0
- package/lib/actions/actions.js.map +1 -1
- package/lib/common/crypto/crypto-provider.cjs +1 -3
- package/lib/common/crypto/crypto-provider.cjs.map +1 -1
- package/lib/common/crypto/crypto-provider.js +1 -3
- package/lib/common/crypto/crypto-provider.js.map +1 -1
- package/lib/common/crypto/signature-provider.cjs +1 -0
- package/lib/common/crypto/signature-provider.cjs.map +1 -1
- package/lib/common/crypto/signature-provider.js +1 -0
- package/lib/common/crypto/signature-provider.js.map +1 -1
- package/lib/common/crypto/subtle-crypto-provider.cjs +1 -0
- package/lib/common/crypto/subtle-crypto-provider.cjs.map +1 -1
- package/lib/common/crypto/subtle-crypto-provider.js +1 -0
- package/lib/common/crypto/subtle-crypto-provider.js.map +1 -1
- package/lib/common/exceptions/bad-request.exception.cjs +9 -6
- package/lib/common/exceptions/bad-request.exception.cjs.map +1 -1
- package/lib/common/exceptions/bad-request.exception.js +9 -6
- package/lib/common/exceptions/bad-request.exception.js.map +1 -1
- package/lib/common/exceptions/conflict.exception.cjs +6 -5
- package/lib/common/exceptions/conflict.exception.cjs.map +1 -1
- package/lib/common/exceptions/conflict.exception.js +6 -5
- package/lib/common/exceptions/conflict.exception.js.map +1 -1
- package/lib/common/exceptions/generic-server.exception.cjs +2 -2
- package/lib/common/exceptions/generic-server.exception.cjs.map +1 -1
- package/lib/common/exceptions/generic-server.exception.js +2 -2
- package/lib/common/exceptions/generic-server.exception.js.map +1 -1
- package/lib/common/exceptions/no-api-key-provided.exception.cjs +3 -6
- package/lib/common/exceptions/no-api-key-provided.exception.cjs.map +1 -1
- package/lib/common/exceptions/no-api-key-provided.exception.js +3 -6
- package/lib/common/exceptions/no-api-key-provided.exception.js.map +1 -1
- package/lib/common/exceptions/not-found.exception.cjs +8 -5
- package/lib/common/exceptions/not-found.exception.cjs.map +1 -1
- package/lib/common/exceptions/not-found.exception.js +8 -5
- package/lib/common/exceptions/not-found.exception.js.map +1 -1
- package/lib/common/exceptions/oauth.exception.cjs +1 -1
- package/lib/common/exceptions/oauth.exception.cjs.map +1 -1
- package/lib/common/exceptions/oauth.exception.js +1 -1
- package/lib/common/exceptions/oauth.exception.js.map +1 -1
- package/lib/common/exceptions/rate-limit-exceeded.exception.cjs +1 -1
- package/lib/common/exceptions/rate-limit-exceeded.exception.cjs.map +1 -1
- package/lib/common/exceptions/rate-limit-exceeded.exception.js +1 -1
- package/lib/common/exceptions/rate-limit-exceeded.exception.js.map +1 -1
- package/lib/common/exceptions/signature-verification.exception.cjs +4 -4
- package/lib/common/exceptions/signature-verification.exception.cjs.map +1 -1
- package/lib/common/exceptions/signature-verification.exception.js +4 -4
- package/lib/common/exceptions/signature-verification.exception.js.map +1 -1
- package/lib/common/exceptions/unauthorized.exception.cjs +3 -2
- package/lib/common/exceptions/unauthorized.exception.cjs.map +1 -1
- package/lib/common/exceptions/unauthorized.exception.js +3 -2
- package/lib/common/exceptions/unauthorized.exception.js.map +1 -1
- package/lib/common/exceptions/unprocessable-entity.exception.cjs +8 -6
- package/lib/common/exceptions/unprocessable-entity.exception.cjs.map +1 -1
- package/lib/common/exceptions/unprocessable-entity.exception.js +8 -6
- package/lib/common/exceptions/unprocessable-entity.exception.js.map +1 -1
- package/lib/common/net/fetch-client.cjs +2 -0
- package/lib/common/net/fetch-client.cjs.map +1 -1
- package/lib/common/net/fetch-client.js +2 -0
- package/lib/common/net/fetch-client.js.map +1 -1
- package/lib/common/net/http-client.cjs +15 -12
- package/lib/common/net/http-client.cjs.map +1 -1
- package/lib/common/net/http-client.js +15 -12
- package/lib/common/net/http-client.js.map +1 -1
- package/lib/common/utils/fetch-error.cjs +6 -5
- package/lib/common/utils/fetch-error.cjs.map +1 -1
- package/lib/common/utils/fetch-error.js +6 -5
- package/lib/common/utils/fetch-error.js.map +1 -1
- package/lib/common/utils/pagination.cjs +2 -1
- package/lib/common/utils/pagination.cjs.map +1 -1
- package/lib/common/utils/pagination.js +2 -1
- package/lib/common/utils/pagination.js.map +1 -1
- package/lib/fga/interfaces/check.interface.cjs +5 -0
- package/lib/fga/interfaces/check.interface.cjs.map +1 -1
- package/lib/fga/interfaces/check.interface.js +5 -0
- package/lib/fga/interfaces/check.interface.js.map +1 -1
- package/lib/fga/utils/fga-paginatable.cjs +1 -0
- package/lib/fga/utils/fga-paginatable.cjs.map +1 -1
- package/lib/fga/utils/fga-paginatable.js +1 -0
- package/lib/fga/utils/fga-paginatable.js.map +1 -1
- package/lib/user-management/session.cjs +4 -0
- package/lib/user-management/session.cjs.map +1 -1
- package/lib/user-management/session.js +4 -0
- package/lib/user-management/session.js.map +1 -1
- package/lib/user-management/user-management.cjs +2 -0
- package/lib/user-management/user-management.cjs.map +1 -1
- package/lib/user-management/user-management.js +2 -0
- package/lib/user-management/user-management.js.map +1 -1
- package/lib/vault/vault.cjs +1 -0
- package/lib/vault/vault.cjs.map +1 -1
- package/lib/vault/vault.js +1 -0
- package/lib/vault/vault.js.map +1 -1
- package/lib/webhooks/webhooks.cjs +1 -0
- package/lib/webhooks/webhooks.cjs.map +1 -1
- package/lib/webhooks/webhooks.js +1 -0
- package/lib/webhooks/webhooks.js.map +1 -1
- package/lib/workos.cjs +19 -13
- package/lib/workos.cjs.map +1 -1
- package/lib/workos.js +19 -13
- package/lib/workos.js.map +1 -1
- package/package.json +1 -1
package/lib/actions/actions.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/actions/actions.ts"],"sourcesContent":["import { CryptoProvider } from '../common/crypto/crypto-provider';\nimport { SignatureProvider } from '../common/crypto/signature-provider';\nimport { unreachable } from '../common/utils/unreachable';\nimport { ActionContext, ActionPayload } from './interfaces/action.interface';\nimport {\n AuthenticationActionResponseData,\n ResponsePayload,\n UserRegistrationActionResponseData,\n} from './interfaces/response-payload.interface';\nimport { deserializeAction } from './serializers/action.serializer';\n\nexport class Actions {\n private signatureProvider: SignatureProvider;\n\n constructor(cryptoProvider: CryptoProvider) {\n this.signatureProvider = new SignatureProvider(cryptoProvider);\n }\n\n private get computeSignature() {\n return this.signatureProvider.computeSignature.bind(this.signatureProvider);\n }\n\n get verifyHeader() {\n return this.signatureProvider.verifyHeader.bind(this.signatureProvider);\n }\n\n serializeType(\n type:\n | AuthenticationActionResponseData['type']\n | UserRegistrationActionResponseData['type'],\n ) {\n switch (type) {\n case 'authentication':\n return 'authentication_action_response';\n case 'user_registration':\n return 'user_registration_action_response';\n default:\n return unreachable(type);\n }\n }\n\n async signResponse(\n data: AuthenticationActionResponseData | UserRegistrationActionResponseData,\n secret: string,\n ) {\n let errorMessage: string | undefined;\n const { verdict, type } = data;\n\n if (verdict === 'Deny' && data.errorMessage) {\n errorMessage = data.errorMessage;\n }\n\n const responsePayload: ResponsePayload = {\n timestamp: Date.now(),\n verdict,\n ...(verdict === 'Deny' &&\n data.errorMessage && { error_message: errorMessage }),\n };\n\n const response = {\n object: this.serializeType(type),\n payload: responsePayload,\n signature: await this.computeSignature(\n responsePayload.timestamp,\n responsePayload,\n secret,\n ),\n };\n\n return response;\n }\n\n async constructAction({\n payload,\n sigHeader,\n secret,\n tolerance = 30000,\n }: {\n payload: unknown;\n sigHeader: string;\n secret: string;\n tolerance?: number;\n }): Promise<ActionContext> {\n const options = { payload, sigHeader, secret, tolerance };\n await this.verifyHeader(options);\n\n return deserializeAction(payload as ActionPayload);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gCAAkC;AAClC,yBAA4B;AAO5B,IAAAA,iBAAkC;AAE3B,MAAM,QAAQ;AAAA,EAXrB,OAWqB;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/actions/actions.ts"],"sourcesContent":["import { CryptoProvider } from '../common/crypto/crypto-provider';\nimport { SignatureProvider } from '../common/crypto/signature-provider';\nimport { unreachable } from '../common/utils/unreachable';\nimport { ActionContext, ActionPayload } from './interfaces/action.interface';\nimport {\n AuthenticationActionResponseData,\n ResponsePayload,\n UserRegistrationActionResponseData,\n} from './interfaces/response-payload.interface';\nimport { deserializeAction } from './serializers/action.serializer';\n\nexport class Actions {\n private signatureProvider: SignatureProvider;\n\n constructor(cryptoProvider: CryptoProvider) {\n this.signatureProvider = new SignatureProvider(cryptoProvider);\n }\n\n private get computeSignature() {\n return this.signatureProvider.computeSignature.bind(this.signatureProvider);\n }\n\n get verifyHeader() {\n return this.signatureProvider.verifyHeader.bind(this.signatureProvider);\n }\n\n serializeType(\n type:\n | AuthenticationActionResponseData['type']\n | UserRegistrationActionResponseData['type'],\n ) {\n switch (type) {\n case 'authentication':\n return 'authentication_action_response';\n case 'user_registration':\n return 'user_registration_action_response';\n default:\n return unreachable(type);\n }\n }\n\n async signResponse(\n data: AuthenticationActionResponseData | UserRegistrationActionResponseData,\n secret: string,\n ) {\n let errorMessage: string | undefined;\n const { verdict, type } = data;\n\n if (verdict === 'Deny' && data.errorMessage) {\n errorMessage = data.errorMessage;\n }\n\n const responsePayload: ResponsePayload = {\n timestamp: Date.now(),\n verdict,\n ...(verdict === 'Deny' &&\n data.errorMessage && { error_message: errorMessage }),\n };\n\n const response = {\n object: this.serializeType(type),\n payload: responsePayload,\n signature: await this.computeSignature(\n responsePayload.timestamp,\n responsePayload,\n secret,\n ),\n };\n\n return response;\n }\n\n async constructAction({\n payload,\n sigHeader,\n secret,\n tolerance = 30000,\n }: {\n payload: unknown;\n sigHeader: string;\n secret: string;\n tolerance?: number;\n }): Promise<ActionContext> {\n const options = { payload, sigHeader, secret, tolerance };\n await this.verifyHeader(options);\n\n return deserializeAction(payload as ActionPayload);\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,gCAAkC;AAClC,yBAA4B;AAO5B,IAAAA,iBAAkC;AAE3B,MAAM,QAAQ;AAAA,EAXrB,OAWqB;AAAA;AAAA;AAAA,EACX;AAAA,EAER,YAAY,gBAAgC;AAC1C,SAAK,oBAAoB,IAAI,4CAAkB,cAAc;AAAA,EAC/D;AAAA,EAEA,IAAY,mBAAmB;AAC7B,WAAO,KAAK,kBAAkB,iBAAiB,KAAK,KAAK,iBAAiB;AAAA,EAC5E;AAAA,EAEA,IAAI,eAAe;AACjB,WAAO,KAAK,kBAAkB,aAAa,KAAK,KAAK,iBAAiB;AAAA,EACxE;AAAA,EAEA,cACE,MAGA;AACA,YAAQ,MAAM;AAAA,MACZ,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,mBAAO,gCAAY,IAAI;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,MAAM,aACJ,MACA,QACA;AACA,QAAI;AACJ,UAAM,EAAE,SAAS,KAAK,IAAI;AAE1B,QAAI,YAAY,UAAU,KAAK,cAAc;AAC3C,qBAAe,KAAK;AAAA,IACtB;AAEA,UAAM,kBAAmC;AAAA,MACvC,WAAW,KAAK,IAAI;AAAA,MACpB;AAAA,MACA,GAAI,YAAY,UACd,KAAK,gBAAgB,EAAE,eAAe,aAAa;AAAA,IACvD;AAEA,UAAM,WAAW;AAAA,MACf,QAAQ,KAAK,cAAc,IAAI;AAAA,MAC/B,SAAS;AAAA,MACT,WAAW,MAAM,KAAK;AAAA,QACpB,gBAAgB;AAAA,QAChB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,gBAAgB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,EACd,GAK2B;AACzB,UAAM,UAAU,EAAE,SAAS,WAAW,QAAQ,UAAU;AACxD,UAAM,KAAK,aAAa,OAAO;AAE/B,eAAO,kCAAkB,OAAwB;AAAA,EACnD;AACF;","names":["import_action"]}
|
package/lib/actions/actions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/actions/actions.ts"],"sourcesContent":["import { CryptoProvider } from '../common/crypto/crypto-provider';\nimport { SignatureProvider } from '../common/crypto/signature-provider';\nimport { unreachable } from '../common/utils/unreachable';\nimport { ActionContext, ActionPayload } from './interfaces/action.interface';\nimport {\n AuthenticationActionResponseData,\n ResponsePayload,\n UserRegistrationActionResponseData,\n} from './interfaces/response-payload.interface';\nimport { deserializeAction } from './serializers/action.serializer';\n\nexport class Actions {\n private signatureProvider: SignatureProvider;\n\n constructor(cryptoProvider: CryptoProvider) {\n this.signatureProvider = new SignatureProvider(cryptoProvider);\n }\n\n private get computeSignature() {\n return this.signatureProvider.computeSignature.bind(this.signatureProvider);\n }\n\n get verifyHeader() {\n return this.signatureProvider.verifyHeader.bind(this.signatureProvider);\n }\n\n serializeType(\n type:\n | AuthenticationActionResponseData['type']\n | UserRegistrationActionResponseData['type'],\n ) {\n switch (type) {\n case 'authentication':\n return 'authentication_action_response';\n case 'user_registration':\n return 'user_registration_action_response';\n default:\n return unreachable(type);\n }\n }\n\n async signResponse(\n data: AuthenticationActionResponseData | UserRegistrationActionResponseData,\n secret: string,\n ) {\n let errorMessage: string | undefined;\n const { verdict, type } = data;\n\n if (verdict === 'Deny' && data.errorMessage) {\n errorMessage = data.errorMessage;\n }\n\n const responsePayload: ResponsePayload = {\n timestamp: Date.now(),\n verdict,\n ...(verdict === 'Deny' &&\n data.errorMessage && { error_message: errorMessage }),\n };\n\n const response = {\n object: this.serializeType(type),\n payload: responsePayload,\n signature: await this.computeSignature(\n responsePayload.timestamp,\n responsePayload,\n secret,\n ),\n };\n\n return response;\n }\n\n async constructAction({\n payload,\n sigHeader,\n secret,\n tolerance = 30000,\n }: {\n payload: unknown;\n sigHeader: string;\n secret: string;\n tolerance?: number;\n }): Promise<ActionContext> {\n const options = { payload, sigHeader, secret, tolerance };\n await this.verifyHeader(options);\n\n return deserializeAction(payload as ActionPayload);\n }\n}\n"],"mappings":";;AACA,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAO5B,SAAS,yBAAyB;AAE3B,MAAM,QAAQ;AAAA,EAXrB,OAWqB;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../src/actions/actions.ts"],"sourcesContent":["import { CryptoProvider } from '../common/crypto/crypto-provider';\nimport { SignatureProvider } from '../common/crypto/signature-provider';\nimport { unreachable } from '../common/utils/unreachable';\nimport { ActionContext, ActionPayload } from './interfaces/action.interface';\nimport {\n AuthenticationActionResponseData,\n ResponsePayload,\n UserRegistrationActionResponseData,\n} from './interfaces/response-payload.interface';\nimport { deserializeAction } from './serializers/action.serializer';\n\nexport class Actions {\n private signatureProvider: SignatureProvider;\n\n constructor(cryptoProvider: CryptoProvider) {\n this.signatureProvider = new SignatureProvider(cryptoProvider);\n }\n\n private get computeSignature() {\n return this.signatureProvider.computeSignature.bind(this.signatureProvider);\n }\n\n get verifyHeader() {\n return this.signatureProvider.verifyHeader.bind(this.signatureProvider);\n }\n\n serializeType(\n type:\n | AuthenticationActionResponseData['type']\n | UserRegistrationActionResponseData['type'],\n ) {\n switch (type) {\n case 'authentication':\n return 'authentication_action_response';\n case 'user_registration':\n return 'user_registration_action_response';\n default:\n return unreachable(type);\n }\n }\n\n async signResponse(\n data: AuthenticationActionResponseData | UserRegistrationActionResponseData,\n secret: string,\n ) {\n let errorMessage: string | undefined;\n const { verdict, type } = data;\n\n if (verdict === 'Deny' && data.errorMessage) {\n errorMessage = data.errorMessage;\n }\n\n const responsePayload: ResponsePayload = {\n timestamp: Date.now(),\n verdict,\n ...(verdict === 'Deny' &&\n data.errorMessage && { error_message: errorMessage }),\n };\n\n const response = {\n object: this.serializeType(type),\n payload: responsePayload,\n signature: await this.computeSignature(\n responsePayload.timestamp,\n responsePayload,\n secret,\n ),\n };\n\n return response;\n }\n\n async constructAction({\n payload,\n sigHeader,\n secret,\n tolerance = 30000,\n }: {\n payload: unknown;\n sigHeader: string;\n secret: string;\n tolerance?: number;\n }): Promise<ActionContext> {\n const options = { payload, sigHeader, secret, tolerance };\n await this.verifyHeader(options);\n\n return deserializeAction(payload as ActionPayload);\n }\n}\n"],"mappings":";;AACA,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAO5B,SAAS,yBAAyB;AAE3B,MAAM,QAAQ;AAAA,EAXrB,OAWqB;AAAA;AAAA;AAAA,EACX;AAAA,EAER,YAAY,gBAAgC;AAC1C,SAAK,oBAAoB,IAAI,kBAAkB,cAAc;AAAA,EAC/D;AAAA,EAEA,IAAY,mBAAmB;AAC7B,WAAO,KAAK,kBAAkB,iBAAiB,KAAK,KAAK,iBAAiB;AAAA,EAC5E;AAAA,EAEA,IAAI,eAAe;AACjB,WAAO,KAAK,kBAAkB,aAAa,KAAK,KAAK,iBAAiB;AAAA,EACxE;AAAA,EAEA,cACE,MAGA;AACA,YAAQ,MAAM;AAAA,MACZ,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO,YAAY,IAAI;AAAA,IAC3B;AAAA,EACF;AAAA,EAEA,MAAM,aACJ,MACA,QACA;AACA,QAAI;AACJ,UAAM,EAAE,SAAS,KAAK,IAAI;AAE1B,QAAI,YAAY,UAAU,KAAK,cAAc;AAC3C,qBAAe,KAAK;AAAA,IACtB;AAEA,UAAM,kBAAmC;AAAA,MACvC,WAAW,KAAK,IAAI;AAAA,MACpB;AAAA,MACA,GAAI,YAAY,UACd,KAAK,gBAAgB,EAAE,eAAe,aAAa;AAAA,IACvD;AAEA,UAAM,WAAW;AAAA,MACf,QAAQ,KAAK,cAAc,IAAI;AAAA,MAC/B,SAAS;AAAA,MACT,WAAW,MAAM,KAAK;AAAA,QACpB,gBAAgB;AAAA,QAChB;AAAA,QACA;AAAA,MACF;AAAA,IACF;AAEA,WAAO;AAAA,EACT;AAAA,EAEA,MAAM,gBAAgB;AAAA,IACpB;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,EACd,GAK2B;AACzB,UAAM,UAAU,EAAE,SAAS,WAAW,QAAQ,UAAU;AACxD,UAAM,KAAK,aAAa,OAAO;AAE/B,WAAO,kBAAkB,OAAwB;AAAA,EACnD;AACF;","names":[]}
|
|
@@ -23,12 +23,10 @@ __export(crypto_provider_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(crypto_provider_exports);
|
|
25
25
|
class CryptoProvider {
|
|
26
|
-
constructor() {
|
|
27
|
-
this.encoder = new TextEncoder();
|
|
28
|
-
}
|
|
29
26
|
static {
|
|
30
27
|
__name(this, "CryptoProvider");
|
|
31
28
|
}
|
|
29
|
+
encoder = new TextEncoder();
|
|
32
30
|
}
|
|
33
31
|
// Annotate the CommonJS export names for ESM import in node:
|
|
34
32
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/crypto/crypto-provider.ts"],"sourcesContent":["/**\n * Interface encapsulating the various crypto computations used by the library,\n * allowing pluggable underlying crypto implementations.\n */\nexport abstract class CryptoProvider {\n encoder = new TextEncoder();\n\n /**\n * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).\n * The output HMAC should be encoded in hexadecimal.\n *\n * Sample values for implementations:\n * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'\n * - computeHMACSignature('\\ud83d\\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43\n */\n abstract computeHMACSignature(payload: string, secret: string): string;\n\n /**\n * Asynchronous version of `computeHMACSignature`. Some implementations may\n * only allow support async signature computation.\n *\n * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).\n * The output HMAC should be encoded in hexadecimal.\n *\n * Sample values for implementations:\n * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'\n * - computeHMACSignature('\\ud83d\\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43\n */\n abstract computeHMACSignatureAsync(\n payload: string,\n secret: string,\n ): Promise<string>;\n\n /**\n * Cryptographically determine whether two signatures are equal\n */\n abstract secureCompare(stringA: string, stringB: string): Promise<boolean>;\n\n /**\n * Encrypts data using AES-256-GCM algorithm.\n *\n * @param plaintext The data to encrypt\n * @param key The encryption key (should be 32 bytes for AES-256)\n * @param iv Optional initialization vector (if not provided, a random one will be generated)\n * @param aad Optional additional authenticated data\n * @returns Object containing the encrypted ciphertext, the IV used, and the authentication tag\n */\n abstract encrypt(\n plaintext: Uint8Array,\n key: Uint8Array,\n iv?: Uint8Array,\n aad?: Uint8Array,\n ): Promise<{\n ciphertext: Uint8Array;\n iv: Uint8Array;\n tag: Uint8Array;\n }>;\n\n /**\n * Decrypts data that was encrypted using AES-256-GCM algorithm.\n *\n * @param ciphertext The encrypted data\n * @param key The decryption key (must be the same key used for encryption)\n * @param iv The initialization vector used during encryption\n * @param tag The authentication tag produced during encryption\n * @param aad Optional additional authenticated data (must match what was used during encryption)\n * @returns The decrypted data\n * @throws Will throw an error if authentication fails or the data has been tampered with\n */\n abstract decrypt(\n ciphertext: Uint8Array,\n key: Uint8Array,\n iv: Uint8Array,\n tag: Uint8Array,\n aad?: Uint8Array,\n ): Promise<Uint8Array>;\n\n /**\n * Generates cryptographically secure random bytes.\n *\n * @param length The number of random bytes to generate\n * @returns A Uint8Array containing the random bytes\n */\n abstract randomBytes(length: number): Uint8Array;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,MAAe,eAAe;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/crypto/crypto-provider.ts"],"sourcesContent":["/**\n * Interface encapsulating the various crypto computations used by the library,\n * allowing pluggable underlying crypto implementations.\n */\nexport abstract class CryptoProvider {\n encoder = new TextEncoder();\n\n /**\n * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).\n * The output HMAC should be encoded in hexadecimal.\n *\n * Sample values for implementations:\n * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'\n * - computeHMACSignature('\\ud83d\\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43\n */\n abstract computeHMACSignature(payload: string, secret: string): string;\n\n /**\n * Asynchronous version of `computeHMACSignature`. Some implementations may\n * only allow support async signature computation.\n *\n * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).\n * The output HMAC should be encoded in hexadecimal.\n *\n * Sample values for implementations:\n * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'\n * - computeHMACSignature('\\ud83d\\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43\n */\n abstract computeHMACSignatureAsync(\n payload: string,\n secret: string,\n ): Promise<string>;\n\n /**\n * Cryptographically determine whether two signatures are equal\n */\n abstract secureCompare(stringA: string, stringB: string): Promise<boolean>;\n\n /**\n * Encrypts data using AES-256-GCM algorithm.\n *\n * @param plaintext The data to encrypt\n * @param key The encryption key (should be 32 bytes for AES-256)\n * @param iv Optional initialization vector (if not provided, a random one will be generated)\n * @param aad Optional additional authenticated data\n * @returns Object containing the encrypted ciphertext, the IV used, and the authentication tag\n */\n abstract encrypt(\n plaintext: Uint8Array,\n key: Uint8Array,\n iv?: Uint8Array,\n aad?: Uint8Array,\n ): Promise<{\n ciphertext: Uint8Array;\n iv: Uint8Array;\n tag: Uint8Array;\n }>;\n\n /**\n * Decrypts data that was encrypted using AES-256-GCM algorithm.\n *\n * @param ciphertext The encrypted data\n * @param key The decryption key (must be the same key used for encryption)\n * @param iv The initialization vector used during encryption\n * @param tag The authentication tag produced during encryption\n * @param aad Optional additional authenticated data (must match what was used during encryption)\n * @returns The decrypted data\n * @throws Will throw an error if authentication fails or the data has been tampered with\n */\n abstract decrypt(\n ciphertext: Uint8Array,\n key: Uint8Array,\n iv: Uint8Array,\n tag: Uint8Array,\n aad?: Uint8Array,\n ): Promise<Uint8Array>;\n\n /**\n * Generates cryptographically secure random bytes.\n *\n * @param length The number of random bytes to generate\n * @returns A Uint8Array containing the random bytes\n */\n abstract randomBytes(length: number): Uint8Array;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIO,MAAe,eAAe;AAAA,EAJrC,OAIqC;AAAA;AAAA;AAAA,EACnC,UAAU,IAAI,YAAY;AA+E5B;","names":[]}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
class CryptoProvider {
|
|
4
|
-
constructor() {
|
|
5
|
-
this.encoder = new TextEncoder();
|
|
6
|
-
}
|
|
7
4
|
static {
|
|
8
5
|
__name(this, "CryptoProvider");
|
|
9
6
|
}
|
|
7
|
+
encoder = new TextEncoder();
|
|
10
8
|
}
|
|
11
9
|
export {
|
|
12
10
|
CryptoProvider
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/crypto/crypto-provider.ts"],"sourcesContent":["/**\n * Interface encapsulating the various crypto computations used by the library,\n * allowing pluggable underlying crypto implementations.\n */\nexport abstract class CryptoProvider {\n encoder = new TextEncoder();\n\n /**\n * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).\n * The output HMAC should be encoded in hexadecimal.\n *\n * Sample values for implementations:\n * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'\n * - computeHMACSignature('\\ud83d\\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43\n */\n abstract computeHMACSignature(payload: string, secret: string): string;\n\n /**\n * Asynchronous version of `computeHMACSignature`. Some implementations may\n * only allow support async signature computation.\n *\n * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).\n * The output HMAC should be encoded in hexadecimal.\n *\n * Sample values for implementations:\n * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'\n * - computeHMACSignature('\\ud83d\\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43\n */\n abstract computeHMACSignatureAsync(\n payload: string,\n secret: string,\n ): Promise<string>;\n\n /**\n * Cryptographically determine whether two signatures are equal\n */\n abstract secureCompare(stringA: string, stringB: string): Promise<boolean>;\n\n /**\n * Encrypts data using AES-256-GCM algorithm.\n *\n * @param plaintext The data to encrypt\n * @param key The encryption key (should be 32 bytes for AES-256)\n * @param iv Optional initialization vector (if not provided, a random one will be generated)\n * @param aad Optional additional authenticated data\n * @returns Object containing the encrypted ciphertext, the IV used, and the authentication tag\n */\n abstract encrypt(\n plaintext: Uint8Array,\n key: Uint8Array,\n iv?: Uint8Array,\n aad?: Uint8Array,\n ): Promise<{\n ciphertext: Uint8Array;\n iv: Uint8Array;\n tag: Uint8Array;\n }>;\n\n /**\n * Decrypts data that was encrypted using AES-256-GCM algorithm.\n *\n * @param ciphertext The encrypted data\n * @param key The decryption key (must be the same key used for encryption)\n * @param iv The initialization vector used during encryption\n * @param tag The authentication tag produced during encryption\n * @param aad Optional additional authenticated data (must match what was used during encryption)\n * @returns The decrypted data\n * @throws Will throw an error if authentication fails or the data has been tampered with\n */\n abstract decrypt(\n ciphertext: Uint8Array,\n key: Uint8Array,\n iv: Uint8Array,\n tag: Uint8Array,\n aad?: Uint8Array,\n ): Promise<Uint8Array>;\n\n /**\n * Generates cryptographically secure random bytes.\n *\n * @param length The number of random bytes to generate\n * @returns A Uint8Array containing the random bytes\n */\n abstract randomBytes(length: number): Uint8Array;\n}\n"],"mappings":";;AAIO,MAAe,eAAe;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/crypto/crypto-provider.ts"],"sourcesContent":["/**\n * Interface encapsulating the various crypto computations used by the library,\n * allowing pluggable underlying crypto implementations.\n */\nexport abstract class CryptoProvider {\n encoder = new TextEncoder();\n\n /**\n * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).\n * The output HMAC should be encoded in hexadecimal.\n *\n * Sample values for implementations:\n * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'\n * - computeHMACSignature('\\ud83d\\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43\n */\n abstract computeHMACSignature(payload: string, secret: string): string;\n\n /**\n * Asynchronous version of `computeHMACSignature`. Some implementations may\n * only allow support async signature computation.\n *\n * Computes a SHA-256 HMAC given a secret and a payload (encoded in UTF-8).\n * The output HMAC should be encoded in hexadecimal.\n *\n * Sample values for implementations:\n * - computeHMACSignature('', 'test_secret') => 'f7f9bd47fb987337b5796fdc1fdb9ba221d0d5396814bfcaf9521f43fd8927fd'\n * - computeHMACSignature('\\ud83d\\ude00', 'test_secret') => '837da296d05c4fe31f61d5d7ead035099d9585a5bcde87de952012a78f0b0c43\n */\n abstract computeHMACSignatureAsync(\n payload: string,\n secret: string,\n ): Promise<string>;\n\n /**\n * Cryptographically determine whether two signatures are equal\n */\n abstract secureCompare(stringA: string, stringB: string): Promise<boolean>;\n\n /**\n * Encrypts data using AES-256-GCM algorithm.\n *\n * @param plaintext The data to encrypt\n * @param key The encryption key (should be 32 bytes for AES-256)\n * @param iv Optional initialization vector (if not provided, a random one will be generated)\n * @param aad Optional additional authenticated data\n * @returns Object containing the encrypted ciphertext, the IV used, and the authentication tag\n */\n abstract encrypt(\n plaintext: Uint8Array,\n key: Uint8Array,\n iv?: Uint8Array,\n aad?: Uint8Array,\n ): Promise<{\n ciphertext: Uint8Array;\n iv: Uint8Array;\n tag: Uint8Array;\n }>;\n\n /**\n * Decrypts data that was encrypted using AES-256-GCM algorithm.\n *\n * @param ciphertext The encrypted data\n * @param key The decryption key (must be the same key used for encryption)\n * @param iv The initialization vector used during encryption\n * @param tag The authentication tag produced during encryption\n * @param aad Optional additional authenticated data (must match what was used during encryption)\n * @returns The decrypted data\n * @throws Will throw an error if authentication fails or the data has been tampered with\n */\n abstract decrypt(\n ciphertext: Uint8Array,\n key: Uint8Array,\n iv: Uint8Array,\n tag: Uint8Array,\n aad?: Uint8Array,\n ): Promise<Uint8Array>;\n\n /**\n * Generates cryptographically secure random bytes.\n *\n * @param length The number of random bytes to generate\n * @returns A Uint8Array containing the random bytes\n */\n abstract randomBytes(length: number): Uint8Array;\n}\n"],"mappings":";;AAIO,MAAe,eAAe;AAAA,EAJrC,OAIqC;AAAA;AAAA;AAAA,EACnC,UAAU,IAAI,YAAY;AA+E5B;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/crypto/signature-provider.ts"],"sourcesContent":["import { SignatureVerificationException } from '../exceptions';\nimport { CryptoProvider } from './crypto-provider';\n\nexport class SignatureProvider {\n private cryptoProvider: CryptoProvider;\n\n constructor(cryptoProvider: CryptoProvider) {\n this.cryptoProvider = cryptoProvider;\n }\n\n async verifyHeader({\n payload,\n sigHeader,\n secret,\n tolerance = 180000,\n }: {\n payload: any;\n sigHeader: string;\n secret: string;\n tolerance?: number;\n }): Promise<boolean> {\n const [timestamp, signatureHash] =\n this.getTimestampAndSignatureHash(sigHeader);\n\n if (!signatureHash || Object.keys(signatureHash).length === 0) {\n throw new SignatureVerificationException(\n 'No signature hash found with expected scheme v1',\n );\n }\n\n if (parseInt(timestamp, 10) < Date.now() - tolerance) {\n throw new SignatureVerificationException(\n 'Timestamp outside the tolerance zone',\n );\n }\n\n const expectedSig = await this.computeSignature(timestamp, payload, secret);\n if (\n (await this.cryptoProvider.secureCompare(expectedSig, signatureHash)) ===\n false\n ) {\n throw new SignatureVerificationException(\n 'Signature hash does not match the expected signature hash for payload',\n );\n }\n return true;\n }\n\n getTimestampAndSignatureHash(sigHeader: string): [string, string] {\n const signature = sigHeader;\n const [t, v1] = signature.split(',');\n if (typeof t === 'undefined' || typeof v1 === 'undefined') {\n throw new SignatureVerificationException(\n 'Signature or timestamp missing',\n );\n }\n const { 1: timestamp } = t.split('=');\n const { 1: signatureHash } = v1.split('=');\n\n return [timestamp, signatureHash];\n }\n\n async computeSignature(\n timestamp: any,\n payload: any,\n secret: string,\n ): Promise<string> {\n payload = JSON.stringify(payload);\n const signedPayload = `${timestamp}.${payload}`;\n\n return await this.cryptoProvider.computeHMACSignatureAsync(\n signedPayload,\n secret,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA+C;AAGxC,MAAM,kBAAkB;AAAA,EAH/B,OAG+B;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/crypto/signature-provider.ts"],"sourcesContent":["import { SignatureVerificationException } from '../exceptions';\nimport { CryptoProvider } from './crypto-provider';\n\nexport class SignatureProvider {\n private cryptoProvider: CryptoProvider;\n\n constructor(cryptoProvider: CryptoProvider) {\n this.cryptoProvider = cryptoProvider;\n }\n\n async verifyHeader({\n payload,\n sigHeader,\n secret,\n tolerance = 180000,\n }: {\n payload: any;\n sigHeader: string;\n secret: string;\n tolerance?: number;\n }): Promise<boolean> {\n const [timestamp, signatureHash] =\n this.getTimestampAndSignatureHash(sigHeader);\n\n if (!signatureHash || Object.keys(signatureHash).length === 0) {\n throw new SignatureVerificationException(\n 'No signature hash found with expected scheme v1',\n );\n }\n\n if (parseInt(timestamp, 10) < Date.now() - tolerance) {\n throw new SignatureVerificationException(\n 'Timestamp outside the tolerance zone',\n );\n }\n\n const expectedSig = await this.computeSignature(timestamp, payload, secret);\n if (\n (await this.cryptoProvider.secureCompare(expectedSig, signatureHash)) ===\n false\n ) {\n throw new SignatureVerificationException(\n 'Signature hash does not match the expected signature hash for payload',\n );\n }\n return true;\n }\n\n getTimestampAndSignatureHash(sigHeader: string): [string, string] {\n const signature = sigHeader;\n const [t, v1] = signature.split(',');\n if (typeof t === 'undefined' || typeof v1 === 'undefined') {\n throw new SignatureVerificationException(\n 'Signature or timestamp missing',\n );\n }\n const { 1: timestamp } = t.split('=');\n const { 1: signatureHash } = v1.split('=');\n\n return [timestamp, signatureHash];\n }\n\n async computeSignature(\n timestamp: any,\n payload: any,\n secret: string,\n ): Promise<string> {\n payload = JSON.stringify(payload);\n const signedPayload = `${timestamp}.${payload}`;\n\n return await this.cryptoProvider.computeHMACSignatureAsync(\n signedPayload,\n secret,\n );\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,wBAA+C;AAGxC,MAAM,kBAAkB;AAAA,EAH/B,OAG+B;AAAA;AAAA;AAAA,EACrB;AAAA,EAER,YAAY,gBAAgC;AAC1C,SAAK,iBAAiB;AAAA,EACxB;AAAA,EAEA,MAAM,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,EACd,GAKqB;AACnB,UAAM,CAAC,WAAW,aAAa,IAC7B,KAAK,6BAA6B,SAAS;AAE7C,QAAI,CAAC,iBAAiB,OAAO,KAAK,aAAa,EAAE,WAAW,GAAG;AAC7D,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,QAAI,SAAS,WAAW,EAAE,IAAI,KAAK,IAAI,IAAI,WAAW;AACpD,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,cAAc,MAAM,KAAK,iBAAiB,WAAW,SAAS,MAAM;AAC1E,QACG,MAAM,KAAK,eAAe,cAAc,aAAa,aAAa,MACnE,OACA;AACA,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EAEA,6BAA6B,WAAqC;AAChE,UAAM,YAAY;AAClB,UAAM,CAAC,GAAG,EAAE,IAAI,UAAU,MAAM,GAAG;AACnC,QAAI,OAAO,MAAM,eAAe,OAAO,OAAO,aAAa;AACzD,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AACA,UAAM,EAAE,GAAG,UAAU,IAAI,EAAE,MAAM,GAAG;AACpC,UAAM,EAAE,GAAG,cAAc,IAAI,GAAG,MAAM,GAAG;AAEzC,WAAO,CAAC,WAAW,aAAa;AAAA,EAClC;AAAA,EAEA,MAAM,iBACJ,WACA,SACA,QACiB;AACjB,cAAU,KAAK,UAAU,OAAO;AAChC,UAAM,gBAAgB,GAAG,SAAS,IAAI,OAAO;AAE7C,WAAO,MAAM,KAAK,eAAe;AAAA,MAC/B;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/crypto/signature-provider.ts"],"sourcesContent":["import { SignatureVerificationException } from '../exceptions';\nimport { CryptoProvider } from './crypto-provider';\n\nexport class SignatureProvider {\n private cryptoProvider: CryptoProvider;\n\n constructor(cryptoProvider: CryptoProvider) {\n this.cryptoProvider = cryptoProvider;\n }\n\n async verifyHeader({\n payload,\n sigHeader,\n secret,\n tolerance = 180000,\n }: {\n payload: any;\n sigHeader: string;\n secret: string;\n tolerance?: number;\n }): Promise<boolean> {\n const [timestamp, signatureHash] =\n this.getTimestampAndSignatureHash(sigHeader);\n\n if (!signatureHash || Object.keys(signatureHash).length === 0) {\n throw new SignatureVerificationException(\n 'No signature hash found with expected scheme v1',\n );\n }\n\n if (parseInt(timestamp, 10) < Date.now() - tolerance) {\n throw new SignatureVerificationException(\n 'Timestamp outside the tolerance zone',\n );\n }\n\n const expectedSig = await this.computeSignature(timestamp, payload, secret);\n if (\n (await this.cryptoProvider.secureCompare(expectedSig, signatureHash)) ===\n false\n ) {\n throw new SignatureVerificationException(\n 'Signature hash does not match the expected signature hash for payload',\n );\n }\n return true;\n }\n\n getTimestampAndSignatureHash(sigHeader: string): [string, string] {\n const signature = sigHeader;\n const [t, v1] = signature.split(',');\n if (typeof t === 'undefined' || typeof v1 === 'undefined') {\n throw new SignatureVerificationException(\n 'Signature or timestamp missing',\n );\n }\n const { 1: timestamp } = t.split('=');\n const { 1: signatureHash } = v1.split('=');\n\n return [timestamp, signatureHash];\n }\n\n async computeSignature(\n timestamp: any,\n payload: any,\n secret: string,\n ): Promise<string> {\n payload = JSON.stringify(payload);\n const signedPayload = `${timestamp}.${payload}`;\n\n return await this.cryptoProvider.computeHMACSignatureAsync(\n signedPayload,\n secret,\n );\n }\n}\n"],"mappings":";;AAAA,SAAS,sCAAsC;AAGxC,MAAM,kBAAkB;AAAA,EAH/B,OAG+B;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/crypto/signature-provider.ts"],"sourcesContent":["import { SignatureVerificationException } from '../exceptions';\nimport { CryptoProvider } from './crypto-provider';\n\nexport class SignatureProvider {\n private cryptoProvider: CryptoProvider;\n\n constructor(cryptoProvider: CryptoProvider) {\n this.cryptoProvider = cryptoProvider;\n }\n\n async verifyHeader({\n payload,\n sigHeader,\n secret,\n tolerance = 180000,\n }: {\n payload: any;\n sigHeader: string;\n secret: string;\n tolerance?: number;\n }): Promise<boolean> {\n const [timestamp, signatureHash] =\n this.getTimestampAndSignatureHash(sigHeader);\n\n if (!signatureHash || Object.keys(signatureHash).length === 0) {\n throw new SignatureVerificationException(\n 'No signature hash found with expected scheme v1',\n );\n }\n\n if (parseInt(timestamp, 10) < Date.now() - tolerance) {\n throw new SignatureVerificationException(\n 'Timestamp outside the tolerance zone',\n );\n }\n\n const expectedSig = await this.computeSignature(timestamp, payload, secret);\n if (\n (await this.cryptoProvider.secureCompare(expectedSig, signatureHash)) ===\n false\n ) {\n throw new SignatureVerificationException(\n 'Signature hash does not match the expected signature hash for payload',\n );\n }\n return true;\n }\n\n getTimestampAndSignatureHash(sigHeader: string): [string, string] {\n const signature = sigHeader;\n const [t, v1] = signature.split(',');\n if (typeof t === 'undefined' || typeof v1 === 'undefined') {\n throw new SignatureVerificationException(\n 'Signature or timestamp missing',\n );\n }\n const { 1: timestamp } = t.split('=');\n const { 1: signatureHash } = v1.split('=');\n\n return [timestamp, signatureHash];\n }\n\n async computeSignature(\n timestamp: any,\n payload: any,\n secret: string,\n ): Promise<string> {\n payload = JSON.stringify(payload);\n const signedPayload = `${timestamp}.${payload}`;\n\n return await this.cryptoProvider.computeHMACSignatureAsync(\n signedPayload,\n secret,\n );\n }\n}\n"],"mappings":";;AAAA,SAAS,sCAAsC;AAGxC,MAAM,kBAAkB;AAAA,EAH/B,OAG+B;AAAA;AAAA;AAAA,EACrB;AAAA,EAER,YAAY,gBAAgC;AAC1C,SAAK,iBAAiB;AAAA,EACxB;AAAA,EAEA,MAAM,aAAa;AAAA,IACjB;AAAA,IACA;AAAA,IACA;AAAA,IACA,YAAY;AAAA,EACd,GAKqB;AACnB,UAAM,CAAC,WAAW,aAAa,IAC7B,KAAK,6BAA6B,SAAS;AAE7C,QAAI,CAAC,iBAAiB,OAAO,KAAK,aAAa,EAAE,WAAW,GAAG;AAC7D,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,QAAI,SAAS,WAAW,EAAE,IAAI,KAAK,IAAI,IAAI,WAAW;AACpD,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AAEA,UAAM,cAAc,MAAM,KAAK,iBAAiB,WAAW,SAAS,MAAM;AAC1E,QACG,MAAM,KAAK,eAAe,cAAc,aAAa,aAAa,MACnE,OACA;AACA,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AACA,WAAO;AAAA,EACT;AAAA,EAEA,6BAA6B,WAAqC;AAChE,UAAM,YAAY;AAClB,UAAM,CAAC,GAAG,EAAE,IAAI,UAAU,MAAM,GAAG;AACnC,QAAI,OAAO,MAAM,eAAe,OAAO,OAAO,aAAa;AACzD,YAAM,IAAI;AAAA,QACR;AAAA,MACF;AAAA,IACF;AACA,UAAM,EAAE,GAAG,UAAU,IAAI,EAAE,MAAM,GAAG;AACpC,UAAM,EAAE,GAAG,cAAc,IAAI,GAAG,MAAM,GAAG;AAEzC,WAAO,CAAC,WAAW,aAAa;AAAA,EAClC;AAAA,EAEA,MAAM,iBACJ,WACA,SACA,QACiB;AACjB,cAAU,KAAK,UAAU,OAAO;AAChC,UAAM,gBAAgB,GAAG,SAAS,IAAI,OAAO;AAE7C,WAAO,MAAM,KAAK,eAAe;AAAA,MAC/B;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/crypto/subtle-crypto-provider.ts"],"sourcesContent":["import { CryptoProvider } from './crypto-provider';\n\n/**\n * `CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API.\n *\n * This only supports asynchronous operations.\n */\nexport class SubtleCryptoProvider extends CryptoProvider {\n subtleCrypto: SubtleCrypto;\n\n constructor(subtleCrypto?: SubtleCrypto) {\n super();\n\n // If no subtle crypto is interface, default to the global namespace. This\n // is to allow custom interfaces (eg. using the Node webcrypto interface in\n // tests).\n this.subtleCrypto = subtleCrypto || crypto.subtle;\n }\n\n computeHMACSignature(_payload: string, _secret: string): string {\n throw new Error(\n 'SubleCryptoProvider cannot be used in a synchronous context.',\n );\n }\n\n /** @override */\n async computeHMACSignatureAsync(\n payload: string,\n secret: string,\n ): Promise<string> {\n const encoder = new TextEncoder();\n\n const key = await this.subtleCrypto.importKey(\n 'raw',\n encoder.encode(secret),\n {\n name: 'HMAC',\n hash: { name: 'SHA-256' },\n },\n false,\n ['sign'],\n );\n\n const signatureBuffer = await this.subtleCrypto.sign(\n 'hmac',\n key,\n encoder.encode(payload),\n );\n\n // crypto.subtle returns the signature in base64 format. This must be\n // encoded in hex to match the CryptoProvider contract. We map each byte in\n // the buffer to its corresponding hex octet and then combine into a string.\n const signatureBytes = new Uint8Array(signatureBuffer);\n const signatureHexCodes = new Array(signatureBytes.length);\n\n for (let i = 0; i < signatureBytes.length; i++) {\n signatureHexCodes[i] = byteHexMapping[signatureBytes[i]];\n }\n\n return signatureHexCodes.join('');\n }\n\n /** @override */\n async secureCompare(stringA: string, stringB: string): Promise<boolean> {\n const bufferA = this.encoder.encode(stringA);\n const bufferB = this.encoder.encode(stringB);\n\n if (bufferA.length !== bufferB.length) {\n return false;\n }\n\n const algorithm = { name: 'HMAC', hash: 'SHA-256' };\n const key = (await crypto.subtle.generateKey(algorithm, false, [\n 'sign',\n 'verify',\n ])) as CryptoKey;\n const hmac = await crypto.subtle.sign(algorithm, key, bufferA);\n const equal = await crypto.subtle.verify(algorithm, key, hmac, bufferB);\n\n return equal;\n }\n\n async encrypt(\n plaintext: Uint8Array,\n key: Uint8Array,\n iv?: Uint8Array,\n aad?: Uint8Array,\n ): Promise<{\n ciphertext: Uint8Array;\n iv: Uint8Array;\n tag: Uint8Array;\n }> {\n const actualIv = iv || crypto.getRandomValues(new Uint8Array(32));\n\n const cryptoKey = await this.subtleCrypto.importKey(\n 'raw',\n key,\n { name: 'AES-GCM' },\n false,\n ['encrypt'],\n );\n\n const encryptParams: AesGcmParams = {\n name: 'AES-GCM',\n iv: actualIv,\n };\n\n if (aad) {\n encryptParams.additionalData = aad;\n }\n\n const encryptedData = await this.subtleCrypto.encrypt(\n encryptParams,\n cryptoKey,\n plaintext,\n );\n\n const encryptedBytes = new Uint8Array(encryptedData);\n\n // Extract tag (last 16 bytes)\n const tagSize = 16;\n const tagStart = encryptedBytes.length - tagSize;\n const tag = encryptedBytes.slice(tagStart);\n const ciphertext = encryptedBytes.slice(0, tagStart);\n\n return {\n ciphertext,\n iv: actualIv,\n tag,\n };\n }\n\n async decrypt(\n ciphertext: Uint8Array,\n key: Uint8Array,\n iv: Uint8Array,\n tag: Uint8Array,\n aad?: Uint8Array,\n ): Promise<Uint8Array> {\n // SubtleCrypto expects tag to be appended to ciphertext for AES-GCM\n const combinedData = new Uint8Array(ciphertext.length + tag.length);\n combinedData.set(ciphertext, 0);\n combinedData.set(tag, ciphertext.length);\n\n const cryptoKey = await this.subtleCrypto.importKey(\n 'raw',\n key,\n { name: 'AES-GCM' },\n false,\n ['decrypt'],\n );\n\n const decryptParams: AesGcmParams = {\n name: 'AES-GCM',\n iv,\n };\n\n if (aad) {\n decryptParams.additionalData = aad;\n }\n\n const decryptedData = await this.subtleCrypto.decrypt(\n decryptParams,\n cryptoKey,\n combinedData,\n );\n\n return new Uint8Array(decryptedData);\n }\n\n randomBytes(length: number): Uint8Array {\n const bytes = new Uint8Array(length);\n crypto.getRandomValues(bytes);\n return bytes;\n }\n}\n\n// Cached mapping of byte to hex representation. We do this once to avoid re-\n// computing every time we need to convert the result of a signature to hex.\nconst byteHexMapping = new Array(256);\nfor (let i = 0; i < byteHexMapping.length; i++) {\n byteHexMapping[i] = i.toString(16).padStart(2, '0');\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,6BAA+B;AAOxB,MAAM,6BAA6B,sCAAe;AAAA,EAPzD,OAOyD;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/crypto/subtle-crypto-provider.ts"],"sourcesContent":["import { CryptoProvider } from './crypto-provider';\n\n/**\n * `CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API.\n *\n * This only supports asynchronous operations.\n */\nexport class SubtleCryptoProvider extends CryptoProvider {\n subtleCrypto: SubtleCrypto;\n\n constructor(subtleCrypto?: SubtleCrypto) {\n super();\n\n // If no subtle crypto is interface, default to the global namespace. This\n // is to allow custom interfaces (eg. using the Node webcrypto interface in\n // tests).\n this.subtleCrypto = subtleCrypto || crypto.subtle;\n }\n\n computeHMACSignature(_payload: string, _secret: string): string {\n throw new Error(\n 'SubleCryptoProvider cannot be used in a synchronous context.',\n );\n }\n\n /** @override */\n async computeHMACSignatureAsync(\n payload: string,\n secret: string,\n ): Promise<string> {\n const encoder = new TextEncoder();\n\n const key = await this.subtleCrypto.importKey(\n 'raw',\n encoder.encode(secret),\n {\n name: 'HMAC',\n hash: { name: 'SHA-256' },\n },\n false,\n ['sign'],\n );\n\n const signatureBuffer = await this.subtleCrypto.sign(\n 'hmac',\n key,\n encoder.encode(payload),\n );\n\n // crypto.subtle returns the signature in base64 format. This must be\n // encoded in hex to match the CryptoProvider contract. We map each byte in\n // the buffer to its corresponding hex octet and then combine into a string.\n const signatureBytes = new Uint8Array(signatureBuffer);\n const signatureHexCodes = new Array(signatureBytes.length);\n\n for (let i = 0; i < signatureBytes.length; i++) {\n signatureHexCodes[i] = byteHexMapping[signatureBytes[i]];\n }\n\n return signatureHexCodes.join('');\n }\n\n /** @override */\n async secureCompare(stringA: string, stringB: string): Promise<boolean> {\n const bufferA = this.encoder.encode(stringA);\n const bufferB = this.encoder.encode(stringB);\n\n if (bufferA.length !== bufferB.length) {\n return false;\n }\n\n const algorithm = { name: 'HMAC', hash: 'SHA-256' };\n const key = (await crypto.subtle.generateKey(algorithm, false, [\n 'sign',\n 'verify',\n ])) as CryptoKey;\n const hmac = await crypto.subtle.sign(algorithm, key, bufferA);\n const equal = await crypto.subtle.verify(algorithm, key, hmac, bufferB);\n\n return equal;\n }\n\n async encrypt(\n plaintext: Uint8Array,\n key: Uint8Array,\n iv?: Uint8Array,\n aad?: Uint8Array,\n ): Promise<{\n ciphertext: Uint8Array;\n iv: Uint8Array;\n tag: Uint8Array;\n }> {\n const actualIv = iv || crypto.getRandomValues(new Uint8Array(32));\n\n const cryptoKey = await this.subtleCrypto.importKey(\n 'raw',\n key,\n { name: 'AES-GCM' },\n false,\n ['encrypt'],\n );\n\n const encryptParams: AesGcmParams = {\n name: 'AES-GCM',\n iv: actualIv,\n };\n\n if (aad) {\n encryptParams.additionalData = aad;\n }\n\n const encryptedData = await this.subtleCrypto.encrypt(\n encryptParams,\n cryptoKey,\n plaintext,\n );\n\n const encryptedBytes = new Uint8Array(encryptedData);\n\n // Extract tag (last 16 bytes)\n const tagSize = 16;\n const tagStart = encryptedBytes.length - tagSize;\n const tag = encryptedBytes.slice(tagStart);\n const ciphertext = encryptedBytes.slice(0, tagStart);\n\n return {\n ciphertext,\n iv: actualIv,\n tag,\n };\n }\n\n async decrypt(\n ciphertext: Uint8Array,\n key: Uint8Array,\n iv: Uint8Array,\n tag: Uint8Array,\n aad?: Uint8Array,\n ): Promise<Uint8Array> {\n // SubtleCrypto expects tag to be appended to ciphertext for AES-GCM\n const combinedData = new Uint8Array(ciphertext.length + tag.length);\n combinedData.set(ciphertext, 0);\n combinedData.set(tag, ciphertext.length);\n\n const cryptoKey = await this.subtleCrypto.importKey(\n 'raw',\n key,\n { name: 'AES-GCM' },\n false,\n ['decrypt'],\n );\n\n const decryptParams: AesGcmParams = {\n name: 'AES-GCM',\n iv,\n };\n\n if (aad) {\n decryptParams.additionalData = aad;\n }\n\n const decryptedData = await this.subtleCrypto.decrypt(\n decryptParams,\n cryptoKey,\n combinedData,\n );\n\n return new Uint8Array(decryptedData);\n }\n\n randomBytes(length: number): Uint8Array {\n const bytes = new Uint8Array(length);\n crypto.getRandomValues(bytes);\n return bytes;\n }\n}\n\n// Cached mapping of byte to hex representation. We do this once to avoid re-\n// computing every time we need to convert the result of a signature to hex.\nconst byteHexMapping = new Array(256);\nfor (let i = 0; i < byteHexMapping.length; i++) {\n byteHexMapping[i] = i.toString(16).padStart(2, '0');\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/crypto/subtle-crypto-provider.ts"],"sourcesContent":["import { CryptoProvider } from './crypto-provider';\n\n/**\n * `CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API.\n *\n * This only supports asynchronous operations.\n */\nexport class SubtleCryptoProvider extends CryptoProvider {\n subtleCrypto: SubtleCrypto;\n\n constructor(subtleCrypto?: SubtleCrypto) {\n super();\n\n // If no subtle crypto is interface, default to the global namespace. This\n // is to allow custom interfaces (eg. using the Node webcrypto interface in\n // tests).\n this.subtleCrypto = subtleCrypto || crypto.subtle;\n }\n\n computeHMACSignature(_payload: string, _secret: string): string {\n throw new Error(\n 'SubleCryptoProvider cannot be used in a synchronous context.',\n );\n }\n\n /** @override */\n async computeHMACSignatureAsync(\n payload: string,\n secret: string,\n ): Promise<string> {\n const encoder = new TextEncoder();\n\n const key = await this.subtleCrypto.importKey(\n 'raw',\n encoder.encode(secret),\n {\n name: 'HMAC',\n hash: { name: 'SHA-256' },\n },\n false,\n ['sign'],\n );\n\n const signatureBuffer = await this.subtleCrypto.sign(\n 'hmac',\n key,\n encoder.encode(payload),\n );\n\n // crypto.subtle returns the signature in base64 format. This must be\n // encoded in hex to match the CryptoProvider contract. We map each byte in\n // the buffer to its corresponding hex octet and then combine into a string.\n const signatureBytes = new Uint8Array(signatureBuffer);\n const signatureHexCodes = new Array(signatureBytes.length);\n\n for (let i = 0; i < signatureBytes.length; i++) {\n signatureHexCodes[i] = byteHexMapping[signatureBytes[i]];\n }\n\n return signatureHexCodes.join('');\n }\n\n /** @override */\n async secureCompare(stringA: string, stringB: string): Promise<boolean> {\n const bufferA = this.encoder.encode(stringA);\n const bufferB = this.encoder.encode(stringB);\n\n if (bufferA.length !== bufferB.length) {\n return false;\n }\n\n const algorithm = { name: 'HMAC', hash: 'SHA-256' };\n const key = (await crypto.subtle.generateKey(algorithm, false, [\n 'sign',\n 'verify',\n ])) as CryptoKey;\n const hmac = await crypto.subtle.sign(algorithm, key, bufferA);\n const equal = await crypto.subtle.verify(algorithm, key, hmac, bufferB);\n\n return equal;\n }\n\n async encrypt(\n plaintext: Uint8Array,\n key: Uint8Array,\n iv?: Uint8Array,\n aad?: Uint8Array,\n ): Promise<{\n ciphertext: Uint8Array;\n iv: Uint8Array;\n tag: Uint8Array;\n }> {\n const actualIv = iv || crypto.getRandomValues(new Uint8Array(32));\n\n const cryptoKey = await this.subtleCrypto.importKey(\n 'raw',\n key,\n { name: 'AES-GCM' },\n false,\n ['encrypt'],\n );\n\n const encryptParams: AesGcmParams = {\n name: 'AES-GCM',\n iv: actualIv,\n };\n\n if (aad) {\n encryptParams.additionalData = aad;\n }\n\n const encryptedData = await this.subtleCrypto.encrypt(\n encryptParams,\n cryptoKey,\n plaintext,\n );\n\n const encryptedBytes = new Uint8Array(encryptedData);\n\n // Extract tag (last 16 bytes)\n const tagSize = 16;\n const tagStart = encryptedBytes.length - tagSize;\n const tag = encryptedBytes.slice(tagStart);\n const ciphertext = encryptedBytes.slice(0, tagStart);\n\n return {\n ciphertext,\n iv: actualIv,\n tag,\n };\n }\n\n async decrypt(\n ciphertext: Uint8Array,\n key: Uint8Array,\n iv: Uint8Array,\n tag: Uint8Array,\n aad?: Uint8Array,\n ): Promise<Uint8Array> {\n // SubtleCrypto expects tag to be appended to ciphertext for AES-GCM\n const combinedData = new Uint8Array(ciphertext.length + tag.length);\n combinedData.set(ciphertext, 0);\n combinedData.set(tag, ciphertext.length);\n\n const cryptoKey = await this.subtleCrypto.importKey(\n 'raw',\n key,\n { name: 'AES-GCM' },\n false,\n ['decrypt'],\n );\n\n const decryptParams: AesGcmParams = {\n name: 'AES-GCM',\n iv,\n };\n\n if (aad) {\n decryptParams.additionalData = aad;\n }\n\n const decryptedData = await this.subtleCrypto.decrypt(\n decryptParams,\n cryptoKey,\n combinedData,\n );\n\n return new Uint8Array(decryptedData);\n }\n\n randomBytes(length: number): Uint8Array {\n const bytes = new Uint8Array(length);\n crypto.getRandomValues(bytes);\n return bytes;\n }\n}\n\n// Cached mapping of byte to hex representation. We do this once to avoid re-\n// computing every time we need to convert the result of a signature to hex.\nconst byteHexMapping = new Array(256);\nfor (let i = 0; i < byteHexMapping.length; i++) {\n byteHexMapping[i] = i.toString(16).padStart(2, '0');\n}\n"],"mappings":";;AAAA,SAAS,sBAAsB;AAOxB,MAAM,6BAA6B,eAAe;AAAA,EAPzD,OAOyD;AAAA;AAAA;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/crypto/subtle-crypto-provider.ts"],"sourcesContent":["import { CryptoProvider } from './crypto-provider';\n\n/**\n * `CryptoProvider which uses the SubtleCrypto interface of the Web Crypto API.\n *\n * This only supports asynchronous operations.\n */\nexport class SubtleCryptoProvider extends CryptoProvider {\n subtleCrypto: SubtleCrypto;\n\n constructor(subtleCrypto?: SubtleCrypto) {\n super();\n\n // If no subtle crypto is interface, default to the global namespace. This\n // is to allow custom interfaces (eg. using the Node webcrypto interface in\n // tests).\n this.subtleCrypto = subtleCrypto || crypto.subtle;\n }\n\n computeHMACSignature(_payload: string, _secret: string): string {\n throw new Error(\n 'SubleCryptoProvider cannot be used in a synchronous context.',\n );\n }\n\n /** @override */\n async computeHMACSignatureAsync(\n payload: string,\n secret: string,\n ): Promise<string> {\n const encoder = new TextEncoder();\n\n const key = await this.subtleCrypto.importKey(\n 'raw',\n encoder.encode(secret),\n {\n name: 'HMAC',\n hash: { name: 'SHA-256' },\n },\n false,\n ['sign'],\n );\n\n const signatureBuffer = await this.subtleCrypto.sign(\n 'hmac',\n key,\n encoder.encode(payload),\n );\n\n // crypto.subtle returns the signature in base64 format. This must be\n // encoded in hex to match the CryptoProvider contract. We map each byte in\n // the buffer to its corresponding hex octet and then combine into a string.\n const signatureBytes = new Uint8Array(signatureBuffer);\n const signatureHexCodes = new Array(signatureBytes.length);\n\n for (let i = 0; i < signatureBytes.length; i++) {\n signatureHexCodes[i] = byteHexMapping[signatureBytes[i]];\n }\n\n return signatureHexCodes.join('');\n }\n\n /** @override */\n async secureCompare(stringA: string, stringB: string): Promise<boolean> {\n const bufferA = this.encoder.encode(stringA);\n const bufferB = this.encoder.encode(stringB);\n\n if (bufferA.length !== bufferB.length) {\n return false;\n }\n\n const algorithm = { name: 'HMAC', hash: 'SHA-256' };\n const key = (await crypto.subtle.generateKey(algorithm, false, [\n 'sign',\n 'verify',\n ])) as CryptoKey;\n const hmac = await crypto.subtle.sign(algorithm, key, bufferA);\n const equal = await crypto.subtle.verify(algorithm, key, hmac, bufferB);\n\n return equal;\n }\n\n async encrypt(\n plaintext: Uint8Array,\n key: Uint8Array,\n iv?: Uint8Array,\n aad?: Uint8Array,\n ): Promise<{\n ciphertext: Uint8Array;\n iv: Uint8Array;\n tag: Uint8Array;\n }> {\n const actualIv = iv || crypto.getRandomValues(new Uint8Array(32));\n\n const cryptoKey = await this.subtleCrypto.importKey(\n 'raw',\n key,\n { name: 'AES-GCM' },\n false,\n ['encrypt'],\n );\n\n const encryptParams: AesGcmParams = {\n name: 'AES-GCM',\n iv: actualIv,\n };\n\n if (aad) {\n encryptParams.additionalData = aad;\n }\n\n const encryptedData = await this.subtleCrypto.encrypt(\n encryptParams,\n cryptoKey,\n plaintext,\n );\n\n const encryptedBytes = new Uint8Array(encryptedData);\n\n // Extract tag (last 16 bytes)\n const tagSize = 16;\n const tagStart = encryptedBytes.length - tagSize;\n const tag = encryptedBytes.slice(tagStart);\n const ciphertext = encryptedBytes.slice(0, tagStart);\n\n return {\n ciphertext,\n iv: actualIv,\n tag,\n };\n }\n\n async decrypt(\n ciphertext: Uint8Array,\n key: Uint8Array,\n iv: Uint8Array,\n tag: Uint8Array,\n aad?: Uint8Array,\n ): Promise<Uint8Array> {\n // SubtleCrypto expects tag to be appended to ciphertext for AES-GCM\n const combinedData = new Uint8Array(ciphertext.length + tag.length);\n combinedData.set(ciphertext, 0);\n combinedData.set(tag, ciphertext.length);\n\n const cryptoKey = await this.subtleCrypto.importKey(\n 'raw',\n key,\n { name: 'AES-GCM' },\n false,\n ['decrypt'],\n );\n\n const decryptParams: AesGcmParams = {\n name: 'AES-GCM',\n iv,\n };\n\n if (aad) {\n decryptParams.additionalData = aad;\n }\n\n const decryptedData = await this.subtleCrypto.decrypt(\n decryptParams,\n cryptoKey,\n combinedData,\n );\n\n return new Uint8Array(decryptedData);\n }\n\n randomBytes(length: number): Uint8Array {\n const bytes = new Uint8Array(length);\n crypto.getRandomValues(bytes);\n return bytes;\n }\n}\n\n// Cached mapping of byte to hex representation. We do this once to avoid re-\n// computing every time we need to convert the result of a signature to hex.\nconst byteHexMapping = new Array(256);\nfor (let i = 0; i < byteHexMapping.length; i++) {\n byteHexMapping[i] = i.toString(16).padStart(2, '0');\n}\n"],"mappings":"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","names":[]}
|
|
@@ -23,6 +23,15 @@ __export(bad_request_exception_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(bad_request_exception_exports);
|
|
25
25
|
class BadRequestException extends Error {
|
|
26
|
+
static {
|
|
27
|
+
__name(this, "BadRequestException");
|
|
28
|
+
}
|
|
29
|
+
status = 400;
|
|
30
|
+
name = "BadRequestException";
|
|
31
|
+
message = "Bad request";
|
|
32
|
+
code;
|
|
33
|
+
errors;
|
|
34
|
+
requestID;
|
|
26
35
|
constructor({
|
|
27
36
|
code,
|
|
28
37
|
errors,
|
|
@@ -30,9 +39,6 @@ class BadRequestException extends Error {
|
|
|
30
39
|
requestID
|
|
31
40
|
}) {
|
|
32
41
|
super();
|
|
33
|
-
this.status = 400;
|
|
34
|
-
this.name = "BadRequestException";
|
|
35
|
-
this.message = "Bad request";
|
|
36
42
|
this.requestID = requestID;
|
|
37
43
|
if (message) {
|
|
38
44
|
this.message = message;
|
|
@@ -44,9 +50,6 @@ class BadRequestException extends Error {
|
|
|
44
50
|
this.errors = errors;
|
|
45
51
|
}
|
|
46
52
|
}
|
|
47
|
-
static {
|
|
48
|
-
__name(this, "BadRequestException");
|
|
49
|
-
}
|
|
50
53
|
}
|
|
51
54
|
// Annotate the CommonJS export names for ESM import in node:
|
|
52
55
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/bad-request.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class BadRequestException extends Error implements RequestException {\n readonly status = 400;\n readonly name = 'BadRequestException';\n readonly message: string = 'Bad request';\n readonly code?: string;\n readonly errors?: unknown[];\n readonly requestID: string;\n\n constructor({\n code,\n errors,\n message,\n requestID,\n }: {\n code?: string;\n errors?: unknown[];\n message?: string;\n requestID: string;\n }) {\n super();\n\n this.requestID = requestID;\n\n if (message) {\n this.message = message;\n }\n\n if (code) {\n this.code = code;\n }\n\n if (errors) {\n this.errors = errors;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,4BAA4B,MAAkC;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/bad-request.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class BadRequestException extends Error implements RequestException {\n readonly status = 400;\n readonly name = 'BadRequestException';\n readonly message: string = 'Bad request';\n readonly code?: string;\n readonly errors?: unknown[];\n readonly requestID: string;\n\n constructor({\n code,\n errors,\n message,\n requestID,\n }: {\n code?: string;\n errors?: unknown[];\n message?: string;\n requestID: string;\n }) {\n super();\n\n this.requestID = requestID;\n\n if (message) {\n this.message = message;\n }\n\n if (code) {\n this.code = code;\n }\n\n if (errors) {\n this.errors = errors;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,4BAA4B,MAAkC;AAAA,EAF3E,OAE2E;AAAA;AAAA;AAAA,EAChE,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAkB;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAKG;AACD,UAAM;AAEN,SAAK,YAAY;AAEjB,QAAI,SAAS;AACX,WAAK,UAAU;AAAA,IACjB;AAEA,QAAI,MAAM;AACR,WAAK,OAAO;AAAA,IACd;AAEA,QAAI,QAAQ;AACV,WAAK,SAAS;AAAA,IAChB;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,6 +1,15 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
class BadRequestException extends Error {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "BadRequestException");
|
|
6
|
+
}
|
|
7
|
+
status = 400;
|
|
8
|
+
name = "BadRequestException";
|
|
9
|
+
message = "Bad request";
|
|
10
|
+
code;
|
|
11
|
+
errors;
|
|
12
|
+
requestID;
|
|
4
13
|
constructor({
|
|
5
14
|
code,
|
|
6
15
|
errors,
|
|
@@ -8,9 +17,6 @@ class BadRequestException extends Error {
|
|
|
8
17
|
requestID
|
|
9
18
|
}) {
|
|
10
19
|
super();
|
|
11
|
-
this.status = 400;
|
|
12
|
-
this.name = "BadRequestException";
|
|
13
|
-
this.message = "Bad request";
|
|
14
20
|
this.requestID = requestID;
|
|
15
21
|
if (message) {
|
|
16
22
|
this.message = message;
|
|
@@ -22,9 +28,6 @@ class BadRequestException extends Error {
|
|
|
22
28
|
this.errors = errors;
|
|
23
29
|
}
|
|
24
30
|
}
|
|
25
|
-
static {
|
|
26
|
-
__name(this, "BadRequestException");
|
|
27
|
-
}
|
|
28
31
|
}
|
|
29
32
|
export {
|
|
30
33
|
BadRequestException
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/bad-request.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class BadRequestException extends Error implements RequestException {\n readonly status = 400;\n readonly name = 'BadRequestException';\n readonly message: string = 'Bad request';\n readonly code?: string;\n readonly errors?: unknown[];\n readonly requestID: string;\n\n constructor({\n code,\n errors,\n message,\n requestID,\n }: {\n code?: string;\n errors?: unknown[];\n message?: string;\n requestID: string;\n }) {\n super();\n\n this.requestID = requestID;\n\n if (message) {\n this.message = message;\n }\n\n if (code) {\n this.code = code;\n }\n\n if (errors) {\n this.errors = errors;\n }\n }\n}\n"],"mappings":";;AAEO,MAAM,4BAA4B,MAAkC;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/bad-request.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class BadRequestException extends Error implements RequestException {\n readonly status = 400;\n readonly name = 'BadRequestException';\n readonly message: string = 'Bad request';\n readonly code?: string;\n readonly errors?: unknown[];\n readonly requestID: string;\n\n constructor({\n code,\n errors,\n message,\n requestID,\n }: {\n code?: string;\n errors?: unknown[];\n message?: string;\n requestID: string;\n }) {\n super();\n\n this.requestID = requestID;\n\n if (message) {\n this.message = message;\n }\n\n if (code) {\n this.code = code;\n }\n\n if (errors) {\n this.errors = errors;\n }\n }\n}\n"],"mappings":";;AAEO,MAAM,4BAA4B,MAAkC;AAAA,EAF3E,OAE2E;AAAA;AAAA;AAAA,EAChE,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UAAkB;AAAA,EAClB;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAKG;AACD,UAAM;AAEN,SAAK,YAAY;AAEjB,QAAI,SAAS;AACX,WAAK,UAAU;AAAA,IACjB;AAEA,QAAI,MAAM;AACR,WAAK,OAAO;AAAA,IACd;AAEA,QAAI,QAAQ;AACV,WAAK,SAAS;AAAA,IAChB;AAAA,EACF;AACF;","names":[]}
|
|
@@ -23,14 +23,18 @@ __export(conflict_exception_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(conflict_exception_exports);
|
|
25
25
|
class ConflictException extends Error {
|
|
26
|
+
static {
|
|
27
|
+
__name(this, "ConflictException");
|
|
28
|
+
}
|
|
29
|
+
status = 409;
|
|
30
|
+
name = "ConflictException";
|
|
31
|
+
requestID;
|
|
26
32
|
constructor({
|
|
27
33
|
error,
|
|
28
34
|
message,
|
|
29
35
|
requestID
|
|
30
36
|
}) {
|
|
31
37
|
super();
|
|
32
|
-
this.status = 409;
|
|
33
|
-
this.name = "ConflictException";
|
|
34
38
|
this.requestID = requestID;
|
|
35
39
|
if (message) {
|
|
36
40
|
this.message = message;
|
|
@@ -40,9 +44,6 @@ class ConflictException extends Error {
|
|
|
40
44
|
this.message = `An conflict has occurred on the server.`;
|
|
41
45
|
}
|
|
42
46
|
}
|
|
43
|
-
static {
|
|
44
|
-
__name(this, "ConflictException");
|
|
45
|
-
}
|
|
46
47
|
}
|
|
47
48
|
// Annotate the CommonJS export names for ESM import in node:
|
|
48
49
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/conflict.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class ConflictException extends Error implements RequestException {\n readonly status = 409;\n readonly name = 'ConflictException';\n readonly requestID: string;\n\n constructor({\n error,\n message,\n requestID,\n }: {\n error?: string;\n message?: string;\n requestID: string;\n }) {\n super();\n\n this.requestID = requestID;\n\n if (message) {\n this.message = message;\n } else if (error) {\n this.message = `Error: ${error}`;\n } else {\n this.message = `An conflict has occurred on the server.`;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,0BAA0B,MAAkC;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/conflict.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class ConflictException extends Error implements RequestException {\n readonly status = 409;\n readonly name = 'ConflictException';\n readonly requestID: string;\n\n constructor({\n error,\n message,\n requestID,\n }: {\n error?: string;\n message?: string;\n requestID: string;\n }) {\n super();\n\n this.requestID = requestID;\n\n if (message) {\n this.message = message;\n } else if (error) {\n this.message = `Error: ${error}`;\n } else {\n this.message = `An conflict has occurred on the server.`;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,0BAA0B,MAAkC;AAAA,EAFzE,OAEyE;AAAA;AAAA;AAAA,EAC9D,SAAS;AAAA,EACT,OAAO;AAAA,EACP;AAAA,EAET,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAIG;AACD,UAAM;AAEN,SAAK,YAAY;AAEjB,QAAI,SAAS;AACX,WAAK,UAAU;AAAA,IACjB,WAAW,OAAO;AAChB,WAAK,UAAU,UAAU,KAAK;AAAA,IAChC,OAAO;AACL,WAAK,UAAU;AAAA,IACjB;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
class ConflictException extends Error {
|
|
4
|
+
static {
|
|
5
|
+
__name(this, "ConflictException");
|
|
6
|
+
}
|
|
7
|
+
status = 409;
|
|
8
|
+
name = "ConflictException";
|
|
9
|
+
requestID;
|
|
4
10
|
constructor({
|
|
5
11
|
error,
|
|
6
12
|
message,
|
|
7
13
|
requestID
|
|
8
14
|
}) {
|
|
9
15
|
super();
|
|
10
|
-
this.status = 409;
|
|
11
|
-
this.name = "ConflictException";
|
|
12
16
|
this.requestID = requestID;
|
|
13
17
|
if (message) {
|
|
14
18
|
this.message = message;
|
|
@@ -18,9 +22,6 @@ class ConflictException extends Error {
|
|
|
18
22
|
this.message = `An conflict has occurred on the server.`;
|
|
19
23
|
}
|
|
20
24
|
}
|
|
21
|
-
static {
|
|
22
|
-
__name(this, "ConflictException");
|
|
23
|
-
}
|
|
24
25
|
}
|
|
25
26
|
export {
|
|
26
27
|
ConflictException
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/conflict.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class ConflictException extends Error implements RequestException {\n readonly status = 409;\n readonly name = 'ConflictException';\n readonly requestID: string;\n\n constructor({\n error,\n message,\n requestID,\n }: {\n error?: string;\n message?: string;\n requestID: string;\n }) {\n super();\n\n this.requestID = requestID;\n\n if (message) {\n this.message = message;\n } else if (error) {\n this.message = `Error: ${error}`;\n } else {\n this.message = `An conflict has occurred on the server.`;\n }\n }\n}\n"],"mappings":";;AAEO,MAAM,0BAA0B,MAAkC;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/conflict.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class ConflictException extends Error implements RequestException {\n readonly status = 409;\n readonly name = 'ConflictException';\n readonly requestID: string;\n\n constructor({\n error,\n message,\n requestID,\n }: {\n error?: string;\n message?: string;\n requestID: string;\n }) {\n super();\n\n this.requestID = requestID;\n\n if (message) {\n this.message = message;\n } else if (error) {\n this.message = `Error: ${error}`;\n } else {\n this.message = `An conflict has occurred on the server.`;\n }\n }\n}\n"],"mappings":";;AAEO,MAAM,0BAA0B,MAAkC;AAAA,EAFzE,OAEyE;AAAA;AAAA;AAAA,EAC9D,SAAS;AAAA,EACT,OAAO;AAAA,EACP;AAAA,EAET,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAIG;AACD,UAAM;AAEN,SAAK,YAAY;AAEjB,QAAI,SAAS;AACX,WAAK,UAAU;AAAA,IACjB,WAAW,OAAO;AAChB,WAAK,UAAU,UAAU,KAAK;AAAA,IAChC,OAAO;AACL,WAAK,UAAU;AAAA,IACjB;AAAA,EACF;AACF;","names":[]}
|
|
@@ -28,8 +28,6 @@ class GenericServerException extends Error {
|
|
|
28
28
|
this.status = status;
|
|
29
29
|
this.rawData = rawData;
|
|
30
30
|
this.requestID = requestID;
|
|
31
|
-
this.name = "GenericServerException";
|
|
32
|
-
this.message = "The request could not be completed.";
|
|
33
31
|
if (message) {
|
|
34
32
|
this.message = message;
|
|
35
33
|
}
|
|
@@ -37,6 +35,8 @@ class GenericServerException extends Error {
|
|
|
37
35
|
static {
|
|
38
36
|
__name(this, "GenericServerException");
|
|
39
37
|
}
|
|
38
|
+
name = "GenericServerException";
|
|
39
|
+
message = "The request could not be completed.";
|
|
40
40
|
}
|
|
41
41
|
// Annotate the CommonJS export names for ESM import in node:
|
|
42
42
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/generic-server.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class GenericServerException extends Error implements RequestException {\n readonly name: string = 'GenericServerException';\n readonly message: string = 'The request could not be completed.';\n\n constructor(\n readonly status: number,\n message: string | undefined,\n readonly rawData: unknown,\n readonly requestID: string,\n ) {\n super();\n if (message) {\n this.message = message;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,+BAA+B,MAAkC;AAAA,EAI5E,YACW,QACT,SACS,SACA,WACT;AACA,UAAM;AALG;AAEA;AACA;
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/generic-server.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class GenericServerException extends Error implements RequestException {\n readonly name: string = 'GenericServerException';\n readonly message: string = 'The request could not be completed.';\n\n constructor(\n readonly status: number,\n message: string | undefined,\n readonly rawData: unknown,\n readonly requestID: string,\n ) {\n super();\n if (message) {\n this.message = message;\n }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,+BAA+B,MAAkC;AAAA,EAI5E,YACW,QACT,SACS,SACA,WACT;AACA,UAAM;AALG;AAEA;AACA;AAGT,QAAI,SAAS;AACX,WAAK,UAAU;AAAA,IACjB;AAAA,EACF;AAAA,EAhBF,OAE8E;AAAA;AAAA;AAAA,EACnE,OAAe;AAAA,EACf,UAAkB;AAa7B;","names":[]}
|
|
@@ -6,8 +6,6 @@ class GenericServerException extends Error {
|
|
|
6
6
|
this.status = status;
|
|
7
7
|
this.rawData = rawData;
|
|
8
8
|
this.requestID = requestID;
|
|
9
|
-
this.name = "GenericServerException";
|
|
10
|
-
this.message = "The request could not be completed.";
|
|
11
9
|
if (message) {
|
|
12
10
|
this.message = message;
|
|
13
11
|
}
|
|
@@ -15,6 +13,8 @@ class GenericServerException extends Error {
|
|
|
15
13
|
static {
|
|
16
14
|
__name(this, "GenericServerException");
|
|
17
15
|
}
|
|
16
|
+
name = "GenericServerException";
|
|
17
|
+
message = "The request could not be completed.";
|
|
18
18
|
}
|
|
19
19
|
export {
|
|
20
20
|
GenericServerException
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/generic-server.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class GenericServerException extends Error implements RequestException {\n readonly name: string = 'GenericServerException';\n readonly message: string = 'The request could not be completed.';\n\n constructor(\n readonly status: number,\n message: string | undefined,\n readonly rawData: unknown,\n readonly requestID: string,\n ) {\n super();\n if (message) {\n this.message = message;\n }\n }\n}\n"],"mappings":";;AAEO,MAAM,+BAA+B,MAAkC;AAAA,EAI5E,YACW,QACT,SACS,SACA,WACT;AACA,UAAM;AALG;AAEA;AACA;
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/generic-server.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class GenericServerException extends Error implements RequestException {\n readonly name: string = 'GenericServerException';\n readonly message: string = 'The request could not be completed.';\n\n constructor(\n readonly status: number,\n message: string | undefined,\n readonly rawData: unknown,\n readonly requestID: string,\n ) {\n super();\n if (message) {\n this.message = message;\n }\n }\n}\n"],"mappings":";;AAEO,MAAM,+BAA+B,MAAkC;AAAA,EAI5E,YACW,QACT,SACS,SACA,WACT;AACA,UAAM;AALG;AAEA;AACA;AAGT,QAAI,SAAS;AACX,WAAK,UAAU;AAAA,IACjB;AAAA,EACF;AAAA,EAhBF,OAE8E;AAAA;AAAA;AAAA,EACnE,OAAe;AAAA,EACf,UAAkB;AAa7B;","names":[]}
|
|
@@ -23,15 +23,12 @@ __export(no_api_key_provided_exception_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(no_api_key_provided_exception_exports);
|
|
25
25
|
class NoApiKeyProvidedException extends Error {
|
|
26
|
-
constructor() {
|
|
27
|
-
super(...arguments);
|
|
28
|
-
this.status = 500;
|
|
29
|
-
this.name = "NoApiKeyProvidedException";
|
|
30
|
-
this.message = `Missing API key. Pass it to the constructor (new WorkOS("sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU")) or define it in the WORKOS_API_KEY environment variable.`;
|
|
31
|
-
}
|
|
32
26
|
static {
|
|
33
27
|
__name(this, "NoApiKeyProvidedException");
|
|
34
28
|
}
|
|
29
|
+
status = 500;
|
|
30
|
+
name = "NoApiKeyProvidedException";
|
|
31
|
+
message = `Missing API key. Pass it to the constructor (new WorkOS("sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU")) or define it in the WORKOS_API_KEY environment variable.`;
|
|
35
32
|
}
|
|
36
33
|
// Annotate the CommonJS export names for ESM import in node:
|
|
37
34
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/no-api-key-provided.exception.ts"],"sourcesContent":["export class NoApiKeyProvidedException extends Error {\n readonly status = 500;\n readonly name = 'NoApiKeyProvidedException';\n readonly message =\n `Missing API key. Pass it to the constructor (new WorkOS(\"sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU\")) ` +\n `or define it in the WORKOS_API_KEY environment variable.`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,kCAAkC,MAAM;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/no-api-key-provided.exception.ts"],"sourcesContent":["export class NoApiKeyProvidedException extends Error {\n readonly status = 500;\n readonly name = 'NoApiKeyProvidedException';\n readonly message =\n `Missing API key. Pass it to the constructor (new WorkOS(\"sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU\")) ` +\n `or define it in the WORKOS_API_KEY environment variable.`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,kCAAkC,MAAM;AAAA,EAArD,OAAqD;AAAA;AAAA;AAAA,EAC1C,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UACP;AAEJ;","names":[]}
|
|
@@ -1,15 +1,12 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
3
3
|
class NoApiKeyProvidedException extends Error {
|
|
4
|
-
constructor() {
|
|
5
|
-
super(...arguments);
|
|
6
|
-
this.status = 500;
|
|
7
|
-
this.name = "NoApiKeyProvidedException";
|
|
8
|
-
this.message = `Missing API key. Pass it to the constructor (new WorkOS("sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU")) or define it in the WORKOS_API_KEY environment variable.`;
|
|
9
|
-
}
|
|
10
4
|
static {
|
|
11
5
|
__name(this, "NoApiKeyProvidedException");
|
|
12
6
|
}
|
|
7
|
+
status = 500;
|
|
8
|
+
name = "NoApiKeyProvidedException";
|
|
9
|
+
message = `Missing API key. Pass it to the constructor (new WorkOS("sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU")) or define it in the WORKOS_API_KEY environment variable.`;
|
|
13
10
|
}
|
|
14
11
|
export {
|
|
15
12
|
NoApiKeyProvidedException
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/no-api-key-provided.exception.ts"],"sourcesContent":["export class NoApiKeyProvidedException extends Error {\n readonly status = 500;\n readonly name = 'NoApiKeyProvidedException';\n readonly message =\n `Missing API key. Pass it to the constructor (new WorkOS(\"sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU\")) ` +\n `or define it in the WORKOS_API_KEY environment variable.`;\n}\n"],"mappings":";;AAAO,MAAM,kCAAkC,MAAM;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/no-api-key-provided.exception.ts"],"sourcesContent":["export class NoApiKeyProvidedException extends Error {\n readonly status = 500;\n readonly name = 'NoApiKeyProvidedException';\n readonly message =\n `Missing API key. Pass it to the constructor (new WorkOS(\"sk_test_Sz3IQjepeSWaI4cMS4ms4sMuU\")) ` +\n `or define it in the WORKOS_API_KEY environment variable.`;\n}\n"],"mappings":";;AAAO,MAAM,kCAAkC,MAAM;AAAA,EAArD,OAAqD;AAAA;AAAA;AAAA,EAC1C,SAAS;AAAA,EACT,OAAO;AAAA,EACP,UACP;AAEJ;","names":[]}
|
|
@@ -23,6 +23,14 @@ __export(not_found_exception_exports, {
|
|
|
23
23
|
});
|
|
24
24
|
module.exports = __toCommonJS(not_found_exception_exports);
|
|
25
25
|
class NotFoundException extends Error {
|
|
26
|
+
static {
|
|
27
|
+
__name(this, "NotFoundException");
|
|
28
|
+
}
|
|
29
|
+
status = 404;
|
|
30
|
+
name = "NotFoundException";
|
|
31
|
+
message;
|
|
32
|
+
code;
|
|
33
|
+
requestID;
|
|
26
34
|
constructor({
|
|
27
35
|
code,
|
|
28
36
|
message,
|
|
@@ -30,15 +38,10 @@ class NotFoundException extends Error {
|
|
|
30
38
|
requestID
|
|
31
39
|
}) {
|
|
32
40
|
super();
|
|
33
|
-
this.status = 404;
|
|
34
|
-
this.name = "NotFoundException";
|
|
35
41
|
this.code = code;
|
|
36
42
|
this.message = message ?? `The requested path '${path}' could not be found.`;
|
|
37
43
|
this.requestID = requestID;
|
|
38
44
|
}
|
|
39
|
-
static {
|
|
40
|
-
__name(this, "NotFoundException");
|
|
41
|
-
}
|
|
42
45
|
}
|
|
43
46
|
// Annotate the CommonJS export names for ESM import in node:
|
|
44
47
|
0 && (module.exports = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/common/exceptions/not-found.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class NotFoundException extends Error implements RequestException {\n readonly status = 404;\n readonly name = 'NotFoundException';\n readonly message: string;\n readonly code?: string;\n readonly requestID: string;\n\n constructor({\n code,\n message,\n path,\n requestID,\n }: {\n code?: string;\n message?: string;\n path: string;\n requestID: string;\n }) {\n super();\n this.code = code;\n this.message =\n message ?? `The requested path '${path}' could not be found.`;\n this.requestID = requestID;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,0BAA0B,MAAkC;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/common/exceptions/not-found.exception.ts"],"sourcesContent":["import { RequestException } from '../interfaces/request-exception.interface';\n\nexport class NotFoundException extends Error implements RequestException {\n readonly status = 404;\n readonly name = 'NotFoundException';\n readonly message: string;\n readonly code?: string;\n readonly requestID: string;\n\n constructor({\n code,\n message,\n path,\n requestID,\n }: {\n code?: string;\n message?: string;\n path: string;\n requestID: string;\n }) {\n super();\n this.code = code;\n this.message =\n message ?? `The requested path '${path}' could not be found.`;\n this.requestID = requestID;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEO,MAAM,0BAA0B,MAAkC;AAAA,EAFzE,OAEyE;AAAA;AAAA;AAAA,EAC9D,SAAS;AAAA,EACT,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EAET,YAAY;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,GAKG;AACD,UAAM;AACN,SAAK,OAAO;AACZ,SAAK,UACH,WAAW,uBAAuB,IAAI;AACxC,SAAK,YAAY;AAAA,EACnB;AACF;","names":[]}
|