@sudoplatform/sudo-user 11.0.0 → 12.0.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 → cjs/src}/client/apiClient.d.ts +0 -0
- package/cjs/src/client/apiClient.js +149 -0
- package/cjs/src/client/apiClient.js.map +1 -0
- package/{lib → cjs/src}/core/api-key-names.d.ts +0 -0
- package/cjs/src/core/api-key-names.js +12 -0
- package/cjs/src/core/api-key-names.js.map +1 -0
- package/{lib → cjs/src}/core/auth-store.d.ts +0 -0
- package/cjs/src/core/auth-store.js +92 -0
- package/cjs/src/core/auth-store.js.map +1 -0
- package/{lib → cjs/src}/core/crypto.d.ts +0 -0
- package/cjs/src/core/crypto.js +3 -0
- package/cjs/src/core/crypto.js.map +1 -0
- package/{lib → cjs/src}/core/key-manager.d.ts +0 -0
- package/cjs/src/core/key-manager.js +113 -0
- package/cjs/src/core/key-manager.js.map +1 -0
- package/cjs/src/core/protected-store.d.ts +5 -0
- package/cjs/src/core/protected-store.js +3 -0
- package/cjs/src/core/protected-store.js.map +1 -0
- package/{lib → cjs/src}/core/publisher.d.ts +0 -0
- package/cjs/src/core/publisher.js +3 -0
- package/cjs/src/core/publisher.js.map +1 -0
- package/{lib → cjs/src}/core/sdk-config.d.ts +0 -0
- package/cjs/src/core/sdk-config.js +61 -0
- package/cjs/src/core/sdk-config.js.map +1 -0
- package/{lib → cjs/src}/core/subscriber.d.ts +0 -0
- package/cjs/src/core/subscriber.js +3 -0
- package/cjs/src/core/subscriber.js.map +1 -0
- package/{lib → cjs/src}/gen/graphql-types.d.ts +0 -0
- package/cjs/src/gen/graphql-types.js +105 -0
- package/cjs/src/gen/graphql-types.js.map +1 -0
- package/{lib → cjs/src}/index.d.ts +0 -0
- package/cjs/src/index.js +13 -0
- package/cjs/src/index.js.map +1 -0
- package/{lib/runtimes/node/node-crypto.d.ts → cjs/src/runtimes/browser/browser-crypto.d.ts} +0 -0
- package/cjs/src/runtimes/browser/browser-crypto.js +10 -0
- package/cjs/src/runtimes/browser/browser-crypto.js.map +1 -0
- package/cjs/src/runtimes/node/node-crypto.d.ts +2 -0
- package/cjs/src/runtimes/node/node-crypto.js +9 -0
- package/cjs/src/runtimes/node/node-crypto.js.map +1 -0
- package/{lib → cjs/src}/sdk.d.ts +0 -0
- package/cjs/src/sdk.js +9 -0
- package/cjs/src/sdk.js.map +1 -0
- package/{lib → cjs/src}/user/auth-provider.d.ts +0 -0
- package/cjs/src/user/auth-provider.js +116 -0
- package/cjs/src/user/auth-provider.js.map +1 -0
- package/{lib → cjs/src}/user/auth.d.ts +0 -0
- package/cjs/src/user/auth.js +136 -0
- package/cjs/src/user/auth.js.map +1 -0
- package/{lib → cjs/src}/user/error.d.ts +0 -0
- package/{lib → cjs/src}/user/error.js +16 -29
- package/cjs/src/user/error.js.map +1 -0
- package/{lib → cjs/src}/user/identity-provider.d.ts +0 -0
- package/cjs/src/user/identity-provider.js +245 -0
- package/cjs/src/user/identity-provider.js.map +1 -0
- package/{lib → cjs/src}/user/user-client-interface.d.ts +0 -0
- package/cjs/src/user/user-client-interface.js +3 -0
- package/cjs/src/user/user-client-interface.js.map +1 -0
- package/{lib → cjs/src}/user/user-client.d.ts +0 -0
- package/cjs/src/user/user-client.js +440 -0
- package/cjs/src/user/user-client.js.map +1 -0
- package/{lib → cjs/src}/user/user-key-names.d.ts +0 -0
- package/cjs/src/user/user-key-names.js +10 -0
- package/cjs/src/user/user-key-names.js.map +1 -0
- package/{lib → cjs/src}/utils/resolvable-promise.d.ts +0 -0
- package/cjs/src/utils/resolvable-promise.js +20 -0
- package/cjs/src/utils/resolvable-promise.js.map +1 -0
- package/cjs/test/integration/user-client-int.spec.d.ts +1 -0
- package/cjs/test/integration/user-client-int.spec.js +206 -0
- package/cjs/test/integration/user-client-int.spec.js.map +1 -0
- package/cjs/test/unit/core/sdk-config.spec.d.ts +1 -0
- package/cjs/test/unit/core/sdk-config.spec.js +51 -0
- package/cjs/test/unit/core/sdk-config.spec.js.map +1 -0
- package/cjs/test/unit/key-manager.spec.d.ts +1 -0
- package/cjs/test/unit/key-manager.spec.js +23 -0
- package/cjs/test/unit/key-manager.spec.js.map +1 -0
- package/cjs/test/unit/user-client.spec.d.ts +1 -0
- package/cjs/test/unit/user-client.spec.js +323 -0
- package/cjs/test/unit/user-client.spec.js.map +1 -0
- package/docs/classes/AlreadyRegisteredError.html +4 -4
- package/docs/classes/IdentityServiceConfigNotFoundError.html +4 -4
- package/lib/src/client/apiClient.d.ts +25 -0
- package/lib/src/client/apiClient.js +145 -0
- package/lib/src/client/apiClient.js.map +1 -0
- package/lib/src/core/api-key-names.d.ts +8 -0
- package/lib/src/core/api-key-names.js +9 -0
- package/lib/src/core/api-key-names.js.map +1 -0
- package/lib/src/core/auth-store.d.ts +51 -0
- package/lib/src/core/auth-store.js +88 -0
- package/lib/src/core/auth-store.js.map +1 -0
- package/lib/src/core/crypto.d.ts +3 -0
- package/lib/src/core/crypto.js +2 -0
- package/lib/src/core/crypto.js.map +1 -0
- package/lib/src/core/key-manager.d.ts +31 -0
- package/lib/src/core/key-manager.js +108 -0
- package/lib/src/core/key-manager.js.map +1 -0
- package/lib/src/core/protected-store.d.ts +5 -0
- package/lib/src/core/protected-store.js +2 -0
- package/lib/src/core/protected-store.js.map +1 -0
- package/lib/src/core/publisher.d.ts +6 -0
- package/lib/src/core/publisher.js +2 -0
- package/lib/src/core/publisher.js.map +1 -0
- package/lib/src/core/sdk-config.d.ts +52 -0
- package/lib/src/core/sdk-config.js +56 -0
- package/lib/src/core/sdk-config.js.map +1 -0
- package/lib/src/core/subscriber.d.ts +3 -0
- package/lib/src/core/subscriber.js +2 -0
- package/lib/src/core/subscriber.js.map +1 -0
- package/lib/src/gen/graphql-types.d.ts +101 -0
- package/lib/src/gen/graphql-types.js +102 -0
- package/lib/src/gen/graphql-types.js.map +1 -0
- package/lib/src/index.d.ts +4 -0
- package/lib/src/index.js +6 -0
- package/lib/src/index.js.map +1 -0
- package/lib/src/runtimes/browser/browser-crypto.d.ts +2 -0
- package/lib/src/runtimes/browser/browser-crypto.js +7 -0
- package/lib/src/runtimes/browser/browser-crypto.js.map +1 -0
- package/lib/src/runtimes/node/node-crypto.d.ts +2 -0
- package/lib/src/runtimes/node/node-crypto.js +6 -0
- package/lib/src/runtimes/node/node-crypto.js.map +1 -0
- package/lib/src/sdk.d.ts +1 -0
- package/lib/src/sdk.js +6 -0
- package/lib/src/sdk.js.map +1 -0
- package/lib/src/user/auth-provider.d.ts +97 -0
- package/lib/src/user/auth-provider.js +108 -0
- package/lib/src/user/auth-provider.js.map +1 -0
- package/lib/src/user/auth.d.ts +64 -0
- package/lib/src/user/auth.js +131 -0
- package/lib/src/user/auth.js.map +1 -0
- package/lib/src/user/error.d.ts +18 -0
- package/lib/src/user/error.js +28 -0
- package/lib/src/user/error.js.map +1 -0
- package/lib/src/user/identity-provider.d.ts +73 -0
- package/lib/src/user/identity-provider.js +241 -0
- package/lib/src/user/identity-provider.js.map +1 -0
- package/lib/src/user/user-client-interface.d.ts +168 -0
- package/lib/src/user/user-client-interface.js +2 -0
- package/lib/src/user/user-client-interface.js.map +1 -0
- package/lib/src/user/user-client.d.ts +82 -0
- package/lib/src/user/user-client.js +435 -0
- package/lib/src/user/user-client.js.map +1 -0
- package/lib/src/user/user-key-names.d.ts +6 -0
- package/lib/src/user/user-key-names.js +7 -0
- package/lib/src/user/user-key-names.js.map +1 -0
- package/lib/src/utils/resolvable-promise.d.ts +9 -0
- package/lib/src/utils/resolvable-promise.js +16 -0
- package/lib/src/utils/resolvable-promise.js.map +1 -0
- package/lib/test/integration/user-client-int.spec.d.ts +1 -0
- package/lib/test/integration/user-client-int.spec.js +203 -0
- package/lib/test/integration/user-client-int.spec.js.map +1 -0
- package/lib/test/unit/core/sdk-config.spec.d.ts +1 -0
- package/lib/test/unit/core/sdk-config.spec.js +49 -0
- package/lib/test/unit/core/sdk-config.spec.js.map +1 -0
- package/lib/test/unit/key-manager.spec.d.ts +1 -0
- package/lib/test/unit/key-manager.spec.js +21 -0
- package/lib/test/unit/key-manager.spec.js.map +1 -0
- package/lib/test/unit/user-client.spec.d.ts +1 -0
- package/lib/test/unit/user-client.spec.js +320 -0
- package/lib/test/unit/user-client.spec.js.map +1 -0
- package/package.json +23 -22
- package/lib/client/apiClient.js +0 -190
- package/lib/core/api-key-names.js +0 -15
- package/lib/core/auth-store.js +0 -144
- package/lib/core/crypto.js +0 -5
- package/lib/core/key-manager.js +0 -158
- package/lib/core/protected-store.js +0 -5
- package/lib/core/publisher.js +0 -5
- package/lib/core/sdk-config.js +0 -56
- package/lib/core/subscriber.js +0 -5
- package/lib/gen/graphql-types.js +0 -141
- package/lib/index.js +0 -67
- package/lib/runtimes/browser/browser-crypto.js +0 -15
- package/lib/runtimes/node/node-crypto.js +0 -12
- package/lib/sdk.js +0 -18
- package/lib/user/auth-provider.js +0 -158
- package/lib/user/auth.js +0 -183
- package/lib/user/identity-provider.js +0 -270
- package/lib/user/user-client-interface.js +0 -5
- package/lib/user/user-client.js +0 -522
- package/lib/user/user-key-names.js +0 -13
- package/lib/utils/resolvable-promise.js +0 -22
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"publisher.js","sourceRoot":"","sources":["../../../src/core/publisher.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import * as t from 'io-ts';
|
|
2
|
+
export declare const IdentityServiceConfigCodec: t.IntersectionC<[t.TypeC<{
|
|
3
|
+
region: t.StringC;
|
|
4
|
+
poolId: t.StringC;
|
|
5
|
+
clientId: t.StringC;
|
|
6
|
+
identityPoolId: t.StringC;
|
|
7
|
+
apiUrl: t.StringC;
|
|
8
|
+
apiKey: t.StringC;
|
|
9
|
+
bucket: t.StringC;
|
|
10
|
+
transientBucket: t.StringC;
|
|
11
|
+
registrationMethods: t.ArrayC<t.StringC>;
|
|
12
|
+
}>, t.PartialC<{
|
|
13
|
+
refreshTokenLifetime: t.NumberC;
|
|
14
|
+
}>]>;
|
|
15
|
+
export declare const FederatedSignInConfigCodec: t.IntersectionC<[t.TypeC<{
|
|
16
|
+
appClientId: t.StringC;
|
|
17
|
+
signInRedirectUri: t.StringC;
|
|
18
|
+
signOutRedirectUri: t.StringC;
|
|
19
|
+
webDomain: t.StringC;
|
|
20
|
+
}>, t.PartialC<{
|
|
21
|
+
identityProvider: t.StringC;
|
|
22
|
+
refreshTokenLifetime: t.NumberC;
|
|
23
|
+
}>]>;
|
|
24
|
+
export declare const Config: t.IntersectionC<[t.TypeC<{
|
|
25
|
+
identityService: t.IntersectionC<[t.TypeC<{
|
|
26
|
+
region: t.StringC;
|
|
27
|
+
poolId: t.StringC;
|
|
28
|
+
clientId: t.StringC;
|
|
29
|
+
identityPoolId: t.StringC;
|
|
30
|
+
apiUrl: t.StringC;
|
|
31
|
+
apiKey: t.StringC;
|
|
32
|
+
bucket: t.StringC;
|
|
33
|
+
transientBucket: t.StringC;
|
|
34
|
+
registrationMethods: t.ArrayC<t.StringC>;
|
|
35
|
+
}>, t.PartialC<{
|
|
36
|
+
refreshTokenLifetime: t.NumberC;
|
|
37
|
+
}>]>;
|
|
38
|
+
}>, t.PartialC<{
|
|
39
|
+
federatedSignIn: t.IntersectionC<[t.TypeC<{
|
|
40
|
+
appClientId: t.StringC;
|
|
41
|
+
signInRedirectUri: t.StringC;
|
|
42
|
+
signOutRedirectUri: t.StringC;
|
|
43
|
+
webDomain: t.StringC;
|
|
44
|
+
}>, t.PartialC<{
|
|
45
|
+
identityProvider: t.StringC;
|
|
46
|
+
refreshTokenLifetime: t.NumberC;
|
|
47
|
+
}>]>;
|
|
48
|
+
}>]>;
|
|
49
|
+
export declare type Config = t.TypeOf<typeof Config>;
|
|
50
|
+
export declare type IdentityServiceConfig = t.TypeOf<typeof IdentityServiceConfigCodec>;
|
|
51
|
+
export declare type FederatedSignInConfig = t.TypeOf<typeof FederatedSignInConfigCodec>;
|
|
52
|
+
export declare function getIdentityServiceConfig(): Config;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { DefaultConfigurationManager } from '@sudoplatform/sudo-common';
|
|
2
|
+
import * as t from 'io-ts';
|
|
3
|
+
import { IdentityServiceConfigNotFoundError } from '../user/error';
|
|
4
|
+
// eslint-disable-next-line tree-shaking/no-side-effects-in-initialization
|
|
5
|
+
export const IdentityServiceConfigCodec = t.intersection([
|
|
6
|
+
// eslint-disable-next-line tree-shaking/no-side-effects-in-initialization
|
|
7
|
+
t.type({
|
|
8
|
+
region: t.string,
|
|
9
|
+
poolId: t.string,
|
|
10
|
+
clientId: t.string,
|
|
11
|
+
identityPoolId: t.string,
|
|
12
|
+
apiUrl: t.string,
|
|
13
|
+
apiKey: t.string,
|
|
14
|
+
bucket: t.string,
|
|
15
|
+
transientBucket: t.string,
|
|
16
|
+
// eslint-disable-next-line tree-shaking/no-side-effects-in-initialization
|
|
17
|
+
registrationMethods: t.array(t.string),
|
|
18
|
+
}),
|
|
19
|
+
// eslint-disable-next-line tree-shaking/no-side-effects-in-initialization
|
|
20
|
+
t.partial({
|
|
21
|
+
refreshTokenLifetime: t.number,
|
|
22
|
+
}),
|
|
23
|
+
], 'IdentityServiceConfig');
|
|
24
|
+
// eslint-disable-next-line tree-shaking/no-side-effects-in-initialization
|
|
25
|
+
export const FederatedSignInConfigCodec = t.intersection([
|
|
26
|
+
// eslint-disable-next-line tree-shaking/no-side-effects-in-initialization
|
|
27
|
+
t.type({
|
|
28
|
+
appClientId: t.string,
|
|
29
|
+
signInRedirectUri: t.string,
|
|
30
|
+
signOutRedirectUri: t.string,
|
|
31
|
+
webDomain: t.string,
|
|
32
|
+
}),
|
|
33
|
+
// eslint-disable-next-line tree-shaking/no-side-effects-in-initialization
|
|
34
|
+
t.partial({
|
|
35
|
+
identityProvider: t.string,
|
|
36
|
+
refreshTokenLifetime: t.number,
|
|
37
|
+
}),
|
|
38
|
+
], 'FederatedSignInConfig');
|
|
39
|
+
// eslint-disable-next-line tree-shaking/no-side-effects-in-initialization
|
|
40
|
+
export const Config = t.intersection([
|
|
41
|
+
// eslint-disable-next-line tree-shaking/no-side-effects-in-initialization
|
|
42
|
+
t.type({
|
|
43
|
+
identityService: IdentityServiceConfigCodec,
|
|
44
|
+
}),
|
|
45
|
+
// eslint-disable-next-line tree-shaking/no-side-effects-in-initialization
|
|
46
|
+
t.partial({
|
|
47
|
+
federatedSignIn: FederatedSignInConfigCodec,
|
|
48
|
+
}),
|
|
49
|
+
]);
|
|
50
|
+
export function getIdentityServiceConfig() {
|
|
51
|
+
if (!DefaultConfigurationManager.getInstance().getConfigSet('identityService')) {
|
|
52
|
+
throw new IdentityServiceConfigNotFoundError();
|
|
53
|
+
}
|
|
54
|
+
return DefaultConfigurationManager.getInstance().bindConfigSet(Config, undefined);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=sdk-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk-config.js","sourceRoot":"","sources":["../../../src/core/sdk-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAA;AACvE,OAAO,KAAK,CAAC,MAAM,OAAO,CAAA;AAC1B,OAAO,EAAE,kCAAkC,EAAE,MAAM,eAAe,CAAA;AAElE,0EAA0E;AAC1E,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAC,CAAC,YAAY,CACtD;IACE,0EAA0E;IAC1E,CAAC,CAAC,IAAI,CAAC;QACL,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,QAAQ,EAAE,CAAC,CAAC,MAAM;QAClB,cAAc,EAAE,CAAC,CAAC,MAAM;QACxB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM;QAChB,eAAe,EAAE,CAAC,CAAC,MAAM;QACzB,0EAA0E;QAC1E,mBAAmB,EAAE,CAAC,CAAC,K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ings":""}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { TypedDocumentNode as DocumentNode } from '@graphql-typed-document-node/core';
|
|
2
|
+
export declare type Maybe<T> = T | undefined;
|
|
3
|
+
export declare type InputMaybe<T> = T | undefined;
|
|
4
|
+
export declare type Exact<T extends {
|
|
5
|
+
[key: string]: unknown;
|
|
6
|
+
}> = {
|
|
7
|
+
[K in keyof T]: T[K];
|
|
8
|
+
};
|
|
9
|
+
export declare type MakeOptional<T, K extends keyof T> = Omit<T, K> & {
|
|
10
|
+
[SubKey in K]?: Maybe<T[SubKey]>;
|
|
11
|
+
};
|
|
12
|
+
export declare type MakeMaybe<T, K extends keyof T> = Omit<T, K> & {
|
|
13
|
+
[SubKey in K]: Maybe<T[SubKey]>;
|
|
14
|
+
};
|
|
15
|
+
/** All built-in and custom scalars, mapped to their actual values */
|
|
16
|
+
export declare type Scalars = {
|
|
17
|
+
ID: string;
|
|
18
|
+
String: string;
|
|
19
|
+
Boolean: boolean;
|
|
20
|
+
Int: number;
|
|
21
|
+
Float: number;
|
|
22
|
+
AWSDate: any;
|
|
23
|
+
AWSDateTime: any;
|
|
24
|
+
AWSEmail: any;
|
|
25
|
+
AWSIPAddress: any;
|
|
26
|
+
AWSJSON: unknown;
|
|
27
|
+
AWSPhone: any;
|
|
28
|
+
AWSTime: any;
|
|
29
|
+
AWSTimestamp: any;
|
|
30
|
+
AWSURL: any;
|
|
31
|
+
};
|
|
32
|
+
export declare type Deregister = {
|
|
33
|
+
__typename?: 'Deregister';
|
|
34
|
+
success: Scalars['Boolean'];
|
|
35
|
+
};
|
|
36
|
+
export declare type FederatedId = {
|
|
37
|
+
__typename?: 'FederatedId';
|
|
38
|
+
identityId: Scalars['String'];
|
|
39
|
+
};
|
|
40
|
+
export declare type GlobalSignOut = {
|
|
41
|
+
__typename?: 'GlobalSignOut';
|
|
42
|
+
success: Scalars['Boolean'];
|
|
43
|
+
};
|
|
44
|
+
export declare type Mutation = {
|
|
45
|
+
__typename?: 'Mutation';
|
|
46
|
+
deregister?: Maybe<Deregister>;
|
|
47
|
+
globalSignOut?: Maybe<GlobalSignOut>;
|
|
48
|
+
registerFederatedId?: Maybe<FederatedId>;
|
|
49
|
+
};
|
|
50
|
+
export declare type MutationRegisterFederatedIdArgs = {
|
|
51
|
+
input?: InputMaybe<RegisterFederatedIdInput>;
|
|
52
|
+
};
|
|
53
|
+
export declare type Query = {
|
|
54
|
+
__typename?: 'Query';
|
|
55
|
+
notImplemented?: Maybe<Scalars['Boolean']>;
|
|
56
|
+
};
|
|
57
|
+
export declare type QueryNotImplementedArgs = {
|
|
58
|
+
dummy: Scalars['String'];
|
|
59
|
+
};
|
|
60
|
+
export declare type RegisterFederatedIdInput = {
|
|
61
|
+
idToken: Scalars['String'];
|
|
62
|
+
};
|
|
63
|
+
export declare type DeregisterMutationVariables = Exact<{
|
|
64
|
+
[key: string]: never;
|
|
65
|
+
}>;
|
|
66
|
+
export declare type DeregisterMutation = {
|
|
67
|
+
__typename?: 'Mutation';
|
|
68
|
+
deregister?: {
|
|
69
|
+
__typename?: 'Deregister';
|
|
70
|
+
success: boolean;
|
|
71
|
+
} | undefined;
|
|
72
|
+
};
|
|
73
|
+
export declare type GlobalSignOutMutationVariables = Exact<{
|
|
74
|
+
[key: string]: never;
|
|
75
|
+
}>;
|
|
76
|
+
export declare type GlobalSignOutMutation = {
|
|
77
|
+
__typename?: 'Mutation';
|
|
78
|
+
globalSignOut?: {
|
|
79
|
+
__typename?: 'GlobalSignOut';
|
|
80
|
+
success: boolean;
|
|
81
|
+
} | undefined;
|
|
82
|
+
};
|
|
83
|
+
export declare type RegisterFederatedIdMutationVariables = Exact<{
|
|
84
|
+
input: RegisterFederatedIdInput;
|
|
85
|
+
}>;
|
|
86
|
+
export declare type RegisterFederatedIdMutation = {
|
|
87
|
+
__typename?: 'Mutation';
|
|
88
|
+
registerFederatedId?: {
|
|
89
|
+
__typename?: 'FederatedId';
|
|
90
|
+
identityId: string;
|
|
91
|
+
} | undefined;
|
|
92
|
+
};
|
|
93
|
+
export declare const DeregisterDocument: DocumentNode<DeregisterMutation, Exact<{
|
|
94
|
+
[key: string]: never;
|
|
95
|
+
}>>;
|
|
96
|
+
export declare const GlobalSignOutDocument: DocumentNode<GlobalSignOutMutation, Exact<{
|
|
97
|
+
[key: string]: never;
|
|
98
|
+
}>>;
|
|
99
|
+
export declare const RegisterFederatedIdDocument: DocumentNode<RegisterFederatedIdMutation, Exact<{
|
|
100
|
+
input: RegisterFederatedIdInput;
|
|
101
|
+
}>>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
export const DeregisterDocument = {
|
|
2
|
+
kind: 'Document',
|
|
3
|
+
definitions: [
|
|
4
|
+
{
|
|
5
|
+
kind: 'OperationDefinition',
|
|
6
|
+
operation: 'mutation',
|
|
7
|
+
name: { kind: 'Name', value: 'deregister' },
|
|
8
|
+
selectionSet: {
|
|
9
|
+
kind: 'SelectionSet',
|
|
10
|
+
selections: [
|
|
11
|
+
{
|
|
12
|
+
kind: 'Field',
|
|
13
|
+
name: { kind: 'Name', value: 'deregister' },
|
|
14
|
+
selectionSet: {
|
|
15
|
+
kind: 'SelectionSet',
|
|
16
|
+
selections: [
|
|
17
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'success' } },
|
|
18
|
+
],
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
};
|
|
26
|
+
export const GlobalSignOutDocument = {
|
|
27
|
+
kind: 'Document',
|
|
28
|
+
definitions: [
|
|
29
|
+
{
|
|
30
|
+
kind: 'OperationDefinition',
|
|
31
|
+
operation: 'mutation',
|
|
32
|
+
name: { kind: 'Name', value: 'GlobalSignOut' },
|
|
33
|
+
selectionSet: {
|
|
34
|
+
kind: 'SelectionSet',
|
|
35
|
+
selections: [
|
|
36
|
+
{
|
|
37
|
+
kind: 'Field',
|
|
38
|
+
name: { kind: 'Name', value: 'globalSignOut' },
|
|
39
|
+
selectionSet: {
|
|
40
|
+
kind: 'SelectionSet',
|
|
41
|
+
selections: [
|
|
42
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'success' } },
|
|
43
|
+
],
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
};
|
|
51
|
+
export const RegisterFederatedIdDocument = {
|
|
52
|
+
kind: 'Document',
|
|
53
|
+
definitions: [
|
|
54
|
+
{
|
|
55
|
+
kind: 'OperationDefinition',
|
|
56
|
+
operation: 'mutation',
|
|
57
|
+
name: { kind: 'Name', value: 'registerFederatedId' },
|
|
58
|
+
variableDefinitions: [
|
|
59
|
+
{
|
|
60
|
+
kind: 'VariableDefinition',
|
|
61
|
+
variable: {
|
|
62
|
+
kind: 'Variable',
|
|
63
|
+
name: { kind: 'Name', value: 'input' },
|
|
64
|
+
},
|
|
65
|
+
type: {
|
|
66
|
+
kind: 'NonNullType',
|
|
67
|
+
type: {
|
|
68
|
+
kind: 'NamedType',
|
|
69
|
+
name: { kind: 'Name', value: 'RegisterFederatedIdInput' },
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
selectionSet: {
|
|
75
|
+
kind: 'SelectionSet',
|
|
76
|
+
selections: [
|
|
77
|
+
{
|
|
78
|
+
kind: 'Field',
|
|
79
|
+
name: { kind: 'Name', value: 'registerFederatedId' },
|
|
80
|
+
arguments: [
|
|
81
|
+
{
|
|
82
|
+
kind: 'Argument',
|
|
83
|
+
name: { kind: 'Name', value: 'input' },
|
|
84
|
+
value: {
|
|
85
|
+
kind: 'Variable',
|
|
86
|
+
name: { kind: 'Name', value: 'input' },
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
selectionSet: {
|
|
91
|
+
kind: 'SelectionSet',
|
|
92
|
+
selections: [
|
|
93
|
+
{ kind: 'Field', name: { kind: 'Name', value: 'identityId' } },
|
|
94
|
+
],
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
};
|
|
102
|
+
//# sourceMappingURL=graphql-types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"graphql-types.js","sourceRoot":"","sources":["../../../src/gen/graphql-types.ts"],"names":[],"mappings":"AAgGA,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE;QACX;YACE,IAAI,EAAE,qBAAqB;YAC3B,SAAS,EAAE,UAAU;YACrB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE;YAC3C,YAAY,EAAE;gBACZ,IAAI,EAAE,cAAc;gBACpB,UAAU,EAAE;oBACV;wBACE,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE;wBAC3C,YAAY,EAAE;4BACZ,IAAI,EAAE,cAAc;4BACpB,UAAU,EAAE;gCACV,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE;6BAC5D;yBACF;qBACF;iBACF;aACF;SACF;KACF;CAC0E,CAAA;AAC7E,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,IAAI,EAAE,UAAU;IAChB,WAAW,EAAE;QACX;YACE,IAAI,EAAE,qBAAqB;YAC3B,SAAS,EAAE,UAAU;YACrB,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,eAAe,EAAE;YAC9C,YAAY,EAAE;gBACZ,IAAI,EAAE,cAAc;gBACpB,UAAU,EAAE;oBACV;wBACE,IAAI,EAAE,OAAO;wBACb,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,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E;iCACvC;6BACF;yBACF;wBACD,YAAY,EAAE;4BACZ,IAAI,EAAE,cAAc;4BACpB,UAAU,EAAE;gCACV,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE;6BAC/D;yBACF;qBACF;iBACF;aACF;SACF;KACF;CAIF,CAAA"}
|
package/lib/src/index.js
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/* Everything exported here is considered public API and is documented by typedoc. */
|
|
2
|
+
export { DefaultSudoUserClient } from './user/user-client';
|
|
3
|
+
export * from './user/user-client-interface';
|
|
4
|
+
export { TESTAuthenticationProvider, LocalAuthenticationProvider, } from './user/auth-provider';
|
|
5
|
+
export * from './user/error';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,qFAAqF;AACrF,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAC1D,cAAc,8BAA8B,CAAA;AAC5C,OAAO,EACL,0BAA0B,EAC1B,2BAA2B,GAE5B,MAAM,sBAAsB,CAAA;AAE7B,cAAc,cAAc,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-crypto.js","sourceRoot":"","sources":["../../../../src/runtimes/browser/browser-crypto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAA;AAElD,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,mBAAmB,EAAE,CAAC,MAAmB,EAAU,EAAE;QACnD,OAAO,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAA;IAC9B,CAAC;CACF,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node-crypto.js","sourceRoot":"","sources":["../../../../src/runtimes/node/node-crypto.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,cAAc,GAAmB;IAC5C,mBAAmB,EAAE,CAAC,MAAmB,EAAU,EAAE;QACnD,OAAO,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAA;IAC/C,CAAC;CACF,CAAA"}
|
package/lib/src/sdk.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './core/sdk-config';
|
package/lib/src/sdk.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sdk.js","sourceRoot":"","sources":["../../src/sdk.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,cAAc,mBAAmB,CAAA"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
export interface AuthenticationInfo {
|
|
2
|
+
/**
|
|
3
|
+
* Authentication type.
|
|
4
|
+
*/
|
|
5
|
+
type: string;
|
|
6
|
+
/**
|
|
7
|
+
* Indicates whether or not the authentication information is valid.
|
|
8
|
+
*
|
|
9
|
+
* @return *true* if the authentication information is valid.
|
|
10
|
+
*/
|
|
11
|
+
isValid(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Encodes the authentication information as a string.
|
|
14
|
+
*
|
|
15
|
+
* @return encoded authentication information.
|
|
16
|
+
*/
|
|
17
|
+
encode(): string;
|
|
18
|
+
/**
|
|
19
|
+
* Returns the username associated with this authentication information.
|
|
20
|
+
*
|
|
21
|
+
* @return username.
|
|
22
|
+
*/
|
|
23
|
+
getUsername(): string;
|
|
24
|
+
}
|
|
25
|
+
export interface AuthenticationProvider {
|
|
26
|
+
/**
|
|
27
|
+
* Generates and returns authentication information.
|
|
28
|
+
*
|
|
29
|
+
* @return authentication information.
|
|
30
|
+
*/
|
|
31
|
+
getAuthenticationInfo(): Promise<AuthenticationInfo>;
|
|
32
|
+
/**
|
|
33
|
+
* Resets internal state and releases any associated resources.
|
|
34
|
+
*/
|
|
35
|
+
reset(): void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Authentication info consisting of a JWT signed using the TEST registration key.
|
|
39
|
+
*/
|
|
40
|
+
export declare class TESTAuthenticationInfo implements AuthenticationInfo {
|
|
41
|
+
private jwt;
|
|
42
|
+
readonly type: string;
|
|
43
|
+
constructor(jwt: string);
|
|
44
|
+
isValid(): boolean;
|
|
45
|
+
encode(): string;
|
|
46
|
+
getUsername(): string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Authentication provider for generating authentication info using a TEST registration key.
|
|
50
|
+
*
|
|
51
|
+
* @param name provider name. This name will be prepended to the generated UUID in JWT sub.
|
|
52
|
+
* @param privateKey PEM encoded RSA private key.
|
|
53
|
+
* @param keyId key ID of the TEST registration key which is obtained from the admin console.
|
|
54
|
+
* @param attributes additional attributes to be added to the issued authentication info.
|
|
55
|
+
*/
|
|
56
|
+
export declare class TESTAuthenticationProvider implements AuthenticationProvider {
|
|
57
|
+
private name;
|
|
58
|
+
private privateKey;
|
|
59
|
+
private keyId;
|
|
60
|
+
private attributes?;
|
|
61
|
+
readonly testRegistrationIssuer: string;
|
|
62
|
+
readonly testRegistrationAudience: string;
|
|
63
|
+
constructor(name: string, privateKey: string, keyId?: string, attributes?: Record<string, any> | undefined);
|
|
64
|
+
getAuthenticationInfo(): Promise<AuthenticationInfo>;
|
|
65
|
+
reset(): void;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Authentication info consisting of a JWT signed using the locally stored private key.
|
|
69
|
+
*/
|
|
70
|
+
export declare class LocalAuthenticationInfo implements AuthenticationInfo {
|
|
71
|
+
private jwt;
|
|
72
|
+
private username;
|
|
73
|
+
readonly type: string;
|
|
74
|
+
constructor(jwt: string, username: string);
|
|
75
|
+
isValid(): boolean;
|
|
76
|
+
encode(): string;
|
|
77
|
+
getUsername(): string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Authentication info consisting of a JWT signed using the locally stored private key.
|
|
81
|
+
*
|
|
82
|
+
* @param name provider name. This name will be used to populate JWT iss (issuer).
|
|
83
|
+
* @param privateKey PEM encoded RSA private key.
|
|
84
|
+
* @param keyId key ID.
|
|
85
|
+
* @param username username to be associated with the issued authentication info.
|
|
86
|
+
* @param attributes additional attributes to be added to the issued authentication info.
|
|
87
|
+
*/
|
|
88
|
+
export declare class LocalAuthenticationProvider implements AuthenticationProvider {
|
|
89
|
+
private name;
|
|
90
|
+
private privateKey;
|
|
91
|
+
private keyId;
|
|
92
|
+
private username;
|
|
93
|
+
private attributes?;
|
|
94
|
+
constructor(name: string, privateKey: string, keyId: string, username: string, attributes?: Record<string, any> | undefined);
|
|
95
|
+
getAuthenticationInfo(): Promise<AuthenticationInfo>;
|
|
96
|
+
reset(): void;
|
|
97
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import * as JWT from 'jsonwebtoken';
|
|
2
|
+
import { v4 } from 'uuid';
|
|
3
|
+
/**
|
|
4
|
+
* Authentication info consisting of a JWT signed using the TEST registration key.
|
|
5
|
+
*/
|
|
6
|
+
export class TESTAuthenticationInfo {
|
|
7
|
+
constructor(jwt) {
|
|
8
|
+
this.jwt = jwt;
|
|
9
|
+
this.type = 'TEST';
|
|
10
|
+
}
|
|
11
|
+
isValid() {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
encode() {
|
|
15
|
+
return this.jwt;
|
|
16
|
+
}
|
|
17
|
+
getUsername() {
|
|
18
|
+
return '';
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Authentication provider for generating authentication info using a TEST registration key.
|
|
23
|
+
*
|
|
24
|
+
* @param name provider name. This name will be prepended to the generated UUID in JWT sub.
|
|
25
|
+
* @param privateKey PEM encoded RSA private key.
|
|
26
|
+
* @param keyId key ID of the TEST registration key which is obtained from the admin console.
|
|
27
|
+
* @param attributes additional attributes to be added to the issued authentication info.
|
|
28
|
+
*/
|
|
29
|
+
export class TESTAuthenticationProvider {
|
|
30
|
+
constructor(name, privateKey, keyId = 'register_key', attributes) {
|
|
31
|
+
this.name = name;
|
|
32
|
+
this.privateKey = privateKey;
|
|
33
|
+
this.keyId = keyId;
|
|
34
|
+
this.attributes = attributes;
|
|
35
|
+
this.testRegistrationIssuer = 'testRegisterIssuer';
|
|
36
|
+
this.testRegistrationAudience = 'testRegisterAudience';
|
|
37
|
+
}
|
|
38
|
+
async getAuthenticationInfo() {
|
|
39
|
+
const jwt = JWT.sign(this.attributes ? this.attributes : {}, this.privateKey, {
|
|
40
|
+
jwtid: v4(),
|
|
41
|
+
audience: this.testRegistrationAudience,
|
|
42
|
+
expiresIn: '60s',
|
|
43
|
+
notBefore: '0m',
|
|
44
|
+
subject: `${this.name}-${v4()}`,
|
|
45
|
+
issuer: this.testRegistrationIssuer,
|
|
46
|
+
header: { alg: 'RS256', kid: this.keyId },
|
|
47
|
+
algorithm: 'RS256',
|
|
48
|
+
});
|
|
49
|
+
return new TESTAuthenticationInfo(jwt);
|
|
50
|
+
}
|
|
51
|
+
reset() {
|
|
52
|
+
// Not implemented
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Authentication info consisting of a JWT signed using the locally stored private key.
|
|
57
|
+
*/
|
|
58
|
+
export class LocalAuthenticationInfo {
|
|
59
|
+
constructor(jwt, username) {
|
|
60
|
+
this.jwt = jwt;
|
|
61
|
+
this.username = username;
|
|
62
|
+
this.type = 'FSSO';
|
|
63
|
+
}
|
|
64
|
+
isValid() {
|
|
65
|
+
return true;
|
|
66
|
+
}
|
|
67
|
+
encode() {
|
|
68
|
+
return this.jwt;
|
|
69
|
+
}
|
|
70
|
+
getUsername() {
|
|
71
|
+
return this.username;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Authentication info consisting of a JWT signed using the locally stored private key.
|
|
76
|
+
*
|
|
77
|
+
* @param name provider name. This name will be used to populate JWT iss (issuer).
|
|
78
|
+
* @param privateKey PEM encoded RSA private key.
|
|
79
|
+
* @param keyId key ID.
|
|
80
|
+
* @param username username to be associated with the issued authentication info.
|
|
81
|
+
* @param attributes additional attributes to be added to the issued authentication info.
|
|
82
|
+
*/
|
|
83
|
+
export class LocalAuthenticationProvider {
|
|
84
|
+
constructor(name, privateKey, keyId, username, attributes) {
|
|
85
|
+
this.name = name;
|
|
86
|
+
this.privateKey = privateKey;
|
|
87
|
+
this.keyId = keyId;
|
|
88
|
+
this.username = username;
|
|
89
|
+
this.attributes = attributes;
|
|
90
|
+
}
|
|
91
|
+
async getAuthenticationInfo() {
|
|
92
|
+
const jwt = JWT.sign(this.attributes ? this.attributes : {}, this.privateKey, {
|
|
93
|
+
jwtid: v4(),
|
|
94
|
+
audience: 'identity-service',
|
|
95
|
+
expiresIn: '60s',
|
|
96
|
+
notBefore: '0m',
|
|
97
|
+
subject: this.username,
|
|
98
|
+
issuer: this.name,
|
|
99
|
+
header: { alg: 'RS256', kid: this.keyId },
|
|
100
|
+
algorithm: 'RS256',
|
|
101
|
+
});
|
|
102
|
+
return new LocalAuthenticationInfo(jwt, this.username);
|
|
103
|
+
}
|
|
104
|
+
reset() {
|
|
105
|
+
// Not implemented
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
//# sourceMappingURL=auth-provider.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"auth-provider.js","sourceRoot":"","sources":["../../../src/user/auth-provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,GAAG,MAAM,cAAc,CAAA;AACnC,OAAO,EAAE,EAAE,EAAE,MAAM,MAAM,CAAA;AA2CzB;;GAEG;AACH,MAAM,OAAO,sBAAsB;IAGjC,YAAoB,GAAW;QAAX,QAAG,GAAH,GAAG,CAAQ;QAFtB,SAAI,GAAW,MAAM,CAAA;IAEI,CAAC;IAEnC,OAAO;QACL,OAAO,IAAI,CAAA;IACb,CAAC;IAED,MAAM;QACJ,OAAO,IAAI,CAAC,GAAG,CAAA;IACjB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