Category Archives: Development

Playing in the Triodos Open Banking sandbox

Check out Triodos Open Banking for Developers

I’ve made some scripty stuff in python to play with the lovely Triodos Bank’s Open Banking sandbox. I’m really not sure why…

My python code does everything needed to get a transaction list out of the Triodos API. (As of writing it just grabs the first account that permissions are granted for.)

There are 14 commands (I’m calling modes) which, if followed in order, result in a final “Get Account Transactions” command (12-14 are Initial Query (get first), Get Next (pagination), Get First again)

Actions performed (as described in Triodos API docs) are: Get Initial Access Token, Register URIs, Get Authorization, Exchange the Authorization Code for an Access Token, Request Consent, Get Accounts, Get Account Balances, Get Account Transactions.

If you want to use my Python code then follow these steps.

Step 0:

Unpack my files

Install python and maybe lots of python modules… (and also php if you want to use callback recording bit)

Step 1:

Get a test certificate:

https://xs2a-sandbox.triodos.com/xs2a-bg/internalonly/generateCertificate.xhtml

The organization ID needs to be a valid format for eIDAS eg: PSDUS-AAA-AAAA88 if your country code is “US”

You should save your organization ID into:

rfyoz-OB1/secrets_store/mybank1/your_id.txt (without leading or trailing whitespace in file)

Step 2:

Save your eIDAS Organization Id to:

rfyoz-OB1/secrets_store/mybank1/your_id.txt

Save the generated Private key to:

rfyoz-OB1/secrets_store/mybank1/secret_key.txt

Save the generated Signing Certificate public key to:

rfyoz-OB1/secrets_store/mybank1/sign.txt

Save the generated Issuer key id to:

rfyoz-OB1/secrets_store/mybank1/key_id.txt

Step 2.5:

Create a test user in the sandbox:

https://xs2a-sandbox.triodos.com/xs2a-bg/internalonly/generateTestUser.xhtml

Step 3:

Run rfyoz-OB1/code/server/go_server.sh

Step 4:

Run rfyoz-OB1/code/scripts/run_first.sh

Run rfyoz-OB1/code/scripts/go.sh

Run rfyoz-OB1/code/scripts/go2.sh

You should get some transactions, that when put in an HTML table, look like this: Triodos API output.

Triodos weren’t very imaginative with the fake data it seems.

Code for Password Generator – Good or bad?

Is this a good way to generate random passwords? (used in this app)

https://apps.andymade.uk/pre-downloads/password-generator/browse_source/main/java/uk/rfyoz/passwordgenerator/MainActivity.kt

package uk.rfyoz.passwordgenerator

import android.os.Bundle
import android.util.Log
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.github.davidmoten.util.words.DictionarySowpods
import kotlinx.android.synthetic.main.activity_main.*
import java.util.*

// nextInt is normally exclusive of the top value,
// so add 1 to make it inclusive


class MainActivity : AppCompatActivity() {

    fun randomInt(min:Int,max:Int) :Int {
        /* var randomNum = ThreadLocalRandom . current ().nextInt(min, max + 1); */
        var randomNum = random1.nextInt(max+1)
        return randomNum;
    }
    var d = DictionarySowpods()
    val numberOfWords = d.count()
    var random1: Random = Random()
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)


        val println = Log.println(
                Log.INFO,
                "MYMESSAGE________MESSAGE",d.elementAt(randomInt(0,numberOfWords - 1))

        )
        newPassword()
    }

    fun randomWord() :String
    {
        return d.elementAt(randomInt(0,numberOfWords - 1)).toLowerCase()
    }

    fun randomNumber() :String
    {
        return randomInt(0,9).toString()
    }

    fun randomSymbol() :String
    {
        val s = "#~][.:!£$%^&*"
        return s.elementAt(randomInt(0,s.length-1)).toString()
    }

    fun randomNumberOrSymbol() : String
    {
        return if(random1.nextBoolean()) randomSymbol()
        else {
            randomNumber()
        }
    }

    public fun newPasswordButtonClicked(view: View) {

        button.run({

            newPassword()
        })
    }
    fun randomNumbersOrSymbols() : String
    {
        var buffer = ""
        var count = random1.nextInt(3)
        while (count > 0) {
            buffer = buffer + randomNumberOrSymbol()
            count = count - 1
        }
        return buffer
    }


    fun newPassword()
    {
        var newPassword = randomNumbersOrSymbols() + randomWord() + randomNumbersOrSymbols() + randomWord() + randomNumbersOrSymbols() + randomWord();
        passwordText.setText(newPassword)

    }


}