getPasskeys
The getPasskeys function enables your app to get a list of all passkeys currently bound to the device, for example to create a user experience for selecting a passkey.
Dependencies​
The getPasskeys function requires the Beyond Identity SDK.
- JavaScript
- Kotlin
- Swift
- React Native
- Flutter
yarn add @beyondidentity/bi-sdk-js
or
npm install @beyondidentity/bi-sdk-js
Gradle​
To enable the retrieval of Cloudsmith hosted packages via Gradle, we need to add the Cloudsmith repository to
the root/build.gradle file.
repositories {
    maven {
        url "https://packages.beyondidentity.com/public/bi-sdk-android/maven/"
    }
}
After the repository is added, we can specify the Beyond Identity dependencies.
dependencies {
    implementation 'com.beyondidentity.android.sdk:embedded:[version]'
}
Swift Package Manager​
From Xcode​
- From the Xcode Filemenu, selectAdd Packagesand add the following url:
https://github.com/gobeyondidentity/bi-sdk-swift
- Select a version and hit Next.
- Select a target matching the SDK you wish to use.
From Package.swift​
- With Swift Package Manager,
add the following dependencyto yourPackage.swift:
dependencies: [
    .package(url: "https://github.com/gobeyondidentity/bi-sdk-swift.git", from: [version])
]
- Run swift build
Cocoapods​
Add the pod to your Podfile:
pod 'BeyondIdentityEmbedded'
And then run:
pod install
After installing import with
import BeyondIdentityEmbedded
Using react-native init or an expo app.​
- react-native init
- expo
Install the SDK with yarn or npm:
yarn add @beyondidentity/bi-sdk-react-native
npm install @beyondidentity/bi-sdk-react-native
Update native requirements in your ios and android folders:
iOS​
Make sure your ios/Podfile supports "minimum deployment target" 13.0 or later
platform :ios, '13.0'
Navigate to your ios folder and run:
cd ios && pod install
Android​
Make sure your android/build.gradle supports minSdkVersion 26 or later
buildscript {
  ext {
    minSdkVersion = 26
  }
}
Add the following maven url to your repositories in your android/build.gradle
allprojects {
  repositories {
    maven {
      url "https://packages.beyondidentity.com/public/bi-sdk-android/maven/"
    }
  }
}
This package requires custom native code and can be used with Development builds or prebuild and cannot be used with Expo Go.
npx expo install @beyondidentity/bi-sdk-react-native
Add the SDK config plugin to the plugins array of your app.{json,config.js,config.ts}:
{
  "expo": {
    "plugins": [["@beyondidentity/bi-sdk-react-native"]]
  }
}
The SDK requires certain minimum native versions. Set these requirments with expo-build-properties.
npx expo install expo-build-properties
{
  "expo": {
    "plugins": [
      ["@beyondidentity/bi-sdk-react-native"],
      [
        "expo-build-properties",
        {
          "android": {
            "minSdkVersion": 26
          },
          "ios": {
            "deploymentTarget": "13.0"
          }
        }
      ]
    ]
  }
}
Finally, rebuild your app as described in Expo's Adding custom native code guide.
Pub.Dev​
Add the Beyond Identity Embedded SDK to your dependencies
dependencies:
  bi_sdk_flutter: x.y.z
and run an implicit flutter pub get.
Update Android​
Please make sure your android/build.gradle supports minSdkVersion 26 or later.
buildscript {
  ext {
    minSdkVersion = 26
  }
}
Update iOS​
Please make sure your project supports "minimum deployment target" 13.0 or later.
In your ios/Podfile set:
platform :ios, '13.0'
Prerequisites​
Before making a call to getPasskeys, you must complete the following prerequisite calls:
- Import the required types and functions from the SDK. - JavaScript
- Kotlin
- Swift
- React Native
- Flutter
 - import { Embedded } from '@beyondidentity/bi-sdk-js';- import com.beyondidentity.embedded.sdk.EmbeddedSdk- import BeyondIdentityEmbedded- import { Embedded } from '@beyondidentity/bi-sdk-react-native';- import 'package:bi_sdk_flutter/embeddedsdk.dart';
