@aws-amplify/core 6.0.1-console-preview.4b7d177.0 → 6.0.1-console-preview.deaebd5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/Hub/types/AuthTypes.d.ts +14 -0
- package/lib/I18n/I18n.d.ts +1 -1
- package/lib/I18n/index.d.ts +1 -1
- package/lib/Platform/version.d.ts +1 -1
- package/lib/Platform/version.js +1 -1
- package/lib/libraryUtils.d.ts +1 -1
- package/lib/singleton/Auth/utils/index.js +10 -10
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/lib-esm/Hub/types/AuthTypes.d.ts +14 -0
- package/lib-esm/I18n/I18n.d.ts +1 -1
- package/lib-esm/I18n/index.d.ts +1 -1
- package/lib-esm/Platform/version.d.ts +1 -1
- package/lib-esm/Platform/version.js +1 -1
- package/lib-esm/libraryUtils.d.ts +1 -1
- package/lib-esm/singleton/Auth/utils/index.js +10 -10
- package/lib-esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/src/Hub/types/AuthTypes.ts +10 -1
- package/src/I18n/I18n.ts +1 -1
- package/src/I18n/index.ts +1 -1
- package/src/Platform/version.ts +1 -1
- package/src/libraryUtils.ts +1 -1
- package/src/singleton/Auth/utils/index.ts +14 -11
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
type AuthUser = {
|
|
2
|
+
username: string;
|
|
3
|
+
userId: string;
|
|
4
|
+
};
|
|
1
5
|
export type AuthHubEventData =
|
|
2
6
|
/** Dispatched when a user signs in with an oauth provider such as Google.*/
|
|
3
7
|
{
|
|
@@ -19,4 +23,14 @@ export type AuthHubEventData =
|
|
|
19
23
|
| {
|
|
20
24
|
event: 'customOAuthState';
|
|
21
25
|
data: string;
|
|
26
|
+
}
|
|
27
|
+
/** Dispatched when the user is signed-in.*/
|
|
28
|
+
| {
|
|
29
|
+
event: 'signedIn';
|
|
30
|
+
data: AuthUser;
|
|
31
|
+
}
|
|
32
|
+
/** Dispatched after the user calls the `signOut` API successfully.*/
|
|
33
|
+
| {
|
|
34
|
+
event: 'signedOut';
|
|
22
35
|
};
|
|
36
|
+
export {};
|
package/lib/I18n/I18n.d.ts
CHANGED
|
@@ -59,5 +59,5 @@ export declare class I18n {
|
|
|
59
59
|
* @param {Object} vocabularies - Object that has language as key,
|
|
60
60
|
* vocabularies of each language as value
|
|
61
61
|
*/
|
|
62
|
-
putVocabularies(vocabularies: Record<string,
|
|
62
|
+
putVocabularies(vocabularies: Record<string, Record<string, string>>): void;
|
|
63
63
|
}
|
package/lib/I18n/index.d.ts
CHANGED
|
@@ -45,6 +45,6 @@ export declare class I18n {
|
|
|
45
45
|
* @param {Object} vocabularies - Object that has language as key,
|
|
46
46
|
* vocabularies of each language as value
|
|
47
47
|
*/
|
|
48
|
-
static putVocabularies(vocabularies: Record<string, string
|
|
48
|
+
static putVocabularies(vocabularies: Record<string, Record<string, string>>): void;
|
|
49
49
|
static checkConfig(): boolean;
|
|
50
50
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "6.0.1-console-preview.
|
|
1
|
+
export declare const version = "6.0.1-console-preview.deaebd5.0+deaebd5";
|
package/lib/Platform/version.js
CHANGED
package/lib/libraryUtils.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ export { LegacyConfig } from './singleton/types';
|
|
|
4
4
|
export { JWT, StrictUnion, CognitoIdentityPoolConfig, JwtPayload, } from './singleton/Auth/types';
|
|
5
5
|
export { decodeJWT, assertTokenProviderConfig, assertIdentityPoolIdConfig, assertOAuthConfig, } from './singleton/Auth/utils';
|
|
6
6
|
export { isTokenExpired } from './singleton/Auth';
|
|
7
|
-
export { GraphQLAuthModeKeys } from './singleton/API/types';
|
|
7
|
+
export { GraphQLAuthMode, GraphQLAuthModeKeys } from './singleton/API/types';
|
|
8
8
|
export { Signer } from './Signer';
|
|
9
9
|
export { ConsoleLogger, ConsoleLogger as Logger } from './Logger';
|
|
10
10
|
export { ClientDevice } from './ClientDevice';
|
|
@@ -36,15 +36,19 @@ function assertUserPoolAndIdentityPoolConfig(authConfig) {
|
|
|
36
36
|
return (0, errorHelpers_1.assert)(validConfig, errorHelpers_1.AuthConfigurationErrorCode.AuthUserPoolAndIdentityPoolException);
|
|
37
37
|
}
|
|
38
38
|
function decodeJWT(token) {
|
|
39
|
-
var
|
|
40
|
-
if (
|
|
39
|
+
var tokenParts = token.split('.');
|
|
40
|
+
if (tokenParts.length !== 3) {
|
|
41
41
|
throw new Error('Invalid token');
|
|
42
42
|
}
|
|
43
43
|
try {
|
|
44
|
-
var
|
|
45
|
-
var
|
|
46
|
-
var
|
|
47
|
-
|
|
44
|
+
var base64WithUrlSafe = tokenParts[1];
|
|
45
|
+
var base64_1 = base64WithUrlSafe.replace(/-/g, '+').replace(/_/g, '/');
|
|
46
|
+
var jsonStr = decodeURIComponent(convert_1.base64Decoder
|
|
47
|
+
.convert(base64_1)
|
|
48
|
+
.split('')
|
|
49
|
+
.map(function (char) { return "%".concat("00".concat(char.charCodeAt(0).toString(16)).slice(-2)); })
|
|
50
|
+
.join(''));
|
|
51
|
+
var payload = JSON.parse(jsonStr);
|
|
48
52
|
return {
|
|
49
53
|
toString: function () { return token; },
|
|
50
54
|
payload: payload,
|
|
@@ -55,7 +59,3 @@ function decodeJWT(token) {
|
|
|
55
59
|
}
|
|
56
60
|
}
|
|
57
61
|
exports.decodeJWT = decodeJWT;
|
|
58
|
-
function base64ToBytes(base64) {
|
|
59
|
-
var binString = convert_1.base64Decoder.convert(base64);
|
|
60
|
-
return Uint8Array.from(binString, function (m) { return m.codePointAt(0) || 0; });
|
|
61
|
-
}
|