Skip to content

Commit

Permalink
cd script
Browse files Browse the repository at this point in the history
  • Loading branch information
flypaper0 committed Mar 21, 2023
1 parent fc49833 commit 6576e3c
Show file tree
Hide file tree
Showing 9 changed files with 40 additions and 13 deletions.
15 changes: 13 additions & 2 deletions .github/workflows/set-user-agent.yml → .github/workflows/cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
# it takes pull request name
# and automatically commit it as a package version
# pull request name should always be a version of a new release
#
# After version bump publishing Cocoapods release

name: set-user-agent
name: cd

on:
pull_request:
branches: [ main ]
branches: [ main, develop ]
env:
PACKAGE_VERSION: ${{ github.event.pull_request.title }}

Expand All @@ -18,6 +20,7 @@ jobs:
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
token: ${{ secrets.GH_TOKEN }}

- name: Set User Agent
Expand All @@ -27,4 +30,12 @@ jobs:
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: Set User Agent
tagging_message: ${{ github.event.pull_request.title }}
skip_checkout: true

- name: Publish to CocoaPod register
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
run: |
pod trunk push WalletConnectSwiftV2.podspec --verbose
1 change: 1 addition & 0 deletions Sources/WalletConnectIdentity/IdentityImports.swift
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#if !CocoaPods
@_exported import WalletConnectNetworking
@_exported import WalletConnectJWT
#endif
2 changes: 1 addition & 1 deletion Sources/WalletConnectIdentity/IdentityKeyAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ enum IdentityKeyAPI: HTTPService {
}
}

