Skip to content

Commit

Permalink
Revert "Merge branch 'main' into metrics"
Browse files Browse the repository at this point in the history
This reverts commit 2d14a6d, reversing
changes made to 7b2b81f.
  • Loading branch information
maria-mcparland committed Aug 26, 2024
1 parent cd82c3f commit a630ebf
Show file tree
Hide file tree
Showing 99 changed files with 1,158 additions and 7,425 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
name: Tests
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Digital Signature Tests

on:
workflow_dispatch:
Expand All @@ -10,12 +13,6 @@ env:
# Purely testing keys that have no access to JP systems etc.
PUBLIC: -----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoZ203HV7SOVSu0U9aJa2\nJjAPgyroUH76rKdnPZCgUDKhDcFmNdYC76VXAUL9e9ajVOxIZyBi4FIuZlw2sHMs\nJwXQigxl6B5ZnBn71rkIyXSlvobY3TaTM8of64Wu/1HUgVIueogANTNslF9Kf7nF\ns1HOWWY/H5iVgRPrIXZJ/AjkPCYwlBLUqU58rvogBuaFD1Q14cHJlaxtj/HM1GZS\n4q0Dg6M5EAwZxRtHImliYbIy8zjq2yhY7lKrMdXfK224Ovc1xrY4M875OPz3ppn5\nuChRQqWviFkbCShs83JV6ncfmCmxQRObYQLkDwSAcgPUIWaNM6TUZQwtpZ+1Magi\njwIDAQAB\n-----END PUBLIC KEY-----
PRIVATE: -----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQChnbTcdXtI5VK7\nRT1olrYmMA+DKuhQfvqsp2c9kKBQMqENwWY11gLvpVcBQv171qNU7EhnIGLgUi5m\nXDawcywnBdCKDGXoHlmcGfvWuQjJdKW+htjdNpMzyh/rha7/UdSBUi56iAA1M2yU\nX0p/ucWzUc5ZZj8fmJWBE+shdkn8COQ8JjCUEtSpTny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wS4nFQKBgQCA\nL3HElcwVI/Z3jZpBUDyy/wRqLGraOF6Va1SWo+QjhL03P7IqMDTai6tbSUHAsKok\nfdoI/+wGLEwF7KqtD0laEWaWu9Vt/dPGXBfpSkZ0rc86YB1srL5mTwPKNqWi42uy\n40NLkJ7mmsrjeTOplc8Eh+rjjbweGYRJf7g3CkArNQKBgHosHrZdUYm6OU0JqfC0\nmdhfx3lx51CxGFH/WhhTxngr1EeQOZg5la5MQXOsW4XAWj91uW5nLSPD7yGQH/HM\n7ef20OXlTVdaJEfzf3wc1ZszqyxD0h9J83zxA18sdYIiraMjFf0TJN9sp+n+Kayl\nStjA0osTStTg0tthBjBmDe7L\n-----END PRIVATE KEY-----
COUNTRY_NAME: UK
STATE_OR_PROVINCE_NAME: SCOTLAND
LOCALITY_NAME: Glasgow
ORGANIZATION_NAME: Org
COMMON_NAME: HELLO
DNS_NAME: WORLD
permissions:
contents: read

Expand All @@ -24,11 +21,11 @@ jobs:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./python/sample-authentication-code
working-directory: ./python
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Set up Python 3.10
uses: actions/setup-python@v5
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Install dependencies
Expand All @@ -38,28 +35,45 @@ jobs:
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Test with pytest
run: |
cd tests
pytest
test-js:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./js
strategy:
matrix:
node-version: [16.x]
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: "npm"
cache-dependency-path: "./js/yarn.lock"
- run: yarn install --frozen-lockfile
- run: yarn test
test-go:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./go/sample-authentication-code/pkg/samples
working-directory: ./go
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: ">=1.19.0"
- run: go test
test-java:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./java/sample-authentication-code
working-directory: ./java
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v3
- name: Set up JDK 17
uses: actions/setup-java@v4
uses: actions/setup-java@v3
with:
java-version: "17"
distribution: "temurin"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/metrics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
ref: metrics
- uses: stefanzweifel/git-auto-commit-action@v5
- name: Set up Python 3.10
uses: actions/setup-python@v5
uses: actions/setup-python@v3
with:
python-version: "3.10"
- name: Gather metrics
Expand All @@ -33,7 +33,7 @@ jobs:
python -m pip install --upgrade pip
pip install github_traffic_stats
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
gts maria-mcparland:$ACCESS_TOKEN 'authentication' 'save_csv' -o jpmorgan-payments
gts maria-mcparland:$ACCESS_TOKEN 'digital-signature' 'save_csv' -o jpmorgan-payments
ls
- name: Run merge script
run: |
Expand Down
10 changes: 1 addition & 9 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -129,14 +129,6 @@ dist
.yarn/install-state.gz
.pnp.*

# npm
package-lock.json

__pycache__
launch.json
target
.pytest_cache


application-local.yml
.idea
target
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,31 @@
# J.P. Morgan Authentication examples
# Generate a Digital Signature for hitting payments APIs

Within this repository you can find example code for accessing our Payments APIs.
We have split the code by programming language for ease of use.
Each folder contains:
When accessing our Payments API we require a Digital Signature (also known as JWT Token) to be used as a post body.
This digital signature is an encoded version of your JSON body.

- sample-authentication-code: This contains code scripts for generating digital signatures (also known as JWTs), gathering access tokens and generating certificates.
- backend-example: This is a fully functioning server that can handle sending requests to our APIs. (Coming soon to all languages!)
This example code shows you how to generate the digital signature to hit the POST endpoints on our APIs.
We have generated the initial code using the ChatGPT API and then corrected errors manually.

**Note this is not production code and is supplied to get developers started **
## How to run locally

You can manually clone and configure the example yourself:

```
git clone https://github.com/jpmorgan-payments/digital-signature.git
```

This example includes several different language implementations.

Pick a programming langauge:

- [Go](./go/)
- [JavaScript](./js/)
- [Python](./python/)
- [Java](./java/)

### Generating test certificates

You can follow the below commands to get setup with some testing certificates. To use these against J.P. Morgan APIs you will need to onboard them on [developer.jpmorgan.com](https://developer.jpmorgan.com)
You can follow the below commands to get setup with some testing certificates. To use these against J.P. Morgan APIs you will need to onboard them on [developer.jpmorgan.com](developer.jpmorgan.com)

```bash
openssl genrsa -out keypair.pem 2048
Expand Down
3 changes: 0 additions & 3 deletions certificates/README.md

This file was deleted.

27 changes: 27 additions & 0 deletions go/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# Digital Signature GoLang snippet

A snippet of Golang code to show how to create a digital signature

## Requirements

- Go installed
- [Configured .env file](../README.md)

## How to run

You can run this code by running the tests or by including it in your codebase.

1. Confirm `.env` configuration

Ensure the certificate keys are configured in `.env` in this directory. You can find information on generating certificates at in our [readme](../README.md). It should include the following keys:

```yaml
PRIVATE=...
PUBLIC=
```

2. Install dependencies and start the server

```
go test
```
33 changes: 0 additions & 33 deletions go/backend-example/README.md

This file was deleted.

3 changes: 0 additions & 3 deletions go/backend-example/oauth/go.mod

This file was deleted.

76 changes: 0 additions & 76 deletions go/backend-example/oauth/proxy.go

This file was deleted.

3 changes: 0 additions & 3 deletions go/backend-example/ssl/go.mod

This file was deleted.

Loading

0 comments on commit a630ebf

Please sign in to comment.