You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
pEpObjCAdapter/PublicHeaders/PEPPassphraseProviderProtoc...

58 lines
2.3 KiB

//
// PEPPassphraseProviderProtocol.h
// PEPObjCAdapterFramework
//
// Created by Dirk Zimmermann on 08.07.20.
// Copyright © 2020 p≡p. All rights reserved.
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// Delegate methods that an app can utilize to provide passphrases to the adapter after
/// asking the user.
///
/// If this delegate (passphrase provider) exists (see `+ [PEPObjCAdapter passphraseProvider]`),
/// then any supported engine call that returns the engine equivalent of
/// PEPStatusPassphraseRequired or PEPStatusWrongPassphrase
/// leads to an invocation of the delegate, which then can indicate the user's respone
/// via the given callback.
///
/// If no passphrase provider exists, the error status is thrown directly to
/// the caller.
typedef void (^PEPPassphraseProviderCallback)(NSString * _Nullable passphrase);
@protocol PEPPassphraseProviderProtocol <NSObject>
/// Called by the adapter when the engine signals PEPStatusPassphraseRequired.
///
/// See `PEPPassphraseProviderProtocol` for a general description.
///
/// @param completion Callback that either retries the engine call that lead
/// to the adapter calling into the PEPPassphraseProviderProtocol delegate,
/// or, if the given passphrase is nil, return the error to the caller.
- (void)passphraseRequired:(PEPPassphraseProviderCallback)completion;
/// Called by the adapter when the engine signals PEPStatusWrongPassphrase.
///
/// See `PEPPassphraseProviderProtocol` for a general description.
///
/// @param completion Callback that either retries the engine call that lead
/// to the adapter calling into the PEPPassphraseProviderProtocol delegate,
/// or, if the given passphrase is nil, return the error to the caller.
- (void)wrongPassphrase:(PEPPassphraseProviderCallback)completion;
/// Signals that the passphrase indicated by the callback in one of the calls of
/// this delegate was too long and cannot be used.
///
/// See `PEPPassphraseProviderProtocol` for a general description.
///
/// @param completion Callback that either retries the engine call that lead
/// to the adapter calling into the PEPPassphraseProviderProtocol delegate,
/// or, if the given passphrase is nil, return the error to the caller.
- (void)passphraseTooLong:(PEPPassphraseProviderCallback)completion;
@end
NS_ASSUME_NONNULL_END