Skip to content

Commit

Permalink
chore: test onfido
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicolas Burtey committed Oct 4, 2023
1 parent 3ce315a commit cd94021
Show file tree
Hide file tree
Showing 6 changed files with 73 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ONFIDO.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export applicant_id=$(curl -s https://api.eu.onfido.com/v3.6//applicants \
-H "Authorization: Token token=$ONFIDO" \
-d 'first_name=Theresa' \
-d 'last_name=May' | jq -r .id)

export token=$(curl -s https://api.onfido.com/v3/sdk_token \
-H "Authorization: Token token=$ONFIDO" \
-F "applicant_id=$applicant_id" \
-F 'application_id=com.galoy' | jq -r .token)

echo $token
37 changes: 37 additions & 0 deletions app/screens/developer-screen/debug-screen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ import { InAppBrowser } from "react-native-inappbrowser-reborn"
import { useNavigation } from "@react-navigation/native"
import { StackNavigationProp } from "@react-navigation/stack"
import { RootStackParamList } from "@app/navigation/stack-param-lists"
import {
Onfido,
OnfidoCaptureType,
OnfidoCountryCode,
OnfidoDocumentType,
OnfidoTheme,
} from "@onfido/react-native-sdk"

gql`
query debugScreen {
Expand Down Expand Up @@ -182,6 +189,30 @@ export const DeveloperScreen: React.FC = () => {
saveToken(newToken || "")
}

const onfidoStart = async () => {
try {
const res = await Onfido.start({
sdkToken:
"eyJhbGciOiJFUzUxMiJ9.eyJleHAiOjE2OTU0MDA3NDksInBheWxvYWQiOnsiYXBwIjoiZTY0OWU0M2QtYzg3Yy00MDg2LWI5NWMtM2QwODY1NWNhZmIwIiwiYXBwbGljYXRpb25faWQiOiJjb20uZ2Fsb3kiLCJjbGllbnRfdXVpZCI6ImI0ZTZhNWMzLTMwNWQtNGNiZS05OGY0LTFlMmMzNTNlNmQ4ZCIsImlzX3NhbmRib3giOnRydWUsImlzX3NlbGZfc2VydmljZV90cmlhbCI6dHJ1ZSwiaXNfdHJpYWwiOnRydWUsInNhcmRpbmVfc2Vzc2lvbiI6IjA0MDU5YjJkLTQ1ODYtNDBjYi1hMzdlLTVjYTk2M2Q2YjkzNCIsImhhc191c2FnZV9wbGFuIjpmYWxzZX0sInV1aWQiOiJwbGF0Zm9ybV9zdGF0aWNfYXBpX3Rva2VuX3V1aWQiLCJ1cmxzIjp7ImRldGVjdF9kb2N1bWVudF91cmwiOiJodHRwczovL3Nkay5vbmZpZG8uY29tIiwic3luY191cmwiOiJodHRwczovL3N5bmMub25maWRvLmNvbSIsImhvc3RlZF9zZGtfdXJsIjoiaHR0cHM6Ly9pZC5vbmZpZG8uY29tIiwiYXV0aF91cmwiOiJodHRwczovL2FwaS5vbmZpZG8uY29tIiwib25maWRvX2FwaV91cmwiOiJodHRwczovL2FwaS5vbmZpZG8uY29tIiwidGVsZXBob255X3VybCI6Imh0dHBzOi8vYXBpLm9uZmlkby5jb20ifX0.MIGHAkIBhLY6Cqb5nMv_zx3Vx72kPMj-HXP5u2Ss9-JM9Upswb8UAe5n8EyeypaC6_rMvL9E71XC8O6T_xiAvRPwUG2nc94CQWtGAOu0-EMPkoVRi7iizMI_XEHw4yBClOFl-coZWMaizqOBHh6QBswaWNFFYZQKyjC0VkJQofO5kT4wmQ6GxTDW",

Check warning on line 196 in app/screens/developer-screen/debug-screen.tsx

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"OTU" should be "OUT".

Check warning on line 196 in app/screens/developer-screen/debug-screen.tsx

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"ODY" should be "BODY".

Check warning on line 196 in app/screens/developer-screen/debug-screen.tsx

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"ND" should be "AND".

Check warning on line 196 in app/screens/developer-screen/debug-screen.tsx

View workflow job for this annotation

GitHub Actions / Spell Check with Typos

"MIGH" should be "MIGHT".
theme: OnfidoTheme.AUTOMATIC,
flowSteps: {
welcome: true,
captureFace: {
type: OnfidoCaptureType.MOTION,
},
captureDocument: {
docType: OnfidoDocumentType.DRIVING_LICENCE,
countryCode: OnfidoCountryCode.FRA,
},
},
})

console.log(res, "success12")
} catch (err) {
console.log(err, "error")
}
}

return (
<Screen preset="scroll">
<View style={styles.screenContainer}>
Expand Down Expand Up @@ -255,6 +286,12 @@ export const DeveloperScreen: React.FC = () => {
})
}
/>
<Button
title="start onfido"
containerStyle={styles.button}
{...testProps("Navigate to webview")}
onPress={onfidoStart}
/>
<View>
<Text style={styles.textHeader}>Account info</Text>
<Text>AccountId: </Text>
Expand Down
2 changes: 2 additions & 0 deletions ios/GaloyApp.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,12 @@
);
inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-GaloyApp/Pods-GaloyApp-frameworks.sh",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/Onfido/Onfido.framework/Onfido",
"${PODS_XCFRAMEWORKS_BUILD_DIR}/hermes-engine/Pre-built/hermes.framework/hermes",
);
name = "[CP] Embed Pods Frameworks";
outputPaths = (
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/Onfido.framework",
"${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}/hermes.framework",
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
10 changes: 10 additions & 0 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,10 @@ PODS:
- nanopb/encode (= 2.30909.0)
- nanopb/decode (2.30909.0)
- nanopb/encode (2.30909.0)
- Onfido (29.4.2)
- onfido-react-native-sdk (10.3.1):
- Onfido (~> 29.4.0)
- React
- PromisesObjC (2.2.0)
- PromisesSwift (2.2.0):
- PromisesObjC (= 2.2.0)
Expand Down Expand Up @@ -642,6 +646,7 @@ DEPENDENCIES:
- glog (from `../node_modules/react-native/third-party-podspecs/glog.podspec`)
- hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
- libevent (~> 2.1.12)
- "onfido-react-native-sdk (from `../node_modules/@onfido/react-native-sdk`)"
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
- RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
Expand Down Expand Up @@ -738,6 +743,7 @@ SPEC REPOS:
- MLKitCommon
- MLKitVision
- nanopb
- Onfido
- PromisesObjC
- PromisesSwift
- ZXingObjC
Expand All @@ -757,6 +763,8 @@ EXTERNAL SOURCES:
:podspec: "../node_modules/react-native/third-party-podspecs/glog.podspec"
hermes-engine:
:podspec: "../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec"
onfido-react-native-sdk:
:path: "../node_modules/@onfido/react-native-sdk"
RCT-Folly:
:podspec: "../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec"
RCTRequired:
Expand Down Expand Up @@ -923,6 +931,8 @@ SPEC CHECKSUMS:
MLKitCommon: c1b791c3e667091918d91bda4bba69a91011e390
MLKitVision: 8baa5f46ee3352614169b85250574fde38c36f49
nanopb: b552cce312b6c8484180ef47159bc0f65a1f0431
Onfido: abc5d9a0da1e3ae9f8b4a2a16cc1e77b7a38b12e
onfido-react-native-sdk: a62bb2bd5a8994ee29effc0412c013dfddf01f7e
PromisesObjC: 09985d6d70fbe7878040aa746d78236e6946d2ef
PromisesSwift: cf9eb58666a43bbe007302226e510b16c1e10959
RCT-Folly: 424b8c9a7a0b9ab2886ffe9c3b041ef628fd4fb1
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@formatjs/intl-relativetimeformat": "^11.2.3",
"@galoymoney/client": "^0.2.5",
"@galoymoney/react-native-geetest-module": "^0.1.3",
"@onfido/react-native-sdk": "^10.3.1",
"@react-native-async-storage/async-storage": "^1.19.3",
"@react-native-clipboard/clipboard": "^1.11.1",
"@react-native-firebase/analytics": "17",
Expand Down
12 changes: 12 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3952,6 +3952,13 @@
mkdirp "^1.0.4"
rimraf "^3.0.2"

"@onfido/react-native-sdk@^10.3.1":
version "10.3.1"
resolved "https://registry.npmjs.org/@onfido/react-native-sdk/-/react-native-sdk-10.3.1.tgz#06c803d8fbce4244268eba6ca99a8051043da954"
integrity sha512-tiELrpIzY4+e1F4Kk60rSUfnagrG5SuPr1Nqg0MpXpDkN+s8H3SIbNmo/EcGhbaSP+d7+3Wx6186Tm0JVDJ70g==
dependencies:
js-base64 "3.7.5"

"@peculiar/asn1-schema@^2.1.6", "@peculiar/asn1-schema@^2.3.0":
version "2.3.3"
resolved "https://registry.npmjs.org/@peculiar/asn1-schema/-/asn1-schema-2.3.3.tgz#21418e1f3819e0b353ceff0c2dad8ccb61acd777"
Expand Down Expand Up @@ -15453,6 +15460,11 @@ jpeg-js@^0.4.1, jpeg-js@^0.4.4:
resolved "https://registry.npmjs.org/jpeg-js/-/jpeg-js-0.4.4.tgz#a9f1c6f1f9f0fa80cdb3484ed9635054d28936aa"
integrity sha512-WZzeDOEtTOBK4Mdsar0IqEU5sMr3vSV2RqkAIzUEV2BHnUfKGyswWFPFwK5EeDo93K3FohSHbLAjj0s1Wzd+dg==

[email protected]:
version "3.7.5"
resolved "https://registry.npmjs.org/js-base64/-/js-base64-3.7.5.tgz#21e24cf6b886f76d6f5f165bfcd69cc55b9e3fca"
integrity sha512-3MEt5DTINKqfScXKfJFrRbxkrnk2AxPWGBL/ycjz4dK8iqiSJ06UxD8jh8xuh6p10TX4t2+7FsBYVxxQbMg+qA==

js-library-detector@^6.4.0:
version "6.6.0"
resolved "https://registry.npmjs.org/js-library-detector/-/js-library-detector-6.6.0.tgz#b531a4784f8242d87f68f6f3eafc771a0650fb9d"
Expand Down

0 comments on commit cd94021

Please sign in to comment.