Skip to content

Commit

Permalink
feat!(sdk): renaming the sdk and its components
Browse files Browse the repository at this point in the history
BREAKING CHANGE: There was a renaming of components
  • Loading branch information
goncalo-frade-iohk committed May 7, 2024
1 parent 8e9e959 commit 07f84f0
Show file tree
Hide file tree
Showing 351 changed files with 309 additions and 309 deletions.
24 changes: 12 additions & 12 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# Contributing to Atala PRISM Swift SDK
# Contributing to Edge Agent Swift SDK

:rocket::tada: First off, thanks for taking the time to contribute! :tada::rocket:
The following guidelines are for contributing to Atala PRISM Swift SDK. These are mostly guidelines. Use your best judgment, and feel free to propose changes to this document in a pull request.
The following guidelines are for contributing to Edge Agent Swift SDK. These are mostly guidelines. Use your best judgment, and feel free to propose changes to this document in a pull request.

#### Table Of Contents

[What should I know before I get started?](#what-should-i-know-before-i-get-started)
* [Atala PRISM](#atala-prism)
* [Atala PRISM Swift SDK](#atala-prism-swift)
* [Edge Agent](#atala-prism)
* [Edge Agent Swift SDK](#atala-prism-swift)

[How Can I Contribute?](#how-can-i-contribute)
* [Your First Code Contribution](#your-first-code-contribution)
Expand All @@ -23,24 +23,24 @@ The following guidelines are for contributing to Atala PRISM Swift SDK. These ar

## What should I know before I get started?

### Atala PRISM
### Edge Agent

Atala PRISM is a self-sovereign identity (SSI) platform and service suite for verifiable data and digital identity. Built on Cardano, it offers the core infrastructure for issuing DIDs (Decentralized identifiers) and verifiable credentials alongside tools and frameworks to help expand your ecosystem.
Edge Agent is a self-sovereign identity (SSI) platform and service suite for verifiable data and digital identity. Built on Cardano, it offers the core infrastructure for issuing DIDs (Decentralized identifiers) and verifiable credentials alongside tools and frameworks to help expand your ecosystem.
The complete platform is separated into multiple repositories:

* [atala-prism-apollo](https://github.com/input-output-hk/atala-prism-apollo) - Repo for the Apollo Building Block contains the cryptographic methods used around Atala PRISM.
* [atala-prism-apollo](https://github.com/input-output-hk/atala-prism-apollo) - Repo for the Apollo Building Block contains the cryptographic methods used around Edge Agent.
* [atala-prism-building-blocks](https://github.com/hyperledger-labs/open-enterprise-agent) - Repo that contains the servers Building Blocks.
* [atala-prism-mediator](https://github.com/input-output-hk/atala-prism-mediator) - Repo for DIDComm V2 Mediator
* [atala-prism-kmm-sdk](https://github.com/input-output-hk/atala-prism-wallet-sdk-kmm/) - Repo representing the Kotlin Multiplatform SDK.
* [atala-prism-ts-sdk](https://github.com/input-output-hk/atala-prism-wallet-sdk-ts/) - Repo representing the TS SDK.

### Atala PRISM Swift SDK
### Edge Agent Swift SDK

Atala PRISM Swift software development kit will help adoption within Apple frameworks by providing key functionalities. For more information about the SDK, please have a look at the [Readme](https://github.com/input-output-hk/atala-prism-swift-sdk/blob/main/README.md)
Edge Agent Swift software development kit will help adoption within Apple frameworks by providing key functionalities. For more information about the SDK, please have a look at the [Readme](https://github.com/input-output-hk/atala-prism-swift-sdk/blob/main/README.md)

### Your First Code Contribution

Unsure where to begin contributing to Atala PRISM Swift SDK? You can start by looking through the [Readme](https://github.com/input-output-hk/atala-prism-swift-sdk/blob/main/README.md) that provides all the steps to set up your environment.
Unsure where to begin contributing to Edge Agent Swift SDK? You can start by looking through the [Readme](https://github.com/input-output-hk/atala-prism-swift-sdk/blob/main/README.md) that provides all the steps to set up your environment.

### Pull Requests

Expand All @@ -61,7 +61,7 @@ While the prerequisites above must be satisfied before your pull request is revi

### Reporting Bugs

This section guides you through submitting a bug report for Atala PRISM Swift SDK. Following these guidelines helps maintainers and the community understand your report :pencil:, reproduce the behaviour:computer: :computer:, and find related reports :mag_right:.
This section guides you through submitting a bug report for Edge Agent Swift SDK. Following these guidelines helps maintainers and the community understand your report :pencil:, reproduce the behaviour:computer: :computer:, and find related reports :mag_right:.

Before creating bug reports, please check [this list](#before-submitting-a-bug-report), as you might not need to create one. When creating a bug report, please [include as many details as possible](#how-do-i-submit-a-good-bug-report). Fill out [the required template](https://github.com/input-output-hk/atala-prism-wallet-sdk-swift/blob/main/.github/ISSUE_TEMPLATE/1-bug-report.yaml), the information it asks for helps us resolve issues faster.

Expand Down Expand Up @@ -113,7 +113,7 @@ Enhancement suggestions are tracked as [GitHub issues](https://guides.github.com

### Git Commit Messages

Atala PRISM uses [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#specification). Please always provide a commit following these specifications.
Edge Agent uses [Conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#specification). Please always provide a commit following these specifications.

#### Commit Message Format

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,5 @@ public enum LogComponent: String {
case mercury
case pluto
case pollux
case prismAgent
case edgeAgent
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class ConnectionsManagerImpl: ConnectionsManager {
func startMediator() async throws {
guard
try await mediationHandler.bootRegisteredMediator() != nil
else { throw PrismAgentError.noMediatorAvailableError }
else { throw EdgeAgentError.noMediatorAvailableError }
}

func stopAllEvents() {
Expand Down Expand Up @@ -96,7 +96,7 @@ extension ConnectionsManagerImpl: DIDCommConnection {
}

func awaitMessages() throws -> AnyPublisher<[Message], Error> {
guard mediationHandler.mediator != nil else { throw PrismAgentError.noMediatorAvailableError }
guard mediationHandler.mediator != nil else { throw EdgeAgentError.noMediatorAvailableError }
let mediationHandler = mediationHandler
let pluto = pluto
return Future {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,15 +125,15 @@ public class BasicMediatorHandler: MediatorHandler {
self.mediator = mediator
return mediator
} catch let error {
throw PrismAgentError.mediationRequestFailedError(underlyingErrors: [error])
throw EdgeAgentError.mediationRequestFailedError(underlyingErrors: [error])
}
}

return mediator
}

public func updateKeyListWithDIDs(dids: [DID]) async throws {
guard let mediator else { throw PrismAgentError.noMediatorAvailableError }
guard let mediator else { throw EdgeAgentError.noMediatorAvailableError }
let keyListUpdateMessage = try MediationKeysUpdateList(
from: mediator.hostDID,
to: mediator.mediatorDID,
Expand All @@ -143,7 +143,7 @@ public class BasicMediatorHandler: MediatorHandler {
}

public func pickupUnreadMessages(limit: Int) async throws -> [(String, Message)] {
guard let mediator else { throw PrismAgentError.noMediatorAvailableError }
guard let mediator else { throw EdgeAgentError.noMediatorAvailableError }
let request = try PickUpRequest(
from: mediator.hostDID,
to: mediator.mediatorDID,
Expand All @@ -159,7 +159,7 @@ public class BasicMediatorHandler: MediatorHandler {
}

public func registerMessagesAsRead(ids: [String]) async throws {
guard let mediator else { throw PrismAgentError.noMediatorAvailableError }
guard let mediator else { throw EdgeAgentError.noMediatorAvailableError }
let message = try PickUpReceived(
from: mediator.hostDID,
to: mediator.mediatorDID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import Logging
import JSONWebToken

// MARK: Verifiable credentials functionalities
public extension PrismAgent {
public extension EdgeAgent {
/// This function returns the verifiable credentials stored in pluto database
///
/// - Returns: A publisher that emits an array of `VerifiableCredential` and completes when all the
Expand All @@ -32,7 +32,7 @@ public extension PrismAgent {
/// - toDID: The decentralized identifier (DID) of the entity to which the request is being sent.
/// - claimFilters: A collection of filters specifying the claims required in the credential.
/// - Returns: The initiated request for presentation.
/// - Throws: PrismAgentError, if there is a problem initiating the presentation request.
/// - Throws: EdgeAgentError, if there is a problem initiating the presentation request.
func initiatePresentationRequest(
type: CredentialType,
fromDID: DID,
Expand Down Expand Up @@ -87,7 +87,7 @@ public extension PrismAgent {
/// - Parameters:
/// - message: The message containing the presentation to be verified.
/// - Returns: A Boolean value indicating whether the presentation is valid (`true`) or not (`false`).
/// - Throws: PrismAgentError, if there is a problem verifying the presentation.
/// - Throws: EdgeAgentError, if there is a problem verifying the presentation.

func verifyPresentation(message: Message) async throws -> Bool {
do {
Expand All @@ -103,16 +103,16 @@ public extension PrismAgent {
/// - Parameters:
/// - message: Issue credential Message.
/// - Returns: The parsed verifiable credential.
/// - Throws: PrismAgentError, if there is a problem parsing the credential.
/// - Throws: EdgeAgentError, if there is a problem parsing the credential.
func processIssuedCredentialMessage(message: IssueCredential3_0) async throws -> Credential {
guard
let linkSecret = try await pluto.getLinkSecret().first().await()
else { throw PrismAgentError.cannotFindDIDKeyPairIndex }
else { throw EdgeAgentError.cannotFindDIDKeyPairIndex }

let restored = try await self.apollo.restoreKey(linkSecret)
guard
let linkSecretString = String(data: restored.raw, encoding: .utf8)
else { throw PrismAgentError.cannotFindDIDKeyPairIndex }
else { throw EdgeAgentError.cannotFindDIDKeyPairIndex }

let downloader = DownloadDataWithResolver(castor: castor)
let credential = try await pollux.parseCredential(
Expand Down Expand Up @@ -140,27 +140,27 @@ public extension PrismAgent {
/// - did: Subject DID.
/// - did: Received offer credential.
/// - Returns: Created request credential
/// - Throws: PrismAgentError, if there is a problem creating the request credential.
/// - Throws: EdgeAgentError, if there is a problem creating the request credential.
func prepareRequestCredentialWithIssuer(did: DID, offer: OfferCredential3_0) async throws -> RequestCredential3_0? {
guard did.method == "prism" else { throw PolluxError.invalidPrismDID }
let didInfo = try await pluto
.getDIDInfo(did: did)
.first()
.await()

guard let storedPrivateKey = didInfo?.privateKeys.first else { throw PrismAgentError.cannotFindDIDKeyPairIndex }
guard let storedPrivateKey = didInfo?.privateKeys.first else { throw EdgeAgentError.cannotFindDIDKeyPairIndex }

let privateKey = try await apollo.restorePrivateKey(storedPrivateKey)

guard
let exporting = privateKey.exporting,
let linkSecret = try await pluto.getLinkSecret().first().await()
else { throw PrismAgentError.cannotFindDIDKeyPairIndex }
else { throw EdgeAgentError.cannotFindDIDKeyPairIndex }

let restored = try await self.apollo.restoreKey(linkSecret)
guard
let linkSecretString = String(data: restored.raw, encoding: .utf8)
else { throw PrismAgentError.cannotFindDIDKeyPairIndex }
else { throw EdgeAgentError.cannotFindDIDKeyPairIndex }

let downloader = DownloadDataWithResolver(castor: castor)
let requestString = try await pollux.processCredentialRequest(
Expand All @@ -183,7 +183,7 @@ public extension PrismAgent {
guard
let offerPiuri = ProtocolTypes(rawValue: offer.type)
else {
throw PrismAgentError.invalidMessageType(
throw EdgeAgentError.invalidMessageType(
type: offer.type,
shouldBe: [
ProtocolTypes.didcommOfferCredential3_0.rawValue
Expand All @@ -197,7 +197,7 @@ public extension PrismAgent {
case "anoncreds/credential-offer@v1.0":
format = "anoncreds/credential-request@v1.0"
default:
throw PrismAgentError.invalidMessageType(
throw EdgeAgentError.invalidMessageType(
type: offerFormat,
shouldBe: [
"prism/jwt",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import Domain
import Foundation

// MARK: DID High Level functionalities
public extension PrismAgent {
public extension EdgeAgent {
/// Enumeration representing the type of DID used.
enum DIDType {
case prism
Expand All @@ -16,7 +16,7 @@ public extension PrismAgent {
- did: The DID which will be used to sign the message.
- message: The message to be signed
- Throws:
- PrismAgentError.cannotFindDIDKeyPairIndex If the DID provided has no register with the Agent
- EdgeAgentError.cannotFindDIDKeyPairIndex If the DID provided has no register with the Agent
- Any other errors thrown by the `getPrismDIDInfo` function or the `createKeyPair` function
- Returns:
- Signature: The signature of the message.
Expand All @@ -37,7 +37,7 @@ public extension PrismAgent {
Could not find key in storage please use Castor instead and provide the private key
"""
)
throw PrismAgentError.cannotFindDIDKeyPairIndex
throw EdgeAgentError.cannotFindDIDKeyPairIndex
}

let privateKey = try await apollo.restorePrivateKey(storedPrivateKey)
Expand Down Expand Up @@ -127,7 +127,7 @@ Could not find key in storage please use Castor instead and provide the private
/// - services: The services associated to the new DID.
/// - updateMediator: Indicates if the new DID should be added to the mediator's list. It will as well add the mediator service.
/// - Returns: A new DID
/// - Throws: PrismAgentError, if updateMediator is true and there is no mediator available or if storing the new DID failed
/// - Throws: EdgeAgentError, if updateMediator is true and there is no mediator available or if storing the new DID failed
func createNewPeerDID(
services: [DIDDocument.Service] = [],
alias: String? = "",
Expand Down Expand Up @@ -188,7 +188,7 @@ Could not find key in storage please use Castor instead and provide the private
/// - services: The services associated to the new DID.
/// - updateMediator: Indicates if the new DID should be added to the mediator's list.
/// - Returns: A new DID
/// - Throws: PrismAgentError, if updateMediator is true and there is no mediator available or if storing the new DID failed
/// - Throws: EdgeAgentError, if updateMediator is true and there is no mediator available or if storing the new DID failed
func registerPeerDID(
did: DID,
privateKeys: [PrivateKey],
Expand Down Expand Up @@ -226,7 +226,7 @@ Could not find key in storage please use Castor instead and provide the private
/// - services: The services associated to the new DID.
/// - updateMediator: Indicates if the new DID should be added to the mediator's list.
/// - Returns: A new DID
/// - Throws: PrismAgentError, if updateMediator is true and there is no mediator available
/// - Throws: EdgeAgentError, if updateMediator is true and there is no mediator available
func updateMediatorWithDID(did: DID) async throws {
logger.debug(message: "Update mediator key list with DID", metadata: [
.maskedMetadataByLevel(key: "DID", value: did.string, level: .debug)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Domain
import Foundation

// MARK: Invitation funcionalities
public extension PrismAgent {
public extension EdgeAgent {
/// Enumeration representing the type of invitation
enum InvitationType {
/// Struct representing a Prism Onboarding invitation
Expand All @@ -24,20 +24,20 @@ public extension PrismAgent {
/// Parses the given string as an invitation
/// - Parameter str: The string to parse
/// - Returns: The parsed invitation
/// - Throws: `PrismAgentError` if the invitation is not a valid Prism or OOB type
/// - Throws: `EdgeAgentError` if the invitation is not a valid Prism or OOB type
func parseInvitation(str: String) async throws -> InvitationType {
if let prismOnboarding = try? await parsePrismInvitation(str: str) {
return .onboardingPrism(prismOnboarding)
} else if let message = try? parseOOBInvitation(url: str) {
return .onboardingDIDComm(message)
}
throw PrismAgentError.unknownInvitationTypeError
throw EdgeAgentError.unknownInvitationTypeError
}

/// Parses the given string as a Prism Onboarding invitation
/// - Parameter str: The string to parse
/// - Returns: The parsed Prism Onboarding invitation
/// - Throws: `PrismAgentError` if the string is not a valid Prism Onboarding invitation
/// - Throws: `EdgeAgentError` if the string is not a valid Prism Onboarding invitation
func parsePrismInvitation(
str: String
) async throws -> InvitationType.PrismOnboarding {
Expand Down Expand Up @@ -67,7 +67,7 @@ public extension PrismAgent {
/// Parses the given string as an Out-of-Band invitation
/// - Parameter url: The string to parse
/// - Returns: The parsed Out-of-Band invitation
/// - Throws: `PrismAgentError` if the string is not a valid URL
/// - Throws: `EdgeAgentError` if the string is not a valid URL
func parseOOBInvitation(url: String) throws -> OutOfBandInvitation {
guard let url = URL(string: url) else { throw CommonError.invalidURLError(url: url) }
return try parseOOBInvitation(url: url)
Expand All @@ -76,18 +76,18 @@ public extension PrismAgent {
/// Parses the given URL as an Out-of-Band invitation
/// - Parameter url: The URL to parse
/// - Returns: The parsed Out-of-Band invitation
/// - Throws: `PrismAgentError` if the URL is not a valid Out-of-Band invitation
/// - Throws: `EdgeAgentError` if the URL is not a valid Out-of-Band invitation
func parseOOBInvitation(url: URL) throws -> OutOfBandInvitation {
return try DIDCommInvitationRunner(url: url).run()
}

/// Accepts an Out-of-Band (DIDComm) invitation and establishes a new connection
/// - Parameter invitation: The Out-of-Band invitation to accept
/// - Throws: `PrismAgentError` if there is no mediator available or other errors occur during the acceptance process
/// - Throws: `EdgeAgentError` if there is no mediator available or other errors occur during the acceptance process
func acceptDIDCommInvitation(invitation: OutOfBandInvitation) async throws {
guard
let connectionManager
else { throw PrismAgentError.noMediatorAvailableError }
else { throw EdgeAgentError.noMediatorAvailableError }
logger.info(message: "Start accept DIDComm invitation")
let ownDID = try await createNewPeerDID(updateMediator: true)

Expand All @@ -104,7 +104,7 @@ public extension PrismAgent {

/// Accepts a Prism Onboarding invitation and performs the onboarding process
/// - Parameter invitation: The Prism Onboarding invitation to accept
/// - Throws: `PrismAgentError` if the onboarding process fails
/// - Throws: `EdgeAgentError` if the onboarding process fails
func acceptPrismInvitation(invitation: InvitationType.PrismOnboarding) async throws {
struct SendDID: Encodable {
let did: String
Expand Down

0 comments on commit 07f84f0

Please sign in to comment.