Skip to content

Commit

Permalink
fix: standarize hasInternetCredentials (#663)
Browse files Browse the repository at this point in the history
* fix: standarize hasInternetCredentials

* chore: improve types
  • Loading branch information
DorianMazur authored Oct 8, 2024
1 parent 5cb85cf commit df0ab79
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 8 deletions.
5 changes: 1 addition & 4 deletions android/src/main/java/com/oblador/keychain/KeychainModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,7 @@ class KeychainModule(reactContext: ReactApplicationContext) :
promise.resolve(false)
return
}
val results = Arguments.createMap()
results.putString(Maps.SERVICE, alias)
results.putString(Maps.STORAGE, resultSet.cipherStorageName)
promise.resolve(results)
promise.resolve(true)
}

@ReactMethod
Expand Down
6 changes: 2 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,17 +349,15 @@ export function getAllGenericPasswordServices(): Promise<string[]> {
*
* @param {string} server - The server URL.
*
* @returns {Promise<false | Result>} Resolves to an object containing `service` and `storage` when successful, or `false` if not found.
* @returns {Promise<boolean>} Resolves to `true` if internet credentials exist, otherwise `false`.
*
* @example
* ```typescript
* const hasCredentials = await Keychain.hasInternetCredentials('https://example.com');
* console.log('Internet credentials exist:', hasCredentials);
* ```
*/
export function hasInternetCredentials(
server: string
): Promise<false | Result> {
export function hasInternetCredentials(server: string): Promise<boolean> {
return RNKeychainManager.hasInternetCredentialsForServer(server);
}

Expand Down

0 comments on commit df0ab79

Please sign in to comment.