Skip to content

Commit 579c603

Browse files
feat(anoncreds): add support for anoncreds issuance flow
Fixes ATL-4294
1 parent 90c56ce commit 579c603

File tree

148 files changed

+2147
-4549
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+2147
-4549
lines changed

AtalaPrismSDK/Apollo/Sources/ApolloImpl+KeyRestoration.swift

+13-12
Original file line numberDiff line numberDiff line change
@@ -10,29 +10,30 @@ extension ApolloImpl: KeyRestoration {
1010
identifier.hasSuffix("pub")
1111
}
1212

13-
public func restorePrivateKey(identifier: String?, data: Data) throws -> PrivateKey {
14-
guard let identifier else { throw ApolloError.restoratonFailedNoIdentifierOrInvalid }
15-
switch identifier {
13+
public func restorePrivateKey(_ key: StorableKey) throws -> PrivateKey {
14+
switch key.restorationIdentifier {
1615
case "secp256k1+priv":
17-
return Secp256k1PrivateKey(lockedPrivateKey: .init(data: data))
16+
return Secp256k1PrivateKey(
17+
lockedPrivateKey: .init(data: key.storableData),
18+
derivationPath: key.index.map { DerivationPath(index: $0) } ?? DerivationPath(index: 0)
19+
)
1820
case "x25519+priv":
19-
return X25519PrivateKey(appleCurve: try .init(rawRepresentation: data))
21+
return X25519PrivateKey(appleCurve: try .init(rawRepresentation: key.storableData))
2022
case "ed25519+priv":
21-
return Ed25519PrivateKey(appleCurve: try .init(rawRepresentation: data))
23+
return Ed25519PrivateKey(appleCurve: try .init(rawRepresentation: key.storableData))
2224
default:
2325
throw ApolloError.restoratonFailedNoIdentifierOrInvalid
2426
}
2527
}
2628

27-
public func restorePublicKey(identifier: String?, data: Data) throws -> PublicKey {
28-
guard let identifier else { throw ApolloError.restoratonFailedNoIdentifierOrInvalid }
29-
switch identifier {
29+
public func restorePublicKey(_ key: StorableKey) throws -> PublicKey {
30+
switch key.restorationIdentifier {
3031
case "secp256k1+pub":
31-
return Secp256k1PublicKey(lockedPublicKey: .init(bytes: data))
32+
return Secp256k1PublicKey(lockedPublicKey: .init(bytes: key.storableData))
3233
case "x25519+pub":
33-
return X25519PublicKey(appleCurve: try .init(rawRepresentation: data))
34+
return X25519PublicKey(appleCurve: try .init(rawRepresentation: key.storableData))
3435
case "ed25519+pub":
35-
return Ed25519PublicKey(appleCurve: try .init(rawRepresentation: data))
36+
return Ed25519PublicKey(appleCurve: try .init(rawRepresentation: key.storableData))
3637
default:
3738
throw ApolloError.restoratonFailedNoIdentifierOrInvalid
3839
}

AtalaPrismSDK/Apollo/Sources/ApolloImpl+Public.swift

+6-4
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,11 @@ returns random mnemonics nerver returns invalid mnemonics
102102
switch curve {
103103
case .secp256k1:
104104
if
105-
let keyData = parameters[KeyProperties.rawKey.rawValue].flatMap({ Data(base64Encoded: $0) })
105+
let keyData = parameters[KeyProperties.rawKey.rawValue].flatMap({ Data(base64Encoded: $0) }),
106+
let derivationPathStr = parameters[KeyProperties.derivationPath.rawValue]
106107
{
107-
return Secp256k1PrivateKey(lockedPrivateKey: .init(data: keyData))
108+
let derivationPath = try DerivationPath(string: derivationPathStr)
109+
return Secp256k1PrivateKey(lockedPrivateKey: .init(data: keyData), derivationPath: derivationPath)
108110
} else {
109111
guard
110112
let derivationPathStr = parameters[KeyProperties.derivationPath.rawValue],
@@ -143,7 +145,7 @@ returns random mnemonics nerver returns invalid mnemonics
143145
}
144146
}
145147

146-
public func createNewLinkSecret() -> String {
147-
CreateLinkSecretOperation().create()
148+
public func createNewLinkSecret() throws -> String {
149+
try CreateLinkSecretOperation().create()
148150
}
149151
}

AtalaPrismSDK/Apollo/Sources/Model/Ed25519Key.swift

+2
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ extension Ed25519PrivateKey: SignableKey {
3535
extension Ed25519PrivateKey: KeychainStorableKey {
3636
var restorationIdentifier: String { "ed25519+priv" }
3737
var storableData: Data { raw }
38+
var index: Int? { nil }
3839
var type: Domain.KeychainStorableKeyProperties.KeyAlgorithm { .rawKey }
3940
var keyClass: Domain.KeychainStorableKeyProperties.KeyType { .privateKey }
4041
var accessiblity: Domain.KeychainStorableKeyProperties.Accessability? { .firstUnlock(deviceOnly: true) }
@@ -62,6 +63,7 @@ struct Ed25519PublicKey: PublicKey {
6263
extension Ed25519PublicKey: KeychainStorableKey {
6364
var restorationIdentifier: String { "ed25519+pub" }
6465
var storableData: Data { raw }
66+
var index: Int? { nil }
6567
var type: Domain.KeychainStorableKeyProperties.KeyAlgorithm { .rawKey }
6668
var keyClass: Domain.KeychainStorableKeyProperties.KeyType { .publicKey }
6769
var accessiblity: Domain.KeychainStorableKeyProperties.Accessability? { .firstUnlock(deviceOnly: true) }

AtalaPrismSDK/Apollo/Sources/Model/Secp256k1Key.swift

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,14 @@ struct Secp256k1PrivateKey: PrivateKey {
99
let keySpecifications: [String : String]
1010
let size: Int
1111
let raw: Data
12+
let derivationPath: DerivationPath
1213

13-
init(lockedPrivateKey: LockPrivateKey) {
14+
init(lockedPrivateKey: LockPrivateKey, derivationPath: DerivationPath) {
1415
self.lockedPrivateKey = lockedPrivateKey
16+
self.derivationPath = derivationPath
1517
self.keySpecifications = [
16-
KeyProperties.curve.rawValue : "secp256k1"
18+
KeyProperties.curve.rawValue : "secp256k1",
19+
KeyProperties.derivationPath.rawValue : derivationPath.keyPathString()
1720
]
1821

1922
self.raw = lockedPrivateKey.data
@@ -40,6 +43,7 @@ extension Secp256k1PrivateKey: SignableKey {
4043
extension Secp256k1PrivateKey: KeychainStorableKey {
4144
var restorationIdentifier: String { "secp256k1+priv" }
4245
var storableData: Data { raw }
46+
var index: Int? { derivationPath.index }
4347
var type: Domain.KeychainStorableKeyProperties.KeyAlgorithm { .rawKey }
4448
var keyClass: Domain.KeychainStorableKeyProperties.KeyType { .privateKey }
4549
var accessiblity: Domain.KeychainStorableKeyProperties.Accessability? { .firstUnlock(deviceOnly: true) }
@@ -81,6 +85,7 @@ struct Secp256k1PublicKey: PublicKey {
8185
extension Secp256k1PublicKey: KeychainStorableKey {
8286
var restorationIdentifier: String { "secp256k1+pub" }
8387
var storableData: Data { raw }
88+
var index: Int? { nil }
8489
var type: Domain.KeychainStorableKeyProperties.KeyAlgorithm { .rawKey }
8590
var keyClass: Domain.KeychainStorableKeyProperties.KeyType { .publicKey }
8691
var accessiblity: Domain.KeychainStorableKeyProperties.Accessability? { .firstUnlock(deviceOnly: true) }

AtalaPrismSDK/Apollo/Sources/Model/X25519Key.swift

+2
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ struct X25519PrivateKey: PrivateKey {
2323
extension X25519PrivateKey: KeychainStorableKey {
2424
var restorationIdentifier: String { "x25519+priv" }
2525
var storableData: Data { raw }
26+
var index: Int? { nil }
2627
var type: Domain.KeychainStorableKeyProperties.KeyAlgorithm { .rawKey }
2728
var keyClass: Domain.KeychainStorableKeyProperties.KeyType { .privateKey }
2829
var accessiblity: Domain.KeychainStorableKeyProperties.Accessability? { .firstUnlock(deviceOnly: true) }
@@ -50,6 +51,7 @@ struct X25519PublicKey: PublicKey {
5051
extension X25519PublicKey: KeychainStorableKey {
5152
var restorationIdentifier: String { "x25519+pub" }
5253
var storableData: Data { raw }
54+
var index: Int? { nil }
5355
var type: Domain.KeychainStorableKeyProperties.KeyAlgorithm { .rawKey }
5456
var keyClass: Domain.KeychainStorableKeyProperties.KeyType { .publicKey }
5557
var accessiblity: Domain.KeychainStorableKeyProperties.Accessability? { .firstUnlock(deviceOnly: true) }

AtalaPrismSDK/Apollo/Sources/Operations/CreateLinkSecretOperation.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import AnoncredsSwift
22
import Foundation
33

44
struct CreateLinkSecretOperation {
5-
func create() -> String {
6-
Prover().createLinkSecret().getBigNumber()
5+
func create() throws -> String {
6+
try Prover().createLinkSecret().getValue()
77
}
88
}

AtalaPrismSDK/Apollo/Sources/Operations/CreateSec256k1KeyPairOperation.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ struct CreateSec256k1KeyPairOperation {
1616
func compute() throws -> PrivateKey {
1717
let derivedKey = try HDKeychain(seed: seed.value).derivedKey(path: keyPath.keyPathString())
1818

19-
return Secp256k1PrivateKey(lockedPrivateKey: derivedKey.privateKey())
19+
return Secp256k1PrivateKey(lockedPrivateKey: derivedKey.privateKey(), derivationPath: keyPath)
2020
}
2121
}

AtalaPrismSDK/Apollo/Tests/ECSigningTests.swift

+4-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,10 @@ import XCTest
66
final class ECSigningTests: XCTestCase {
77
func testSigning() throws {
88
let privKey = Secp256k1PrivateKey(
9-
lockedPrivateKey: .init(data: Data(fromBase64URL: "N_JFgvYaReyRXwassz5FHg33A4I6dczzdXrjdHGksmg")!)
9+
lockedPrivateKey: .init(
10+
data: Data(fromBase64URL: "N_JFgvYaReyRXwassz5FHg33A4I6dczzdXrjdHGksmg")!
11+
),
12+
derivationPath: .init(index: 0)
1013
)
1114
let testMessage = "Test".data(using: .utf8)!
1215

AtalaPrismSDK/Castor/Sources/Operations/CreatePeerDIDOperation.swift

+1-2
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,7 @@ struct CreatePeerDIDOperation {
150150
accept: endpoint.accept
151151
)
152152
}.compactMap { $0 }
153-
let encoder = JSONEncoder()
154-
encoder.outputFormatting = .withoutEscapingSlashes
153+
let encoder = JSONEncoder.didComm()
155154
if
156155
peerDidServices.count == 1,
157156
let peerDidService = peerDidServices.first

AtalaPrismSDK/Castor/Tests/PeerDIDCreationTests.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import XCTest
55

66
final class PeerDIDCreationTests: XCTestCase {
77
func testPeerDIDCreation() throws {
8-
let validPeerDID = "did:peer:2.Ez6LSoHkfN1Y4nK9RCjx7vopWsLrMGNFNgTNZgoCNQrTzmb1n.Vz6MknRZmapV7uYZQuZez9n9N3tQotjRN18UGS68Vcfo6gR4h.SeyJyIjpbImRpZDpleGFtcGxlOnNvbWVtZWRpYXRvciNzb21la2V5Il0sInMiOiJodHRwczovL2V4YW1wbGUuY29tL2VuZHBvaW50IiwiYSI6W10sInQiOiJkbSJ9"
8+
let validPeerDID = "did:peer:2.Ez6LSoHkfN1Y4nK9RCjx7vopWsLrMGNFNgTNZgoCNQrTzmb1n.Vz6MknRZmapV7uYZQuZez9n9N3tQotjRN18UGS68Vcfo6gR4h.SeyJhIjpbXSwiciI6WyJkaWQ6ZXhhbXBsZTpzb21lbWVkaWF0b3Ijc29tZWtleSJdLCJzIjoiaHR0cHM6Ly9leGFtcGxlLmNvbS9lbmRwb2ludCIsInQiOiJkbSJ9"
99
let apollo = ApolloImpl()
1010
let castor = CastorImpl(apollo: apollo)
1111
let keyAgreementPrivateKey = try apollo.createPrivateKey(parameters: [

AtalaPrismSDK/Domain/Sources/BBs/Apollo.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,5 +55,5 @@ public protocol Apollo {
5555
/// - Returns: The decompressed public key
5656
func uncompressedPublicKey(compressedData: Data) -> PublicKey
5757

58-
func createNewLinkSecret() -> String
58+
func createNewLinkSecret() throws -> String
5959
}

AtalaPrismSDK/Domain/Sources/BBs/Pollux.swift

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import Foundation
44
/// Options that can be passed into various operations.
55
public enum CredentialOperationsOptions {
66
case schema(id: String, json: String) // The JSON schema.
7-
case schemasStream(stream: AnyPublisher<[(id: String, json: String)], Error>) // Stream of schemas, only the first batch is considered
7+
case schemaDownloader(downloader: Downloader) // Stream of schemas, only the first batch is considered
88
case credentialDefinition(id: String, json: String) // The JSON Credential Definition
9-
case credentialDefinitionsStream(stream: AnyPublisher<[(id: String, json: String)], Error>) // Stream of credential definitions, only the first batch is considered
9+
case credentialDefinitionDownloader(downloader: Downloader) // Download of credential definitions, only the first batch is considered
1010
case linkSecret(id: String, secret: String) // A secret link.
1111
case subjectDID(DID) // The decentralized identifier of the subject.
1212
case entropy(String) // Entropy for any randomization operation.
@@ -21,7 +21,7 @@ public protocol Pollux {
2121
/// - Parameter data: The encoded item to parse.
2222
/// - Throws: An error if the item cannot be parsed or decoded.
2323
/// - Returns: An object representing the parsed item.
24-
func parseCredential(issuedCredential: Message) throws -> Credential
24+
func parseCredential(issuedCredential: Message, options: [CredentialOperationsOptions]) async throws -> Credential
2525

2626
/// Restores a previously stored item using the provided restoration identifier and data.
2727
/// - Parameters:
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import Foundation
2+
3+
public protocol Downloader {
4+
func downloadFromEndpoint(urlOrDID: String) async throws -> Data
5+
}

AtalaPrismSDK/Domain/Sources/Models/Credentials/Credential.swift

+2
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ public protocol Credential {
7070
var claims: [Claim] { get }
7171
/// Additional properties associated with the credential.
7272
var properties: [String: Any] { get }
73+
/// The type of the credential Ex: JWT, Anoncred, W3C
74+
var credentialType: String { get }
7375
}
7476

7577
public extension Credential {

AtalaPrismSDK/Domain/Sources/Models/KeyManagement/ExportableImportableKey.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ extension PEMKey {
165165
/// Returns a PEM-encoded string representation of this `PEMKey`.
166166
/// - Returns: A string representing this key in PEM format.
167167
public func pemEncoded() -> String {
168-
let base64Data = keyData.base64EncodedString(options: [.lineLength64Characters])
168+
let base64Data = keyData.base64EncodedString()
169169
let beginMarker = "-----BEGIN \(keyType)-----"
170170
let endMarker = "-----END \(keyType)-----"
171171

AtalaPrismSDK/Domain/Sources/Models/KeyManagement/KeyRestoration.swift

+2-21
Original file line numberDiff line numberDiff line change
@@ -24,32 +24,13 @@ public protocol KeyRestoration {
2424
/// - data: The raw data representing the key.
2525
/// - Throws: If the restoration process fails, this method throws an error.
2626
/// - Returns: The restored `PrivateKey` instance.
27-
func restorePrivateKey(identifier: String?, data: Data) async throws -> PrivateKey
27+
func restorePrivateKey(_ key: StorableKey) async throws -> PrivateKey
2828

2929
/// Restores a public key from the given data.
3030
/// - Parameters:
3131
/// - identifier: An optional string used to identify the key.
3232
/// - data: The raw data representing the key.
3333
/// - Throws: If the restoration process fails, this method throws an error.
3434
/// - Returns: The restored `PublicKey` instance.
35-
func restorePublicKey(identifier: String?, data: Data) async throws -> PublicKey
36-
}
37-
38-
/// Extension of the KeyRestoration protocol to provide additional restoration methods.
39-
public extension KeyRestoration {
40-
/// Restores a private key from the given data, without requiring an identifier.
41-
/// - Parameter data: The raw data representing the key.
42-
/// - Throws: If the restoration process fails, this method throws an error.
43-
/// - Returns: The restored PrivateKey instance.
44-
func restorePrivateKey(data: Data) async throws -> PrivateKey {
45-
try await restorePrivateKey(identifier: nil, data: data)
46-
}
47-
48-
/// Restores a public key from the given data, without requiring an identifier.
49-
/// - Parameter data: The raw data representing the key.
50-
/// - Throws: If the restoration process fails, this method throws an error.
51-
/// - Returns: The restored `PublicKey` instance.
52-
func restorePublicKey(data: Data) async throws -> PublicKey {
53-
try await restorePublicKey(identifier: nil, data: data)
54-
}
35+
func restorePublicKey(_ key: StorableKey) async throws -> PublicKey
5536
}

AtalaPrismSDK/Domain/Sources/Models/KeyManagement/StorableKey.swift

+3
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ public protocol StorableKey {
77

88
/// The raw data representation of the key, suitable for storage.
99
var storableData: Data { get }
10+
11+
/// Indexation of the key is useful to keep track of a derivation index
12+
var index: Int? { get }
1013
}
1114

1215
/// Extension of the `Key` protocol to provide additional functionality related to storage.

AtalaPrismSDK/Pluto/Sources/Domain/Providers/DIDPrivateKeyProvider.swift

+1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,5 @@ protocol DIDPrivateKeyProvider {
77
func getDIDInfo(did: DID) -> AnyPublisher<(did: DID, privateKeys: [StorableKey], alias: String?)?, Error>
88
func getDIDInfo(alias: String) -> AnyPublisher<[(did: DID, privateKeys: [StorableKey], alias: String?)], Error>
99
func getPrivateKeys(did: DID) -> AnyPublisher<[StorableKey]?, Error>
10+
func getLastKeyIndex() -> AnyPublisher<Int, Error>
1011
}

AtalaPrismSDK/Pluto/Sources/Domain/Providers/DIDProvider.swift

-1
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,4 @@ protocol DIDProvider {
1212
func getDIDInfo(
1313
keyPairIndex: Int
1414
) -> AnyPublisher<(did: DID, keyPairIndex: Int, alias: String?)?, Error>
15-
func getLastKeyPairIndex() -> AnyPublisher<Int, Error>
1615
}

AtalaPrismSDK/Pluto/Sources/Domain/StorableKeyModel.swift

+1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ import Foundation
44
struct StorableKeyModel: StorableKey {
55
let restorationIdentifier: String
66
let storableData: Data
7+
let index: Int?
78
}

AtalaPrismSDK/Pluto/Sources/PersistentStorage/DAO/CDDIDPrivateKeyDAO+DIDPrivateKeyProvider.swift

+15-2
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,17 @@ extension CDDIDPrivateKeyDAO: DIDPrivateKeyProvider {
5656
}
5757
.eraseToAnyPublisher()
5858
}
59+
60+
func getLastKeyIndex() -> AnyPublisher<Int, Error> {
61+
keyDao.fetchController(
62+
sorting: NSSortDescriptor(key: "index", ascending: true),
63+
context: readContext
64+
)
65+
.map {
66+
$0.first.map { $0.index?.intValue ?? 0 } ?? 0
67+
}
68+
.eraseToAnyPublisher()
69+
}
5970
}
6071

6172
extension CDKey {
@@ -79,12 +90,14 @@ extension CDKey {
7990

8091
return StorableKeyModel(
8192
restorationIdentifier: keychainKey.restorationIdentifier,
82-
storableData: keyData
93+
storableData: keyData,
94+
index: keychainKey.index?.intValue
8395
)
8496
case let databaseKey as CDDatabaseKey:
8597
return StorableKeyModel(
8698
restorationIdentifier: databaseKey.restorationIdentifier,
87-
storableData: databaseKey.storableData
99+
storableData: databaseKey.storableData,
100+
index: databaseKey.index?.intValue
88101
)
89102
default:
90103
throw UnknownError.somethingWentWrongError(

AtalaPrismSDK/Pluto/Sources/PersistentStorage/DAO/CDDIDPrivateKeyDAO+DIDPrivateKeyStore.swift

+2
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ private extension CDDatabaseKey {
9191
) {
9292
self.identifier = identifier
9393
self.storableData = key.storableData
94+
self.index = key.index.map { NSNumber(integerLiteral: $0) }
9495
self.restorationIdentifier = key.restorationIdentifier
9596
}
9697
}
@@ -104,6 +105,7 @@ private extension CDKeychainKey {
104105
) {
105106
self.identifier = identifier
106107
self.restorationIdentifier = key.restorationIdentifier
108+
self.index = key.index.map { NSNumber(integerLiteral: $0) }
107109
self.type = key.keyClass.rawValue
108110
self.algorithm = key.type.rawValue
109111
self.service = service

AtalaPrismSDK/Pluto/Sources/PersistentStorage/DAO/CDDIDPrivateKeyDAO.swift

+1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ struct CDDIDPrivateKeyDAO: CoreDataDAO {
66
typealias CoreDataObject = CDDIDPrivateKey
77
let keychain: KeychainStore & KeychainProvider
88
let keychainService: String
9+
let keyDao: CDKeyDAO
910
let readContext: NSManagedObjectContext
1011
let writeContext: NSManagedObjectContext
1112
let identifierKey: String? = "did"

AtalaPrismSDK/Pluto/Sources/PersistentStorage/Keychain/KeychainDAO.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ extension KeychainDAO: KeychainStore {
9090
try key.getSecKeyAddItemDictionary(service: service, account: account, accessGroup: accessGroup),
9191
nil
9292
)
93-
guard status == errSecSuccess else {
93+
guard status == errSecSuccess || status == errSecDuplicateItem else {
9494
throw PlutoError.errorSavingKeyOnKeychainWithStatus(status)
9595
}
9696
}

AtalaPrismSDK/Pluto/Sources/PersistentStorage/Models/CDKey+CoreDataProperties.swift

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ extension CDKey {
88

99
@NSManaged var identifier: String
1010
@NSManaged var restorationIdentifier: String
11+
@NSManaged var index: NSNumber?
1112
@NSManaged var did: CDDIDPrivateKey?
1213
}
1314

AtalaPrismSDK/Pluto/Sources/PlutoImpl+Public.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ extension PlutoImpl: Pluto {
7575
}
7676

7777
public func getPrismLastKeyPairIndex() -> AnyPublisher<Int, Error> {
78-
registeredDIDDao.getLastKeyPairIndex()
78+
privateKeyDIDDao.getLastKeyIndex()
7979
}
8080

8181
public func getAllPeerDIDs() -> AnyPublisher<[(did: DID, privateKeys: [StorableKey], alias: String?)], Error> {

AtalaPrismSDK/Pluto/Sources/PlutoImpl.swift

+4
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,10 @@ public struct PlutoImpl {
5656
let privateKeyDao = CDDIDPrivateKeyDAO(
5757
keychain: setup.keychain,
5858
keychainService: setup.keychainService,
59+
keyDao: CDKeyDAO(
60+
readContext: manager.mainContext,
61+
writeContext: manager.editContext
62+
),
5963
readContext: manager.mainContext,
6064
writeContext: manager.editContext
6165
)

0 commit comments

Comments
 (0)