UNPKG

@bitblit/ratchet-warden-server

Version:

Typescript library to simplify using simplewebauthn and secondary auth methods over GraphQL

42 lines 1.21 kB
import { StringRatchet } from "@bitblit/ratchet-common/lang/string-ratchet"; export class WardenEntryBuilder { _entry; constructor(label) { const guid = StringRatchet.createShortUid(); const now = Date.now(); this._entry = { userId: guid, userLabel: label || 'User ' + guid, contactMethods: [], tags: [], webAuthnAuthenticators: [], thirdPartyAuthenticators: [], createdEpochMS: now, updatedEpochMS: now, }; } withTags(tags) { this._entry.tags = tags ?? []; return this; } withThirdPartyAuthentication(thirdPartyAuthenticators) { this._entry.thirdPartyAuthenticators = thirdPartyAuthenticators ?? []; return this; } withLabel(label) { this._entry.userLabel = label; return this; } withLabelFromContact(contact) { this._entry.userLabel = contact.value; return this; } withContacts(contacts) { this._entry.contactMethods = contacts ?? []; return this; } get entry() { return this._entry; } } //# sourceMappingURL=warden-entry-builder.js.map