@aws-amplify/core 6.3.10 → 6.3.11-unstable.6aaf4a0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,5 +3,5 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.version = void 0;
5
5
  // generated by genversion
6
- exports.version = '6.5.1';
6
+ exports.version = '6.5.2-unstable.6aaf4a0.0+6aaf4a0';
7
7
  //# sourceMappingURL=version.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.5.1';\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AACzB;AACA,OAAO,CAAC,OAAO,GAAG,OAAO;;"}
1
+ {"version":3,"file":"version.js","sources":["../../../src/Platform/version.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.version = void 0;\n// generated by genversion\nexports.version = '6.5.2-unstable.6aaf4a0.0+6aaf4a0';\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,OAAO,GAAG,KAAK,CAAC,CAAC;AACzB;AACA,OAAO,CAAC,OAAO,GAAG,kCAAkC;;"}
@@ -31,6 +31,12 @@ function assertIdentityPoolIdConfig(cognitoConfig) {
31
31
  (0, errorHelpers_1.assert)(validConfig, errorHelpers_1.AuthConfigurationErrorCode.InvalidIdentityPoolIdException);
32
32
  }
33
33
  exports.assertIdentityPoolIdConfig = assertIdentityPoolIdConfig;
34
+ /**
35
+ * Decodes payload of JWT token
36
+ *
37
+ * @param {String} token A string representing a token to be decoded
38
+ * @throws {@link Error} - Throws error when token is invalid or payload malformed.
39
+ */
34
40
  function decodeJWT(token) {
35
41
  const tokenParts = token.split('.');
36
42
  if (tokenParts.length !== 3) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../../src/singleton/Auth/utils/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.decodeJWT = exports.assertIdentityPoolIdConfig = exports.assertOAuthConfig = exports.assertTokenProviderConfig = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst convert_1 = require(\"../../../utils/convert\");\nconst errorHelpers_1 = require(\"./errorHelpers\");\nfunction assertTokenProviderConfig(cognitoConfig) {\n let assertionValid = true; // assume valid until otherwise proveed\n if (!cognitoConfig) {\n assertionValid = false;\n }\n else {\n assertionValid =\n !!cognitoConfig.userPoolId && !!cognitoConfig.userPoolClientId;\n }\n (0, errorHelpers_1.assert)(assertionValid, errorHelpers_1.AuthConfigurationErrorCode.AuthUserPoolException);\n}\nexports.assertTokenProviderConfig = assertTokenProviderConfig;\nfunction assertOAuthConfig(cognitoConfig) {\n const validOAuthConfig = !!cognitoConfig?.loginWith?.oauth?.domain &&\n !!cognitoConfig?.loginWith?.oauth?.redirectSignOut &&\n !!cognitoConfig?.loginWith?.oauth?.redirectSignIn &&\n !!cognitoConfig?.loginWith?.oauth?.responseType;\n (0, errorHelpers_1.assert)(validOAuthConfig, errorHelpers_1.AuthConfigurationErrorCode.OAuthNotConfigureException);\n}\nexports.assertOAuthConfig = assertOAuthConfig;\nfunction assertIdentityPoolIdConfig(cognitoConfig) {\n const validConfig = !!cognitoConfig?.identityPoolId;\n (0, errorHelpers_1.assert)(validConfig, errorHelpers_1.AuthConfigurationErrorCode.InvalidIdentityPoolIdException);\n}\nexports.assertIdentityPoolIdConfig = assertIdentityPoolIdConfig;\nfunction decodeJWT(token) {\n const tokenParts = token.split('.');\n if (tokenParts.length !== 3) {\n throw new Error('Invalid token');\n }\n try {\n const base64WithUrlSafe = tokenParts[1];\n const base64 = base64WithUrlSafe.replace(/-/g, '+').replace(/_/g, '/');\n const jsonStr = decodeURIComponent(convert_1.base64Decoder\n .convert(base64)\n .split('')\n .map(char => `%${`00${char.charCodeAt(0).toString(16)}`.slice(-2)}`)\n .join(''));\n const payload = JSON.parse(jsonStr);\n return {\n toString: () => token,\n payload,\n };\n }\n catch (err) {\n throw new Error('Invalid token payload');\n }\n}\nexports.decodeJWT = decodeJWT;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,0BAA0B,GAAG,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,yBAAyB,GAAG,KAAK,CAAC,CAAC;AAChI;AACA;AACA,MAAM,SAAS,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;AACpD,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC;AACjD,SAAS,yBAAyB,CAAC,aAAa,EAAE;AAClD,IAAI,IAAI,cAAc,GAAG,IAAI,CAAC;AAC9B,IAAI,IAAI,CAAC,aAAa,EAAE;AACxB,QAAQ,cAAc,GAAG,KAAK,CAAC;AAC/B,KAAK;AACL,SAAS;AACT,QAAQ,cAAc;AACtB,YAAY,CAAC,CAAC,aAAa,CAAC,UAAU,IAAI,CAAC,CAAC,aAAa,CAAC,gBAAgB,CAAC;AAC3E,KAAK;AACL,IAAI,IAAI,cAAc,CAAC,MAAM,EAAE,cAAc,EAAE,cAAc,CAAC,0BAA0B,CAAC,qBAAqB,CAAC,CAAC;AAChH,CAAC;AACD,OAAO,CAAC,yBAAyB,GAAG,yBAAyB,CAAC;AAC9D,SAAS,iBAAiB,CA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CAAC,aAAa;AAClE,aAAa,OAAO,CAAC,MAAM,CAAC;AAC5B,aAAa,KAAK,CAAC,EAAE,CAAC;AACtB,aAAa,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,aAAa,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACvB,QAAQ,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5C,QAAQ,OAAO;AACf,YAAY,QAAQ,EAAE,MAAM,KAAK;AACjC,YAAY,OAAO;AACnB,SAAS,CAAC;AACV,KAAK;AACL,IAAI,OAAO,GAAG,EAAE;AAChB,QAAQ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;AACjD,KAAK;AACL,CAAC;AACD,OAAO,CAAC,SAAS,GAAG,SAAS;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../../src/singleton/Auth/utils/index.ts"],"sourcesContent":["\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.decodeJWT = exports.assertIdentityPoolIdConfig = exports.assertOAuthConfig = exports.assertTokenProviderConfig = void 0;\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nconst convert_1 = require(\"../../../utils/convert\");\nconst errorHelpers_1 = require(\"./errorHelpers\");\nfunction assertTokenProviderConfig(cognitoConfig) {\n let assertionValid = true; // assume valid until otherwise proveed\n if (!cognitoConfig) {\n assertionValid = false;\n }\n else {\n assertionValid =\n !!cognitoConfig.userPoolId && !!cognitoConfig.userPoolClientId;\n }\n (0, errorHelpers_1.assert)(assertionValid, errorHelpers_1.AuthConfigurationErrorCode.AuthUserPoolException);\n}\nexports.assertTokenProviderConfig = assertTokenProviderConfig;\nfunction assertOAuthConfig(cognitoConfig) {\n const validOAuthConfig = !!cognitoConfig?.loginWith?.oauth?.domain &&\n !!cognitoConfig?.loginWith?.oauth?.redirectSignOut &&\n !!cognitoConfig?.loginWith?.oauth?.redirectSignIn &&\n !!cognitoConfig?.loginWith?.oauth?.responseType;\n (0, errorHelpers_1.assert)(validOAuthConfig, errorHelpers_1.AuthConfigurationErrorCode.OAuthNotConfigureException);\n}\nexports.assertOAuthConfig = assertOAuthConfig;\nfunction assertIdentityPoolIdConfig(cognitoConfig) {\n const validConfig = !!cognitoConfig?.identityPoolId;\n (0, errorHelpers_1.assert)(validConfig, errorHelpers_1.AuthConfigurationErrorCode.InvalidIdentityPoolIdException);\n}\nexports.assertIdentityPoolIdConfig = assertIdentityPoolIdConfig;\n/**\n * Decodes payload of JWT token\n *\n * @param {String} token A string representing a token to be decoded\n * @throws {@link Error} - Throws error when token is invalid or payload malformed.\n */\nfunction decodeJWT(token) {\n const tokenParts = token.split('.');\n if (tokenParts.length !== 3) {\n throw new Error('Invalid token');\n }\n try {\n const base64WithUrlSafe = tokenParts[1];\n const base64 = base64WithUrlSafe.replace(/-/g, '+').replace(/_/g, '/');\n const jsonStr = decodeURIComponent(convert_1.base64Decoder\n .convert(base64)\n .split('')\n .map(char => `%${`00${char.charCodeAt(0).toString(16)}`.slice(-2)}`)\n .join(''));\n const payload = JSON.parse(jsonStr);\n return {\n toString: () => token,\n payload,\n };\n }\n catch (err) {\n throw new Error('Invalid token payload');\n }\n}\nexports.decodeJWT = decodeJWT;\n"],"names":[],"mappings":";;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,SAAS,GAAG,OAAO,CAAC,0BAA0B,GAAG,OAAO,CAAC,iBAAiB,GAAG,OAAO,CAAC,yBAAyB,GAAG,KAAK,CAAC,CAAC;AAChI;AACA;AACA,MAAM,SAAS,GAAG,OA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AAC,SAAS,GAAG,SAAS;;"}
@@ -6,6 +6,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.fetchAuthSession = void 0;
7
7
  const Amplify_1 = require("../Amplify");
8
8
  const fetchAuthSession_1 = require("./internal/fetchAuthSession");
9
+ /**
10
+ * Fetch the auth session including the tokens and credentials if they are available. By default it
11
+ * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh
12
+ * with `{ forceRefresh: true }` input.
13
+ *
14
+ * @param options - Options configuring the fetch behavior.
15
+ * @throws {@link AuthError} - Throws error when session information cannot be refreshed.
16
+ * @returns Promise<AuthSession>
17
+ */
9
18
  const fetchAuthSession = (options) => {
10
19
  return (0, fetchAuthSession_1.fetchAuthSession)(Amplify_1.Amplify, options);
11
20
  };
@@ -1 +1 @@
1
- {"version":3,"file":"fetchAuthSession.js","sources":["../../../../src/singleton/apis/fetchAuthSession.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.fetchAuthSession = void 0;\nconst Amplify_1 = require(\"../Amplify\");\nconst fetchAuthSession_1 = require(\"./internal/fetchAuthSession\");\nconst fetchAuthSession = (options) => {\n return (0, fetchAuthSession_1.fetchAuthSession)(Amplify_1.Amplify, options);\n};\nexports.fetchAuthSession = fetchAuthSession;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,gBAAgB,GAAG,KAAK,CAAC,CAAC;AAClC,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACxC,MAAM,kBAAkB,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAClE,MAAM,gBAAgB,GAAG,CAAC,OAAO,KAAK;AACtC,IAAI,OAAO,IAAI,kBAAkB,CAAC,gBAAgB,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAChF,CAAC,CAAC;AACF,OAAO,CAAC,gBAAgB,GAAG,gBAAgB;;"}
1
+ {"version":3,"file":"fetchAuthSession.js","sources":["../../../../src/singleton/apis/fetchAuthSession.ts"],"sourcesContent":["\"use strict\";\n// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.fetchAuthSession = void 0;\nconst Amplify_1 = require(\"../Amplify\");\nconst fetchAuthSession_1 = require(\"./internal/fetchAuthSession\");\n/**\n * Fetch the auth session including the tokens and credentials if they are available. By default it\n * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh\n * with `{ forceRefresh: true }` input.\n *\n * @param options - Options configuring the fetch behavior.\n * @throws {@link AuthError} - Throws error when session information cannot be refreshed.\n * @returns Promise<AuthSession>\n */\nconst fetchAuthSession = (options) => {\n return (0, fetchAuthSession_1.fetchAuthSession)(Amplify_1.Amplify, options);\n};\nexports.fetchAuthSession = fetchAuthSession;\n"],"names":[],"mappings":";;AACA;AACA;AACA,MAAM,CAAC,cAAc,CAAC,OAAO,EAAE,YAAY,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC9D,OAAO,CAAC,gBAAgB,GAAG,KAAK,CAAC,CAAC;AAClC,MAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AACxC,MAAM,kBAAkB,GAAG,OAAO,CAAC,6BAA6B,CAAC,CAAC;AAClE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,MAAM,gBAAgB,GAAG,CAAC,OAAO,KAAK;AACtC,IAAI,OAAO,IAAI,kBAAkB,CAAC,gBAAgB,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AAChF,CAAC,CAAC;AACF,OAAO,CAAC,gBAAgB,GAAG,gBAAgB;;"}
@@ -1 +1 @@
1
- export declare const version = "6.5.1";
1
+ export declare const version = "6.5.2-unstable.6aaf4a0.0+6aaf4a0";
@@ -1,5 +1,5 @@
1
1
  // generated by genversion
2
- const version = '6.5.1';
2
+ const version = '6.5.2-unstable.6aaf4a0.0+6aaf4a0';
3
3
 
4
4
  export { version };
5
5
  //# sourceMappingURL=version.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.5.1';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
1
+ {"version":3,"file":"version.mjs","sources":["../../../src/Platform/version.ts"],"sourcesContent":["// generated by genversion\nexport const version = '6.5.2-unstable.6aaf4a0.0+6aaf4a0';\n"],"names":[],"mappings":"AAAA;AACY,MAAC,OAAO,GAAG;;;;"}
@@ -7,4 +7,10 @@ export declare function assertOAuthConfig(cognitoConfig?: AuthConfig['Cognito'])
7
7
  };
8
8
  };
