Skip to content

Commit

Permalink
add sep-30 support
Browse files Browse the repository at this point in the history
  • Loading branch information
christian-rogobete committed Oct 27, 2023
1 parent ee02d70 commit 0294b28
Show file tree
Hide file tree
Showing 18 changed files with 1,251 additions and 15 deletions.
18 changes: 13 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ To integrate stellar SDK into your Xcode project using CocoaPods, specify it in
use_frameworks!

target '<Your Target Name>' do
pod 'stellar-ios-mac-sdk', '~> 2.4.8'
pod 'stellar-ios-mac-sdk', '~> 2.4.9'
end
```

Expand All @@ -44,15 +44,15 @@ $ brew install carthage
To integrate stellar-ios-mac-sdk into your Xcode project using Carthage, specify it in your `Cartfile`:

```ogdl
github "soneso/stellar-ios-mac-sdk" ~> 2.4.8
github "soneso/stellar-ios-mac-sdk" ~> 2.4.9
```

Run `carthage update` to build the framework and drag the build `stellar-ios-mac-sdk.framework` into your Xcode project.

### Swift Package Manager

```swift
.package(name: "stellarsdk", url: "[email protected]:Soneso/stellar-ios-mac-sdk.git", from: "2.4.8"),
.package(name: "stellarsdk", url: "[email protected]:Soneso/stellar-ios-mac-sdk.git", from: "2.4.9"),
```

### Manual
Expand Down Expand Up @@ -636,6 +636,13 @@ Helps clients to interact with anchors in a standard way defined by [SEP-0024: H

See [SEP-0024 SDK documentation](https://github.com/Soneso/stellar-ios-mac-sdk/tree/master/docs/SEP-0024.md)

### 11. Account recovery

Enables an individual (e.g., a user or wallet) to regain access to a Stellar account as defined by
[SEP-0030: Account Recovery](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0030.md).

See [SEP-0030: Account Recovery](https://github.com/Soneso/stellar-ios-mac-sdk/tree/master/docs/SEP-0030.md)

## Documentation and Examples

You can find more documentation and examples in the [docs](https://github.com/Soneso/stellar-ios-mac-sdk/tree/master/docs) folder.
Expand All @@ -646,7 +653,7 @@ Our SDK is used by the open source [LOBSTR Vault](https://vault.lobstr.co). You

Our SDK is also used by the [LOBSTR Wallet](https://lobstr.co).

## Stellar Ecosystem Proposals (SEPs) implemented
## Stellar Ecosystem Proposals (SEPs) supported

- [SEP-0001](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0001.md) - Stellar Info File (Toml)
- [SEP-0002](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0002.md) - Federation protocol
Expand All @@ -658,10 +665,11 @@ Our SDK is also used by the [LOBSTR Wallet](https://lobstr.co).
- [SEP-0011](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0011.md) - Txrep
- [SEP-0012](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0012.md) - Anchor/Client customer info transfer
- [SEP-0024](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0024.md) - Hosted Deposit and Withdrawal
- [SEP-0030](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0030.md) - Account Recovery

## Soroban support

This SDK provides experimental [support for Soroban](https://github.com/Soneso/stellar-ios-mac-sdk/blob/master/soroban.md).
This SDK provides [support for Soroban](https://github.com/Soneso/stellar-ios-mac-sdk/blob/master/soroban.md).

## How to contribute

Expand Down
100 changes: 100 additions & 0 deletions docs/SEP-0030.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@

# SEP-0030 - Account Recovery

Enables an individual (e.g., a user or wallet) to regain access to a Stellar account as defined by
[SEP-0030: Account Recovery](https://github.com/stellar/stellar-protocol/blob/master/ecosystem/sep-0030.md).


## Create a SEP30RecoveryService instance

**By providing the recovery server url directly via the constructor:**

```swift
recoveryService = RecoveryService(serviceAddress: "http://api.stellar-anchor.org/recovery")
```

## Register an account

```swift
let request = Sep30Request(identities: [senderIdentity, receiverIdentity])
recoveryService.registerAccount(address: addressA, request: request, jwt: jwtToken) { (response) -> (Void) in
switch response {
case .success(let response):
// ...
case .failure(let err):
// ...
}
}
```

## Update identities for an account

```swift
let request = Sep30Request(identities: [senderIdentity, receiverIdentity])
recoveryService.updateIdentitiesForAccount(address: addressA, request: request, jwt: jwtToken) { (response) -> (Void) in
switch response {
case .success(let response):
// ...
case .failure(let err):
// ...
}
}

```

## Sign a transaction

```swift
recoveryService.signTransaction(address: addressA, signingAddress: signingAddress, transaction:transaction, jwt: jwtToken) { (response) -> (Void) in
switch response {
case .success(let response):
// ...
case .failure(let err):
// ...
}
}
```

## Get account details

```swift
recoveryService.accountDetails(address: addressA, jwt: jwtToken) { (response) -> (Void) in
switch response {
case .success(let response):
// ...
case .failure(let err):
// ...
}
}
```

## Delete account

```swift
recoveryService.deleteAccount(address: addressA, jwt: jwtToken) { (response) -> (Void) in
switch response {
case .success(let response):
// ...
case .failure(let err):
// ...
}
}
```


## List accounts

```swift
recoveryService.accounts(jwt: jwtToken, after: after) { (response) -> (Void) in
switch response {
case .success(let response):
// ...
case .failure(let err):
// ...
}
}
```

### Further readings

For more info, see also the class [RecoveryService](https://github.com/Soneso/stellar-ios-mac-sdk/blob/master/stellarsdk/stellarsdk/recovery/RecoveryService.swift) and the SDK's [SEP-30 test cases](https://github.com/Soneso/stellar-ios-mac-sdk/blob/master/stellarsdk/stellarsdkTests/recovery/RecoveryServiceTestCase.swift).
2 changes: 1 addition & 1 deletion stellar-ios-mac-sdk.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "stellar-ios-mac-sdk"
s.version = "2.4.8"
s.version = "2.4.9"
s.summary = "Fully featured iOS and macOS SDK that provides APIs to build transactions and connect to Horizon server for the Stellar ecosystem."
s.module_name = 'stellarsdk'
s.swift_version = '5.0'
Expand Down
Loading

0 comments on commit 0294b28

Please sign in to comment.