Skip to content

Commit

Permalink
chore: upgrade react-native-keychain (#2360)
Browse files Browse the repository at this point in the history
  • Loading branch information
pwltr authored Nov 26, 2024
1 parent 8dcc70b commit 06258ce
Show file tree
Hide file tree
Showing 14 changed files with 202 additions and 206 deletions.
34 changes: 0 additions & 34 deletions __mocks__/@synonymdev/react-native-keychain/index.ts

This file was deleted.

71 changes: 71 additions & 0 deletions __mocks__/react-native-keychain/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
const mockKeychainPasswords = {};

const getGenericPassword = jest.fn(({ service }) => {
return { password: mockKeychainPasswords[service] };
});

const setGenericPassword = jest.fn((key, value) => {
mockKeychainPasswords[key] = value;
});

const keychainMock = {
SECURITY_LEVEL: {
SECURE_SOFTWARE: 'MOCK_SECURITY_LEVEL_SECURE_SOFTWARE',
SECURE_HARDWARE: 'MOCK_SECURITY_LEVEL_SECURE_HARDWARE',
ANY: 'MOCK_SECURITY_LEVEL_ANY',
},
ACCESSIBLE: {
WHEN_UNLOCKED: 'MOCK_AccessibleWhenUnlocked',
AFTER_FIRST_UNLOCK: 'MOCK_AccessibleAfterFirstUnlock',
ALWAYS: 'MOCK_AccessibleAlways',
WHEN_PASSCODE_SET_THIS_DEVICE_ONLY:
'MOCK_AccessibleWhenPasscodeSetThisDeviceOnly',
WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'MOCK_AccessibleWhenUnlockedThisDeviceOnly',
AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY:
'MOCK_AccessibleAfterFirstUnlockThisDeviceOnly',
},
ACCESS_CONTROL: {
USER_PRESENCE: 'MOCK_UserPresence',
BIOMETRY_ANY: 'MOCK_BiometryAny',
BIOMETRY_CURRENT_SET: 'MOCK_BiometryCurrentSet',
DEVICE_PASSCODE: 'MOCK_DevicePasscode',
APPLICATION_PASSWORD: 'MOCK_ApplicationPassword',
BIOMETRY_ANY_OR_DEVICE_PASSCODE: 'MOCK_BiometryAnyOrDevicePasscode',
BIOMETRY_CURRENT_SET_OR_DEVICE_PASSCODE:
'MOCK_BiometryCurrentSetOrDevicePasscode',
},
AUTHENTICATION_TYPE: {
DEVICE_PASSCODE_OR_BIOMETRICS:
'MOCK_AuthenticationWithBiometricsDevicePasscode',
BIOMETRICS: 'MOCK_AuthenticationWithBiometrics',
},
STORAGE_TYPE: {
FB: 'MOCK_FacebookConceal',
AES: 'MOCK_KeystoreAESCBC',
RSA: 'MOCK_KeystoreRSAECB',
KC: 'MOCK_keychain',
},
getGenericPassword,
setGenericPassword,
resetGenericPassword: jest.fn().mockResolvedValue(true),
hasGenericPassword: jest.fn().mockResolvedValue(true),
getAllGenericPasswordServices: jest
.fn()
.mockResolvedValue(['mockService1', 'mockService2']),
setInternetCredentials: jest.fn().mockResolvedValue({
service: 'mockService',
storage: 'mockStorage',
}),
getInternetCredentials: jest.fn().mockResolvedValue({
username: 'mockUser',
password: 'mockPassword',
service: 'mockService',
storage: 'mockStorage',
}),
resetInternetCredentials: jest.fn().mockResolvedValue(true),
getSupportedBiometryType: jest.fn().mockResolvedValue('MOCK_TouchID'),
canImplyAuthentication: jest.fn().mockResolvedValue(true),
getSecurityLevel: jest.fn().mockResolvedValue('MOCK_SECURE_SOFTWARE'),
};

export default keychainMock;
12 changes: 6 additions & 6 deletions ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNKeychain (9.1.1):
- RNKeychain (9.2.2):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1987,7 +1987,7 @@ DEPENDENCIES:
- RNDeviceInfo (from `../node_modules/react-native-device-info`)
- RNFS (from `../node_modules/react-native-fs`)
- RNGestureHandler (from `../node_modules/react-native-gesture-handler`)
- "RNKeychain (from `../node_modules/@synonymdev/react-native-keychain`)"
- RNKeychain (from `../node_modules/react-native-keychain`)
- RNLocalize (from `../node_modules/react-native-localize`)
- "RNNotifee (from `../node_modules/@notifee/react-native`)"
- RNPermissions (from `../node_modules/react-native-permissions`)
Expand Down Expand Up @@ -2178,7 +2178,7 @@ EXTERNAL SOURCES:
RNGestureHandler:
:path: "../node_modules/react-native-gesture-handler"
RNKeychain:
:path: "../node_modules/@synonymdev/react-native-keychain"
:path: "../node_modules/react-native-keychain"
RNLocalize:
:path: "../node_modules/react-native-localize"
RNNotifee:
Expand Down Expand Up @@ -2293,7 +2293,7 @@ SPEC CHECKSUMS:
RNDeviceInfo: b899ce37a403a4dea52b7cb85e16e49c04a5b88e
RNFS: 4ac0f0ea233904cb798630b3c077808c06931688
RNGestureHandler: e80cae4246813ee7f667a2552012a6b7da5550a1
RNKeychain: 3ac3a44294d0b18492667ff87e4c50829cb35505
RNKeychain: 4cfd0dc8634c2dd81a4607c8299ed424bfdee1a7
RNLocalize: dbea38dcb344bf80ff18a1757b1becf11f70cae4
RNNotifee: 8e2d3df3f0e9ce8f5d1fe4c967431138190b6175
RNPermissions: 2c0eec471f4de66d04d226c339898d10a6e123c4
Expand All @@ -2308,9 +2308,9 @@ SPEC CHECKSUMS:
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
sodium-react-native-direct: 8feb9a6d0d88ce65efa305d6cc774c11c62d9a15
SSZipArchive: c69881e8ac5521f0e622291387add5f60f30f3c4
Yoga: 2a45d7e59592db061217551fd3bbe2dd993817ae
Yoga: a1d7895431387402a674fd0d1c04ec85e87909b8
ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5

PODFILE CHECKSUM: cb153cb4a39e6c92c8b869eafab65a4bba7b869f

COCOAPODS: 1.15.2
COCOAPODS: 1.16.2
Loading

0 comments on commit 06258ce

Please sign in to comment.