few more things

This commit is contained in:
Hailey
2024-04-15 02:47:43 -07:00
parent dbbcd275b4
commit d56116a6f4
3 changed files with 5 additions and 16 deletions
@@ -49,7 +49,9 @@ export class ReactNativeKey extends Key {
// We don't need to validate this, because the native types ensure it is correct. But this is a TODO // We don't need to validate this, because the native types ensure it is correct. But this is a TODO
// for the same reason above // for the same reason above
const protectedHeader = result.protectedHeader const protectedHeader = Object.fromEntries(
Object.entries(result.protectedHeader).filter(([_, v]) => v !== null),
)
if (options?.audience != null) { if (options?.audience != null) {
const audience = Array.isArray(options.audience) const audience = Array.isArray(options.audience)
@@ -14,13 +14,10 @@ type Item = {
type EncodedKey = { type EncodedKey = {
keyId: string keyId: string
keyPair: CryptoKeyPair keyPair: CryptoKey
} }
function encodeKey(key: Key): EncodedKey { function encodeKey(key: Key): EncodedKey {
if (!(key instanceof WebcryptoKey) || !key.kid) {
throw new Error('Invalid key object')
}
return { return {
keyId: key.kid, keyId: key.kid,
keyPair: key.cryptoKeyPair, keyPair: key.cryptoKeyPair,
@@ -42,7 +39,6 @@ export type Schema = {
}> }>
session: Item<{ session: Item<{
dpopKey: EncodedKey dpopKey: EncodedKey
tokenSet: TokenSet tokenSet: TokenSet
}> }>
+1 -10
View File
@@ -1,12 +1,10 @@
import React from 'react' import React from 'react'
import {Keyboard, View} from 'react-native' import {Keyboard, View} from 'react-native'
import * as Browser from 'expo-web-browser'
import {ComAtprotoServerDescribeServer} from '@atproto/api' import {ComAtprotoServerDescribeServer} from '@atproto/api'
import {msg, Trans} from '@lingui/macro' import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react' import {useLingui} from '@lingui/react'
import {useAnalytics} from '#/lib/analytics/analytics' import {useAnalytics} from '#/lib/analytics/analytics'
import {isAndroid} from 'platform/detection'
import {useLogin} from '#/screens/Login/hooks/useLogin' import {useLogin} from '#/screens/Login/hooks/useLogin'
import {atoms as a} from '#/alf' import {atoms as a} from '#/alf'
import {Button, ButtonText} from '#/components/Button' import {Button, ButtonText} from '#/components/Button'
@@ -34,14 +32,7 @@ export const LoginForm = ({
}) => { }) => {
const {track} = useAnalytics() const {track} = useAnalytics()
const {_} = useLingui() const {_} = useLingui()
const {openAuthSession} = useLogin(serviceUrl) const {openAuthSession} = useLogin()
// This improves speed at which the browser presents itself on Android
React.useEffect(() => {
if (isAndroid) {
Browser.warmUpAsync()
}
}, [])
const onPressSelectService = React.useCallback(() => { const onPressSelectService = React.useCallback(() => {
Keyboard.dismiss() Keyboard.dismiss()