1//2// TOROnionAuth.h3// Tor4//5// Created by Benjamin Erhart on 29.09.21.6//78#import <Foundation/Foundation.h>9#import "TORAuthKey.h"1011NS_ASSUME_NONNULL_BEGIN1213/**14 Support for Onion v3 service authentication configuration files.15 */16NS_SWIFT_NAME(TorOnionAuth)17@interface TOROnionAuth : NSObject181920/**21 The directory where this instance expects the private key files to be in.22 */23@property (nonatomic, nullable, readonly) NSURL *privateUrl;2425/**26 The directory where this instance expects the public key files to be in.27 */28@property (nonatomic, nullable, readonly) NSURL *publicUrl;2930/**31 The found public and/or private keys in the base \c directory.3233 @see -directory34 */35@property (nonatomic, nonnull, readonly) NSArray<TORAuthKey *>*keys;363738/**39 Initialize with a given directory. Will immediately read all keys on disk.4041 If you have a lot of keys, you might want to do this in a background thread!4243 @param privateUrl The base directory where the key files live.44 Should be the same as you set in \c <ClientOnionAuthDir> for clients.4546 @param publicUrl The base directory where the key files live.47 Should be the same as you set in \c <HiddenServiceDir> for servers.4849 @see https://2019.www.torproject.org/docs/tor-manual.html.en#ClientOnionAuthDir5051 @see https://2019.www.torproject.org/docs/tor-manual.html.en#HiddenServiceDir5253 @see https://2019.www.torproject.org/docs/tor-manual.html.en#_client_authorization54 */55-(instancetype)initWithPrivateDirUrl:(nullable NSURL *)privateUrl andPublicDirUrl:(nullable NSURL *)publicUrl NS_SWIFT_NAME(init(withPrivateDir:andPublicDir:));5657/**58 Initialize with a given directory. Will immediately read all keys on disk.5960 If you have a lot of keys, you might want to do this in a background thread!6162 @param privatePath The base directory where the key files live.63 Should be the same as you set in \c <ClientOnionAuthDir> for clients.6465 @param publicPath The base directory where the key files live.66 Should be the same as you set in \c <HiddenServiceDir> for servers.6768 @see https://2019.www.torproject.org/docs/tor-manual.html.en#ClientOnionAuthDir6970 @see https://2019.www.torproject.org/docs/tor-manual.html.en#HiddenServiceDir7172 @see https://2019.www.torproject.org/docs/tor-manual.html.en#_client_authorization73 */74-(instancetype)initWithPrivateDir:(NSString *)privatePath andPublicDir:(NSString *)publicPath NS_SWIFT_NAME(init(withPrivateDir:andPublicDir:));757677/**78 Add an authentication key (public or private) to the configuration.7980 If a key with the same file name already exists, it will be overwritten. If not, it will be added at the end of the81 \c keys array.8283 @param key A new or modified key.8485 @returns \c YES on success, \c NO on failure.86*/87-(BOOL)set:(TORAuthKey *)key;8889/**90 Remove the key at the specified index.9192 @param idx The index of the key in \c keys.9394 @returns \c YES on success, \c NO on failure.95 */96-(BOOL)removeKeyAtIndex:(NSInteger)idx;979899@end100101NS_ASSUME_NONNULL_END