Skip to content

Commit

Permalink
Merge pull request #22 from boltcard/ios-update
Browse files Browse the repository at this point in the history
Use APDU commands to allow card programming to work on iOS as well as android
  • Loading branch information
chloehjung15 authored Aug 7, 2023
2 parents e0baf6a + cca5ac2 commit 61d5470
Show file tree
Hide file tree
Showing 14 changed files with 2,480 additions and 413 deletions.
907 changes: 907 additions & 0 deletions class/Ntag424.js

Large diffs are not rendered by default.

56 changes: 56 additions & 0 deletions constants/ErrorCodes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
export default errorCodes = {
'6700': 'Wrong or inconsistent APDU length.',
'6985': 'Wrapped chained command or multiple pass command ongoing.',
'6a82': 'Application or file not found, currently selected application remains selected.',
'6a86': 'Wrong parameter P1 and/or P2',
'6a87': 'Wrong parameter Lc inconsistent with P1-P2',
'6e00': 'Wrong CLA',
'6581': 'Memory failure',
'6982': 'Security status not satisfied',
'91ca': 'COMMAND_ABORTED',
'917e': 'LENGTH_ERROR',
'919e': 'PARAMETER_ERROR',
'9140': 'NO_SUCH_KEY',
'919d': 'PERMISSION_DENIED',
'91ad': 'AUTHENTICATION_DELAY',
'911e': 'INTEGRITY_ERROR',
'91f0': 'FILE_NOT_FOUND',
'91ae': 'AUTHENTICATION_ERROR',
'91ee': 'MEMORY_ERROR',
'91be': 'BOUNDARY_ERROR'
};

//NOTE: when new APDU command gets added make sure the error codes are added here


export const isoSelectErrorCodes = {
'6700' : 'Wrong or inconsistent APDU length.',
'6985' : 'Wrapped chained command or multiple pass command ongoing.',
'6a82' : 'Application or file not found, currently selected application remains selected.',
'6a86' : 'Wrong parameter P1 and/or P2',
'6a87' : 'Wrong parameter Lc inconsistent with P1-P2',
'6e00' : 'Wrong CLA',
};


export const changeKeyErrorCodes = {
'91ca' : 'COMMAND_ABORTED Chained command or multiple pass command ongoing.',
'911e' : 'INTEGRITY_ERROR Integrity error in cryptogram or Invalid Secure Messaging MAC (only).',
'917e' : 'LENGTH_ERROR Command size not allowed.',
'919e' : 'PARAMETER_ERROR Parameter value not allowed',
'919d' : 'PERMISSION_DENIED PICC level (MF) is selected. access right Change of targeted file has access conditions set to Fh. Enabling Secure Dynamic Messaging (FileOption Bit 6 set to 1b) is only allowed for FileNo 02h.',
'91ae' : 'AUTHENTICATION_ERROR At application level, missing active authentication with AppMasterKey while targeting any AppKey.',
'91ee' : 'MEMORY_ERROR Failure when reading or writing to non-volatile memory.',
};