var method: WalletConnectNetworking.HTTPMethod {
var method: HTTPMethod {
switch self {
case .registerIdentity, .registerInvite:
return .post
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Foundation

struct AuthPayload: JWTClaimsCodable {
struct RelayAuthPayload: JWTClaimsCodable {

struct Wrapper: JWTWrapper {
let jwtString: String
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct SocketAuthenticator: SocketAuthenticating {

func createAuthToken() throws -> String {
let keyPair = try clientIdStorage.getOrCreateKeyPair()
let payload = AuthPayload(subject: getSubject(), audience: getAudience())
let payload = RelayAuthPayload(subject: getSubject(), audience: getAudience())
return try payload.signAndCreateWrapper(keyPair: keyPair).jwtString
}

Expand Down
2 changes: 0 additions & 2 deletions Sources/WalletConnectRelay/RPC/Methods/Subscription.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@

import Foundation
import WalletConnectUtils

struct Subscription: RelayRPC {

Expand Down
2 changes: 1 addition & 1 deletion Tests/RelayerTests/AuthTests/EdDSASignerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class EdDSASignerTests: XCTestCase {
let signingKey = try! SigningPrivateKey(rawRepresentation: keyRaw)
sut = EdDSASigner(signingKey)
let header = try! JWTHeader(alg: "EdDSA").encode()
let claims = try! AuthPayload.Claims.stub().encode()
let claims = try! RelayAuthPayload.Claims.stub().encode()
let signature = try! sut.sign(header: header, claims: claims)
XCTAssertNotNil(signature)
}
Expand Down
8 changes: 4 additions & 4 deletions Tests/RelayerTests/AuthTests/JWTTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ final class JWTTests: XCTestCase {
let expectedJWT = "eyJhbGciOiJFZERTQSIsInR5cCI6IkpXVCJ9.eyJpYXQiOjE2NTY5MTAwOTcsImV4cCI6MTY1Njk5NjQ5NywiaXNzIjoiZGlkOmtleTp6Nk1rb2RIWnduZVZSU2h0YUxmOEpLWWt4cERHcDF2R1pucEdtZEJwWDhNMmV4eEgiLCJzdWIiOiJjNDc5ZmU1ZGM0NjRlNzcxZTc4YjE5M2QyMzlhNjViNThkMjc4Y2FkMWMzNGJmYjBiNTcxNmU1YmI1MTQ5MjhlIiwiYXVkIjoid3NzOi8vcmVsYXkud2FsbGV0Y29ubmVjdC5jb20ifQ.0JkxOM-FV21U7Hk-xycargj_qNRaYV2H5HYtE4GzAeVQYiKWj7YySY5AdSqtCgGzX4Gt98XWXn2kSr9rE1qvCA"

func testJWTEncoding() {
var jwt = JWT(claims: AuthPayload.Claims.stub())
var jwt = JWT(claims: RelayAuthPayload.Claims.stub())
let signer = EdDSASignerMock()
signer.signature = "0JkxOM-FV21U7Hk-xycargj_qNRaYV2H5HYtE4GzAeVQYiKWj7YySY5AdSqtCgGzX4Gt98XWXn2kSr9rE1qvCA"
try! jwt.sign(using: signer)
Expand All @@ -16,8 +16,8 @@ final class JWTTests: XCTestCase {
}
}

extension AuthPayload.Claims {
static func stub() -> AuthPayload.Claims {
extension RelayAuthPayload.Claims {
static func stub() -> RelayAuthPayload.Claims {
let iss = "did:key:z6MkodHZwneVRShtaLf8JKYkxpDGp1vGZnpGmdBpX8M2exxH"
let sub = "c479fe5dc464e771e78b193d239a65b58d278cad1c34bfb0b5716e5bb514928e"
let iatDate = Date(timeIntervalSince1970: 1656910097)
Expand All @@ -27,6 +27,6 @@ extension AuthPayload.Claims {
let aud = "wss://relay.walletconnect.com"
let expDate = Calendar.current.date(byAdding: components, to: iatDate)!
let exp = UInt64(expDate.timeIntervalSince1970)
return AuthPayload.Claims(iss: iss, sub: sub, aud: aud, iat: iat, exp: exp)
return RelayAuthPayload.Claims(iss: iss, sub: sub, aud: aud, iat: iat, exp: exp)
}
}
19 changes: 18 additions & 1 deletion WalletConnectSwiftV2.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,24 @@ Pod::Spec.new do |spec|

spec.subspec 'WalletConnectChat' do |ss|
ss.source_files = 'Sources/Chat/**/*.{h,m,swift}'
ss.dependency 'WalletConnectSwiftV2/WalletConnectSigner'
ss.dependency 'WalletConnectSwiftV2/WalletConnectIdentity'
end

spec.subspec 'WalletConnectSigner' do |ss|
ss.source_files = 'Sources/WalletConnectSigner/**/*.{h,m,swift}'
ss.dependency 'WalletConnectSwiftV2/WalletConnectNetworking'
end

spec.subspec 'WalletConnectIdentity' do |ss|
ss.source_files = 'Sources/WalletConnectIdentity/**/*.{h,m,swift}'
ss.dependency 'WalletConnectSwiftV2/WalletConnectNetworking'
ss.dependency 'WalletConnectSwiftV2/WalletConnectJWT'
end

spec.subspec 'WalletConnectJWT' do |ss|
ss.source_files = 'Sources/WalletConnectJWT/**/*.{h,m,swift}'
ss.dependency 'WalletConnectSwiftV2/WalletConnectKMS'
end

spec.subspec 'WalletConnectNetworking' do |ss|
Expand All @@ -117,7 +134,7 @@ Pod::Spec.new do |spec|

spec.subspec 'WalletConnectRelay' do |ss|
ss.source_files = 'Sources/WalletConnectRelay/**/*.{h,m,swift}'
ss.dependency 'WalletConnectSwiftV2/WalletConnectKMS'
ss.dependency 'WalletConnectSwiftV2/WalletConnectJWT'
ss.resource_bundles = {
'WalletConnect_WalletConnectRelay' => [
'Sources/WalletConnectRelay/PackageConfig.json'
Expand Down

0 comments on commit 6576e3c

Please sign in to comment.