Skip to content

Commit

Permalink
fix: remove a bunch of unused phone code (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
paolodamico authored Mar 1, 2023
1 parent 070b88e commit 59f3ac0
Show file tree
Hide file tree
Showing 11 changed files with 11 additions and 101 deletions.
1 change: 0 additions & 1 deletion example-nextjs/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export default function Home() {
return new Promise<void>((resolve) => {
setTimeout(() => resolve(), 3000);
// NOTE: Example of how to decline the verification request and show an error message to the user
//setTimeout(() => reject({ message: "This phone number has already been used!" }), 3000);
});
}, []);

Expand Down
1 change: 0 additions & 1 deletion example-react/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ function App() {
return new Promise<void>((resolve) => {
setTimeout(() => resolve(), 3000);
// NOTE: Example of how to decline the verification request and show an error message to the user
//setTimeout(() => reject({ message: "This phone number has already been used!" }), 3000);
});
};

Expand Down
4 changes: 0 additions & 4 deletions idkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,12 @@
"@walletconnect/types": "^2.2.0",
"@walletconnect/utils": "^2.2.1",
"copy-to-clipboard": "^3.3.3",
"country-telephone-data": "^0.6.3",
"framer-motion": "^7.6.7",
"js-sha3": "^0.8.0",
"phone": "^3.1.30",
"posthog-js-lite": "2.0.0",
"qr-code-styling-new": "^1.6.1",
"qrcode": "^1.5.1",
"react-countdown": "^2.3.4",
"react-country-flag": "^3.0.2",
"react-frame-component": "^5.2.3",
"react-shadow": "^19.0.3",
"zustand": "^4.3.3"
Expand All @@ -78,7 +75,6 @@
"@babel/core": "^7.20.2",
"@babel/plugin-syntax-typescript": "^7.20.0",
"@esbuild-plugins/node-globals-polyfill": "^0.1.1",
"@types/country-telephone-data": "^0.6.1",
"@types/node": "18.11.9",
"@types/qrcode": "^1.5.0",
"@types/react": "18.0.25",
Expand Down
7 changes: 3 additions & 4 deletions idkit/src/components/IDKitWidget/States/AboutState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ const AboutState = () => {
something once without revealing personal information.
</p>
<p className="text-70868f mt-3 text-center">
It currently supports verification through biometrics (using a device called an Orb), and through
phone numbers. Zero-Knowledge Proofs and other cryptographic mechanisms are used to preserve
privacy.
It currently supports verification through biometrics (using a device called an Orb). Zero-Knowledge
Proofs and other cryptographic mechanisms are used to preserve privacy.
</p>

<p className="text-70868f mt-3 text-center">Apps will never see your phone number or biometrics.</p>
<p className="text-70868f mt-3 text-center">Apps will never see your biometrics.</p>
</div>
<div>
<motion.a
Expand Down
2 changes: 0 additions & 2 deletions idkit/src/components/IDKitWidget/States/ErrorState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ const getParams = ({ retryFlow, errorState }: IDKitStore) => ({ retryFlow, error

export const ERROR_TITLES: Record<ErrorCodes, string> = {
[ErrorCodes.GENERIC_ERROR]: 'Something went wrong',
[ErrorCodes.INVALID_CODE]: 'Invalid code',
[ErrorCodes.PHONE_OTP_REQUEST_ERROR]: 'We could not send you a code',
[ErrorCodes.REJECTED_BY_HOST_APP]: 'Verification declined by app',
}

Expand Down
14 changes: 1 addition & 13 deletions idkit/src/components/IDKitWidget/States/PrivacyState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,6 @@ const PrivacyState = () => {
IDKit and World ID are fully privacy preserving.
</p>
<ul className="mb-6 list-disc space-y-3 px-4">
<li className="text-left dark:text-white">
Phone numbers are never kept by anyone. IDKit and its phone carrier only uses your number to deliver
a one-time code.
<ul className="text-9eafc0 dark:text-9eafc0 mt-3 list-disc pl-4">
<li>
Apps only receive a hash-like nullifier which can&apos;t be reversed. Worldcoin or IDKit
don&apos;t store nullifier hashes.
</li>
</ul>
</li>
<li className="text-left dark:text-white">
Orb biometrics analyzed by the Orb are not stored. Orb credential is used with Zero-Knowledge Proofs
which makes it cryptographically impossible to track persons across applications.
Expand All @@ -38,9 +28,7 @@ const PrivacyState = () => {
</ul>
<div className="-ml-4 flex items-center space-x-3">
<InfoIcon className="h-4 w-4 text-white" />
<p className="whitespace-nowrap text-sm font-medium text-white">
Apps will never see your phone number or biometrics.
</p>
<p className="whitespace-nowrap text-sm font-medium text-white">Apps will never see your biometrics.</p>
</div>
</div>
)
Expand Down
20 changes: 0 additions & 20 deletions idkit/src/components/Icons/DevicePhoneMobileIcon.tsx

This file was deleted.

9 changes: 0 additions & 9 deletions idkit/src/lib/telemetry.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { PostHog } from 'posthog-js-lite'
import type { PhoneVerificationChannel } from '@/types'

// Set at build time
declare const IDKitVersion: string
Expand Down Expand Up @@ -50,11 +49,3 @@ export const initTelemetry = (enableTelemetry?: boolean): void => {
export const telemetryModalOpened = (): void => {
posthog?.capture('idkit opened', SUPER_PROPS)
}

export const telemetryPhoneTyped = (): void => {
posthog?.capture('idkit phone typed', SUPER_PROPS)
}

export const telemetryRetryCode = (channel: PhoneVerificationChannel): void => {
posthog?.capture('idkit phone code retried', { ...SUPER_PROPS, channel })
}
7 changes: 1 addition & 6 deletions idkit/src/store/idkit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ export type IDKitStore = {
open: boolean
stage: IDKITStage
autoClose: boolean
phoneNumber: string
processing: boolean
copy: Config['copy']
theme: Config['theme']
Expand All @@ -33,7 +32,6 @@ export type IDKitStore = {
setStage: (stage: IDKITStage) => void
onOpenChange: (open: boolean) => void
setProcessing: (processing: boolean) => void
setPhoneNumber: (phoneNumber: string) => void
handleVerify: (result: ISuccessResult) => void
setErrorState: (state: IErrorState | null) => void
setOptions: (options: Config, source: ConfigSource) => void
Expand All @@ -54,14 +52,13 @@ const useIDKitStore = create<IDKitStore>()((set, get) => ({
theme: 'light',
errorTitle: '',
errorDetail: '',
phoneNumber: '',
autoClose: false,
errorState: null,
processing: false,
verifyCallbacks: {},
successCallbacks: {},
stringifiedActionId: '',
methods: ['orb', 'phone'],
methods: ['orb'],
stage: IDKITStage.WORLD_ID,
copy: {},

Expand All @@ -79,7 +76,6 @@ const useIDKitStore = create<IDKitStore>()((set, get) => ({
setCode: code => set({ code }),
setStage: stage => set({ stage }),
setErrorState: errorState => set({ errorState }),
setPhoneNumber: phoneNumber => set({ phoneNumber }),
setProcessing: (processing: boolean) => set({ processing }),
retryFlow: () => {
set({ stage: IDKITStage.WORLD_ID, errorState: null })
Expand Down Expand Up @@ -166,7 +162,6 @@ const useIDKitStore = create<IDKitStore>()((set, get) => ({
open,
code: '',
result: null,
phoneNumber: '',
errorState: null,
processing: false,
stage: IDKITStage.WORLD_ID,
Expand Down
27 changes: 6 additions & 21 deletions idkit/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export enum IDKITStage {

export enum CredentialType {
Orb = 'orb',
Phone = 'phone',
}

export interface ISuccessResult {
Expand All @@ -26,32 +25,18 @@ export interface ISuccessResult {

export type CallbackFn = (result: ISuccessResult) => Promise<void> | void

export interface IErrorState {
code: ErrorCodes
message?: string
}

export enum ErrorCodes {
GENERIC_ERROR = 'GENERIC_ERROR',
PHONE_OTP_REQUEST_ERROR = 'PHONE_OTP_REQUEST_ERROR',
INVALID_CODE = 'INVALID_CODE', // OTP code is invalid
REJECTED_BY_HOST_APP = 'REJECTED_BY_HOST_APP', // Host app rejected the verification request
}

// Error response received from World app through WalletConnect
export interface ExpectedErrorResponse {
message: string
stack: string
}

export enum PhoneVerificationChannel {
SMS = 'sms',
Call = 'call',
export interface IErrorState {
code: ErrorCodes
message?: string
}

export enum PhoneRequestErrorCodes {
MAX_ATTEMPTS = 'max_attempts',
TIMEOUT = 'timeout',
UNSUPPORTED_COUNTRY = 'unsupported_country',
SERVER_ERROR = 'server_error',
export enum ErrorCodes {
GENERIC_ERROR = 'GENERIC_ERROR',
REJECTED_BY_HOST_APP = 'REJECTED_BY_HOST_APP', // Host app rejected the verification request
}
20 changes: 0 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2952,11 +2952,6 @@
dependencies:
"@types/node" "*"

"@types/country-telephone-data@^0.6.1":
version "0.6.1"
resolved "https://registry.npmjs.org/@types/country-telephone-data/-/country-telephone-data-0.6.1.tgz"
integrity sha512-GjrvfnS+mFyEj1wOr5L7KKWHAcFgNxilP/AnNdQj2EM0R7c9rlM8OC+Pf2H5KHiMDbH/XjApJgdnjN/WYbzWew==

"@types/eslint-scope@^3.7.3":
version "3.7.4"
resolved "https://registry.npmjs.org/@types/eslint-scope/-/eslint-scope-3.7.4.tgz"
Expand Down Expand Up @@ -5406,11 +5401,6 @@ cosmiconfig@^8.0.0:
parse-json "^5.0.0"
path-type "^4.0.0"

country-telephone-data@^0.6.3:
version "0.6.3"
resolved "https://registry.npmjs.org/country-telephone-data/-/country-telephone-data-0.6.3.tgz"
integrity sha512-3tQLA0vec+NDVlcaHhXGqILq/oQRsv4fRi4EedCfJqUuJUjQGdcSPM8r2IJIT2kZ5yWbiOCkXMgy7YTo8FNS2w==

create-require@^1.1.0:
version "1.1.1"
resolved "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz"
Expand Down Expand Up @@ -10542,11 +10532,6 @@ performance-now@^2.1.0:
resolved "https://registry.npmjs.org/performance-now/-/performance-now-2.1.0.tgz"
integrity sha512-7EAHlyLHI56VEIdK57uwHdHKIaAGbnXPiw0yWbarQZOKaKpvUIgW0jWRVLiatnM+XXlSwsanIBH/hzGMJulMow==

phone@^3.1.30:
version "3.1.33"
resolved "https://registry.npmjs.org/phone/-/phone-3.1.33.tgz"
integrity sha512-mTDJ9NsXyRxxsnhEZpdNO6PFoPxSzEW0s5gjaxgTv8rqmIcyfbNBZpKxmdifr6jJVL/0oSwiHHvL2+SNL9BVFw==

picocolors@^0.2.1:
version "0.2.1"
resolved "https://registry.npmjs.org/picocolors/-/picocolors-0.2.1.tgz"
Expand Down Expand Up @@ -11490,11 +11475,6 @@ react-countdown@^2.3.4:
dependencies:
prop-types "^15.7.2"

react-country-flag@^3.0.2:
version "3.0.2"
resolved "https://registry.npmjs.org/react-country-flag/-/react-country-flag-3.0.2.tgz"
integrity sha512-JPaz+q3QD0/nZtHBKj5x3O7r/SgSG9kxbymdaIU0RqlDAcorJIe4KV0DFhWIdKh69q5cPVkIVERcMYGZdvXgAA==

react-dev-utils@^12.0.1:
version "12.0.1"
resolved "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.1.tgz"
Expand Down

1 comment on commit 59f3ac0

@vercel
Copy link

@vercel vercel bot commented on 59f3ac0 Mar 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.