export const changeFileSettingsErrorCodes = {
'91ca' : 'COMMAND_ABORTED chained command or multiple pass command ongoing.',
'911e' : 'INTEGRITY_ERROR Integrity error in cryptogram. Invalid Secure Messaging MAC (only).',
'917e' : 'LENGTH_ERROR Command size not allowed.',
'919e' : 'PARAMETER_ERROR Parameter value not allowed',
'919d' : 'PERMISSION_DENIED PICC level (MF) is selected. access right Change of targeted file has access conditions set to Fh. Enabling Secure Dynamic Messaging (FileOption Bit 6 set to 1b) is only allowed for FileNo 02h.',
'91f0' : 'FILE_NOT_FOUND F0h File with targeted FileNo does not exist for the targeted application. ',
'91ae' : 'AUTHENTICATION_ERROR AEh File access right Change of targeted file not granted as there is no active authentication with the required key while the access conditions is different from Fh.',
'91ee' : 'MEMORY_ERROR EEh Failure when reading or writing to non-volatile memory.',
};
Binary file added img/bolt-card-link_black.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions ios/BoltCardWallet.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1131,7 +1131,7 @@
CODE_SIGN_ENTITLEMENTS = BoltCardWallet/BoltCardWallet.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 6;
CURRENT_PROJECT_VERSION = 1;
DEAD_CODE_STRIPPING = NO;
DEVELOPMENT_TEAM = G2LFSW78NA;
ENABLE_BITCODE = NO;
Expand All @@ -1154,7 +1154,7 @@
"$(inherited)",
"$(PROJECT_DIR)",
);
MARKETING_VERSION = 0.1.1;
MARKETING_VERSION = 0.2.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down Expand Up @@ -1185,7 +1185,7 @@
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 6;
CURRENT_PROJECT_VERSION = 1;
DEVELOPMENT_TEAM = G2LFSW78NA;
ENABLE_BITCODE = NO;
"ENABLE_HARDENED_RUNTIME[sdk=macosx*]" = YES;
Expand All @@ -1202,7 +1202,7 @@
"$(inherited)",
"$(PROJECT_DIR)",
);
MARKETING_VERSION = 0.1.1;
MARKETING_VERSION = 0.2.1;
OTHER_LDFLAGS = (
"$(inherited)",
"-ObjC",
Expand Down
5 changes: 5 additions & 0 deletions ios/BoltCardWallet/BoltCardWallet.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>TAG</string>
<string>NDEF</string>
</array>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
Expand Down
5 changes: 5 additions & 0 deletions ios/BoltCardWallet/BoltCardWalletRelease.entitlements
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
<dict>
<key>aps-environment</key>
<string>development</string>
<key>com.apple.developer.nfc.readersession.formats</key>
<array>
<string>TAG</string>
<string>NDEF</string>
</array>
<key>com.apple.security.app-sandbox</key>
<true/>
<key>com.apple.security.application-groups</key>
Expand Down
7 changes: 7 additions & 0 deletions ios/BoltCardWallet/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@
<true/>
<key>LSSupportsOpeningDocumentsInPlace</key>
<true/>
<key>NFCReaderUsageDescription</key>
<string>NFC scanning is used to read/program your boltcard</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
Expand Down Expand Up @@ -316,5 +318,10 @@
<key>apiKey</key>
<string>736dc945917207ed3993518c9110bbd9</string>
</dict>
<key>com.apple.developer.nfc.readersession.iso7816.select-identifiers</key>
<array>
<string>D2760000850100</string>
<string>D2760000850101</string>
</array>
</dict>
</plist>
2 changes: 2 additions & 0 deletions ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ target 'BoltCardWallet' do
# to enable hermes on iOS, change `false` to `true` and then install pods
:hermes_enabled => false
)

pod 'RNFS', :path => '../node_modules/react-native-fs'

# Enables Flipper.
#
Expand Down
8 changes: 7 additions & 1 deletion ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,8 @@ PODS:
- React-Core
- react-native-ios-context-menu (1.15.3):
- React-Core
- react-native-nfc-manager (3.14.5):
- React-Core
- react-native-qrcode-local-image (1.0.4):
- React
- react-native-randombytes (3.6.1):
Expand Down Expand Up @@ -555,6 +557,7 @@ DEPENDENCIES:
- react-native-idle-timer (from `../node_modules/react-native-idle-timer`)
- react-native-image-picker (from `../node_modules/react-native-image-picker`)
- react-native-ios-context-menu (from `../node_modules/react-native-ios-context-menu`)
- react-native-nfc-manager (from `../node_modules/react-native-nfc-manager`)
- "react-native-qrcode-local-image (from `../node_modules/@remobile/react-native-qrcode-local-image`)"
- react-native-randombytes (from `../node_modules/react-native-randombytes`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
Expand Down Expand Up @@ -683,6 +686,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native-image-picker"
react-native-ios-context-menu:
:path: "../node_modules/react-native-ios-context-menu"
react-native-nfc-manager:
:path: "../node_modules/react-native-nfc-manager"
react-native-qrcode-local-image:
:path: "../node_modules/@remobile/react-native-qrcode-local-image"
react-native-randombytes:
Expand Down Expand Up @@ -827,6 +832,7 @@ SPEC CHECKSUMS:
react-native-idle-timer: 97b8283237d45146a7a5c25bdebe9e1e85f3687b
react-native-image-picker: 24a36044140202085113ce99b57bf52c62dc339e
react-native-ios-context-menu: b522377ce20e859c96d4d508703483f028ae1844
react-native-nfc-manager: 00700a5cd081bf78e2f33fbf84b8610aef4a832c
react-native-qrcode-local-image: 35ccb306e4265bc5545f813e54cc830b5d75bcfc
react-native-randombytes: 5fc412efe7b5c55b9002c0004d75fe5fabcaa507
react-native-safe-area-context: 5b8a418400eb3d8364aa87300e865c0262cc17b9
Expand Down Expand Up @@ -876,6 +882,6 @@ SPEC CHECKSUMS:
Yoga: 5ed1699acbba8863755998a4245daa200ff3817b
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a

PODFILE CHECKSUM: 18cca50594797cb5feb4d92634ca0f147993b45b
PODFILE CHECKSUM: a0db116dd5af0f09d150a5ce801116d7fdaf48a6

COCOAPODS: 1.10.2
Loading

0 comments on commit 61d5470

Please sign in to comment.