On a project I’m working on there is an integration to the payment provider Klarna. I was having trouble to get it to work on my local development environment.
Everytime a purchase was made the visitor(me) was supposed to get redirected back to the dev-environment. I was… but to the wrong url: https://local-dev-env-url/+CSCOE+/wrong_url.html In my case this was connected to the validation_uri setting.
Validation uri
What is the validation_uri ?
“This checkout function will allow you to validate the information provided by the consumer in the Klarna Checkout iframe before the purchase is completed.” – Klarna
Since I’m running this code locally the Klarna API can’t reach my validation uri. That was what was causing my problem. For debugging purposes you can skip to send the validation_uri since it is an optional setting according to the documentation. To also debug the validation logic you need to make sure the Klarna API can reach that url.
Hopefully this helps someone else in the same situation as I was. But I have a feeling you can encounter the same error but it’s being caused by something else.
A big thanks to the Klarna support for helping out with this!
brew update
brew install Caskroom/cask/osxfuse
cd /Downloads/dislocker-master/src
brew install dislocker.rb
When I ran the last command to install dislocker this error showed up:
Last 15 lines from /Library/Logs/Homebrew/dislocker/02.make:
In file included from /tmp/dislocker-20171015-14904-gzgqvz/dislocker-0.7/src/config.c:30:
In file included from /tmp/dislocker-20171015-14904-gzgqvz/dislocker-0.7/include/dislocker/dislocker.priv.h:31:
/tmp/dislocker-20171015-14904-gzgqvz/dislocker-0.7/include/dislocker/metadata/metadata.priv.h:296:20: error: unknown type name 'VALUE'
void Init_metadata(VALUE rb_mDislocker);
^
make[2]: ***[src/CMakeFiles/dislocker.dir/dislocker.c.o] Error 1
make[2]: ***[src/CMakeFiles/dislocker_bundle.dir/dislocker.c.o] Error 1
13 errors generated.
...
make[2]: ***[src/CMakeFiles/dislocker.dir/config.c.o] Error 1
make[1]: ***[src/CMakeFiles/dislocker.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
make[1]: ***[src/CMakeFiles/dislocker_bundle.dir/all] Error 2
make: ***[all] Error 2
By unlinking ruby as explained by jricks92 on Github the install went through with no errors:
brew unlink ruby
brew install dislocker.rb
brew link ruby
2. Drive identifier
Now we need to know the identifier of the bitlocker encrypted disk. In the terminal we’ll run the command diskutil list (on macOS).
$ diskutil list
/dev/disk2 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *500.1 GB disk2
1: Microsoft Basic Data 500.1 GB disk2s1
The identifier i’m interested in here is called disk2s1
3. Encrypt with dislocker
First we need to create a folder where a virtual NTFS partition called dislocker-file will be created. I’ll call mine externalhdd and i’ll create it in the mnt folder.
sudo mkdir /mnt/externalhdd
Now it’s time to use Dislocker to decrypt the disk.
-V /dev/disk2s1 tells dislocker what disk to decrypt. -u tells dislockers to ask the user for the password the disk is encrypted with. -- /mnt/externalhdd passes the path to the folder we created to store the virtual ntfs-partition.
4. Create a block device
Now we need to create a block device before mounting the disk.
hdiutil - manipulate disk images (attach, verify, create, etc) attach - Attach a disk image as a device imagekey - specify a key/value pair for the disk image recognition system. I can’t find information on what the diskimageclass=creatdiskimage means in the man pages of hdiutil. nomount - indicate whether filesystems in the image should be mounted or not.
After running this command i got the line /dev/disk3 printed in the console. Now we’ll use that to mount the drive.
5. Mount
Start by creating a folder where the drive will be mounted
sudo mkdir /Volumes/ExternalHDD
Then we run this command to mount it (only readable):
sudo mount -t ntfs /dev/disk3 /Volumes/ExternalHDD/
And by now, if you haven’t encountered any errors, you should see the disk in Finder.
Documentation
There are more to dislocker than this post shows, take a look at the man pages to get more info:
With dest we set where the .deb package will be saved.
The icon options points to an icon the app will get.
categories sets the category where the application will be seen in menus. I’ve choosen Utility for this app since there is no real good place for it. You can take a look at the available categories for your app.
lintianOverrides is used to quieten Lintian, which is a debian package checker.
There are a lot of other options you can set. You might want to check how to set for example dependencies. But this will currently be enough for the Electron tutorial app.
3. Package the app
Now we need to make sure we have a packaged app. First I need to make an update to the packager script since I’ve missed a setting there. Thank you Felipe Castillo for the help!
The package script called package-linux in package.json that currently looks like this:
After doing that step I was happy and tired and didn’t add that key into the info.plist again before going on vacation. Bad move. I spent an hour figuring out why my app wouldn’t start when running react-native run-ios. Instead i got the error No bundle URL Present..
Info.plist
By adding the following to info.plist it started to work again: