Skip to content

Commit

Permalink
Merge pull request #1 from payrails/PR-2360-create-cse-ios-sdk-with-n…
Browse files Browse the repository at this point in the history
…ew-client-side-encryption-flow

PR-2360: Create cse ios sdk
  • Loading branch information
ngub authored Jun 30, 2023
2 parents d57e1ff + 9371124 commit e078a25
Show file tree
Hide file tree
Showing 11 changed files with 477 additions and 13 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: iOS CSE CI
on:
pull_request:
branches: ["main"]
jobs:
ci:
runs-on: macos-latest

strategy:
matrix:
node-version: [12.x]

steps:
- uses: actions/checkout@v2

- name: Pod Lint
run: |
pod lib lint
2 changes: 1 addition & 1 deletion .github/workflows/semgrep.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ jobs:
env:
# more rules at semgrep.dev/explore
SEMGREP_RULES: >-
.semgrep
p/security-audit
p/secrets
p/supply-chain
Expand All @@ -45,6 +44,7 @@ jobs:
p/javascript
p/kubernetes
p/terraform
p/swift
SEMGREP_SEND_METRICS: 0
SEMGREP_TIMEOUT: 1800
#SEMGREP_BASELINE_REF: master
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/trivy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Run Trivy vulnerability scanner (filesystem)
uses: aquasecurity/trivy-action@master
with:
scan-type: 'config'
scan-type: 'fs'
scan-ref: '.'
hide-progress: false
ignore-unfixed: true
Expand Down
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
.idea/
.DS_Store
/.build
/Packages
/*.xcodeproj
xcuserdata/
DerivedData/
.swiftpm/config/registries.json
.swiftpm/xcode/package.xcworkspace/contents.xcworkspacedata
.netrc
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2023 Payrails GmbH

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
14 changes: 14 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"pins" : [
{
"identity" : "joseswift",
"kind" : "remoteSourceControl",
"location" : "https://github.com/airsidemobile/JOSESwift.git",
"state" : {
"revision" : "10ed3b6736def7c26eb87135466b1cb46ea7e37f",
"version" : "2.4.0"
}
}
],
"version" : 2
}
33 changes: 33 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// swift-tools-version: 5.8
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "PayrailsCSE",
platforms: [
.macOS(.v11),
.iOS(.v14)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "PayrailsCSE",
targets: ["PayrailsCSE"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
.package(url: "https://github.com/airsidemobile/JOSESwift.git", from: "2.3.0")
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "PayrailsCSE",
dependencies: ["JOSESwift"]),
.testTarget(
name: "PayrailsCSETests",
dependencies: ["PayrailsCSE"]),
]
)
35 changes: 35 additions & 0 deletions PayrailsCSE.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#
# Be sure to run `pod lib lint PayrailsCSE.podspec' to ensure this is a
# valid spec before submitting.
#
# Any lines starting with a # are optional, but their use is encouraged
# To learn more about a Podspec see https://guides.cocoapods.org/syntax/podspec.html
#

Pod::Spec.new do |s|
s.name = 'PayrailsCSE'
s.version = '0.1.0'
s.summary = 'Payrails client-side encryption SDK'

# This description is used to generate tags and improve search results.
# * Think: What does it do? Why did you write it? What is the focus?
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!

s.swift_version = '5.8'

s.description = <<-DESC
SDK provides client side encryption and tokenization on Payrails platform.
DESC

s.homepage = 'https://github.com/payrails/ios-cse'
s.license = { :type => 'MIT', :file => 'LICENSE' }
s.author = { 'Payrails' => '[email protected]' }
s.source = { :git => 'https://github.com/payrails/ios-cse.git', :tag => s.version.to_s }

s.ios.deployment_target = '10.0'

s.source_files = 'Sources/**/*'
s.dependency 'JOSESwift'
end
66 changes: 55 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,63 @@
# Payrails Template Repository
# Payrails iOS CSE SDK

[![Semgrep Badge](https://github.com/payrails/template-repository/actions/workflows/semgrep.yaml/badge.svg?branch=master)](https://github.com/payrails/template-repository/actions/workflows/semgrep.yaml)

### Features
## Features

...
SDK provides client side encryption and tokenization on Payrails platform.

### Getting Started
## Installation

...
### CocoaPods

### Reporting Vulnerabilities
Add `pod 'PayrailsCSE'` to your `Podfile`.
Run `pod install`.

...
### Swift Package Manager

### Contributing
Use `https://github.com/Payrails/ios-cse` as the repository URL

...
## Usage example

```(swift)
import PayrailsCSE
let cse = PayrailsCSE(
data: initResponse.data,
version: initResponse.version
)
cse.tokenize(
cardNumber: cardNumber,
expiryMonth: expiryMonth,
expiryYear: expiryYear,
holderName: holderName,
securityCode: securityCode,
futureUsage: futureUsage,
storeInstrument: storeInstrument,
completion: {(result: Result<TokenizeResponse, Error>) in
switch result {
case .success(let response):
debugPrint("tokenization request successful")
case .failure(let error):
debugPrint("tokenization request failed")
}
}
)
```

## Security Policy

### Reporting a Vulnerability

If you find any vulnerability in ios-cse, do not hesitate to _report them_.

1. Send the disclosure to [email protected]

2. Describe the vulnerability.

If you have a fix, that is most welcome -- please attach or summarize it in your message!

3. We will evaluate the vulnerability and, if necessary, release a fix or mitigating steps to address it. We will contact you to let you know the outcome, and will credit you in the report.

Please **do not disclose the vulnerability publicly** until a fix is released!

4. Once we have either a) published a fix, or b) declined to address the vulnerability for whatever reason, you are free to publicly disclose it.
Loading

0 comments on commit e078a25

Please sign in to comment.