@sudoplatform/sudo-user 9.1.1 → 10.1.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/docs/assets/highlight.css +1 -1
- package/docs/assets/main.js +2 -2
- package/docs/assets/search.js +1 -1
- package/docs/assets/style.css +32 -2
- package/docs/classes/AlreadyRegisteredError.html +3 -3
- package/docs/classes/DefaultSudoUserClient.html +30 -28
- package/docs/classes/IdentityServiceConfigNotFoundError.html +3 -3
- package/docs/classes/LocalAuthenticationProvider.html +3 -3
- package/docs/classes/TESTAuthenticationProvider.html +3 -3
- package/docs/index.html +1 -1
- package/docs/interfaces/AuthenticationProvider.html +2 -2
- package/docs/interfaces/AuthenticationTokens.html +2 -2
- package/docs/interfaces/SudoUserClient.html +27 -25
- package/docs/modules.html +1 -1
- package/lib/user/auth.js +2 -2
- package/lib/user/identity-provider.d.ts +7 -0
- package/lib/user/identity-provider.js +22 -1
- package/lib/user/user-client-interface.d.ts +4 -0
- package/lib/user/user-client.d.ts +1 -0
- package/lib/user/user-client.js +27 -9
- package/package.json +40 -36
package/lib/user/user-client.js
CHANGED
|
@@ -39,7 +39,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
39
39
|
|
|
40
40
|
class DefaultSudoUserClient {
|
|
41
41
|
constructor(options) {
|
|
42
|
-
var
|
|
42
|
+
var _this$config;
|
|
43
43
|
|
|
44
44
|
_defineProperty(this, "config", void 0);
|
|
45
45
|
|
|
@@ -59,9 +59,9 @@ class DefaultSudoUserClient {
|
|
|
59
59
|
|
|
60
60
|
_defineProperty(this, "launchUriFn", void 0);
|
|
61
61
|
|
|
62
|
-
this.logger = (
|
|
63
|
-
this.config = (
|
|
64
|
-
this.authenticationStore = (
|
|
62
|
+
this.logger = (options === null || options === void 0 ? void 0 : options.logger) ?? new _sudoCommon.DefaultLogger('SudoUser', 'warn');
|
|
63
|
+
this.config = (options === null || options === void 0 ? void 0 : options.config) ?? (0, _sdkConfig.getIdentityServiceConfig)();
|
|
64
|
+
this.authenticationStore = (options === null || options === void 0 ? void 0 : options.authenticationStore) ?? new _authStore.AuthenticationStore();
|
|
65
65
|
|
|
66
66
|
if (options !== null && options !== void 0 && options.sudoKeyManager) {
|
|
67
67
|
this.sudoUserKeyManager = options === null || options === void 0 ? void 0 : options.sudoKeyManager;
|
|
@@ -72,16 +72,14 @@ class DefaultSudoUserClient {
|
|
|
72
72
|
|
|
73
73
|
this.keyManager = new _keyManager.KeyManager(this.sudoUserKeyManager);
|
|
74
74
|
this.launchUriFn = options === null || options === void 0 ? void 0 : options.launchUriFn;
|
|
75
|
-
this.identityProvider = (
|
|
75
|
+
this.identityProvider = (options === null || options === void 0 ? void 0 : options.identityProvider) ?? new _identityProvider.CognitoUserPoolIdentityProvider(this.keyManager, this.config, this.logger);
|
|
76
76
|
const federatedSignInConfig = (_this$config = this.config) === null || _this$config === void 0 ? void 0 : _this$config.federatedSignIn;
|
|
77
77
|
|
|
78
78
|
if (federatedSignInConfig) {
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
this.authUI = (_options$authUI = options === null || options === void 0 ? void 0 : options.authUI) !== null && _options$authUI !== void 0 ? _options$authUI : new _auth.CognitoAuthUI(this.authenticationStore, federatedSignInConfig, this.keyManager, this.logger, this.launchUriFn);
|
|
79
|
+
this.authUI = (options === null || options === void 0 ? void 0 : options.authUI) ?? new _auth.CognitoAuthUI(this.authenticationStore, federatedSignInConfig, this.keyManager, this.logger, this.launchUriFn);
|
|
82
80
|
}
|
|
83
81
|
|
|
84
|
-
this.apiClient = (
|
|
82
|
+
this.apiClient = (options === null || options === void 0 ? void 0 : options.apiClient) ?? new _apiClient.ApiClient(this.config.identityService.region, this.config.identityService.apiUrl, this, this.logger);
|
|
85
83
|
}
|
|
86
84
|
|
|
87
85
|
get sudoKeyManager() {
|
|
@@ -243,6 +241,26 @@ class DefaultSudoUserClient {
|
|
|
243
241
|
}
|
|
244
242
|
}
|
|
245
243
|
|
|
244
|
+
async signOut() {
|
|
245
|
+
let refreshToken;
|
|
246
|
+
|
|
247
|
+
try {
|
|
248
|
+
refreshToken = await this.getRefreshToken();
|
|
249
|
+
} catch (err) {
|
|
250
|
+
if (err instanceof _sudoCommon.KeyNotFoundError) {
|
|
251
|
+
throw new _sudoCommon.NotSignedInError();
|
|
252
|
+
} else {
|
|
253
|
+
throw err;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
if (refreshToken) {
|
|
258
|
+
await this.identityProvider.signOut(refreshToken);
|
|
259
|
+
} else {
|
|
260
|
+
throw new _sudoCommon.NotSignedInError();
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
|
|
246
264
|
async globalSignOut() {
|
|
247
265
|
if (!(await this.isSignedIn())) {
|
|
248
266
|
throw new _sudoCommon.NotSignedInError();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudoplatform/sudo-user",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "10.1.0",
|
|
4
4
|
"author": "Anonyome Labs, Inc.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,34 +32,37 @@
|
|
|
32
32
|
"./lib/runtimes/node/node-crypto.js": "./lib/runtimes/browser/browser-crypto.js"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@aws-sdk/client-cognito-identity-provider": "^3.
|
|
36
|
-
"@graphql-typed-document-node/core": "^3.1.
|
|
37
|
-
"@sudoplatform/sudo-web-crypto-provider": "^
|
|
35
|
+
"@aws-sdk/client-cognito-identity-provider": "^3.80.0",
|
|
36
|
+
"@graphql-typed-document-node/core": "^3.1.1",
|
|
37
|
+
"@sudoplatform/sudo-web-crypto-provider": "^3.1.0",
|
|
38
38
|
"amazon-cognito-auth-js": "^1.3.3",
|
|
39
39
|
"apollo-cache-inmemory": "^1.6.6",
|
|
40
|
-
"asn1js": "^2.
|
|
41
|
-
"aws-appsync": "4.
|
|
42
|
-
"fp-ts": "^2.
|
|
40
|
+
"asn1js": "^2.4.0",
|
|
41
|
+
"aws-appsync": "4.1.5",
|
|
42
|
+
"fp-ts": "^2.12.1",
|
|
43
43
|
"graphql": "^15.6.1",
|
|
44
|
-
"io-ts": "^2.2.
|
|
45
|
-
"jsonwebtoken": "^8.5.
|
|
46
|
-
"lodash": "^4.17.
|
|
47
|
-
"monocle-ts": "^2.3.
|
|
48
|
-
"newtype-ts": "^0.3.
|
|
49
|
-
"tslib": "^2.
|
|
50
|
-
"uuid": "^8.3.
|
|
44
|
+
"io-ts": "^2.2.16",
|
|
45
|
+
"jsonwebtoken": "^8.5.1",
|
|
46
|
+
"lodash": "^4.17.21",
|
|
47
|
+
"monocle-ts": "^2.3.13",
|
|
48
|
+
"newtype-ts": "^0.3.5",
|
|
49
|
+
"tslib": "^2.4.0",
|
|
50
|
+
"uuid": "^8.3.2"
|
|
51
51
|
},
|
|
52
52
|
"resolutions": {
|
|
53
53
|
"apollo-cache-inmemory": "^1.6.6",
|
|
54
|
-
"@graphql-codegen/**/ansi-regex": "^5.0.1"
|
|
54
|
+
"@graphql-codegen/**/ansi-regex": "^5.0.1",
|
|
55
|
+
"cross-fetch": "^3.1.5",
|
|
56
|
+
"node-fetch": "^2.6.7",
|
|
57
|
+
"minimist": "^1.2.6"
|
|
55
58
|
},
|
|
56
59
|
"devDependencies": {
|
|
57
|
-
"@babel/cli": "^7.
|
|
58
|
-
"@babel/core": "^7.
|
|
59
|
-
"@babel/plugin-proposal-class-properties": "^7.
|
|
60
|
-
"@babel/plugin-proposal-private-methods": "^7.
|
|
61
|
-
"@babel/preset-env": "^7.
|
|
62
|
-
"@babel/preset-typescript": "^7.
|
|
60
|
+
"@babel/cli": "^7.16.0",
|
|
61
|
+
"@babel/core": "^7.16.0",
|
|
62
|
+
"@babel/plugin-proposal-class-properties": "^7.16.0",
|
|
63
|
+
"@babel/plugin-proposal-private-methods": "^7.16.0",
|
|
64
|
+
"@babel/preset-env": "^7.16.0",
|
|
65
|
+
"@babel/preset-typescript": "^7.16.0",
|
|
63
66
|
"@graphql-codegen/add": "^3.1.0",
|
|
64
67
|
"@graphql-codegen/cli": "^2.2.1",
|
|
65
68
|
"@graphql-codegen/plugin-helpers": "^2.2.0",
|
|
@@ -67,33 +70,34 @@
|
|
|
67
70
|
"@graphql-codegen/typescript": "^2.2.4",
|
|
68
71
|
"@graphql-codegen/typescript-operations": "^2.1.8",
|
|
69
72
|
"@graphql-typed-document-node/apollo-client-2": "^1.0.0",
|
|
70
|
-
"@sudoplatform/sudo-common": "^
|
|
73
|
+
"@sudoplatform/sudo-common": "^6.2.0",
|
|
71
74
|
"@types/amazon-cognito-auth-js": "^1.3.0",
|
|
72
|
-
"@types/
|
|
73
|
-
"@types/
|
|
74
|
-
"@types/
|
|
75
|
+
"@types/firefox-webext-browser": "^82.0.1",
|
|
76
|
+
"@types/jest": "^27.4.1",
|
|
77
|
+
"@types/jsonwebtoken": "^8.5.8",
|
|
78
|
+
"@types/lodash": "^4.14.182",
|
|
75
79
|
"@types/node": "^14.17.27",
|
|
76
|
-
"@types/uuid": "^8.3.
|
|
77
|
-
"@typescript-eslint/eslint-plugin": "^5.
|
|
78
|
-
"@typescript-eslint/parser": "^5.
|
|
80
|
+
"@types/uuid": "^8.3.4",
|
|
81
|
+
"@typescript-eslint/eslint-plugin": "^5.21.0",
|
|
82
|
+
"@typescript-eslint/parser": "^5.21.0",
|
|
79
83
|
"apollo-client": "^2.6.10",
|
|
80
|
-
"eslint": "^8.0
|
|
81
|
-
"eslint-config-prettier": "^8.
|
|
82
|
-
"eslint-plugin-import": "^2.
|
|
84
|
+
"eslint": "^8.14.0",
|
|
85
|
+
"eslint-config-prettier": "^8.5.0",
|
|
86
|
+
"eslint-plugin-import": "^2.26.0",
|
|
83
87
|
"eslint-plugin-prettier": "^4.0.0",
|
|
84
88
|
"isomorphic-fetch": "^3.0.0",
|
|
85
89
|
"isomorphic-webcrypto": "^2.3.8",
|
|
86
90
|
"jest": "27.3.1",
|
|
87
|
-
"prettier": "^2.
|
|
91
|
+
"prettier": "^2.6.2",
|
|
88
92
|
"react": "16.13.1",
|
|
89
|
-
"subscriptions-transport-ws": "^0.
|
|
93
|
+
"subscriptions-transport-ws": "^0.11.0",
|
|
90
94
|
"ts-mockito": "^2.6.1",
|
|
91
|
-
"typedoc": "^0.22.
|
|
92
|
-
"typescript": "^4.
|
|
95
|
+
"typedoc": "^0.22.15",
|
|
96
|
+
"typescript": "^4.6.4",
|
|
93
97
|
"websocket": "^1.0.34"
|
|
94
98
|
},
|
|
95
99
|
"peerDependencies": {
|
|
96
|
-
"@sudoplatform/sudo-common": "^
|
|
100
|
+
"@sudoplatform/sudo-common": "^6.0.0",
|
|
97
101
|
"io-ts": "^2.2.11"
|
|
98
102
|
}
|
|
99
103
|
}
|