Skip to content

Commit

Permalink
chore: rename attr
Browse files Browse the repository at this point in the history
  • Loading branch information
sammous committed May 31, 2023
1 parent b9b3a73 commit 3cc5ab4
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Sources/Xenissuing/SecureSession/SecureSession.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public struct EncryptedMessage {
public class SecureSession: Crypto {
/// The key provided by Xendit.
let xenditPublicKey: SecKey
var sSession: EncryptedMessage?
var secureSession: EncryptedMessage?

/**
Initializes an object with the provided public key data and tag.
Expand Down Expand Up @@ -72,11 +72,11 @@ public class SecureSession: Crypto {
}
}
let sKey = try self.generateRandom()
self.sSession = try self.generateSessionId(sessionKey: sKey)
self.secureSession = try self.generateSessionId(sessionKey: sKey)
}

public func getKey() -> Data {
return self.sSession!.key
return self.secureSession!.key
}

public func decryptCardData(secret: String, iv: String) throws -> Data {
Expand Down
8 changes: 7 additions & 1 deletion Tests/XenissuingTests/XenissuingTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ import XCTest
@testable import Xenissuing

final class XenissuingTests: XCTestCase {
let validPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArY3DXFJ2M0EHbsD9r+2XgFVtpYEQR5bxnQZVHVxtVzQP8u2cv/1APs2cft+8E682wKGY7SFUEsFsoqxoak7qsfXYL/mOdvQe6XDyNC7N6oo9Zb8dUKtuy8qPb1bVeTbxAwDVUzIdJpiRVI69fAGCW7aF3jTAV7Q+Z5qUTaLUFyKvu3+j8u/A58Nw5fjOENTLHBZRrXhFtQC1eql2O6FiQRJBDACYtzhyFBMyT/B7SKNPkEvLm1w4AQEWxxwL93B8vxstfpatbJJvorJaDEl/glncxJVtZ0lBeB3dkWdro/TrhpPD7CHKlBIUKRfvq1TgmMFs9SP90DxD9l9mE+AUAwIDAQAB"

func testValidPubicKey() throws {
// This is an example of a functional test case.
// Use XCTAssert and related functions to verify your tests produce the correct
// results.
let validPublicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArY3DXFJ2M0EHbsD9r+2XgFVtpYEQR5bxnQZVHVxtVzQP8u2cv/1APs2cft+8E682wKGY7SFUEsFsoqxoak7qsfXYL/mOdvQe6XDyNC7N6oo9Zb8dUKtuy8qPb1bVeTbxAwDVUzIdJpiRVI69fAGCW7aF3jTAV7Q+Z5qUTaLUFyKvu3+j8u/A58Nw5fjOENTLHBZRrXhFtQC1eql2O6FiQRJBDACYtzhyFBMyT/B7SKNPkEvLm1w4AQEWxxwL93B8vxstfpatbJJvorJaDEl/glncxJVtZ0lBeB3dkWdro/TrhpPD7CHKlBIUKRfvq1TgmMFs9SP90DxD9l9mE+AUAwIDAQAB"
XCTAssertNoThrow(try Xenissuing.createSecureSession(xenditPublicKeyData: Data(base64Encoded: validPublicKey)!))
}

func testCreateSecureSession() throws {
let secureSession = try Xenissuing.createSecureSession(xenditPublicKeyData: Data(base64Encoded: validPublicKey)!)
XCTAssertNotNil(secureSession.secureSession)
}
}

0 comments on commit 3cc5ab4

Please sign in to comment.