Skip to content

Commit

Permalink
Merge pull request #81 from niscy-eudiw/fix/vp_token_json
Browse files Browse the repository at this point in the history
VpToken in json form update
  • Loading branch information
dtsiflit authored Dec 18, 2024
2 parents 29b1028 + 42fc279 commit 8a0f93c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 3 additions & 5 deletions Sources/Entities/Types/VpToken.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,16 +45,14 @@ public struct VpToken: Encodable {

// Helper function to encode individual VerifiablePresentation cases
private func encodeToken(_ token: VerifiablePresentation) throws -> JSON {
let jsonData: Data
switch token {
case .generic(let value):
jsonData = try JSONEncoder().encode(value)
return JSON(value)
case .msoMdoc(let value):
jsonData = try JSONEncoder().encode(value)
return JSON(value)
case .json(let json):
jsonData = try JSONEncoder().encode(json)
return json
}
return try JSON(data: jsonData)
}

public func encode(to encoder: Encoder) throws {
Expand Down
2 changes: 2 additions & 0 deletions Tests/Constants/TestsConstants.swift
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ struct TestsConstants {

static var x5cInterCertificateBase64 = "TUlJRHpUQ0NBcldnQXdJQkFnSVFDamVIWkY1ZnRJd2lUdjBiN1JRTVBEQU5CZ2txaGtpRzl3MEJBUXNGQURCYU1Rc3dDUVlEVlFRR0V3SkpSVEVTTUJBR0ExVUVDaE1KUW1Gc2RHbHRiM0psTVJNd0VRWURWUVFMRXdwRGVXSmxjbFJ5ZFhOME1TSXdJQVlEVlFRREV4bENZV3gwYVcxdmNtVWdRM2xpWlhKVWNuVnpkQ0JTYjI5ME1CNFhEVEl3TURFeU56RXlORGd3T0ZvWERUSTBNVEl6TVRJek5UazFPVm93U2pFTE1Ba0dBMVVFQmhNQ1ZWTXhHVEFYQmdOVkJBb1RFRU5zYjNWa1pteGhjbVVzSUVsdVl5NHhJREFlQmdOVkJBTVRGME5zYjNWa1pteGhjbVVnU1c1aklFVkRReUJEUVMwek1Ga3dFd1lIS29aSXpqMENBUVlJS29aSXp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0zLV9xMkEzUlZnIiwiYWRtaW5pc3RyYXRpdmVfbnVtYmVyIiwiNjc4MTVkNzMtODZiNy00NDBlLWIyNDItNTI3NzM3ZDBlZjY5Il0~WyJreXZwUktWLXpfOEZmNnJYSk1sYWxBIiwiaXNzdWluZ19jb3VudHJ5IiwiR1IiXQ~WyJiUkI1Y3lWTFFTWVc5QmtVaDdqY2tnIiwiaXNzdWluZ19qdXJpc2RpY3Rpb24iLCJHUi1JIl0~"

static func generateMdocGeneratedNonce() -> String {
var bytes = [UInt8](repeating: 0, count: 16)
let result = SecRandomCopyBytes(kSecRandomDefault, bytes.count, &bytes)
Expand Down

0 comments on commit 8a0f93c

Please sign in to comment.