import { RootKeyInterface } from '@standardnotes/models'; import { DiskStorageService } from '../Storage/DiskStorageService'; import { AbstractService, ChallengeServiceInterface, InternalEventBusInterface, Challenge, ChallengeArtifacts, ChallengeReason, ChallengeValue, ChallengeInterface, ChallengePromptInterface, EncryptionService, ChallengeObserver } from '@standardnotes/services'; import { ChallengeResponse } from './ChallengeResponse'; type ChallengeValidationResponse = { valid: boolean; artifacts?: ChallengeArtifacts; }; /** * The challenge service creates, updates and keeps track of running challenge operations. */ export declare class ChallengeService extends AbstractService implements ChallengeServiceInterface { private storageService; private encryptionService; protected internalEventBus: InternalEventBusInterface; private challengeOperations; sendChallenge: (challenge: Challenge) => void; private challengeObservers; constructor(storageService: DiskStorageService, encryptionService: EncryptionService, internalEventBus: InternalEventBusInterface); deinit(): void; promptForChallengeResponse(challenge: Challenge): Promise; createChallenge(prompts: ChallengePromptInterface[], reason: ChallengeReason, cancelable: boolean, heading?: string, subheading?: string): ChallengeInterface; validateChallengeValue(value: ChallengeValue): Promise; promptForCorrectPasscode(reason: ChallengeReason): Promise; promptForAccountPassword(): Promise; /** * Returns the wrapping key for operations that require resaving the root key * (changing the account password, signing in, registering, or upgrading protocol) * Returns empty object if no passcode is configured. * Otherwise returns {cancled: true} if the operation is canceled, or * {wrappingKey} with the result. * @param passcode - If the consumer already has access to the passcode, * they can pass it here so that the user is not prompted again. */ getWrappingKeyIfApplicable(passcode?: string): Promise<{ canceled?: undefined; wrappingKey?: undefined; } | { canceled: boolean; wrappingKey?: undefined; } | { wrappingKey: RootKeyInterface; canceled?: undefined; }>; addChallengeObserver(challenge: Challenge, observer: ChallengeObserver): () => void; private createOrGetChallengeOperation; private performOnObservers; private onChallengeValidValue; private onChallengeInvalidValue; private onChallengeNonvalidatedSubmit; private onChallengeComplete; private onChallengeCancel; private getChallengeOperation; private deleteChallengeOperation; cancelChallenge(challenge: Challenge): void; completeChallenge(challenge: Challenge): void; submitValuesForChallenge(challenge: Challenge, values: ChallengeValue[]): Promise; setValidationStatusForChallenge(challenge: ChallengeInterface, value: ChallengeValue, valid: boolean, artifacts?: ChallengeArtifacts): void; } export {};