mirror of https://github.com/oxen-io/session-ios
				
				
				
			
			You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
	
	
		
			98 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Swift
		
	
		
		
			
		
	
	
			98 lines
		
	
	
		
			3.4 KiB
		
	
	
	
		
			Swift
		
	
| 
											4 years ago
										 | // Copyright © 2022 Rangeproof Pty Ltd. All rights reserved. | ||
|  | 
 | ||
|  | import Foundation | ||
|  | import Sodium | ||
|  | import SessionSnodeKit | ||
|  | import SessionUtilitiesKit | ||
|  | 
 | ||
| 
											3 years ago
										 | public class SMKDependencies: Dependencies { | ||
| 
											4 years ago
										 |     internal var _onionApi: OnionRequestAPIType.Type? | ||
| 
											4 years ago
										 |     public var onionApi: OnionRequestAPIType.Type { | ||
| 
											4 years ago
										 |         get { Dependencies.getValueSettingIfNull(&_onionApi) { OnionRequestAPI.self } } | ||
| 
											4 years ago
										 |         set { _onionApi = newValue } | ||
| 
											4 years ago
										 |     } | ||
|  |      | ||
| 
											4 years ago
										 |     internal var _sodium: SodiumType? | ||
| 
											4 years ago
										 |     public var sodium: SodiumType { | ||
| 
											4 years ago
										 |         get { Dependencies.getValueSettingIfNull(&_sodium) { Sodium() } } | ||
| 
											4 years ago
										 |         set { _sodium = newValue } | ||
|  |     } | ||
|  |      | ||
| 
											4 years ago
										 |     internal var _box: BoxType? | ||
|  |     public var box: BoxType { | ||
|  |         get { Dependencies.getValueSettingIfNull(&_box) { sodium.getBox() } } | ||
|  |         set { _box = newValue } | ||
|  |     } | ||
|  |      | ||
|  |     internal var _genericHash: GenericHashType? | ||
|  |     public var genericHash: GenericHashType { | ||
|  |         get { Dependencies.getValueSettingIfNull(&_genericHash) { sodium.getGenericHash() } } | ||
|  |         set { _genericHash = newValue } | ||
| 
											4 years ago
										 |     } | ||
|  |      | ||
| 
											4 years ago
										 |     internal var _sign: SignType? | ||
| 
											4 years ago
										 |     public var sign: SignType { | ||
| 
											4 years ago
										 |         get { Dependencies.getValueSettingIfNull(&_sign) { sodium.getSign() } } | ||
| 
											4 years ago
										 |         set { _sign = newValue } | ||
|  |     } | ||
|  |      | ||
| 
											4 years ago
										 |     internal var _aeadXChaCha20Poly1305Ietf: AeadXChaCha20Poly1305IetfType? | ||
|  |     public var aeadXChaCha20Poly1305Ietf: AeadXChaCha20Poly1305IetfType { | ||
|  |         get { Dependencies.getValueSettingIfNull(&_aeadXChaCha20Poly1305Ietf) { sodium.getAeadXChaCha20Poly1305Ietf() } } | ||
|  |         set { _aeadXChaCha20Poly1305Ietf = newValue } | ||
| 
											4 years ago
										 |     } | ||
|  |      | ||
| 
											4 years ago
										 |     internal var _ed25519: Ed25519Type? | ||
| 
											4 years ago
										 |     public var ed25519: Ed25519Type { | ||
| 
											4 years ago
										 |         get { Dependencies.getValueSettingIfNull(&_ed25519) { Ed25519Wrapper() } } | ||
| 
											4 years ago
										 |         set { _ed25519 = newValue } | ||
|  |     } | ||
|  |      | ||
| 
											4 years ago
										 |     internal var _nonceGenerator16: NonceGenerator16ByteType? | ||
| 
											4 years ago
										 |     public var nonceGenerator16: NonceGenerator16ByteType { | ||
| 
											4 years ago
										 |         get { Dependencies.getValueSettingIfNull(&_nonceGenerator16) { OpenGroupAPI.NonceGenerator16Byte() } } | ||
| 
											4 years ago
										 |         set { _nonceGenerator16 = newValue } | ||
|  |     } | ||
|  |      | ||
| 
											4 years ago
										 |     internal var _nonceGenerator24: NonceGenerator24ByteType? | ||
| 
											4 years ago
										 |     public var nonceGenerator24: NonceGenerator24ByteType { | ||
| 
											4 years ago
										 |         get { Dependencies.getValueSettingIfNull(&_nonceGenerator24) { OpenGroupAPI.NonceGenerator24Byte() } } | ||
| 
											4 years ago
										 |         set { _nonceGenerator24 = newValue } | ||
|  |     } | ||
|  |      | ||
|  |     // MARK: - Initialization | ||
|  |      | ||
|  |     public init( | ||
| 
											4 years ago
										 |         onionApi: OnionRequestAPIType.Type? = nil, | ||
| 
											4 years ago
										 |         generalCache: Atomic<GeneralCacheType>? = nil, | ||
| 
											3 years ago
										 |         storage: GRDBStorage? = nil, | ||
| 
											4 years ago
										 |         sodium: SodiumType? = nil, | ||
| 
											4 years ago
										 |         box: BoxType? = nil, | ||
| 
											4 years ago
										 |         genericHash: GenericHashType? = nil, | ||
| 
											4 years ago
										 |         sign: SignType? = nil, | ||
|  |         aeadXChaCha20Poly1305Ietf: AeadXChaCha20Poly1305IetfType? = nil, | ||
| 
											4 years ago
										 |         ed25519: Ed25519Type? = nil, | ||
| 
											4 years ago
										 |         nonceGenerator16: NonceGenerator16ByteType? = nil, | ||
|  |         nonceGenerator24: NonceGenerator24ByteType? = nil, | ||
|  |         standardUserDefaults: UserDefaultsType? = nil, | ||
|  |         date: Date? = nil | ||
|  |     ) { | ||
| 
											4 years ago
										 |         _onionApi = onionApi | ||
| 
											4 years ago
										 |         _sodium = sodium | ||
| 
											4 years ago
										 |         _box = box | ||
| 
											4 years ago
										 |         _genericHash = genericHash | ||
| 
											4 years ago
										 |         _sign = sign | ||
|  |         _aeadXChaCha20Poly1305Ietf = aeadXChaCha20Poly1305Ietf | ||
| 
											4 years ago
										 |         _ed25519 = ed25519 | ||
|  |         _nonceGenerator16 = nonceGenerator16 | ||
|  |         _nonceGenerator24 = nonceGenerator24 | ||
| 
											4 years ago
										 |          | ||
| 
											3 years ago
										 |         super.init( | ||
|  |             generalCache: generalCache, | ||
|  |             storage: storage, | ||
|  |             standardUserDefaults: standardUserDefaults, | ||
|  |             date: date | ||
|  |         ) | ||
| 
											4 years ago
										 |     } | ||
|  | } |