native crypto setup
This commit is contained in:
+3
-1
@@ -42,7 +42,9 @@ module.exports = function (api) {
|
||||
platform: './src/platform',
|
||||
state: './src/state',
|
||||
view: './src/view',
|
||||
crypto: './src/platform/crypto.ts',
|
||||
crypto: 'react-native-quick-crypto',
|
||||
stream: 'stream-browserify',
|
||||
buffer: '@craftzdog/react-native-buffer',
|
||||
},
|
||||
},
|
||||
],
|
||||
|
||||
+2
-1
@@ -263,7 +263,8 @@
|
||||
},
|
||||
"resolutions": {
|
||||
"@types/react": "^18",
|
||||
"**/zeed-dom": "0.10.9"
|
||||
"**/zeed-dom": "0.10.9",
|
||||
"browserify-sign": "4.2.2"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "jest-expo/ios",
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
import {isWeb} from 'platform/detection'
|
||||
|
||||
export const OAUTH_CLIENT_ID = 'https://bsky.app'
|
||||
export const OAUTH_REDIRECT_URI = 'https://bsky.app/auth/callback'
|
||||
export const OAUTH_CLIENT_ID = 'http://localhost/'
|
||||
export const OAUTH_REDIRECT_URI = 'http://127.0.0.1:5173/'
|
||||
export const OAUTH_SCOPE = 'openid profile email phone offline_access'
|
||||
export const OAUTH_GRANT_TYPES = [
|
||||
'authorization_code',
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import React from 'react'
|
||||
import * as Browser from 'expo-web-browser'
|
||||
import {BrowserOAuthClientFactory} from '@atproto/oauth-client-react-native'
|
||||
|
||||
import {
|
||||
buildOAuthUrl,
|
||||
@@ -11,16 +12,11 @@ import {
|
||||
OAUTH_RESPONSE_TYPES,
|
||||
OAUTH_SCOPE,
|
||||
} from 'lib/oauth'
|
||||
import {CryptoImplementation} from '#/oauth-client-temp/client/crypto-implementation'
|
||||
import {OAuthClientFactory} from '#/oauth-client-temp/client/oauth-client-factory'
|
||||
|
||||
// TODO remove hack
|
||||
const serviceUrl = 'http://localhost'
|
||||
|
||||
// Service URL here is just a placeholder, this isn't how it will actually work
|
||||
export function useLogin(serviceUrl: string | undefined) {
|
||||
const openAuthSession = React.useCallback(async () => {
|
||||
const oauthFactory = new OAuthClientFactory({
|
||||
const oauthFactory = new BrowserOAuthClientFactory({
|
||||
clientMetadata: {
|
||||
client_id: OAUTH_CLIENT_ID,
|
||||
redirect_uris: [OAUTH_REDIRECT_URI],
|
||||
@@ -30,9 +26,12 @@ export function useLogin(serviceUrl: string | undefined) {
|
||||
dpop_bound_access_tokens: DPOP_BOUND_ACCESS_TOKENS,
|
||||
application_type: OAUTH_APPLICATION_TYPE,
|
||||
},
|
||||
cryptoImplementation: new CryptoImplementation(crypto),
|
||||
})
|
||||
|
||||
await oauthFactory.signIn('afepwasfojefpaowejfpwef')
|
||||
|
||||
return
|
||||
|
||||
if (!serviceUrl) return
|
||||
|
||||
const url = buildOAuthUrl(serviceUrl, '123') // TODO replace '123' with the appropriate state
|
||||
|
||||
@@ -9279,20 +9279,19 @@ browserify-rsa@^4.0.0, browserify-rsa@^4.1.0:
|
||||
bn.js "^5.0.0"
|
||||
randombytes "^2.0.1"
|
||||
|
||||
browserify-sign@^4.0.0:
|
||||
version "4.2.3"
|
||||
resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.3.tgz#7afe4c01ec7ee59a89a558a4b75bd85ae62d4208"
|
||||
integrity sha512-JWCZW6SKhfhjJxO8Tyiiy+XYB7cqd2S5/+WeYHsKdNKFlCBhKbblba1A/HN/90YwtxKc8tCErjffZl++UNmGiw==
|
||||
browserify-sign@4.2.2, browserify-sign@^4.0.0:
|
||||
version "4.2.2"
|
||||
resolved "https://registry.yarnpkg.com/browserify-sign/-/browserify-sign-4.2.2.tgz#e78d4b69816d6e3dd1c747e64e9947f9ad79bc7e"
|
||||
integrity sha512-1rudGyeYY42Dk6texmv7c4VcQ0EsvVbLwZkA+AQB7SxvXxmcD93jcHie8bzecJ+ChDlmAm2Qyu0+Ccg5uhZXCg==
|
||||
dependencies:
|
||||
bn.js "^5.2.1"
|
||||
browserify-rsa "^4.1.0"
|
||||
create-hash "^1.2.0"
|
||||
create-hmac "^1.1.7"
|
||||
elliptic "^6.5.5"
|
||||
hash-base "~3.0"
|
||||
elliptic "^6.5.4"
|
||||
inherits "^2.0.4"
|
||||
parse-asn1 "^5.1.7"
|
||||
readable-stream "^2.3.8"
|
||||
parse-asn1 "^5.1.6"
|
||||
readable-stream "^3.6.2"
|
||||
safe-buffer "^5.2.1"
|
||||
|
||||
browserslist@^4.0.0, browserslist@^4.14.5, browserslist@^4.18.1, browserslist@^4.21.10, browserslist@^4.21.4, browserslist@^4.21.9:
|
||||
@@ -11082,7 +11081,7 @@ elliptic@^6.4.1:
|
||||
minimalistic-assert "^1.0.1"
|
||||
minimalistic-crypto-utils "^1.0.1"
|
||||
|
||||
elliptic@^6.5.3, elliptic@^6.5.5:
|
||||
elliptic@^6.5.3, elliptic@^6.5.4:
|
||||
version "6.5.5"
|
||||
resolved "https://registry.yarnpkg.com/elliptic/-/elliptic-6.5.5.tgz#c715e09f78b6923977610d4c2346d6ce22e6dded"
|
||||
integrity sha512-7EjbcmUm17NQFu4Pmgmq2olYMj8nwMnpcddByChSUjArp8F5DQWcIcpriwO4ZToLNAJig0yiyjswfyGNje/ixw==
|
||||
@@ -17262,7 +17261,7 @@ parent-module@^1.0.0:
|
||||
dependencies:
|
||||
callsites "^3.0.0"
|
||||
|
||||
parse-asn1@^5.0.0, parse-asn1@^5.1.7:
|
||||
parse-asn1@^5.0.0, parse-asn1@^5.1.6:
|
||||
version "5.1.7"
|
||||
resolved "https://registry.yarnpkg.com/parse-asn1/-/parse-asn1-5.1.7.tgz#73cdaaa822125f9647165625eb45f8a051d2df06"
|
||||
integrity sha512-CTM5kuWR3sx9IFamcl5ErfPl6ea/N8IYwiJ+vpeB2g+1iknv7zBl5uPwbMbRVznRVbrNY6lGuDoE5b30grmbqg==
|
||||
@@ -18265,7 +18264,7 @@ pouchdb-collections@^1.0.1:
|
||||
resolved "https://registry.yarnpkg.com/pouchdb-collections/-/pouchdb-collections-1.0.1.tgz#fe63a17da977611abef7cb8026cb1a9553fd8359"
|
||||
integrity sha512-31db6JRg4+4D5Yzc2nqsRqsA2oOkZS8DpFav3jf/qVNBxusKa2ClkEIZ2bJNpaDbMfWtnuSq59p6Bn+CipPMdg==
|
||||
|
||||
prebuild-install@^7.1.0, prebuild-install@^7.1.1:
|
||||
prebuild-install@^7.1.1:
|
||||
version "7.1.1"
|
||||
resolved "https://registry.yarnpkg.com/prebuild-install/-/prebuild-install-7.1.1.tgz#de97d5b34a70a0c81334fd24641f2a1702352e45"
|
||||
integrity sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==
|
||||
@@ -19252,7 +19251,7 @@ read-cache@^1.0.0:
|
||||
dependencies:
|
||||
pify "^2.3.0"
|
||||
|
||||
readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.3.8, readable-stream@~2.3.6:
|
||||
readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@~2.3.6:
|
||||
version "2.3.8"
|
||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-2.3.8.tgz#91125e8042bba1b9887f49345f6277027ce8be9b"
|
||||
integrity sha512-8p0AUk4XODgIewSi0l8Epjs+EVnWiK7NoDIEGU0HhE7+ZyY8D1IMY7odu5lRrFXGg71L15KG8QrPmum45RTtdA==
|
||||
@@ -19265,7 +19264,7 @@ readable-stream@^2.0.1, readable-stream@^2.0.2, readable-stream@^2.3.8, readable
|
||||
string_decoder "~1.1.1"
|
||||
util-deprecate "~1.0.1"
|
||||
|
||||
readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0:
|
||||
readable-stream@^3.0.6, readable-stream@^3.1.1, readable-stream@^3.4.0, readable-stream@^3.5.0, readable-stream@^3.6.0, readable-stream@^3.6.2:
|
||||
version "3.6.2"
|
||||
resolved "https://registry.yarnpkg.com/readable-stream/-/readable-stream-3.6.2.tgz#56a9b36ea965c00c5a93ef31eb111a0f11056967"
|
||||
integrity sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==
|
||||
@@ -22640,11 +22639,6 @@ zeego@^1.6.2:
|
||||
"@radix-ui/react-dropdown-menu" "^2.0.1"
|
||||
sf-symbols-typescript "^1.0.0"
|
||||
|
||||
zod@3.21.4:
|
||||
version "3.21.4"
|
||||
resolved "https://registry.yarnpkg.com/zod/-/zod-3.21.4.tgz#10882231d992519f0a10b5dd58a38c9dabbb64db"
|
||||
integrity sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==
|
||||
|
||||
zod@^3.14.2, zod@^3.21.4:
|
||||
version "3.22.2"
|
||||
resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.2.tgz#3add8c682b7077c05ac6f979fea6998b573e157b"
|
||||
|
||||
Reference in New Issue
Block a user