@bitblit/ratchet-warden-server
Version:
Typescript library to simplify using simplewebauthn and secondary auth methods over GraphQL
51 lines (50 loc) • 3.07 kB
TypeScript
import { DynamoRatchet } from '@bitblit/ratchet-aws/dynamodb/dynamo-ratchet';
import { WardenDynamoStorageProviderOptions } from './warden-dynamo-storage-provider-options.js';
import { WardenContact } from '@bitblit/ratchet-warden-common/common/model/warden-contact';
import { WardenEntry } from '@bitblit/ratchet-warden-common/common/model/warden-entry';
import { WardenEntrySummary } from '@bitblit/ratchet-warden-common/common/model/warden-entry-summary';
import { ExpiringCodeProvider } from '@bitblit/ratchet-aws/expiring-code/expiring-code-provider';
import { ExpiringCode } from '@bitblit/ratchet-aws/expiring-code/expiring-code';
import { WardenStorageProvider } from "./warden-storage-provider.js";
import { WardenUserDecorationProvider } from "./warden-user-decoration-provider.js";
import { WardenUserDecoration } from "@bitblit/ratchet-warden-common/common/model/warden-user-decoration";
import { WardenTeamRoleMapping } from "@bitblit/ratchet-warden-common/common/model/warden-team-role-mapping";
export declare class WardenDynamoStorageProvider<T> implements WardenStorageProvider, ExpiringCodeProvider, WardenUserDecorationProvider<T> {
private ddb;
private options;
private static readonly EXPIRING_CODE_PROVIDER_KEY;
constructor(ddb: DynamoRatchet, options: WardenDynamoStorageProviderOptions<T>);
createDecoration(decoration: T): WardenUserDecoration<T>;
updateRoles(userId: string, roles: WardenTeamRoleMapping[]): Promise<WardenUserDecoration<T>>;
updateTokenExpirationSeconds(userId: string, newValue: number): Promise<WardenUserDecoration<T>>;
updateDecoration(userId: string, decoration: T): Promise<WardenUserDecoration<T>>;
fetchDecoration(wardenUser: WardenEntry): Promise<WardenUserDecoration<T>>;
fetchDecorationById(userId: string): Promise<WardenUserDecoration<T>>;
private fetchExpiringCodes;
private updateInternal;
checkCode(code: string, context: string, deleteOnMatch?: boolean): Promise<boolean>;
storeCode(code: ExpiringCode): Promise<boolean>;
private static contactToSearchString;
private static thirdPartyToSearchString;
private fetchInternalByUserId;
fetchCurrentUserChallenge(userId: string, relyingPartyId: string): Promise<string>;
findEntryByThirdPartyId(thirdParty: string, thirdPartyId: string): Promise<WardenEntry>;
findEntryByContact(contact: WardenContact): Promise<WardenEntry>;
findEntryById(userId: string): Promise<WardenEntry>;
listUserSummaries(): Promise<WardenEntrySummary[]>;
removeEntry(userId: string): Promise<boolean>;
saveEntry(entry: WardenEntry): Promise<WardenEntry>;
updateUserChallenge(userId: string, relyingPartyId: string, challenge: string): Promise<boolean>;
}
export interface WardenDynamoStorageDataWrapper {
userId: string;
entry: WardenEntry;
decoration: WardenUserDecoration<any>;
currentUserChallenges: string[];
contactSearchString: string;
thirdPartySearchString: string;
}
export interface ExpiringCodeHolder {
userId: string;
values: ExpiringCode[];
}