Skip to content

Commit

Permalink
add: support compressed fv signature
Browse files Browse the repository at this point in the history
  • Loading branch information
sirpy committed Dec 17, 2024
1 parent 4956b54 commit aaad755
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
},
"scripts": {
"web": "npm run lingui:compile && NODE_OPTIONS=\"--openssl-legacy-provider\" vite",
"goodid": "export REACT_APP_INDEXJS='./src/index.fv.jsx' && NODE_OPTIONS=\"--openssl-legacy-provider\" vite",
"android": "npm run lingui:compile && ENVFILE=.env; npm run copy:gdfont && npm run animation:assets && NODE_OPTIONS=\"--openssl-legacy-provider\" react-native run-android",
"ios": "npm run lingui:compile && ENVFILE=.env; npm run animation:assets && NODE_OPTIONS=\"--openssl-legacy-provider\" react-native run-ios",
"start:native": "react-native start",
Expand Down Expand Up @@ -145,6 +146,7 @@
"lottie-ios": "^3.4.0",
"lottie-react-native": "^5",
"lottie-web": "^5.12.2",
"lz-string": "^1.5.0",
"mnid": "^0.1.3",
"mobile-device-detect": "^0.4.3",
"moment": "^2.29.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import React, { createContext, useEffect, useRef } from 'react'

import { decompressFromEncodedURIComponent } from 'lz-string'
import useFVFlow from '../hooks/useFVFlow'
import DeepLinking from '../../../../lib/utils/deepLinking'

Expand Down Expand Up @@ -28,6 +28,10 @@ export const FVFlowContext = createContext({
const FVFlowProvider = props => {
const unsupportedCopyUrl = DeepLinking.link

const params = useRef(DeepLinking.params).current

// new version compresses params to support large signatures
const decompressed = JSON.parse(decompressFromEncodedURIComponent(params.lz) || '{}')
const {
sig,
nonce,
Expand All @@ -38,7 +42,8 @@ const FVFlowProvider = props => {
account,
chain,
isDelta,
} = useRef(DeepLinking.params).current
} = { ...params, ...decompressed }

const { jwt, error } = useFVFlow(sig, nonce, faceIdentifier, account)

useEffect(() => {
Expand Down
1 change: 0 additions & 1 deletion src/config/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,6 @@ const Config = {
graphQlUrl: env.REACT_APP_GRAPHQL_URL || 'https://api.thegraph.com/subgraphs/name/gooddollar',
chainIdUrl: env.REACT_APP_CHAINID_URL || 'https://chainid.network',
networkId,
isFVFlow: env.REACT_APP_BUILD_TARGET === 'FV',
estimateGasPrice: env.REACT_APP_ESTIMATE_GAS_PRICE === 'true',
defaultGasPrice: parseInt(env.REACT_APP_DEFAULT_GAS_PRICE || 11),
defaultTxGas: parseInt(env.REACT_APP_DEFAULT_TX_GAS || 1000000),
Expand Down
10 changes: 10 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -6880,6 +6880,7 @@ __metadata:
lottie-ios: ^3.4.0
lottie-react-native: ^5
lottie-web: ^5.12.2
lz-string: ^1.5.0
metro: 0.80.5
metro-core: ^0.80.5
metro-react-native-babel-preset: ^0.77.0
Expand Down Expand Up @@ -35458,6 +35459,15 @@ __metadata:
languageName: node
linkType: hard

"lz-string@npm:^1.5.0":
version: 1.5.0
resolution: "lz-string@npm:1.5.0"
bin:
lz-string: bin/bin.js
checksum: 1ee98b4580246fd90dd54da6e346fb1caefcf05f677c686d9af237a157fdea3fd7c83a4bc58f858cd5b10a34d27afe0fdcbd0505a47e0590726a873dc8b8f65d
languageName: node
linkType: hard

"magic-string@npm:0.27.0":
version: 0.27.0
resolution: "magic-string@npm:0.27.0"
Expand Down

0 comments on commit aaad755

Please sign in to comment.