- Initialize the SDK. - JavaScript
- Kotlin
- Swift
- React Native
- Flutter
 - // --- Initialize with required arguments
 try {
 const embedded = await Embedded.initialize();
 console.log("Initialization successful", embedded);
 } catch (error) {
 console.error("Initialization failed:", error);
 }
 // --- Initialize with required and optional arguments
 const config = {
 allowedDomains: ["example.com", "another-example.com"],
 logger: function (logType, message) {
 console.log(`[${logType}] ${message}`);
 },
 };
 try {
 const embedded = await Embedded.initialize(config);
 console.log("Initialization successful", embedded);
 } catch (error) {
 console.error("Initialization failed:", error);
 }- // --- Initialize with required arguments
 EmbeddedSdk.init(
 app = this,
 keyguardPrompt = { allowCallback ->
 // launch the keyguard service and then
 // call allowCallback with the result
 },
 logger = { logMessage ->
 Log.d("BeyondIdentityLog", logMessage)
 }
 )
 // --- Initialize with required and optional arguments
 EmbeddedSdk.init(
 app = this,
 keyguardPrompt = { allowCallback ->
 // launch the keyguard service and then
 // call allowCallback with the result
 },
 logger = { logMessage ->
 Log.d("BeyondIdentityLog", logMessage)
 },
 biometricAskPrompt = getString(R.string.embedded_export_biometric_prompt_title),
 allowedDomains = listOf("example.com", "another-example.com")
 )- // --- Initialize with required arguments
 Embedded.shared.initialize(
 biometricAskPrompt: "Please provide your biometric"
 ) { result in
 switch result {
 case .success():
 print("Initialization successful")
 case .failure(let error):
 print("Initialization failed: \(error)")
 }
 }
 // --- Initialize with required and optional arguments
 Embedded.shared.initialize(
 allowedDomains: ["example.com", "another-example.com"],
 biometricAskPrompt: "Please provide your biometric",
 logger: { (logType, message) in
 print("\(logType): \(message)")
 }
 ) { result in
 switch result {
 case .success():
 print("Initialization successful")
 case .failure(let error):
 print("Initialization failed: \(error)")
 }
 }- // --- Initialize with required arguments
 try {
 const response = await Embedded.initialize("Please provide your biometric");
 console.log(response);
 } catch (error) {
 console.error("Initialization failed:", error);
 }
 // --- Initialize with required and optional arguments
 try {
 const response = await Embedded.initialize(
 "Please provide your biometric", [
 ("example.com", "another-example.com"),
 ]);
 console.log(response);
 Embedded.logEventEmitter.addListener(
 "BeyondIdentityLogger",
 (message: string) => {
 console.log(message);
 }
 );
 } catch (error) {
 console.error("Initialization failed:", error);
 }- // --- Initialize with required arguments
 EmbeddedSdk.initialize('Please provide your biometric');
 // --- Initialize with required and optional arguments
 EmbeddedSdk.initialize(
 'Please provide your biometric',
 allowedDomains: ["example.com", "another-example.com"],
 logger: EmbeddedSdk.enableLogger
 ).then(() {
 print('Initialization successful');
 }).catchError((error) {
 print('Initialization failed: $error');
 });
Parameters​
none
Returns​
Upon success, returns an array/list of Passkey.
Examples​
Example: Call getPasskeys and surface the list to the user to select a passkey​
- JavaScript
- Kotlin
- Swift
- React Native
- Flutter
const allPasskeys = await embedded.getPasskeys();
EmbeddedSdk.getPasskeys() { result ->
    result.onSuccess { }
    result.onFailure { }
}
Embedded.shared.getPasskeys { result in
    switch result {
    case .success(let passkeys):
        print("Passkeys: \(passkeys)")
    case .failure(let error):
        print("Error fetching passkeys: \(error.localizedDescription)")
    }
}
const passkeys = await Embedded.getPasskeys();
List<Passkey> passkeys = await EmbeddedSdk.getPasskeys();