Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(pluto): add pluto implementation and interface #39

Merged
merged 1 commit into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions Domain/Sources/BBs/Pluto.swift
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import Foundation
import Combine

protocol Pluto {
func storeSeed(seed: Seed) async throws -> Session
public protocol Pluto {
func storeDID(
session: Session,
did: DID,
keyPairIndex: Int,
alias: String?
) async throws
) -> AnyPublisher<Void, Error>

func getSession() async -> Session
func getDID(alias: String) async -> DID
func getDIDKeyPairIndex(did: DID) async -> Int
func getAllDIDs() -> AnyPublisher<[(did: DID, keyPairIndex: Int, alias: String?)], Error>
func getDIDInfo(did: DID) -> AnyPublisher<(did: DID, keyPairIndex: Int, alias: String?)?, Error>
func getDIDInfo(alias: String) -> AnyPublisher<[(did: DID, keyPairIndex: Int)], Error>
func getDIDKeyPairIndex(did: DID) -> AnyPublisher<Int?, Error>
}
1 change: 0 additions & 1 deletion Experiences/Tests/ExperiencesTest.swift

This file was deleted.

37 changes: 0 additions & 37 deletions Pluto/Sources/Helpers/Keychain/KeychainStorage.swift

This file was deleted.

252 changes: 0 additions & 252 deletions Pluto/Sources/Helpers/Keychain/KeychainStorageImpl.swift

This file was deleted.

36 changes: 0 additions & 36 deletions Pluto/Sources/Pluto.swift

This file was deleted.

28 changes: 28 additions & 0 deletions Pluto/Sources/PlutoImpl+Public.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import Combine
import Domain

extension PlutoImpl: Pluto {
public func storeDID(did: DID, keyPairIndex: Int, alias: String?) -> AnyPublisher<Void, Error> {
registeredDIDDao.addDID(did: did, keyPairIndex: keyPairIndex, alias: alias)
}

public func getAllDIDs() -> AnyPublisher<[(did: DID, keyPairIndex: Int, alias: String?)], Error> {
registeredDIDDao.getAll()
}

public func getDIDInfo(did: DID) -> AnyPublisher<(did: DID, keyPairIndex: Int, alias: String?)?, Error> {
registeredDIDDao.getDIDInfo(did: did)
}

public func getDIDInfo(alias: String) -> AnyPublisher<[(did: DID, keyPairIndex: Int)], Error> {
registeredDIDDao.getDIDInfo(alias: alias)
.map { $0.map { ($0.did, $0.keyPairIndex) } }
.eraseToAnyPublisher()
}

public func getDIDKeyPairIndex(did: DID) -> AnyPublisher<Int?, Error> {
getDIDInfo(did: did)
.map { $0?.keyPairIndex }
.eraseToAnyPublisher()
}
}
Loading