@@ -152,7 +152,7 @@ + (OTPAuthURL *)ease_authURLWithKeychainDictionary:(NSDictionary *)dict{
152152 OTPAuthURL *authURL = [self authURLWithKeychainDictionary: dict];
153153 if (authURL) {
154154 NSString *secAttrAccount = dict[(__bridge id )kSecAttrAccount ];
155- if (![secAttrAccount isEqualToString: authURL.name]) {
155+ if (secAttrAccount && ![secAttrAccount isEqualToString: authURL.name]) {
156156 authURL.name = secAttrAccount;
157157 }
158158 }
@@ -165,7 +165,7 @@ + (OTPAuthURL *)authURLWithKeychainDictionary:(NSDictionary *)dict {
165165 NSString *urlString = [[NSString alloc ] initWithData: urlData
166166 encoding: NSUTF8StringEncoding];
167167 NSString *issuer = dict[(__bridge id )kSecAttrType ];
168- if (issuer. length > 0 ) {
168+ if (issuer) {
169169 urlString = [urlString stringByAppendingFormat: @" %@ =%@ " , kQueryIssuerKey , issuer];
170170 }
171171 NSURL *url = [NSURL URLWithString: urlString];
@@ -211,11 +211,11 @@ - (BOOL)saveToKeychain {
211211 attributes[(__bridge id )kSecClass ] = (__bridge id )kSecClassGenericPassword ;
212212 attributes[(__bridge id )kSecReturnPersistentRef ] = (id )kCFBooleanTrue ;
213213 attributes[(__bridge id )kSecAttrService ] = kOTPService ;
214-
214+ attributes[(__bridge id ) kSecAttrAccount ] = self. name ;
215215
216216 attributes[(__bridge id )kSecAttrGeneric ] = urlData;
217217 attributes[(__bridge id )kSecValueData ] = self.generator .secret ;
218- if (self.issuer . length > 0 ) {
218+ if (self.issuer ) {
219219 attributes[(__bridge id )kSecAttrType ] = self.issuer ;
220220 }
221221
@@ -244,7 +244,7 @@ - (BOOL)hotpUpdateToKeychain{
244244}
245245
246246- (BOOL )removeFromKeychain {
247- if (self.name . length > 0 ) {
247+ if (self.name ) {
248248 NSDictionary *query = [self keychainQuery ];
249249 OSStatus status = SecItemDelete ((__bridge CFDictionaryRef)query);
250250 OTPDevLog (@" SecItemDelete(%@ ) = %d " , query, (int )status);
0 commit comments