+1
-1
.eslintrc.js
+1
-1
.eslintrc.js
+21
LICENSE
+21
LICENSE
···
+137
-16
README.md
+137
-16
README.md
···+This is an Expo client library for Atproto OAuth. It implements the required native crypto functions for supporting JWTs in React Native and uses+the base `OAuthClient` interface found in [the Atproto repository](https://github.com/bluesky-social/atproto/tree/main/packages/oauth/oauth-client).+Before using this library, there are a few additional libraries that you must install within your Expo application.+- [abortcontroller-polyfill](https://www.npmjs.com/package/abortcontroller-polyfill) (or similar)+Apply the two polyfills inside your application's entrypoint (usually `index.ts`). They should be placed _before_ anything else in the file, and particularly before `registerRootComponent(App)`.+> As of current (Expo 53), you _must_ apply an Expo patch for this library to work. You may use the patch found [here](https://github.com/haileyok/expo-atproto-auth/blob/main/patches/expo%2B53.0.19.patch).+A fix for this has been submitted up stream and merged, so will hopefully be fixed in Expo 54 (see the PR [here](https://github.com/expo/expo/pull/38122)).+For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/)+Once you have satisfied the prerequisites, you can simply install the library with `yarn add expo-atproto-auth`.+You will need to server an `oauth-client-metadata.json` from your application's website. An example of this metadata+- The `client_id` should be the same URL as where you are serving your `oauth-client-metadata.json` from+- Your `redirect_uris` should contain the native redirect URI in the first position. Additionally, the scheme must be+formatted as the _reverse_ of the domain you are serving the metadata from. Since I am serving mine from `hailey.at`,+I use `at.hailey` as the scheme. If my domain were `atproto.expo.dev`, I would use `dev.expo.atproto`. Additionally, the scheme _must_ contain _only one trailing slash_ after the `:`. `at.hailey://` would be invalid.+For a real-world example, see [Skylight's client metadata](https://skylight.expo.app/oauth/client-metadata.json).+For more information about client metadata, see [the Atproto documentation](https://atproto.com/specs/oauth#client-id-metadata-document).+Next, you want to create an `ExpoOAuthClient`. You will need to pass in the same client metadata to the client as you are serving in your `oauth-client-metadata.json`.-- [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/atproto-auth/)-- [Documentation for the main branch](https://docs.expo.dev/versions/unversioned/sdk/atproto-auth/)-For [managed](https://docs.expo.dev/archive/managed-vs-bare/) Expo projects, please follow the installation instructions in the [API documentation for the latest stable release](#api-documentation). If you follow the link and there is no documentation available then this library is not yet usable within managed projects — it is likely to be included in an upcoming Expo SDK release.+Whenever you are ready, you can initiate a sign in attempt for the user using the client using `client.signIn(input)`-For bare React Native projects, you must ensure that you have [installed and configured the `expo` package](https://docs.expo.dev/bare/installing-expo-modules/) before continuing.+> If you wish to allow a user to _create_ an account instead of signing in, simply use a valid PDS hostname rather than+> a handle. They will be presented the option to either Sign In with an existing account, or create a new one.+To interface with the various Atproto APIs, you will need to create an `Agent`. You will pass your `OAuthSession` to the `Agent`.+After, for example, closing the application, you will probably need to restore the user's session. You can do this by using the user's DID on the `ExpoOAuthClient`.+If the session needs to be refreshed, `.restore()` will do this for you before returning a session.-Contributions are very welcome! Please refer to guidelines described in the [contributing guide]( https://github.com/expo/expo#contributing).+- [Atproto Web OAuth Example](https://github.com/bluesky-social/atproto/tree/main/packages/oauth/oauth-client-browser-example)
+4
android/build.gradle
+4
android/build.gradle
+70
android/src/main/java/expo/modules/atprotoauth/Crypto.kt
+70
android/src/main/java/expo/modules/atprotoauth/Crypto.kt
···
+27
-36
android/src/main/java/expo/modules/atprotoauth/ExpoAtprotoAuthModule.kt
+27
-36
android/src/main/java/expo/modules/atprotoauth/ExpoAtprotoAuthModule.kt
···-// Each module class must implement the definition function. The definition consists of components-// Sets the name of the module that JavaScript code will use to refer to the module. Takes a string as an argument.-// Can be inferred from module's class name, but it's recommended to set it explicitly for clarity.-// Sets constant properties on the module. Can take a dictionary or a closure that returns a dictionary.-// Defines a JavaScript synchronous function that runs the native code on the JavaScript thread.-// Enables the module to be used as a native view. Definition components that are accepted as part of
-30
android/src/main/java/expo/modules/atprotoauth/ExpoAtprotoAuthView.kt
-30
android/src/main/java/expo/modules/atprotoauth/ExpoAtprotoAuthView.kt
···-class ExpoAtprotoAuthView(context: Context, appContext: AppContext) : ExpoView(context, appContext) {-// The name of the event is inferred from the value and needs to match the event name defined in the module.-// Sends an event to JavaScript. Triggers a callback defined on the view component in JavaScript.
+116
android/src/main/java/expo/modules/atprotoauth/Jose.kt
+116
android/src/main/java/expo/modules/atprotoauth/Jose.kt
···
+64
android/src/main/java/expo/modules/atprotoauth/Records.kt
+64
android/src/main/java/expo/modules/atprotoauth/Records.kt
···
+26
-35
example/App.tsx
+26
-35
example/App.tsx
···············
+2
-2
example/ios/expoatprotoauthexample.xcodeproj/project.pbxproj
+2
-2
example/ios/expoatprotoauthexample.xcodeproj/project.pbxproj
···SWIFT_OBJC_BRIDGING_HEADER = "expoatprotoauthexample/expoatprotoauthexample-Bridging-Header.h";···SWIFT_OBJC_BRIDGING_HEADER = "expoatprotoauthexample/expoatprotoauthexample-Bridging-Header.h";
+3
-3
ios/Crypto.swift
+3
-3
ios/Crypto.swift
·········
+7
-13
ios/ExpoAtprotoAuthModule.swift
+7
-13
ios/ExpoAtprotoAuthModule.swift
···-Function("verifyJwt") { (token: String, jwk: JWK, options: VerifyOptions) throws -> VerifyResponse in+Function("verifyJwt") { (token: String, jwk: EncodedJWK, options: VerifyOptions) throws -> VerifyResult in
+2
-2
ios/Jose.swift
+2
-2
ios/Jose.swift
···-static func verifyJwt(token: String, jwk: SecKey, options: VerifyOptions) throws -> VerifyResponse {+static func verifyJwt(token: String, jwk: SecKey, options: VerifyOptions) throws -> VerifyResult {···
+2
-2
ios/Records.swift
+2
-2
ios/Records.swift
+3
-1
package.json
+3
-1
package.json
·········
+1
-1
src/ExpoAtprotoAuth.types.ts
+1
-1
src/ExpoAtprotoAuth.types.ts
+132
src/expo-key.ts
+132
src/expo-key.ts
···
+103
src/expo-oauth-client.ts
+103
src/expo-oauth-client.ts
···+options.clientMetadata ?? atprotoLoopbackClientMetadata('localhost'), // HACK: this fixes a type error for now, look into it later
+253
src/expo-oauth-database.ts
+253
src/expo-oauth-database.ts
···
+28
src/expo-runtime-implementation.ts
+28
src/expo-runtime-implementation.ts
···
+3
-3
src/index.ts
+3
-3
src/index.ts
-132
src/react-native-key.ts
-132
src/react-native-key.ts
···
-69
src/react-native-oauth-client.ts
-69
src/react-native-oauth-client.ts
···-options.clientMetadata ?? atprotoLoopbackClientMetadata('localhost'), // HACK: this fixes a type error for now, look into it later
-256
src/react-native-oauth-database.ts
-256
src/react-native-oauth-database.ts
···
-28
src/react-native-runtime-implementation.ts
-28
src/react-native-runtime-implementation.ts
···
+5
yarn.lock
+5
yarn.lock
···+resolved "https://registry.yarnpkg.com/expo-web-browser/-/expo-web-browser-14.2.0.tgz#d8fb521ae349aebbf5c0ca32448877480124c06c"+integrity sha512-6S51d8pVlDRDsgGAp8BPpwnxtyKiMWEFdezNz+5jVIyT+ctReW42uxnjRgtsdn5sXaqzhaX+Tzk/CWaKCyC0hw==