9
9
  export declare function assertIdentityPoolIdConfig(cognitoConfig?: StrictUnion<CognitoUserPoolConfig | CognitoUserPoolAndIdentityPoolConfig | CognitoIdentityPoolConfig>): asserts cognitoConfig is CognitoIdentityPoolConfig;
10
+ /**
11
+ * Decodes payload of JWT token
12
+ *
13
+ * @param {String} token A string representing a token to be decoded
14
+ * @throws {@link Error} - Throws error when token is invalid or payload malformed.
15
+ */
10
16
  export declare function decodeJWT(token: string): JWT;
@@ -27,6 +27,12 @@ function assertIdentityPoolIdConfig(cognitoConfig) {
27
27
  const validConfig = !!cognitoConfig?.identityPoolId;
28
28
  assert(validConfig, AuthConfigurationErrorCode.InvalidIdentityPoolIdException);
29
29
  }
30
+ /**
31
+ * Decodes payload of JWT token
32
+ *
33
+ * @param {String} token A string representing a token to be decoded
34
+ * @throws {@link Error} - Throws error when token is invalid or payload malformed.
35
+ */
30
36
  function decodeJWT(token) {
31
37
  const tokenParts = token.split('.');
32
38
  if (tokenParts.length !== 3) {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sources":["../../../../../src/singleton/Auth/utils/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { base64Decoder } from '../../../utils/convert';\nimport { AuthConfigurationErrorCode, assert } from './errorHelpers';\nexport function assertTokenProviderConfig(cognitoConfig) {\n let assertionValid = true; // assume valid until otherwise proveed\n if (!cognitoConfig) {\n assertionValid = false;\n }\n else {\n assertionValid =\n !!cognitoConfig.userPoolId && !!cognitoConfig.userPoolClientId;\n }\n assert(assertionValid, AuthConfigurationErrorCode.AuthUserPoolException);\n}\nexport function assertOAuthConfig(cognitoConfig) {\n const validOAuthConfig = !!cognitoConfig?.loginWith?.oauth?.domain &&\n !!cognitoConfig?.loginWith?.oauth?.redirectSignOut &&\n !!cognitoConfig?.loginWith?.oauth?.redirectSignIn &&\n !!cognitoConfig?.loginWith?.oauth?.responseType;\n assert(validOAuthConfig, AuthConfigurationErrorCode.OAuthNotConfigureException);\n}\nexport function assertIdentityPoolIdConfig(cognitoConfig) {\n const validConfig = !!cognitoConfig?.identityPoolId;\n assert(validConfig, AuthConfigurationErrorCode.InvalidIdentityPoolIdException);\n}\nexport function decodeJWT(token) {\n const tokenParts = token.split('.');\n if (tokenParts.length !== 3) {\n throw new Error('Invalid token');\n }\n try {\n const base64WithUrlSafe = tokenParts[1];\n const base64 = base64WithUrlSafe.replace(/-/g, '+').replace(/_/g, '/');\n const jsonStr = decodeURIComponent(base64Decoder\n .convert(base64)\n .split('')\n .map(char => `%${`00${char.charCodeAt(0).toString(16)}`.slice(-2)}`)\n .join(''));\n const payload = JSON.parse(jsonStr);\n return {\n toString: () => token,\n payload,\n };\n }\n catch (err) {\n throw new Error('Invalid token payload');\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAGO,SAAS,yBAAyB,CAAC,aAAa,EAAE;AACzD,IAAI,IAAI,cAAc,GAAG,IAAI,CA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AAM,MAAM,GAAG,iBAAiB,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAC/E,QAAQ,MAAM,OAAO,GAAG,kBAAkB,CAAC,aAAa;AACxD,aAAa,OAAO,CAAC,MAAM,CAAC;AAC5B,aAAa,KAAK,CAAC,EAAE,CAAC;AACtB,aAAa,GAAG,CAAC,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,aAAa,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACvB,QAAQ,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5C,QAAQ,OAAO;AACf,YAAY,QAAQ,EAAE,MAAM,KAAK;AACjC,YAAY,OAAO;AACnB,SAAS,CAAC;AACV,KAAK;AACL,IAAI,OAAO,GAAG,EAAE;AAChB,QAAQ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;AACjD,KAAK;AACL;;;;"}
1
+ {"version":3,"file":"index.mjs","sources":["../../../../../src/singleton/Auth/utils/index.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { base64Decoder } from '../../../utils/convert';\nimport { AuthConfigurationErrorCode, assert } from './errorHelpers';\nexport function assertTokenProviderConfig(cognitoConfig) {\n let assertionValid = true; // assume valid until otherwise proveed\n if (!cognitoConfig) {\n assertionValid = false;\n }\n else {\n assertionValid =\n !!cognitoConfig.userPoolId && !!cognitoConfig.userPoolClientId;\n }\n assert(assertionValid, AuthConfigurationErrorCode.AuthUserPoolException);\n}\nexport function assertOAuthConfig(cognitoConfig) {\n const validOAuthConfig = !!cognitoConfig?.loginWith?.oauth?.domain &&\n !!cognitoConfig?.loginWith?.oauth?.redirectSignOut &&\n !!cognitoConfig?.loginWith?.oauth?.redirectSignIn &&\n !!cognitoConfig?.loginWith?.oauth?.responseType;\n assert(validOAuthConfig, AuthConfigurationErrorCode.OAuthNotConfigureException);\n}\nexport function assertIdentityPoolIdConfig(cognitoConfig) {\n const validConfig = !!cognitoConfig?.identityPoolId;\n assert(validConfig, AuthConfigurationErrorCode.InvalidIdentityPoolIdException);\n}\n/**\n * Decodes payload of JWT token\n *\n * @param {String} token A string representing a token to be decoded\n * @throws {@link Error} - Throws error when token is invalid or payload malformed.\n */\nexport function decodeJWT(token) {\n const tokenParts = token.split('.');\n if (tokenParts.length !== 3) {\n throw new Error('Invalid token');\n }\n try {\n const base64WithUrlSafe = tokenParts[1];\n const base64 = base64WithUrlSafe.replace(/-/g, '+').replace(/_/g, '/');\n const jsonStr = decodeURIComponent(base64Decoder\n .convert(base64)\n .split('')\n .map(char => `%${`00${char.charCodeAt(0).toString(16)}`.slice(-2)}`)\n .join(''));\n const payload = JSON.parse(jsonStr);\n return {\n toString: () => token,\n payload,\n };\n }\n catch (err) {\n throw new Error('Invalid token payload');\n }\n}\n"],"names":[],"mappings":";;;;;AAAA;AACA;AAGO,SAAS,yBAAyB,CAAC,aAAa,EAAE;AACzD,IAAI,IAAI,cAAc,GAAG,IAAI,CAAC;AAC9B,IAAI,IAAI,CAAC,aAAa,EAAE;AACxB,QAAQ,cAAc,GAAG,KAAK,CAAC;AAC/B,KAAK;AACL,SAAS;AACT,QAAQ,cAAc;AACtB,YAAY,CAAC,CAAC,aAAa,CAAC,UAAU,IAAI,CAAC,CAAC,aAAa,CAAC,gBAAgB,CAAC;AAC3E,KAAK;AACL,IAAI,MAAM,CAAC,cAAc,EAAE,0BAA0B,CAAC,qBAAqB,CAAC,CAAC;AAC7E,CAAC;AACM,SAAS,iBAAiB,CAAC,aAAa,EAAE;AACjD,IAAI,MAAM,gBAAgB,GAAG,CAAC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,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,aAAa,IAAI,CAAC,EAAE,CAAC,CAAC,CAAC;AACvB,QAAQ,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC5C,QAAQ,OAAO;AACf,YAAY,QAAQ,EAAE,MAAM,KAAK;AACjC,YAAY,OAAO;AACnB,SAAS,CAAC;AACV,KAAK;AACL,IAAI,OAAO,GAAG,EAAE;AAChB,QAAQ,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;AACjD,KAAK;AACL;;;;"}
@@ -1,2 +1,11 @@
1
1
  import { AuthSession, FetchAuthSessionOptions } from '../Auth/types';
2
+ /**
3
+ * Fetch the auth session including the tokens and credentials if they are available. By default it
4
+ * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh
5
+ * with `{ forceRefresh: true }` input.
6
+ *
7
+ * @param options - Options configuring the fetch behavior.
8
+ * @throws {@link AuthError} - Throws error when session information cannot be refreshed.
9
+ * @returns Promise<AuthSession>
10
+ */
2
11
  export declare const fetchAuthSession: (options?: FetchAuthSessionOptions) => Promise<AuthSession>;
@@ -3,6 +3,15 @@ import { fetchAuthSession as fetchAuthSession$1 } from './internal/fetchAuthSess
3
3
 
4
4
  // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
5
5
  // SPDX-License-Identifier: Apache-2.0
6
+ /**
7
+ * Fetch the auth session including the tokens and credentials if they are available. By default it
8
+ * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh
9
+ * with `{ forceRefresh: true }` input.
10
+ *
11
+ * @param options - Options configuring the fetch behavior.
12
+ * @throws {@link AuthError} - Throws error when session information cannot be refreshed.
13
+ * @returns Promise<AuthSession>
14
+ */
6
15
  const fetchAuthSession = (options) => {
7
16
  return fetchAuthSession$1(Amplify, options);
8
17
  };
@@ -1 +1 @@
1
- {"version":3,"file":"fetchAuthSession.mjs","sources":["../../../../src/singleton/apis/fetchAuthSession.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '../Amplify';\nimport { fetchAuthSession as fetchAuthSessionInternal } from './internal/fetchAuthSession';\nexport const fetchAuthSession = (options) => {\n return fetchAuthSessionInternal(Amplify, options);\n};\n"],"names":["fetchAuthSessionInternal"],"mappings":";;;AAAA;AACA;AAGY,MAAC,gBAAgB,GAAG,CAAC,OAAO,KAAK;AAC7C,IAAI,OAAOA,kBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACtD;;;;"}
1
+ {"version":3,"file":"fetchAuthSession.mjs","sources":["../../../../src/singleton/apis/fetchAuthSession.ts"],"sourcesContent":["// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.\n// SPDX-License-Identifier: Apache-2.0\nimport { Amplify } from '../Amplify';\nimport { fetchAuthSession as fetchAuthSessionInternal } from './internal/fetchAuthSession';\n/**\n * Fetch the auth session including the tokens and credentials if they are available. By default it\n * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh\n * with `{ forceRefresh: true }` input.\n *\n * @param options - Options configuring the fetch behavior.\n * @throws {@link AuthError} - Throws error when session information cannot be refreshed.\n * @returns Promise<AuthSession>\n */\nexport const fetchAuthSession = (options) => {\n return fetchAuthSessionInternal(Amplify, options);\n};\n"],"names":["fetchAuthSessionInternal"],"mappings":";;;AAAA;AACA;AAGA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACY,MAAC,gBAAgB,GAAG,CAAC,OAAO,KAAK;AAC7C,IAAI,OAAOA,kBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;AACtD;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/core",
3
- "version": "6.3.10",
3
+ "version": "6.3.11-unstable.6aaf4a0.0+6aaf4a0",
4
4
  "description": "Core category of aws-amplify",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "module": "./dist/esm/index.mjs",
@@ -60,7 +60,7 @@
60
60
  "uuid": "^9.0.0"
61
61
  },
62
62
  "devDependencies": {
63
- "@aws-amplify/react-native": "1.1.4",
63
+ "@aws-amplify/react-native": "1.1.5-unstable.6aaf4a0.0+6aaf4a0",
64
64
  "@types/js-cookie": "3.0.2",
65
65
  "genversion": "^2.2.0",
66
66
  "typescript": "5.0.2"
@@ -192,5 +192,5 @@
192
192
  ]
193
193
  }
194
194
  },
195
- "gitHead": "5b2fac4fbe7886572fa8dbadbf3fd6045b10e624"
195
+ "gitHead": "6aaf4a0843ed20937a4b3d9c8fae7dc11d6d39f4"
196
196
  }
