@cedarjs/api 9.0.0-canary.1784 → 9.0.0-canary.3124

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.
Files changed (137) hide show
  1. package/dist/auth/index.d.ts +14 -1
  2. package/dist/auth/index.d.ts.map +1 -1
  3. package/dist/auth/index.js +19 -5
  4. package/dist/bins/cedar.js +14 -0
  5. package/dist/bins/cfw.js +14 -0
  6. package/dist/bins/redwood.js +14 -0
  7. package/dist/bins/tsc.js +8 -0
  8. package/dist/cache/clients/RedisClient.d.ts.map +1 -1
  9. package/dist/cache/index.d.ts.map +1 -1
  10. package/dist/cache/index.js +8 -4
  11. package/dist/errors.d.ts +9 -1
  12. package/dist/errors.d.ts.map +1 -1
  13. package/dist/errors.js +9 -2
  14. package/dist/index.d.ts +5 -4
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +5 -19
  17. package/dist/logger/index.d.ts +7 -5
  18. package/dist/logger/index.d.ts.map +1 -1
  19. package/dist/logger/index.js +1 -1
  20. package/dist/runtime.d.ts +48 -0
  21. package/dist/runtime.d.ts.map +1 -0
  22. package/dist/runtime.js +131 -0
  23. package/dist/signedTokens/index.d.ts +2 -0
  24. package/dist/signedTokens/index.d.ts.map +1 -0
  25. package/dist/signedTokens/index.js +1 -0
  26. package/dist/signedTokens/signedTokens.d.ts +99 -0
  27. package/dist/signedTokens/signedTokens.d.ts.map +1 -0
  28. package/dist/signedTokens/signedTokens.js +100 -0
  29. package/dist/transforms.d.ts +1 -0
  30. package/dist/transforms.d.ts.map +1 -1
  31. package/dist/transforms.js +82 -1
  32. package/dist/types.d.ts.map +1 -1
  33. package/dist/validations/validations.d.ts +21 -8
  34. package/dist/validations/validations.d.ts.map +1 -1
  35. package/dist/validations/validations.js +16 -14
  36. package/package.json +35 -46
  37. package/LICENSE +0 -21
  38. package/dist/cjs/auth/index.d.ts +0 -51
  39. package/dist/cjs/auth/index.d.ts.map +0 -1
  40. package/dist/cjs/auth/index.js +0 -129
  41. package/dist/cjs/auth/parseJWT.d.ts +0 -6
  42. package/dist/cjs/auth/parseJWT.d.ts.map +0 -1
  43. package/dist/cjs/auth/parseJWT.js +0 -57
  44. package/dist/cjs/auth/verifiers/base64Sha1Verifier.d.ts +0 -18
  45. package/dist/cjs/auth/verifiers/base64Sha1Verifier.d.ts.map +0 -1
  46. package/dist/cjs/auth/verifiers/base64Sha1Verifier.js +0 -77
  47. package/dist/cjs/auth/verifiers/base64Sha256Verifier.d.ts +0 -18
  48. package/dist/cjs/auth/verifiers/base64Sha256Verifier.d.ts.map +0 -1
  49. package/dist/cjs/auth/verifiers/base64Sha256Verifier.js +0 -77
  50. package/dist/cjs/auth/verifiers/common.d.ts +0 -112
  51. package/dist/cjs/auth/verifiers/common.d.ts.map +0 -1
  52. package/dist/cjs/auth/verifiers/common.js +0 -89
  53. package/dist/cjs/auth/verifiers/index.d.ts +0 -8
  54. package/dist/cjs/auth/verifiers/index.d.ts.map +0 -1
  55. package/dist/cjs/auth/verifiers/index.js +0 -39
  56. package/dist/cjs/auth/verifiers/jwtVerifier.d.ts +0 -18
  57. package/dist/cjs/auth/verifiers/jwtVerifier.d.ts.map +0 -1
  58. package/dist/cjs/auth/verifiers/jwtVerifier.js +0 -84
  59. package/dist/cjs/auth/verifiers/secretKeyVerifier.d.ts +0 -11
  60. package/dist/cjs/auth/verifiers/secretKeyVerifier.d.ts.map +0 -1
  61. package/dist/cjs/auth/verifiers/secretKeyVerifier.js +0 -43
  62. package/dist/cjs/auth/verifiers/sha1Verifier.d.ts +0 -17
  63. package/dist/cjs/auth/verifiers/sha1Verifier.d.ts.map +0 -1
  64. package/dist/cjs/auth/verifiers/sha1Verifier.js +0 -85
  65. package/dist/cjs/auth/verifiers/sha256Verifier.d.ts +0 -17
  66. package/dist/cjs/auth/verifiers/sha256Verifier.d.ts.map +0 -1
  67. package/dist/cjs/auth/verifiers/sha256Verifier.js +0 -85
  68. package/dist/cjs/auth/verifiers/skipVerifier.d.ts +0 -11
  69. package/dist/cjs/auth/verifiers/skipVerifier.d.ts.map +0 -1
  70. package/dist/cjs/auth/verifiers/skipVerifier.js +0 -40
  71. package/dist/cjs/auth/verifiers/timestampSchemeVerifier.d.ts +0 -14
  72. package/dist/cjs/auth/verifiers/timestampSchemeVerifier.d.ts.map +0 -1
  73. package/dist/cjs/auth/verifiers/timestampSchemeVerifier.js +0 -86
  74. package/dist/cjs/bins/cedar.d.ts +0 -9
  75. package/dist/cjs/bins/cedar.d.ts.map +0 -1
  76. package/dist/cjs/bins/cedar.js +0 -36
  77. package/dist/cjs/bins/cfw.d.ts +0 -3
  78. package/dist/cjs/bins/cfw.d.ts.map +0 -1
  79. package/dist/cjs/bins/cfw.js +0 -36
  80. package/dist/cjs/bins/redwood.d.ts +0 -9
  81. package/dist/cjs/bins/redwood.d.ts.map +0 -1
  82. package/dist/cjs/bins/redwood.js +0 -36
  83. package/dist/cjs/bins/tsc.d.ts +0 -3
  84. package/dist/cjs/bins/tsc.d.ts.map +0 -1
  85. package/dist/cjs/bins/tsc.js +0 -30
  86. package/dist/cjs/cache/clients/BaseClient.d.ts +0 -11
  87. package/dist/cjs/cache/clients/BaseClient.d.ts.map +0 -1
  88. package/dist/cjs/cache/clients/BaseClient.js +0 -31
  89. package/dist/cjs/cache/clients/InMemoryClient.d.ts +0 -31
  90. package/dist/cjs/cache/clients/InMemoryClient.d.ts.map +0 -1
  91. package/dist/cjs/cache/clients/InMemoryClient.js +0 -94
  92. package/dist/cjs/cache/clients/MemcachedClient.d.ts +0 -16
  93. package/dist/cjs/cache/clients/MemcachedClient.d.ts.map +0 -1
  94. package/dist/cjs/cache/clients/MemcachedClient.js +0 -79
  95. package/dist/cjs/cache/clients/RedisClient.d.ts +0 -20
  96. package/dist/cjs/cache/clients/RedisClient.d.ts.map +0 -1
  97. package/dist/cjs/cache/clients/RedisClient.js +0 -83
  98. package/dist/cjs/cache/errors.d.ts +0 -4
  99. package/dist/cjs/cache/errors.d.ts.map +0 -1
  100. package/dist/cjs/cache/errors.js +0 -33
  101. package/dist/cjs/cache/index.d.ts +0 -35
  102. package/dist/cjs/cache/index.d.ts.map +0 -1
  103. package/dist/cjs/cache/index.js +0 -171
  104. package/dist/cjs/cors.d.ts +0 -16
  105. package/dist/cjs/cors.d.ts.map +0 -1
  106. package/dist/cjs/cors.js +0 -93
  107. package/dist/cjs/errors.d.ts +0 -5
  108. package/dist/cjs/errors.d.ts.map +0 -1
  109. package/dist/cjs/errors.js +0 -38
  110. package/dist/cjs/event.d.ts +0 -3
  111. package/dist/cjs/event.d.ts.map +0 -1
  112. package/dist/cjs/event.js +0 -34
  113. package/dist/cjs/functions/fixtures/apiGatewayProxyEvent.fixture.d.ts +0 -4
  114. package/dist/cjs/functions/fixtures/apiGatewayProxyEvent.fixture.d.ts.map +0 -1
  115. package/dist/cjs/functions/fixtures/apiGatewayProxyEvent.fixture.js +0 -72
  116. package/dist/cjs/index.d.ts +0 -15
  117. package/dist/cjs/index.d.ts.map +0 -1
  118. package/dist/cjs/index.js +0 -70
  119. package/dist/cjs/logger/index.d.ts +0 -179
  120. package/dist/cjs/logger/index.d.ts.map +0 -1
  121. package/dist/cjs/logger/index.js +0 -195
  122. package/dist/cjs/package.json +0 -1
  123. package/dist/cjs/transforms.d.ts +0 -35
  124. package/dist/cjs/transforms.d.ts.map +0 -1
  125. package/dist/cjs/transforms.js +0 -98
  126. package/dist/cjs/types.d.ts +0 -25
  127. package/dist/cjs/types.d.ts.map +0 -1
  128. package/dist/cjs/types.js +0 -16
  129. package/dist/cjs/validations/errors.d.ts +0 -101
  130. package/dist/cjs/validations/errors.d.ts.map +0 -1
  131. package/dist/cjs/validations/errors.js +0 -298
  132. package/dist/cjs/validations/validations.d.ts +0 -222
  133. package/dist/cjs/validations/validations.d.ts.map +0 -1
  134. package/dist/cjs/validations/validations.js +0 -351
  135. package/dist/cjs/webhooks/index.d.ts +0 -77
  136. package/dist/cjs/webhooks/index.d.ts.map +0 -1
  137. package/dist/cjs/webhooks/index.js +0 -102
