@bitblit/ratchet-warden-common 4.0.99-alpha → 4.0.103-alpha
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/{dist/types → lib}/build/ratchet-warden-common-info.d.ts +1 -1
- package/{dist/types → lib}/client/provider/warden-client-abstract-recent-login-provider.d.ts +4 -4
- package/{dist/es → lib}/client/provider/warden-client-abstract-recent-login-provider.js +3 -2
- package/{dist/types → lib}/client/provider/warden-client-local-storage-logged-in-user-provider.d.ts +2 -2
- package/{dist/es → lib}/client/provider/warden-client-local-storage-logged-in-user-provider.js +4 -1
- package/{dist/types → lib}/client/provider/warden-client-local-storage-recent-login-provider.d.ts +2 -2
- package/{dist/es → lib}/client/provider/warden-client-local-storage-recent-login-provider.js +5 -2
- package/{dist/types → lib}/client/provider/warden-client-recent-login-provider.d.ts +3 -3
- package/{dist/types → lib}/client/provider/warden-client-transient-memory-logged-in-user-provider.d.ts +2 -2
- package/{dist/es → lib}/client/provider/warden-client-transient-memory-logged-in-user-provider.js +1 -0
- package/{dist/types → lib}/client/provider/warden-client-transient-memory-recent-login-provider.d.ts +2 -2
- package/{dist/es → lib}/client/provider/warden-client-transient-memory-recent-login-provider.js +2 -5
- package/{dist/types → lib}/client/provider/warden-command-exchange-provider.d.ts +0 -4
- package/{dist/types → lib}/client/provider/warden-logged-in-user-provider.d.ts +1 -1
- package/{dist/types → lib}/client/provider/warden-logged-in-user-wrapper.d.ts +1 -1
- package/{dist/types → lib}/client/provider/warden-recent-login-descriptor.d.ts +1 -1
- package/{dist/types → lib}/client/provider/warden-user-service-event-processing-provider.d.ts +1 -4
- package/{dist/types → lib}/client/provider/warden-user-service-options.d.ts +4 -4
- package/{dist/types → lib}/client/warden-client.d.ts +8 -8
- package/{dist/es → lib}/client/warden-client.js +6 -1
- package/lib/client/warden-client.spec.js +22 -0
- package/{dist/types → lib}/client/warden-delegating-current-user-providing-user-service-event-processing-provider.d.ts +3 -13
- package/{dist/es → lib}/client/warden-delegating-current-user-providing-user-service-event-processing-provider.js +2 -1
- package/{dist/types → lib}/client/warden-user-service.d.ts +7 -13
- package/{dist/es → lib}/client/warden-user-service.js +12 -5
- package/lib/client/warden-user-service.spec.js +19 -0
- package/{dist/types → lib}/common/command/create-account.d.ts +1 -1
- package/{dist/types → lib}/common/command/warden-command-response.d.ts +3 -3
- package/{dist/types → lib}/common/command/warden-command.d.ts +5 -5
- package/{dist/types → lib}/common/model/warden-contact.d.ts +1 -1
- package/{dist/types → lib}/common/model/warden-entry-summary.d.ts +1 -1
- package/{dist/types → lib}/common/model/warden-entry.d.ts +2 -2
- package/lib/common/model/warden-jwt-token.d.ts +5 -0
- package/{dist/types → lib}/common/model/warden-login-request.d.ts +1 -1
- package/{dist/types → lib}/common/model/warden-login-results.d.ts +1 -1
- package/{dist/types → lib}/common/model/warden-store-registration-response.d.ts +2 -2
- package/{dist/types → lib}/common/model/warden-user-decoration.d.ts +1 -1
- package/lib/common/model/warden-user-decoration.js +1 -0
- package/{dist/types → lib}/common/model/warden-web-authn-entry.d.ts +1 -1
- package/lib/common/model/warden-web-authn-entry.js +1 -0
- package/{dist/types → lib}/common/util/warden-utils.d.ts +6 -6
- package/{dist/es → lib}/common/util/warden-utils.js +3 -2
- package/lib/common/util/warden-utils.spec.d.ts +1 -0
- package/lib/common/util/warden-utils.spec.js +10 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/package.json +10 -13
- package/dist/cjs/build/ratchet-warden-common-info.js +0 -18
- package/dist/cjs/client/provider/warden-client-abstract-recent-login-provider.js +0 -47
- package/dist/cjs/client/provider/warden-client-current-logged-in-jwt-token-provider.js +0 -2
- package/dist/cjs/client/provider/warden-client-local-storage-logged-in-user-provider.js +0 -30
- package/dist/cjs/client/provider/warden-client-local-storage-recent-login-provider.js +0 -24
- package/dist/cjs/client/provider/warden-client-recent-login-provider.js +0 -2
- package/dist/cjs/client/provider/warden-client-transient-memory-logged-in-user-provider.js +0 -15
- package/dist/cjs/client/provider/warden-client-transient-memory-recent-login-provider.js +0 -17
- package/dist/cjs/client/provider/warden-command-exchange-provider.js +0 -2
- package/dist/cjs/client/provider/warden-logged-in-user-provider.js +0 -2
- package/dist/cjs/client/provider/warden-logged-in-user-wrapper.js +0 -2
- package/dist/cjs/client/provider/warden-recent-login-descriptor.js +0 -2
- package/dist/cjs/client/provider/warden-user-service-event-processing-provider.js +0 -2
- package/dist/cjs/client/provider/warden-user-service-options.js +0 -2
- package/dist/cjs/client/warden-client.js +0 -133
- package/dist/cjs/client/warden-delegating-current-user-providing-user-service-event-processing-provider.js +0 -45
- package/dist/cjs/client/warden-user-service.js +0 -254
- package/dist/cjs/common/command/create-account.js +0 -2
- package/dist/cjs/common/command/remove-web-authn-registration.js +0 -2
- package/dist/cjs/common/command/warden-command-response.js +0 -2
- package/dist/cjs/common/command/warden-command.js +0 -2
- package/dist/cjs/common/command/web-authn-object-wrapper.js +0 -2
- package/dist/cjs/common/model/warden-contact-type.js +0 -8
- package/dist/cjs/common/model/warden-contact.js +0 -2
- package/dist/cjs/common/model/warden-customer-message-type.js +0 -7
- package/dist/cjs/common/model/warden-entry-summary.js +0 -2
- package/dist/cjs/common/model/warden-entry.js +0 -2
- package/dist/cjs/common/model/warden-jwt-token.js +0 -2
- package/dist/cjs/common/model/warden-login-request.js +0 -2
- package/dist/cjs/common/model/warden-login-results.js +0 -2
- package/dist/cjs/common/model/warden-store-registration-response-type.js +0 -9
- package/dist/cjs/common/model/warden-store-registration-response.js +0 -2
- package/dist/cjs/common/model/warden-team-role.js +0 -2
- package/dist/cjs/common/model/warden-user-decoration.js +0 -2
- package/dist/cjs/common/model/warden-web-authn-entry.js +0 -2
- package/dist/cjs/common/model/warden-web-authn-transport-future-type.js +0 -12
- package/dist/cjs/common/util/warden-utils.js +0 -108
- package/dist/cjs/index.js +0 -40
- package/dist/es/index.js +0 -37
- package/dist/tsconfig.cjs.tsbuildinfo +0 -1
- package/dist/tsconfig.es.tsbuildinfo +0 -1
- package/dist/tsconfig.types.tsbuildinfo +0 -1
- package/dist/types/common/model/warden-jwt-token.d.ts +0 -5
- package/dist/types/index.d.ts +0 -40
- /package/{dist/es → lib}/build/ratchet-warden-common-info.js +0 -0
- /package/{dist/types → lib}/client/provider/warden-client-current-logged-in-jwt-token-provider.d.ts +0 -0
- /package/{dist/es → lib}/client/provider/warden-client-current-logged-in-jwt-token-provider.js +0 -0
- /package/{dist/es → lib}/client/provider/warden-client-recent-login-provider.js +0 -0
- /package/{dist/es → lib}/client/provider/warden-command-exchange-provider.js +0 -0
- /package/{dist/es → lib}/client/provider/warden-logged-in-user-provider.js +0 -0
- /package/{dist/es → lib}/client/provider/warden-logged-in-user-wrapper.js +0 -0
- /package/{dist/es → lib}/client/provider/warden-recent-login-descriptor.js +0 -0
- /package/{dist/es → lib}/client/provider/warden-user-service-event-processing-provider.js +0 -0
- /package/{dist/es → lib}/client/provider/warden-user-service-options.js +0 -0
- /package/{dist/es/common/command/create-account.js → lib/client/warden-client.spec.d.ts} +0 -0
- /package/{dist/es/common/command/remove-web-authn-registration.js → lib/client/warden-user-service.spec.d.ts} +0 -0
- /package/{dist/es/common/command/warden-command-response.js → lib/common/command/create-account.js} +0 -0
- /package/{dist/types → lib}/common/command/remove-web-authn-registration.d.ts +0 -0
- /package/{dist/es/common/command/warden-command.js → lib/common/command/remove-web-authn-registration.js} +0 -0
- /package/{dist/es/common/command/web-authn-object-wrapper.js → lib/common/command/warden-command-response.js} +0 -0
- /package/{dist/es/common/model/warden-contact.js → lib/common/command/warden-command.js} +0 -0
- /package/{dist/types → lib}/common/command/web-authn-object-wrapper.d.ts +0 -0
- /package/{dist/es/common/model/warden-entry-summary.js → lib/common/command/web-authn-object-wrapper.js} +0 -0
- /package/{dist/types → lib}/common/model/warden-contact-type.d.ts +0 -0
- /package/{dist/es → lib}/common/model/warden-contact-type.js +0 -0
- /package/{dist/es/common/model/warden-entry.js → lib/common/model/warden-contact.js} +0 -0
- /package/{dist/types → lib}/common/model/warden-customer-message-type.d.ts +0 -0
- /package/{dist/es → lib}/common/model/warden-customer-message-type.js +0 -0
- /package/{dist/es/common/model/warden-jwt-token.js → lib/common/model/warden-entry-summary.js} +0 -0
- /package/{dist/es/common/model/warden-login-request.js → lib/common/model/warden-entry.js} +0 -0
- /package/{dist/es/common/model/warden-login-results.js → lib/common/model/warden-jwt-token.js} +0 -0
- /package/{dist/es/common/model/warden-store-registration-response.js → lib/common/model/warden-login-request.js} +0 -0
- /package/{dist/es/common/model/warden-team-role.js → lib/common/model/warden-login-results.js} +0 -0
- /package/{dist/types → lib}/common/model/warden-store-registration-response-type.d.ts +0 -0
- /package/{dist/es → lib}/common/model/warden-store-registration-response-type.js +0 -0
- /package/{dist/es/common/model/warden-user-decoration.js → lib/common/model/warden-store-registration-response.js} +0 -0
- /package/{dist/types → lib}/common/model/warden-team-role.d.ts +0 -0
- /package/{dist/es/common/model/warden-web-authn-entry.js → lib/common/model/warden-team-role.js} +0 -0
- /package/{dist/types → lib}/common/model/warden-web-authn-transport-future-type.d.ts +0 -0
- /package/{dist/es → lib}/common/model/warden-web-authn-transport-future-type.js +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildInformation } from '@bitblit/ratchet-common';
|
|
1
|
+
import { BuildInformation } from '@bitblit/ratchet-common/lib/build/build-information.js';
|
|
2
2
|
export declare class RatchetWardenCommonInfo {
|
|
3
3
|
private constructor();
|
|
4
4
|
static buildInformation(): BuildInformation;
|
package/{dist/types → lib}/client/provider/warden-client-abstract-recent-login-provider.d.ts
RENAMED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WardenClientRecentLoginProvider } from './warden-client-recent-login-provider';
|
|
2
|
-
import { WardenRecentLoginDescriptor } from './warden-recent-login-descriptor';
|
|
3
|
-
import { WardenEntrySummary } from '../../common/model/warden-entry-summary';
|
|
4
|
-
import { WardenContact } from '../../common/model/warden-contact';
|
|
1
|
+
import { WardenClientRecentLoginProvider } from './warden-client-recent-login-provider.js';
|
|
2
|
+
import { WardenRecentLoginDescriptor } from './warden-recent-login-descriptor.js';
|
|
3
|
+
import { WardenEntrySummary } from '../../common/model/warden-entry-summary.js';
|
|
4
|
+
import { WardenContact } from '../../common/model/warden-contact.js';
|
|
5
5
|
export declare abstract class WardenClientAbstractRecentLoginProvider implements WardenClientRecentLoginProvider {
|
|
6
6
|
abstract fetchCache(): WardenRecentLoginDescriptor[];
|
|
7
7
|
abstract updateCache(newValue: WardenRecentLoginDescriptor[]): any;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Logger
|
|
2
|
-
import {
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
2
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
3
|
+
import { WardenUtils } from '../../common/util/warden-utils.js';
|
|
3
4
|
export class WardenClientAbstractRecentLoginProvider {
|
|
4
5
|
saveRecentLogin(entry) {
|
|
5
6
|
if (entry?.userId) {
|
package/{dist/types → lib}/client/provider/warden-client-local-storage-logged-in-user-provider.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WardenLoggedInUserProvider } from './warden-logged-in-user-provider';
|
|
2
|
-
import { WardenLoggedInUserWrapper } from './warden-logged-in-user-wrapper';
|
|
1
|
+
import { WardenLoggedInUserProvider } from './warden-logged-in-user-provider.js';
|
|
2
|
+
import { WardenLoggedInUserWrapper } from './warden-logged-in-user-wrapper.js';
|
|
3
3
|
export declare class WardenClientLocalStorageLoggedInUserProvider<T> implements WardenLoggedInUserProvider<T> {
|
|
4
4
|
private localStorageKey;
|
|
5
5
|
constructor(localStorageKey: string);
|
package/{dist/es → lib}/client/provider/warden-client-local-storage-logged-in-user-provider.js
RENAMED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
2
|
+
import { ErrorRatchet } from '@bitblit/ratchet-common/lib/lang/error-ratchet.js';
|
|
3
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
2
4
|
export class WardenClientLocalStorageLoggedInUserProvider {
|
|
5
|
+
localStorageKey;
|
|
3
6
|
constructor(localStorageKey) {
|
|
4
7
|
this.localStorageKey = localStorageKey;
|
|
5
8
|
RequireRatchet.notNullUndefinedOrOnlyWhitespaceString(this.localStorageKey, 'localStorageKey');
|
package/{dist/types → lib}/client/provider/warden-client-local-storage-recent-login-provider.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WardenRecentLoginDescriptor } from './warden-recent-login-descriptor';
|
|
2
|
-
import { WardenClientAbstractRecentLoginProvider } from './warden-client-abstract-recent-login-provider';
|
|
1
|
+
import { WardenRecentLoginDescriptor } from './warden-recent-login-descriptor.js';
|
|
2
|
+
import { WardenClientAbstractRecentLoginProvider } from './warden-client-abstract-recent-login-provider.js';
|
|
3
3
|
export declare class WardenClientLocalStorageRecentLoginProvider extends WardenClientAbstractRecentLoginProvider {
|
|
4
4
|
private localStorageKey;
|
|
5
5
|
constructor(localStorageKey: string);
|
package/{dist/es → lib}/client/provider/warden-client-local-storage-recent-login-provider.js
RENAMED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
2
|
+
import { ErrorRatchet } from '@bitblit/ratchet-common/lib/lang/error-ratchet.js';
|
|
3
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
4
|
+
import { WardenClientAbstractRecentLoginProvider } from './warden-client-abstract-recent-login-provider.js';
|
|
3
5
|
export class WardenClientLocalStorageRecentLoginProvider extends WardenClientAbstractRecentLoginProvider {
|
|
6
|
+
localStorageKey;
|
|
4
7
|
constructor(localStorageKey) {
|
|
5
8
|
super();
|
|
6
9
|
this.localStorageKey = localStorageKey;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { WardenRecentLoginDescriptor } from './warden-recent-login-descriptor';
|
|
2
|
-
import { WardenEntrySummary } from '../../common/model/warden-entry-summary';
|
|
3
|
-
import { WardenContact } from '../../common/model/warden-contact';
|
|
1
|
+
import { WardenRecentLoginDescriptor } from './warden-recent-login-descriptor.js';
|
|
2
|
+
import { WardenEntrySummary } from '../../common/model/warden-entry-summary.js';
|
|
3
|
+
import { WardenContact } from '../../common/model/warden-contact.js';
|
|
4
4
|
export interface WardenClientRecentLoginProvider {
|
|
5
5
|
saveRecentLogin(entry: WardenEntrySummary): void;
|
|
6
6
|
saveNewUser(userId: string, label: string, contact: WardenContact): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WardenLoggedInUserProvider } from './warden-logged-in-user-provider';
|
|
2
|
-
import { WardenLoggedInUserWrapper } from './warden-logged-in-user-wrapper';
|
|
1
|
+
import { WardenLoggedInUserProvider } from './warden-logged-in-user-provider.js';
|
|
2
|
+
import { WardenLoggedInUserWrapper } from './warden-logged-in-user-wrapper.js';
|
|
3
3
|
export declare class WardenClientTransientMemoryLoggedInUserProvider<T> implements WardenLoggedInUserProvider<T> {
|
|
4
4
|
private wrapper;
|
|
5
5
|
fetchLoggedInUserWrapper(): WardenLoggedInUserWrapper<T>;
|
package/{dist/types → lib}/client/provider/warden-client-transient-memory-recent-login-provider.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WardenRecentLoginDescriptor } from './warden-recent-login-descriptor';
|
|
2
|
-
import { WardenClientAbstractRecentLoginProvider } from './warden-client-abstract-recent-login-provider';
|
|
1
|
+
import { WardenRecentLoginDescriptor } from './warden-recent-login-descriptor.js';
|
|
2
|
+
import { WardenClientAbstractRecentLoginProvider } from './warden-client-abstract-recent-login-provider.js';
|
|
3
3
|
export declare class WardenClientTransientMemoryRecentLoginProvider extends WardenClientAbstractRecentLoginProvider {
|
|
4
4
|
private _cache;
|
|
5
5
|
fetchCache(): WardenRecentLoginDescriptor[];
|
package/{dist/es → lib}/client/provider/warden-client-transient-memory-recent-login-provider.js
RENAMED
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
import { WardenClientAbstractRecentLoginProvider } from './warden-client-abstract-recent-login-provider';
|
|
1
|
+
import { WardenClientAbstractRecentLoginProvider } from './warden-client-abstract-recent-login-provider.js';
|
|
2
2
|
export class WardenClientTransientMemoryRecentLoginProvider extends WardenClientAbstractRecentLoginProvider {
|
|
3
|
-
|
|
4
|
-
super(...arguments);
|
|
5
|
-
this._cache = [];
|
|
6
|
-
}
|
|
3
|
+
_cache = [];
|
|
7
4
|
fetchCache() {
|
|
8
5
|
return this._cache;
|
|
9
6
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WardenLoggedInUserWrapper } from './warden-logged-in-user-wrapper';
|
|
1
|
+
import { WardenLoggedInUserWrapper } from './warden-logged-in-user-wrapper.js';
|
|
2
2
|
export interface WardenLoggedInUserProvider<T> {
|
|
3
3
|
fetchLoggedInUserWrapper(): WardenLoggedInUserWrapper<T>;
|
|
4
4
|
setLoggedInUserWrapper(wrapper: WardenLoggedInUserWrapper<T>): any;
|
package/{dist/types → lib}/client/provider/warden-user-service-event-processing-provider.d.ts
RENAMED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import { WardenLoggedInUserWrapper } from './warden-logged-in-user-wrapper';
|
|
2
|
-
/**
|
|
3
|
-
* Notifies the containing system when significant events happen
|
|
4
|
-
*/
|
|
1
|
+
import { WardenLoggedInUserWrapper } from './warden-logged-in-user-wrapper.js';
|
|
5
2
|
export interface WardenUserServiceEventProcessingProvider<T> {
|
|
6
3
|
onLogout(): void;
|
|
7
4
|
onSuccessfulLogin(newUser: WardenLoggedInUserWrapper<T>): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { WardenLoggedInUserProvider } from './warden-logged-in-user-provider';
|
|
2
|
-
import { WardenClient } from '../warden-client';
|
|
3
|
-
import { WardenUserServiceEventProcessingProvider } from './warden-user-service-event-processing-provider';
|
|
4
|
-
import { WardenClientRecentLoginProvider } from './warden-client-recent-login-provider';
|
|
1
|
+
import { WardenLoggedInUserProvider } from './warden-logged-in-user-provider.js';
|
|
2
|
+
import { WardenClient } from '../warden-client.js';
|
|
3
|
+
import { WardenUserServiceEventProcessingProvider } from './warden-user-service-event-processing-provider.js';
|
|
4
|
+
import { WardenClientRecentLoginProvider } from './warden-client-recent-login-provider.js';
|
|
5
5
|
export interface WardenUserServiceOptions<T> {
|
|
6
6
|
recentLoginProvider?: WardenClientRecentLoginProvider;
|
|
7
7
|
loggedInUserProvider: WardenLoggedInUserProvider<T>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { WardenCommand } from '../common/command/warden-command';
|
|
2
|
-
import { WardenContact } from '../common/model/warden-contact';
|
|
3
|
-
import { WardenCommandExchangeProvider } from './provider/warden-command-exchange-provider';
|
|
4
|
-
import { WardenCommandResponse } from '../common/command/warden-command-response';
|
|
1
|
+
import { WardenCommand } from '../common/command/warden-command.js';
|
|
2
|
+
import { WardenContact } from '../common/model/warden-contact.js';
|
|
3
|
+
import { WardenCommandExchangeProvider } from './provider/warden-command-exchange-provider.js';
|
|
4
|
+
import { WardenCommandResponse } from '../common/command/warden-command-response.js';
|
|
5
5
|
import { PublicKeyCredentialCreationOptionsJSON, PublicKeyCredentialRequestOptionsJSON, RegistrationResponseJSON } from '@simplewebauthn/typescript-types';
|
|
6
|
-
import { WardenLoginResults } from '../common/model/warden-login-results';
|
|
7
|
-
import { WardenLoginRequest } from '../common/model/warden-login-request';
|
|
8
|
-
import { WardenClientCurrentLoggedInJwtTokenProvider } from './provider/warden-client-current-logged-in-jwt-token-provider';
|
|
9
|
-
import { WardenEntrySummary } from '../common/model/warden-entry-summary';
|
|
6
|
+
import { WardenLoginResults } from '../common/model/warden-login-results.js';
|
|
7
|
+
import { WardenLoginRequest } from '../common/model/warden-login-request.js';
|
|
8
|
+
import { WardenClientCurrentLoggedInJwtTokenProvider } from './provider/warden-client-current-logged-in-jwt-token-provider.js';
|
|
9
|
+
import { WardenEntrySummary } from '../common/model/warden-entry-summary.js';
|
|
10
10
|
export declare class WardenClient {
|
|
11
11
|
private commandSender;
|
|
12
12
|
private jwtProvider;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
2
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
3
|
+
import { ErrorRatchet } from '@bitblit/ratchet-common/lib/lang/error-ratchet.js';
|
|
4
|
+
import { RequireRatchet } from '@bitblit/ratchet-common/lib/lang/require-ratchet.js';
|
|
2
5
|
export class WardenClient {
|
|
6
|
+
commandSender;
|
|
7
|
+
jwtProvider;
|
|
3
8
|
constructor(commandSender, jwtProvider) {
|
|
4
9
|
this.commandSender = commandSender;
|
|
5
10
|
this.jwtProvider = jwtProvider;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { JestRatchet } from '@bitblit/ratchet-jest/lib/jest/jest-ratchet.js';
|
|
2
|
+
import { WardenClient } from './warden-client.js';
|
|
3
|
+
import { jest } from '@jest/globals';
|
|
4
|
+
let mockCommandExchangeProvider;
|
|
5
|
+
let mockLoggedInJwtTokenProvider;
|
|
6
|
+
describe('#wardenClient', function () {
|
|
7
|
+
beforeEach(() => {
|
|
8
|
+
mockCommandExchangeProvider = JestRatchet.mock(jest.fn);
|
|
9
|
+
mockLoggedInJwtTokenProvider = JestRatchet.mock(jest.fn);
|
|
10
|
+
});
|
|
11
|
+
it('should instantiate and exchange commands', async () => {
|
|
12
|
+
const wc = new WardenClient(mockCommandExchangeProvider, mockLoggedInJwtTokenProvider);
|
|
13
|
+
expect(wc).not.toBeNull();
|
|
14
|
+
const cmd = {
|
|
15
|
+
generateWebAuthnAuthenticationChallengeForUserId: 'test',
|
|
16
|
+
};
|
|
17
|
+
mockCommandExchangeProvider.sendCommand.mockResolvedValue('{"generateWebAuthnAuthenticationChallengeForUserId": { "dataAsJson": {} }}');
|
|
18
|
+
const result = await wc.exchangeCommand(cmd);
|
|
19
|
+
expect(result).not.toBeNull();
|
|
20
|
+
expect(result.generateWebAuthnRegistrationChallengeForLoggedInUser).not.toBeNull();
|
|
21
|
+
});
|
|
22
|
+
});
|
|
@@ -1,17 +1,7 @@
|
|
|
1
|
-
import { WardenUserServiceEventProcessingProvider } from './provider/warden-user-service-event-processing-provider';
|
|
2
|
-
import { WardenLoggedInUserWrapper } from './provider/warden-logged-in-user-wrapper';
|
|
1
|
+
import { WardenUserServiceEventProcessingProvider } from './provider/warden-user-service-event-processing-provider.js';
|
|
2
|
+
import { WardenLoggedInUserWrapper } from './provider/warden-logged-in-user-wrapper.js';
|
|
3
3
|
import { BehaviorSubject } from 'rxjs';
|
|
4
|
-
import { WardenClientCurrentLoggedInJwtTokenProvider } from './provider/warden-client-current-logged-in-jwt-token-provider';
|
|
5
|
-
/**
|
|
6
|
-
* This class maintains a BehaviorSubject of the current user for things that want to be
|
|
7
|
-
* notified on change without depending on the WardenUserService (most commonly, the
|
|
8
|
-
* API provider with both needs the token for auth'd calls, but also is responsible for
|
|
9
|
-
* doing the login call itself and therefor cannot depend on the UserService which depends
|
|
10
|
-
* on the WardenClient which likely depends on the API provider - prevents a circular
|
|
11
|
-
* dependency to just depend on this)
|
|
12
|
-
*
|
|
13
|
-
* Delegates so that you still can also register other behavior, and just tack this onto it
|
|
14
|
-
*/
|
|
4
|
+
import { WardenClientCurrentLoggedInJwtTokenProvider } from './provider/warden-client-current-logged-in-jwt-token-provider.js';
|
|
15
5
|
export declare class WardenDelegatingCurrentUserProvidingUserServiceEventProcessingProvider<T> implements WardenUserServiceEventProcessingProvider<T>, WardenClientCurrentLoggedInJwtTokenProvider {
|
|
16
6
|
private wrapped?;
|
|
17
7
|
private _currentUserSubject;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { BehaviorSubject } from 'rxjs';
|
|
2
2
|
export class WardenDelegatingCurrentUserProvidingUserServiceEventProcessingProvider {
|
|
3
|
+
wrapped;
|
|
4
|
+
_currentUserSubject = new BehaviorSubject(null);
|
|
3
5
|
constructor(wrapped) {
|
|
4
6
|
this.wrapped = wrapped;
|
|
5
|
-
this._currentUserSubject = new BehaviorSubject(null);
|
|
6
7
|
}
|
|
7
8
|
fetchCurrentLoggedInJwtToken() {
|
|
8
9
|
return this?._currentUserSubject?.getValue()?.jwtToken;
|
|
@@ -1,21 +1,15 @@
|
|
|
1
|
-
import { WardenUserServiceOptions } from './provider/warden-user-service-options';
|
|
2
|
-
import { WardenLoggedInUserWrapper } from './provider/warden-logged-in-user-wrapper';
|
|
3
|
-
import { WardenContact } from '../common/model/warden-contact';
|
|
4
|
-
import { WardenJwtToken } from '../common/model/warden-jwt-token';
|
|
5
|
-
import { WardenLoginResults } from '../common/model/warden-login-results';
|
|
6
|
-
import { WardenEntrySummary } from '../common/model/warden-entry-summary';
|
|
7
|
-
/**
|
|
8
|
-
* A service that handles logging in, saving the current user, watching
|
|
9
|
-
* for expiration, auto-refreshing the token, wrapped around a
|
|
10
|
-
* warden-client.
|
|
11
|
-
*
|
|
12
|
-
* T is the type of user object contained in the
|
|
13
|
-
*/
|
|
1
|
+
import { WardenUserServiceOptions } from './provider/warden-user-service-options.js';
|
|
2
|
+
import { WardenLoggedInUserWrapper } from './provider/warden-logged-in-user-wrapper.js';
|
|
3
|
+
import { WardenContact } from '../common/model/warden-contact.js';
|
|
4
|
+
import { WardenJwtToken } from '../common/model/warden-jwt-token.js';
|
|
5
|
+
import { WardenLoginResults } from '../common/model/warden-login-results.js';
|
|
6
|
+
import { WardenEntrySummary } from '../common/model/warden-entry-summary.js';
|
|
14
7
|
export declare class WardenUserService<T> {
|
|
15
8
|
private options;
|
|
16
9
|
private loggedInTimerSubscription;
|
|
17
10
|
private _autoRefreshEnabled;
|
|
18
11
|
constructor(options: WardenUserServiceOptions<T>);
|
|
12
|
+
cleanShutDown(): void;
|
|
19
13
|
get serviceOptions(): WardenUserServiceOptions<T>;
|
|
20
14
|
createAccount(contact: WardenContact, sendCode?: boolean, label?: string, tags?: string[]): Promise<string>;
|
|
21
15
|
addContactToLoggedInUser(contact: WardenContact): Promise<boolean>;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { Logger } from '@bitblit/ratchet-common';
|
|
1
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
2
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
3
|
+
import { JwtRatchet } from '@bitblit/ratchet-common/lib/jwt/jwt-ratchet.js';
|
|
2
4
|
import { timer } from 'rxjs';
|
|
3
|
-
import jwt_decode from 'jwt-decode';
|
|
4
|
-
import { StringRatchet } from '@bitblit/ratchet-common';
|
|
5
5
|
export class WardenUserService {
|
|
6
|
+
options;
|
|
7
|
+
loggedInTimerSubscription;
|
|
8
|
+
_autoRefreshEnabled = false;
|
|
6
9
|
constructor(options) {
|
|
7
10
|
this.options = options;
|
|
8
|
-
this._autoRefreshEnabled = false;
|
|
9
11
|
Logger.info('Initializing user service');
|
|
10
12
|
const stored = this.options.loggedInUserProvider.fetchLoggedInUserWrapper();
|
|
11
13
|
if (WardenUserService.wrapperIsExpired(stored)) {
|
|
@@ -18,6 +20,11 @@ export class WardenUserService {
|
|
|
18
20
|
const timerSeconds = this.options.loginCheckTimerPingSeconds || 2.5;
|
|
19
21
|
this.loggedInTimerSubscription = timer(0, timerSeconds * 1000).subscribe((t) => this.checkForAutoLogoutOrRefresh(t));
|
|
20
22
|
}
|
|
23
|
+
cleanShutDown() {
|
|
24
|
+
if (this.loggedInTimerSubscription) {
|
|
25
|
+
this.loggedInTimerSubscription.unsubscribe();
|
|
26
|
+
}
|
|
27
|
+
}
|
|
21
28
|
get serviceOptions() {
|
|
22
29
|
return this.options;
|
|
23
30
|
}
|
|
@@ -126,7 +133,7 @@ export class WardenUserService {
|
|
|
126
133
|
}
|
|
127
134
|
else {
|
|
128
135
|
Logger.info('updateLoggedInUserFromTokenString : %s', token);
|
|
129
|
-
const parsed =
|
|
136
|
+
const parsed = JwtRatchet.decodeTokenNoVerify(token);
|
|
130
137
|
if (parsed) {
|
|
131
138
|
rval = {
|
|
132
139
|
userObject: parsed,
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { WardenUserService } from './warden-user-service.js';
|
|
2
|
+
import { JestRatchet } from '@bitblit/ratchet-jest/lib/jest/jest-ratchet.js';
|
|
3
|
+
import { jest } from '@jest/globals';
|
|
4
|
+
describe('#wardenUserService', function () {
|
|
5
|
+
it('should instantiate', async () => {
|
|
6
|
+
const wuso = {
|
|
7
|
+
recentLoginProvider: JestRatchet.mock(jest.fn),
|
|
8
|
+
loggedInUserProvider: JestRatchet.mock(jest.fn),
|
|
9
|
+
wardenClient: JestRatchet.mock(jest.fn),
|
|
10
|
+
eventProcessor: JestRatchet.mock(jest.fn),
|
|
11
|
+
loginCheckTimerPingSeconds: 60,
|
|
12
|
+
autoLoginHandlingThresholdSeconds: 60,
|
|
13
|
+
allowAutoRefresh: true,
|
|
14
|
+
};
|
|
15
|
+
const wus = new WardenUserService(wuso);
|
|
16
|
+
expect(wus).not.toBeNull();
|
|
17
|
+
wus.cleanShutDown();
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { WebAuthnObjectWrapper } from './web-authn-object-wrapper';
|
|
2
|
-
import { WardenLoginResults } from '../model/warden-login-results';
|
|
3
|
-
import { WardenEntrySummary } from '../model/warden-entry-summary';
|
|
1
|
+
import { WebAuthnObjectWrapper } from './web-authn-object-wrapper.js';
|
|
2
|
+
import { WardenLoginResults } from '../model/warden-login-results.js';
|
|
3
|
+
import { WardenEntrySummary } from '../model/warden-entry-summary.js';
|
|
4
4
|
export interface WardenCommandResponse {
|
|
5
5
|
createAccount?: string;
|
|
6
6
|
generateWebAuthnAuthenticationChallengeForUserId?: WebAuthnObjectWrapper;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { CreateAccount } from './create-account';
|
|
2
|
-
import { WardenContact } from '../model/warden-contact';
|
|
3
|
-
import { WebAuthnObjectWrapper } from './web-authn-object-wrapper';
|
|
4
|
-
import { RemoveWebAuthnRegistration } from './remove-web-authn-registration';
|
|
5
|
-
import { WardenLoginRequest } from '../model/warden-login-request';
|
|
1
|
+
import { CreateAccount } from './create-account.js';
|
|
2
|
+
import { WardenContact } from '../model/warden-contact.js';
|
|
3
|
+
import { WebAuthnObjectWrapper } from './web-authn-object-wrapper.js';
|
|
4
|
+
import { RemoveWebAuthnRegistration } from './remove-web-authn-registration.js';
|
|
5
|
+
import { WardenLoginRequest } from '../model/warden-login-request.js';
|
|
6
6
|
export interface WardenCommand {
|
|
7
7
|
createAccount?: CreateAccount;
|
|
8
8
|
generateWebAuthnAuthenticationChallengeForUserId?: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WardenWebAuthnEntry } from './warden-web-authn-entry';
|
|
2
|
-
import { WardenContact } from './warden-contact';
|
|
1
|
+
import { WardenWebAuthnEntry } from './warden-web-authn-entry.js';
|
|
2
|
+
import { WardenContact } from './warden-contact.js';
|
|
3
3
|
export interface WardenEntry {
|
|
4
4
|
userId: string;
|
|
5
5
|
userLabel: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { WardenStoreRegistrationResponseType } from './warden-store-registration-response-type';
|
|
2
|
-
import { WardenEntry } from './warden-entry';
|
|
1
|
+
import { WardenStoreRegistrationResponseType } from './warden-store-registration-response-type.js';
|
|
2
|
+
import { WardenEntry } from './warden-entry.js';
|
|
3
3
|
export interface WardenStoreRegistrationResponse {
|
|
4
4
|
updatedEntry?: WardenEntry;
|
|
5
5
|
registrationResponseId: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WardenWebAuthnTransportFutureType } from './warden-web-authn-transport-future-type';
|
|
1
|
+
import { WardenWebAuthnTransportFutureType } from './warden-web-authn-transport-future-type.js';
|
|
2
2
|
export interface WardenWebAuthnEntry {
|
|
3
3
|
credentialIdBase64: string;
|
|
4
4
|
credentialPublicKeyBase64: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { WardenContact } from '../model/warden-contact';
|
|
2
|
-
import { WardenContactType } from '../model/warden-contact-type';
|
|
3
|
-
import { WardenEntrySummary } from '../model/warden-entry-summary';
|
|
4
|
-
import { WardenEntry } from '../model/warden-entry';
|
|
5
|
-
import { WardenLoginRequest } from '../model/warden-login-request';
|
|
6
|
-
import { WardenTeamRole } from '../model/warden-team-role';
|
|
1
|
+
import { WardenContact } from '../model/warden-contact.js';
|
|
2
|
+
import { WardenContactType } from '../model/warden-contact-type.js';
|
|
3
|
+
import { WardenEntrySummary } from '../model/warden-entry-summary.js';
|
|
4
|
+
import { WardenEntry } from '../model/warden-entry.js';
|
|
5
|
+
import { WardenLoginRequest } from '../model/warden-login-request.js';
|
|
6
|
+
import { WardenTeamRole } from '../model/warden-team-role.js';
|
|
7
7
|
export declare class WardenUtils {
|
|
8
8
|
constructor();
|
|
9
9
|
static extractContactsOfType(req: WardenEntry | WardenEntrySummary, type: WardenContactType): string[];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { WardenContactType } from '../model/warden-contact-type';
|
|
2
|
-
import { Logger
|
|
1
|
+
import { WardenContactType } from '../model/warden-contact-type.js';
|
|
2
|
+
import { Logger } from '@bitblit/ratchet-common/lib/logger/logger.js';
|
|
3
|
+
import { StringRatchet } from '@bitblit/ratchet-common/lib/lang/string-ratchet.js';
|
|
3
4
|
export class WardenUtils {
|
|
4
5
|
constructor() { }
|
|
5
6
|
static extractContactsOfType(req, type) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WardenContactType } from '../model/warden-contact-type.js';
|
|
2
|
+
import { WardenUtils } from './warden-utils.js';
|
|
3
|
+
describe('#WardenUtils', () => {
|
|
4
|
+
it('Should convert a string to a contact type', async () => {
|
|
5
|
+
const output = WardenUtils.stringToWardenContact('test@test.com');
|
|
6
|
+
expect(output).not.toBeNull();
|
|
7
|
+
expect(output.value).toEqual('test@test.com');
|
|
8
|
+
expect(output.type).toEqual(WardenContactType.EmailAddress);
|
|
9
|
+
});
|
|
10
|
+
});
|
package/lib/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/lib/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitblit/ratchet-warden-common",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.103-alpha",
|
|
4
4
|
"description": "Typescript library to simplify using simplewebauthn and secondary auth methods over GraphQL",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"bin": {},
|
|
7
|
-
"
|
|
8
|
-
"module": "
|
|
9
|
-
"types": "./dist/types/index.d.ts",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"module": "index.js",
|
|
10
9
|
"files": [
|
|
11
|
-
"
|
|
12
|
-
"
|
|
10
|
+
"lib/*",
|
|
11
|
+
"bin/*"
|
|
13
12
|
],
|
|
14
13
|
"contributors": [
|
|
15
14
|
"Christopher Weiss <bitblit@gmail.com>"
|
|
@@ -27,16 +26,14 @@
|
|
|
27
26
|
"config": {},
|
|
28
27
|
"scripts": {
|
|
29
28
|
"watch": "tsc-watch",
|
|
30
|
-
"clean": "shx rm -Rf
|
|
31
|
-
"test": "jest",
|
|
29
|
+
"clean": "shx rm -Rf lib",
|
|
30
|
+
"test": "cross-env NODE_OPTIONS=--experimental-vm-modules jest",
|
|
32
31
|
"docs": "typedoc",
|
|
33
32
|
"lint": "eslint src/**/*.ts",
|
|
34
33
|
"lint-fix": "eslint --fix src/**/*.ts",
|
|
35
|
-
"
|
|
36
|
-
"
|
|
37
|
-
"build
|
|
38
|
-
"build:es": "tsc -p tsconfig.es.json",
|
|
39
|
-
"build:types": "tsc -p tsconfig.types.json"
|
|
34
|
+
"__generate-barrels": "barrelsby -q --delete -d src -e .*\\.spec\\.ts",
|
|
35
|
+
"__build": "yarn run generate-barrels && tsc",
|
|
36
|
+
"build": "tsc"
|
|
40
37
|
},
|
|
41
38
|
"repository": {
|
|
42
39
|
"type": "git",
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.RatchetWardenCommonInfo = void 0;
|
|
4
|
-
class RatchetWardenCommonInfo {
|
|
5
|
-
constructor() { }
|
|
6
|
-
static buildInformation() {
|
|
7
|
-
const val = {
|
|
8
|
-
version: 'LOCAL-SNAPSHOT',
|
|
9
|
-
hash: 'LOCAL-HASH',
|
|
10
|
-
branch: 'LOCAL-BRANCH',
|
|
11
|
-
tag: 'LOCAL-TAG',
|
|
12
|
-
timeBuiltISO: 'LOCAL-TIME-ISO',
|
|
13
|
-
notes: 'LOCAL-NOTES',
|
|
14
|
-
};
|
|
15
|
-
return val;
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
exports.RatchetWardenCommonInfo = RatchetWardenCommonInfo;
|