{"id":20037392,"url":"https://github.com/animo/expo-ausweis-sdk","last_synced_at":"2025-07-21T03:06:02.836Z","repository":{"id":246797640,"uuid":"823169428","full_name":"animo/expo-ausweis-sdk","owner":"animo","description":"ausweis-sdk","archived":false,"fork":false,"pushed_at":"2024-09-13T18:16:39.000Z","size":263,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-06-11T03:12:35.660Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"eupl-1.2","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/animo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-07-02T14:23:21.000Z","updated_at":"2025-04-22T10:56:12.000Z","dependencies_parsed_at":null,"dependency_job_id":"7cb67b92-f786-4ec4-adba-96b42d3cad17","html_url":"https://github.com/animo/expo-ausweis-sdk","commit_stats":null,"previous_names":["animo/expo-ausweis-sdk"],"tags_count":15,"template":false,"template_full_name":null,"purl":"pkg:github/animo/expo-ausweis-sdk","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/animo%2Fexpo-ausweis-sdk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/animo%2Fexpo-ausweis-sdk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/animo%2Fexpo-ausweis-sdk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/animo%2Fexpo-ausweis-sdk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/animo","download_url":"https://codeload.github.com/animo/expo-ausweis-sdk/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/animo%2Fexpo-ausweis-sdk/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266231915,"owners_count":23896492,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-13T10:19:18.798Z","updated_at":"2025-07-21T03:06:02.804Z","avatar_url":"https://github.com/animo.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n  \u003cpicture\u003e\n   \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://res.cloudinary.com/animo-solutions/image/upload/v1656578320/animo-logo-light-no-text_ok9auy.svg\"\u003e\n   \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://res.cloudinary.com/animo-solutions/image/upload/v1656578320/animo-logo-dark-no-text_fqqdq9.svg\"\u003e\n   \u003cimg alt=\"Animo Logo\" height=\"200px\" /\u003e\n  \u003c/picture\u003e\n\u003c/p\u003e\n\n\u003ch1 align=\"center\" \u003e\u003cb\u003eExpo - Ausweis SDK\u003c/b\u003e\u003c/h1\u003e\n\n\u003ch4 align=\"center\"\u003ePowered by \u0026nbsp; \n  \u003cpicture\u003e\n    \u003csource media=\"(prefers-color-scheme: light)\" srcset=\"https://res.cloudinary.com/animo-solutions/image/upload/v1656579715/animo-logo-light-text_cma2yo.svg\"\u003e\n    \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://res.cloudinary.com/animo-solutions/image/upload/v1656579715/animo-logo-dark-text_uccvqa.svg\"\u003e\n    \u003cimg alt=\"Animo Logo\" height=\"12px\" /\u003e\n  \u003c/picture\u003e\n\u003c/h4\u003e\u003cbr\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://typescriptlang.org\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/%3C%2F%3E-TypeScript-%230074c1.svg\" /\u003e\n  \u003c/a\u003e\n  \u003ca href=\"https://www.npmjs.com/package/@animo-id/expo-ausweis-sdk\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@animo-id/expo-ausweis-sdk\" /\u003e\n  \u003c/a\u003e\n  \u003ca\n    href=\"https://raw.githubusercontent.com/animo/expo-ausweis-sdk/main/LICENSE\"\n    \u003e\u003cimg\n      alt=\"License\"\n      src=\"https://img.shields.io/badge/License-EUPL%201.2-blue.svg\"\n  /\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"#getting-started\"\u003eGetting started\u003c/a\u003e \n  \u0026nbsp;|\u0026nbsp;\n  \u003ca href=\"#contributing\"\u003eContributing\u003c/a\u003e \n  \u0026nbsp;|\u0026nbsp;\n  \u003ca href=\"#contributing\"\u003eLicense\u003c/a\u003e \n\u003c/p\u003e\n\n---\n\nAn [Expo Module](https://docs.expo.dev/modules/overview/) and [Expo Config Plugin](https://docs.expo.dev/guides/config-plugins/) to automatically set up and configure the [Ausweis App SDK](https://www.ausweisapp.bund.de/sdk/intro.html) for iOS \u0026 Android in Expo apps.\n\n## Getting Started\n\nInstall the plugin and `expo-build-properties` using the following command. We need `expo-build-properties` to set the `minSdkVersion` for Android to at least 26, and enable `useLegacyPackaging` (see [App Bundle](https://www.ausweisapp.bund.de/sdk/android.html#app-bundle) in Ausweis SDK documentation).\n\n```sh\n# yarn\nyarn add @animo-id/expo-ausweis-sdk expo-build-properties\n\n# npm\nnpm install @animo-id/expo-ausweis-sdk expo-build-properties\n\n# npm\npnpm install @animo-id/expo-ausweis-sdk expo-build-properties\n```\n\nThen add the plugin to your Expo app config (`app.json`, `app.config.json` or `app.config.js`) `plugins` array:\n\n```json\n{\n  \"expo\": {\n    \"plugins\": [\n      \"@animo-id/expo-ausweis-sdk\",\n      [\n        \"expo-build-properties\",\n        {\n          \"android\": {\n            \"minSdkVersion\": 26,\n            \"useLegacyPackaging\": true\n          }\n        }\n      ]\n    ]\n  }\n}\n```\n\n\u003e NOTE: the `expo` top level key is only needed in `app.json`. In `app.config.json`, `app.config.js` and `app.config.ts` the top level expo key is not present anymore.\n\nAnd lastly, prebuild the application so the Ausweis SDK and Expo Module wrapper can be added as native dependency (If you aren't making any manual modification to the iOS and Android directories you can add them to the gitignore of your project and generate them on demand):\n\n```sh\n# yarn\nyarn expo prebuild\n\n# npm\nnpx expo prebuild\n```\n\nThat's it, you now have Ausweis App SDK configured for your iOS and Android project.\n\n## Usage\n\nYou can now import `@animo-id/expo-ausweis-sdk` in your application and use the methods from the SDK. \n\nYou can see the available [commands](https://www.ausweisapp.bund.de/sdk/commands.html#) and [messages](https://www.ausweisapp.bund.de/sdk/messages.html), which are typed in the `sendCommand` and `addMessageListener` methods.\n\n```tsx\nimport { useEffect, useState } from 'react'\nimport { initializeSdk, sendCommand, addMessageListener } from '@animo-id/expo-ausweis-sdk'\n\nexport function App() {\n  const [isSdkInitialized, setIsSdkInitialized] = useState(false)\n\n  // Setup listener\n  useEffect(\n    addMessageListener((message) =\u003e {\n      console.log('received message', JSON.stringify(message, null, 2))\n    }).remove,\n    []\n  )\n\n  // Initialize SDK\n  useEffect(() =\u003e {\n    initializeSdk()\n      .then(() =\u003e setIsSdkInitialized(true))\n      .catch((e) =\u003e {\n        console.log('error setting up', e)\n      })\n  }, [])\n\n  // Send command once SDK is initialized\n  useEffect(() =\u003e {\n    if (!isSdkInitialized) return\n\n    sendCommand({ cmd: 'GET_INFO' })\n  }, [isSdkInitialized])\n\n  return null\n}\n```\n\n### Auth Flow\n\nThe package also exports an `AusweisAuthFlow` class that wraps the required logic for a general auth flow. An example of how to use the class can be found below.\n\nTo use the `AusweisAuthFlow` you need to configure it with the correct callbacks, and then call the `start()` method with the `tcTokenUrl`.\n\nTo cancel the flow, you can call the `cancel()` flow on the `AusweisAuthFlow` instance.\n\nThe Ausweis SDK only allows one flow to be active concurrently. It is important that you do not create multiple instances of the `AusweisAuthFlow`, as they will both receive the same events and messages, and will cause conflicts.\n\nNote that this class is optimized for a simple auth flow and thus it may not fit all use cases. For example, the `SET_CAN` and `SET_PUK` commands are not supported (in case of too many failed PIN attempts). Attached simulator cards are also not supported. For more advanced use cases you can use the lower level commands and message listeners methods.\n\n```tsx\nimport { AusweisAuthFlow } from '@animo-id/expo-ausweis-sdk'\nimport { useState } from 'react'\nimport { Button, StyleSheet, Text, View } from 'react-native'\n\nexport default function App() {\n  const [message, setMessage] = useState\u003cstring\u003e()\n  const [flow, setFlow] = useState\u003cAusweisAuthFlow\u003e()\n\n  const [cardAttachRequested, setCardAttachRequested] = useState(false)\n  const [isCardAttached, setIsCardAttached] = useState(false)\n  const [progress, setProgress] = useState(0)\n\n  const [requestedAccessRights, setRequestedAccessRights] = useState\u003cstring[]\u003e()\n  const [onAcceptAccessRights, setOnAcceptAccessRights] = useState\u003c(accept: boolean) =\u003e void\u003e()\n\n  const cancelFlow = () =\u003e\n    flow\n      ?.cancel()\n      .then(() =\u003e setFlow(undefined))\n      .catch((error) =\u003e setMessage(`Error canceling flow. ${error.message}`))\n\n  const runAuthFlow = async () =\u003e {\n    setMessage(undefined)\n    setFlow(\n      new AusweisAuthFlow({\n        debug: true,\n        // Can set to true to allow simulator cards. In this case `onEnterPin` and `onAttachCard` won't be called\n        allowSimulatorCard: false,\n        onEnterPin: ({ attemptsRemaining }) =\u003e {\n          // Mock incorrect pin entry\n          return attemptsRemaining === 1 ? '123456' : '123123'\n        },\n        onError: ({ message, reason }) =\u003e {\n          setFlow(undefined)\n          setCardAttachRequested(false)\n          setProgress(0)\n          setMessage(`${reason}: ${message}`)\n        },\n        onSuccess: () =\u003e {\n          setFlow(undefined)\n          setProgress(100)\n          setCardAttachRequested(false)\n          setMessage('Successfully ran auth flow')\n        },\n        onAttachCard: () =\u003e {\n          // iOS will already show the NFC scanner modal, but on Android we need\n          // use this callback to show the NFC scanner modal.\n          setCardAttachRequested(true)\n        },\n        onCardAttachedChanged: ({ isCardAttached }) =\u003e setIsCardAttached(isCardAttached),\n        onStatusProgress: ({ progress }) =\u003e setProgress(progress),\n        onRequestAccessRights: ({ effective }) =\u003e\n          new Promise((resolve) =\u003e {\n            setRequestedAccessRights(effective)\n            setOnAcceptAccessRights(() =\u003e {\n              return (accept: boolean) =\u003e {\n                resolve({ acceptAccessRights: accept })\n                setOnAcceptAccessRights(undefined)\n                setRequestedAccessRights(undefined)\n              }\n            })\n          }),\n      }).start({\n        tcTokenUrl: 'https://test.governikus-eid.de/AusweisAuskunft/WebServiceRequesterServlet',\n      })\n    )\n  }\n\n  return (\n    \u003cView style={[StyleSheet.absoluteFill, { flex: 1, alignContent: 'center', justifyContent: 'center' }]}\u003e\n      \u003cButton onPress={flow ? cancelFlow : runAuthFlow} title={flow ? 'Cancel' : 'Start Auth Flow'} /\u003e\n      {flow \u0026\u0026 \u003cText\u003eProgress: {progress}%\u003c/Text\u003e}\n      {flow \u0026\u0026 \u003cText\u003eIs card attached: {isCardAttached ? 'Yes' : 'No'}\u003c/Text\u003e}\n      {flow \u0026\u0026 cardAttachRequested \u0026\u0026 \u003cText\u003ePlease present your card to the NFC scanner\u003c/Text\u003e}\n      {flow \u0026\u0026 requestedAccessRights \u0026\u0026 (\n        \u003c\u003e\n          \u003cText\u003e\n            Requested Access Rights:\n            {'\\n -'}\n            {requestedAccessRights.join('\\n- ')}\n          \u003c/Text\u003e\n          \u003cButton title=\"Accept\" onPress={() =\u003e onAcceptAccessRights?.(true)} /\u003e\n        \u003c/\u003e\n      )}\n      {message \u0026\u0026 \u003cText\u003e{message}\u003c/Text\u003e}\n    \u003c/View\u003e\n  )\n}\n```\n\n## Contributing\n\nIs there something you'd like to fix or add? Great, we love community contributions! To get involved, please follow our [contribution guidelines](./CONTRIBUTING.md).\n\n## License\n\nExpo Ausweis SDK is licensed under the [EUPL Version 1.2](./LICENSE). The AusweisApp SDK used by this Expo Module is also licensed under EUPL Version 1.2\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanimo%2Fexpo-ausweis-sdk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fanimo%2Fexpo-ausweis-sdk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fanimo%2Fexpo-ausweis-sdk/lists"}