@@ -1,51 +0,0 @@
1
- export * from './parseJWT.js';
2
- import type { APIGatewayProxyEvent, Context as LambdaContext } from 'aws-lambda';
3
- import type { Decoded } from './parseJWT.js';
4
- export type { Decoded };
5
- export declare const AUTH_PROVIDER_HEADER = "auth-provider";
6
- export declare const getAuthProviderHeader: (event: APIGatewayProxyEvent | Request) => string | null | undefined;
7
- export interface AuthorizationHeader {
8
- schema: 'Bearer' | 'Basic' | string;
9
- token: string;
10
- }
11
- export type AuthorizationCookies = {
12
- parsedCookie: Record<string, string | undefined>;
13
- rawCookie: string;
14
- type: string | undefined;
15
- } | null;
16
- export declare const parseAuthorizationCookie: (event: APIGatewayProxyEvent | Request) => AuthorizationCookies;
17
- /**
18
- * Split the `Authorization` header into a schema and token part.
19
- */
20
- export declare const parseAuthorizationHeader: (event: APIGatewayProxyEvent | Request) => AuthorizationHeader;
21
- /** @MARK Note that we do not send LambdaContext when making fetch requests
22
- *
23
- * This part is incomplete, as we need to decide how we will make the breaking change to
24
- * 1. getCurrentUser
25
- * 2. authDecoders
26
-
27
- */
28
- export type AuthContextPayload = [
29
- Decoded,
30
- {
31
- type: string;
32
- } & AuthorizationHeader,
33
- {
34
- event: APIGatewayProxyEvent | Request;
35
- context?: LambdaContext;
36
- }
37
- ];
38
- export type Decoder = (token: string, type: string, req: {
39
- event: APIGatewayProxyEvent | Request;
40
- context?: LambdaContext;
41
- }) => Promise<Decoded>;
42
- /**
43
- * Get the authorization information from the request headers and request context.
44
- * @returns [decoded, { type, schema, token }, { event, context }]
45
- **/
46
- export declare const getAuthenticationContext: ({ authDecoder, event, context, }: {
47
- authDecoder?: Decoder | Decoder[];
48
- event: APIGatewayProxyEvent | Request;
49
- context?: LambdaContext;
50
- }) => Promise<undefined | AuthContextPayload>;
51
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/auth/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAA;AAE7B,OAAO,KAAK,EAAE,oBAAoB,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,YAAY,CAAA;AAKhF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAC5C,YAAY,EAAE,OAAO,EAAE,CAAA;AAGvB,eAAO,MAAM,oBAAoB,kBAAkB,CAAA;AAEnD,eAAO,MAAM,qBAAqB,GAChC,OAAO,oBAAoB,GAAG,OAAO,8BAStC,CAAA;AAED,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;IACnC,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,MAAM,oBAAoB,GAAG;IACjC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAA;IAChD,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,GAAG,SAAS,CAAA;CACzB,GAAG,IAAI,CAAA;AAER,eAAO,MAAM,wBAAwB,GACnC,OAAO,oBAAoB,GAAG,OAAO,KACpC,oBAiBF,CAAA;AAED;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACnC,OAAO,oBAAoB,GAAG,OAAO,KACpC,mBAUF,CAAA;AAED;;;;;;GAMG;AAEH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO;IACP;QAAE,IAAI,EAAE,MAAM,CAAA;KAAE,GAAG,mBAAmB;IAEtC;QACE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAA;QACrC,OAAO,CAAC,EAAE,aAAa,CAAA;KACxB;CACF,CAAA;AAED,MAAM,MAAM,OAAO,GAAG,CACpB,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,EACZ,GAAG,EAAE;IACH,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAA;IACrC,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB,KACE,OAAO,CAAC,OAAO,CAAC,CAAA;AAErB;;;IAGI;AACJ,eAAO,MAAM,wBAAwB,GAAU,kCAI5C;IACD,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,EAAE,CAAA;IACjC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAA;IACrC,OAAO,CAAC,EAAE,aAAa,CAAA;CACxB,KAAG,OAAO,CAAC,SAAS,GAAG,kBAAkB,CA6DzC,CAAA"}
@@ -1,129 +0,0 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getProtoOf = Object.getPrototypeOf;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
21
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
- // If the importer is in node compatibility mode or this is not an ESM
23
- // file that has been converted to a CommonJS file using a Babel-
24
- // compatible transform (i.e. "__esModule" has not been set), then set
25
- // "default" to the CommonJS "module.exports" for node compatibility.
26
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
- mod
28
- ));
29
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
30
- var auth_exports = {};
31
- __export(auth_exports, {
32
- AUTH_PROVIDER_HEADER: () => AUTH_PROVIDER_HEADER,
33
- getAuthProviderHeader: () => getAuthProviderHeader,
34
- getAuthenticationContext: () => getAuthenticationContext,
35
- parseAuthorizationCookie: () => parseAuthorizationCookie,
36
- parseAuthorizationHeader: () => parseAuthorizationHeader
37
- });
38
- module.exports = __toCommonJS(auth_exports);
39
- __reExport(auth_exports, require("./parseJWT.js"), module.exports);
40
- var cookie = __toESM(require("cookie"), 1);
41
- var import_event = require("../event.js");
42
- const AUTH_PROVIDER_HEADER = "auth-provider";
43
- const getAuthProviderHeader = (event) => {
44
- const authProviderKey = Object.keys(event?.headers ?? {}).find(
45
- (key) => key.toLowerCase() === AUTH_PROVIDER_HEADER
46
- );
47
- if (authProviderKey) {
48
- return (0, import_event.getEventHeader)(event, authProviderKey);
49
- }
50
- return void 0;
51
- };
52
- const parseAuthorizationCookie = (event) => {
53
- const cookieHeader = (0, import_event.getEventHeader)(event, "Cookie");
54
- if (!cookieHeader) {
55
- return null;
56
- }
57
- const parsedCookie = cookie.parse(cookieHeader);
58
- return {
59
- parsedCookie,
60
- rawCookie: cookieHeader,
61
- // When not unauthenticated, this will be null/undefined
62
- // Remember that the cookie header could contain other (unrelated) values!
63
- type: parsedCookie[AUTH_PROVIDER_HEADER]
64
- };
65
- };
66
- const parseAuthorizationHeader = (event) => {
67
- const parts = (0, import_event.getEventHeader)(event, "Authorization")?.split(" ");
68
- if (parts?.length !== 2) {
69
- throw new Error("The `Authorization` header is not valid.");
70
- }
71
- const [schema, token] = parts;
72
- if (!schema.length || !token.length) {
73
- throw new Error("The `Authorization` header is not valid.");
74
- }
75
- return { schema, token };
76
- };
77
- const getAuthenticationContext = async ({
78
- authDecoder,
79
- event,
80
- context
81
- }) => {
82
- const cookieHeader = parseAuthorizationCookie(event);
83
- const typeFromHeader = getAuthProviderHeader(event);
84
- if (!typeFromHeader && !cookieHeader) {
85
- return void 0;
86
- }
87
- let token;
88
- let type;
89
- let schema;
90
- if (cookieHeader?.type) {
91
- token = cookieHeader.rawCookie;
92
- type = cookieHeader.type;
93
- schema = "cookie";
94
- } else if (typeFromHeader) {
95
- const parsedAuthHeader = parseAuthorizationHeader(event);
96
- token = parsedAuthHeader.token;
97
- type = typeFromHeader;
98
- schema = parsedAuthHeader.schema;
99
- }
100
- if (!token || !type || !schema) {
101
- return void 0;
102
- }
103
- let authDecoders = [];
104
- if (Array.isArray(authDecoder)) {
105
- authDecoders = authDecoder;
106
- } else if (authDecoder) {
107
- authDecoders = [authDecoder];
108
- }
109
- let decoded = null;
110
- let i = 0;
111
- while (!decoded && i < authDecoders.length) {
112
- decoded = await authDecoders[i](token, type, {
113
- // @MARK: When called from middleware, the decoder will pass Request, not Lambda event
114
- event,
115
- context
116
- });
117
- i++;
118
- }
119
- return [decoded, { type, schema, token }, { event, context }];
120
- };
121
- // Annotate the CommonJS export names for ESM import in node:
122
- 0 && (module.exports = {
123
- AUTH_PROVIDER_HEADER,
124
- getAuthProviderHeader,
125
- getAuthenticationContext,
126
- parseAuthorizationCookie,
127
- parseAuthorizationHeader,
128
- ...require("./parseJWT.js")
129
- });
@@ -1,6 +0,0 @@
1
- export type Decoded = Record<string, unknown> | null;
2
- export declare const parseJWT: (token: {
3
- decoded: Decoded;
4
- namespace?: string;
5
- }) => any;
6
- //# sourceMappingURL=parseJWT.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parseJWT.d.ts","sourceRoot":"","sources":["../../../src/auth/parseJWT.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;AA8DpD,eAAO,MAAM,QAAQ,GAAI,OAAO;IAC9B,OAAO,EAAE,OAAO,CAAA;IAChB,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB,KAAG,GAKH,CAAA"}
@@ -1,57 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var parseJWT_exports = {};
20
- __export(parseJWT_exports, {
21
- parseJWT: () => parseJWT
22
- });
23
- module.exports = __toCommonJS(parseJWT_exports);
24
- function isTokenWithRoles(token) {
25
- return !!token.decoded?.roles;
26
- }
27
- function isTokenWithMetadata(token) {
28
- const claim = token.namespace ? `${token.namespace}/app_metadata` : "app_metadata";
29
- return !!token.decoded?.[claim];
30
- }
31
- const appMetadata = (token) => {
32
- if (typeof token.decoded === "string") {
33
- return {};
34
- }
35
- if (isTokenWithMetadata(token)) {
36
- const claim = token.namespace ? `${token.namespace}/app_metadata` : "app_metadata";
37
- return token.decoded?.[claim];
38
- }
39
- return {};
40
- };
41
- const roles = (token) => {
42
- if (isTokenWithRoles(token)) {
43
- return token.decoded.roles;
44
- }
45
- const metadata = appMetadata(token);
46
- return metadata?.roles || metadata.authorization?.roles || [];
47
- };
48
- const parseJWT = (token) => {
49
- return {
50
- appMetadata: appMetadata(token),
51
- roles: roles(token)
52
- };
53
- };
54
- // Annotate the CommonJS export names for ESM import in node:
55
- 0 && (module.exports = {
56
- parseJWT
57
- });
@@ -1,18 +0,0 @@
1
- import type { WebhookVerifier, VerifyOptions } from './common.js';
2
- export interface Base64Sha1Verifier extends WebhookVerifier {
3
- type: 'base64Sha1Verifier';
4
- }
5
- export declare const verifySignature: ({ payload, secret, signature, }: {
6
- payload: string | Record<string, unknown>;
7
- secret: string;
8
- signature: string;
9
- }) => boolean;
10
- /**
11
- * Base64 SHA1 HMAC Payload Verifier
12
- *
13
- * Based on Svix's webhook payload verification, but using SHA1 instead
14
- * @see https://docs.svix.com/receiving/verifying-payloads/how-manual
15
- * @see https://github.com/svix/svix-webhooks/blob/main/javascript/src/index.ts
16
- */
17
- export declare function base64Sha1Verifier(_options?: VerifyOptions): Base64Sha1Verifier;
18
- //# sourceMappingURL=base64Sha1Verifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base64Sha1Verifier.d.ts","sourceRoot":"","sources":["../../../../src/auth/verifiers/base64Sha1Verifier.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEjE,MAAM,WAAW,kBAAmB,SAAQ,eAAe;IACzD,IAAI,EAAE,oBAAoB,CAAA;CAC3B;AA0BD,eAAO,MAAM,eAAe,GAAI,iCAI7B;IACD,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB,KAAG,OA0BH,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,CAAC,EAAE,aAAa,GACvB,kBAAkB,CAUpB"}
@@ -1,77 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var base64Sha1Verifier_exports = {};
20
- __export(base64Sha1Verifier_exports, {
21
- base64Sha1Verifier: () => base64Sha1Verifier,
22
- verifySignature: () => verifySignature
23
- });
24
- module.exports = __toCommonJS(base64Sha1Verifier_exports);
25
- var import_crypto = require("crypto");
26
- var import_common = require("./common.js");
27
- function toNormalizedJsonString(payload) {
28
- return JSON.stringify(payload).replace(/[^\\]\\u[\da-f]{4}/g, (s) => {
29
- return s.slice(0, 3) + s.slice(3).toUpperCase();
30
- });
31
- }
32
- const createSignature = ({
33
- payload,
34
- secret = import_common.DEFAULT_WEBHOOK_SECRET
35
- }) => {
36
- const algorithm = "sha1";
37
- const hmac = (0, import_crypto.createHmac)(algorithm, Buffer.from(secret, "base64"));
38
- payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
39
- const digest = hmac.update(payload).digest();
40
- return digest.toString("base64");
41
- };
42
- const verifySignature = ({
43
- payload,
44
- secret = import_common.DEFAULT_WEBHOOK_SECRET,
45
- signature
46
- }) => {
47
- try {
48
- const webhookSignature = Buffer.from(signature || "", "base64");
49
- const hmac = (0, import_crypto.createHmac)("sha1", Buffer.from(secret, "base64"));
50
- payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
51
- const digest = hmac.update(payload).digest();
52
- if (webhookSignature.length === digest.length && (0, import_crypto.timingSafeEqual)(digest, webhookSignature)) {
53
- return true;
54
- }
55
- throw new import_common.WebhookVerificationError();
56
- } catch (error) {
57
- throw new import_common.WebhookVerificationError(
58
- `${import_common.VERIFICATION_ERROR_MESSAGE}: ${error.message}`
59
- );
60
- }
61
- };
62
- function base64Sha1Verifier(_options) {
63
- return {
64
- sign: ({ payload, secret }) => {
65
- return createSignature({ payload, secret });
66
- },
67
- verify: ({ payload, secret, signature }) => {
68
- return verifySignature({ payload, secret, signature });
69
- },
70
- type: "base64Sha1Verifier"
71
- };
72
- }
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- base64Sha1Verifier,
76
- verifySignature
77
- });
@@ -1,18 +0,0 @@
1
- import type { WebhookVerifier, VerifyOptions } from './common.js';
2
- export interface Base64Sha256Verifier extends WebhookVerifier {
3
- type: 'base64Sha256Verifier';
4
- }
5
- export declare const verifySignature: ({ payload, secret, signature, }: {
6
- payload: string | Record<string, unknown>;
7
- secret: string;
8
- signature: string;
9
- }) => boolean;
10
- /**
11
- * Base64 SHA256 HMAC Payload Verifier
12
- *
13
- * Based on Svix's webhook payload verification
14
- * @see https://docs.svix.com/receiving/verifying-payloads/how-manual
15
- * @see https://github.com/svix/svix-webhooks/blob/main/javascript/src/index.ts
16
- */
17
- export declare function base64Sha256Verifier(_options?: VerifyOptions): Base64Sha256Verifier;
18
- //# sourceMappingURL=base64Sha256Verifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"base64Sha256Verifier.d.ts","sourceRoot":"","sources":["../../../../src/auth/verifiers/base64Sha256Verifier.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEjE,MAAM,WAAW,oBAAqB,SAAQ,eAAe;IAC3D,IAAI,EAAE,sBAAsB,CAAA;CAC7B;AA0BD,eAAO,MAAM,eAAe,GAAI,iCAI7B;IACD,OAAO,EAAE,MAAM,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;IACzC,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,MAAM,CAAA;CAClB,KAAG,OA0BH,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAClC,QAAQ,CAAC,EAAE,aAAa,GACvB,oBAAoB,CAUtB"}
@@ -1,77 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var base64Sha256Verifier_exports = {};
20
- __export(base64Sha256Verifier_exports, {
21
- base64Sha256Verifier: () => base64Sha256Verifier,
22
- verifySignature: () => verifySignature
23
- });
24
- module.exports = __toCommonJS(base64Sha256Verifier_exports);
25
- var import_crypto = require("crypto");
26
- var import_common = require("./common.js");
27
- function toNormalizedJsonString(payload) {
28
- return JSON.stringify(payload).replace(/[^\\]\\u[\da-f]{4}/g, (s) => {
29
- return s.slice(0, 3) + s.slice(3).toUpperCase();
30
- });
31
- }
32
- const createSignature = ({
33
- payload,
34
- secret = import_common.DEFAULT_WEBHOOK_SECRET
35
- }) => {
36
- const algorithm = "sha256";
37
- const hmac = (0, import_crypto.createHmac)(algorithm, Buffer.from(secret, "base64"));
38
- payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
39
- const digest = hmac.update(payload).digest();
40
- return digest.toString("base64");
41
- };
42
- const verifySignature = ({
43
- payload,
44
- secret = import_common.DEFAULT_WEBHOOK_SECRET,
45
- signature
46
- }) => {
47
- try {
48
- const webhookSignature = Buffer.from(signature || "", "base64");
49
- const hmac = (0, import_crypto.createHmac)("sha256", Buffer.from(secret, "base64"));
50
- payload = typeof payload === "string" ? payload : toNormalizedJsonString(payload);
51
- const digest = hmac.update(payload).digest();
52
- if (webhookSignature.length === digest.length && (0, import_crypto.timingSafeEqual)(digest, webhookSignature)) {
53
- return true;
54
- }
55
- throw new import_common.WebhookVerificationError();
56
- } catch (error) {
57
- throw new import_common.WebhookVerificationError(
58
- `${import_common.VERIFICATION_ERROR_MESSAGE}: ${error.message}`
59
- );
60
- }
61
- };
62
- function base64Sha256Verifier(_options) {
63
- return {
64
- sign: ({ payload, secret }) => {
65
- return createSignature({ payload, secret });
66
- },
67
- verify: ({ payload, secret, signature }) => {
68
- return verifySignature({ payload, secret, signature });
69
- },
70
- type: "base64Sha256Verifier"
71
- };
72
- }
73
- // Annotate the CommonJS export names for ESM import in node:
74
- 0 && (module.exports = {
75
- base64Sha256Verifier,
76
- verifySignature
77
- });
@@ -1,112 +0,0 @@
1
- import { base64Sha1Verifier } from './base64Sha1Verifier.js';
2
- import type { Base64Sha1Verifier } from './base64Sha1Verifier.js';
3
- import { base64Sha256Verifier } from './base64Sha256Verifier.js';
4
- import type { Base64Sha256Verifier } from './base64Sha256Verifier.js';
5
- import { jwtVerifier } from './jwtVerifier.js';
6
- import type { JwtVerifier } from './jwtVerifier.js';
7
- import { secretKeyVerifier } from './secretKeyVerifier.js';
8
- import type { SecretKeyVerifier } from './secretKeyVerifier.js';
9
- import { sha1Verifier } from './sha1Verifier.js';
10
- import type { Sha1Verifier } from './sha1Verifier.js';
11
- import { sha256Verifier } from './sha256Verifier.js';
12
- import type { Sha256Verifier } from './sha256Verifier.js';
13
- import { skipVerifier } from './skipVerifier.js';
14
- import type { SkipVerifier } from './skipVerifier.js';
15
- import { timestampSchemeVerifier } from './timestampSchemeVerifier.js';
16
- import type { TimestampSchemeVerifier } from './timestampSchemeVerifier.js';
17
- export declare const verifierLookup: {
18
- skipVerifier: typeof skipVerifier;
19
- secretKeyVerifier: typeof secretKeyVerifier;
20
- sha1Verifier: typeof sha1Verifier;
21
- sha256Verifier: typeof sha256Verifier;
22
- base64Sha1Verifier: typeof base64Sha1Verifier;
23
- base64Sha256Verifier: typeof base64Sha256Verifier;
24
- timestampSchemeVerifier: typeof timestampSchemeVerifier;
25
- jwtVerifier: typeof jwtVerifier;
26
- };
27
- export type SupportedVerifiers = SkipVerifier | SecretKeyVerifier | Sha1Verifier | Sha256Verifier | Base64Sha1Verifier | Base64Sha256Verifier | TimestampSchemeVerifier | JwtVerifier;
28
- export type SupportedVerifierTypes = keyof typeof verifierLookup;
29
- export declare const DEFAULT_WEBHOOK_SECRET: string;
30
- export declare const VERIFICATION_ERROR_MESSAGE = "You don't have access to invoke this function.";
31
- export declare const VERIFICATION_SIGN_MESSAGE = "Unable to sign payload";
32
- /**
33
- * @const {number} DEFAULT_TOLERANCE - Five minutes
34
- */
35
- export declare const DEFAULT_TOLERANCE: number;
36
- /**
37
- * Class representing a WebhookError
38
- * @extends Error
39
- */
40
- declare class WebhookError extends Error {
41
- /**
42
- * Create a WebhookError.
43
- * @param {string} message - The error message
44
- * */
45
- constructor(message: string);
46
- }
47
- /**
48
- * Class representing a WebhookVerificationError
49
- * @extends WebhookError
50
- */
51
- export declare class WebhookVerificationError extends WebhookError {
52
- /**
53
- * Create a WebhookVerificationError.
54
- * @param {string} message - The error message
55
- * */
56
- constructor(message?: string);
57
- }
58
- /**
59
- * Class representing a WebhookSignError
60
- * @extends WebhookError
61
- */
62
- export declare class WebhookSignError extends WebhookError {
63
- /**
64
- * Create a WebhookSignError.
65
- * @param {string} message - The error message
66
- * */
67
- constructor(message?: string);
68
- }
69
- /**
70
- * VerifyOptions
71
- *
72
- * Used when verifying a signature based on the verifier's requirements
73
- *
74
- * @param {string} signatureHeader - Optional Header that contains the signature
75
- * to verify. Will default to DEFAULT_WEBHOOK_SIGNATURE_HEADER
76
- * @param {(signature: string) => string} signatureTransformer - Optional
77
- * function that receives the signature from the headers and returns a new
78
- * signature to use in the Verifier
79
- * @param {number} currentTimestampOverride - Optional timestamp to use as the
80
- * "current" timestamp, in msec
81
- * @param {number} eventTimestamp - Optional timestamp to use as the event
82
- * timestamp, in msec. If this is provided the webhook verification will fail
83
- * if the eventTimestamp is too far from the current time (or the time passed
84
- * as the `currentTimestampOverride` option)
85
- * @param {number} tolerance - Optional tolerance in msec
86
- * @param {string} issuer - Options JWT issuer for JWTVerifier
87
- */
88
- export interface VerifyOptions {
89
- signatureHeader?: string;
90
- signatureTransformer?: (signature: string) => string;
91
- currentTimestampOverride?: number;
92
- eventTimestamp?: number;
93
- tolerance?: number;
94
- issuer?: string;
95
- }
96
- /**
97
- * WebhookVerifier is the interface for all verifiers
98
- */
99
- export interface WebhookVerifier {
100
- sign({ payload, secret, }: {
101
- payload: string | Record<string, unknown>;
102
- secret: string;
103
- }): string;
104
- verify({ payload, secret, signature, }: {
105
- payload: string | Record<string, unknown>;
106
- secret: string;
107
- signature: string;
108
- }): boolean | WebhookVerificationError;
109
- type: SupportedVerifierTypes;
110
- }
111
- export {};
112
- //# sourceMappingURL=common.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../../src/auth/verifiers/common.ts"],"names":[],"mappings":"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"}
@@ -1,89 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
- var common_exports = {};
20
- __export(common_exports, {
21
- DEFAULT_TOLERANCE: () => DEFAULT_TOLERANCE,
22
- DEFAULT_WEBHOOK_SECRET: () => DEFAULT_WEBHOOK_SECRET,
23
- VERIFICATION_ERROR_MESSAGE: () => VERIFICATION_ERROR_MESSAGE,
24
- VERIFICATION_SIGN_MESSAGE: () => VERIFICATION_SIGN_MESSAGE,
25
- WebhookSignError: () => WebhookSignError,
26
- WebhookVerificationError: () => WebhookVerificationError,
27
- verifierLookup: () => verifierLookup
28
- });
29
- module.exports = __toCommonJS(common_exports);
30
- var import_base64Sha1Verifier = require("./base64Sha1Verifier.js");
31
- var import_base64Sha256Verifier = require("./base64Sha256Verifier.js");
32
- var import_jwtVerifier = require("./jwtVerifier.js");
33
- var import_secretKeyVerifier = require("./secretKeyVerifier.js");
34
- var import_sha1Verifier = require("./sha1Verifier.js");
35
- var import_sha256Verifier = require("./sha256Verifier.js");
36
- var import_skipVerifier = require("./skipVerifier.js");
37
- var import_timestampSchemeVerifier = require("./timestampSchemeVerifier.js");
38
- const verifierLookup = {
39
- skipVerifier: import_skipVerifier.skipVerifier,
40
- secretKeyVerifier: import_secretKeyVerifier.secretKeyVerifier,
41
- sha1Verifier: import_sha1Verifier.sha1Verifier,
42
- sha256Verifier: import_sha256Verifier.sha256Verifier,
43
- base64Sha1Verifier: import_base64Sha1Verifier.base64Sha1Verifier,
44
- base64Sha256Verifier: import_base64Sha256Verifier.base64Sha256Verifier,
45
- timestampSchemeVerifier: import_timestampSchemeVerifier.timestampSchemeVerifier,
46
- jwtVerifier: import_jwtVerifier.jwtVerifier
47
- };
48
- const DEFAULT_WEBHOOK_SECRET = process.env.WEBHOOK_SECRET ?? "";
49
- const VERIFICATION_ERROR_MESSAGE = "You don't have access to invoke this function.";
50
- const VERIFICATION_SIGN_MESSAGE = "Unable to sign payload";
51
- const FIVE_MINUTES = 5 * 6e4;
52
- const DEFAULT_TOLERANCE = FIVE_MINUTES;
53
- class WebhookError extends Error {
54
- /**
55
- * Create a WebhookError.
56
- * @param {string} message - The error message
57
- * */
58
- constructor(message) {
59
- super(message);
60
- }
61
- }
62
- class WebhookVerificationError extends WebhookError {
63
- /**
64
- * Create a WebhookVerificationError.
65
- * @param {string} message - The error message
66
- * */
67
- constructor(message) {
68
- super(message || VERIFICATION_ERROR_MESSAGE);
69
- }
70
- }
71
- class WebhookSignError extends WebhookError {
72
- /**
73
- * Create a WebhookSignError.
74
- * @param {string} message - The error message
75
- * */
76
- constructor(message) {
77
- super(message || VERIFICATION_SIGN_MESSAGE);
78
- }
79
- }
80
- // Annotate the CommonJS export names for ESM import in node:
81
- 0 && (module.exports = {
82
- DEFAULT_TOLERANCE,
83
- DEFAULT_WEBHOOK_SECRET,
84
- VERIFICATION_ERROR_MESSAGE,
85
- VERIFICATION_SIGN_MESSAGE,
86
- WebhookSignError,
87
- WebhookVerificationError,
88
- verifierLookup
89
- });
@@ -1,8 +0,0 @@
1
- import type { SupportedVerifierTypes, VerifyOptions, WebhookVerifier } from './common.js';
2
- /**
3
- * @param {SupportedVerifierTypes} type - What verification type methods used to sign and verify signatures
4
- * @param {VerifyOptions} options - Options used to verify the signature based on verifiers requirements
5
- */
6
- export declare const createVerifier: (type: SupportedVerifierTypes, options?: VerifyOptions) => WebhookVerifier;
7
- export * from './common.js';
8
- //# sourceMappingURL=index.d.ts.map