@@ -1,2 +1,2 @@
1
1
  // generated by genversion
2
- export const version = '6.5.1';
2
+ export const version = '6.5.2-unstable.6aaf4a0.0+6aaf4a0';
@@ -66,6 +66,12 @@ export function assertIdentityPoolIdConfig(
66
66
  );
67
67
  }
68
68
 
69
+ /**
70
+ * Decodes payload of JWT token
71
+ *
72
+ * @param {String} token A string representing a token to be decoded
73
+ * @throws {@link Error} - Throws error when token is invalid or payload malformed.
74
+ */
69
75
  export function decodeJWT(token: string): JWT {
70
76
  const tokenParts = token.split('.');
71
77
 
@@ -6,6 +6,15 @@ import { AuthSession, FetchAuthSessionOptions } from '../Auth/types';
6
6
 
7
7
  import { fetchAuthSession as fetchAuthSessionInternal } from './internal/fetchAuthSession';
8
8
 
9
+ /**
10
+ * Fetch the auth session including the tokens and credentials if they are available. By default it
11
+ * does not refresh the auth tokens or credentials if they are loaded in storage already. You can force a refresh
12
+ * with `{ forceRefresh: true }` input.
13
+ *
14
+ * @param options - Options configuring the fetch behavior.
15
+ * @throws {@link AuthError} - Throws error when session information cannot be refreshed.
16
+ * @returns Promise<AuthSession>
17
+ */
9
18
  export const fetchAuthSession = (
10
19
  options?: FetchAuthSessionOptions,
11
20
  ): Promise<AuthSession> => {