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

Update readme for iOS and Rust wrappers #581

Merged
merged 7 commits into from
Jan 28, 2020
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
59 changes: 31 additions & 28 deletions docs/examples/Themis-server/Obj-C/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
0. Install Pods
1. Run app, see that it's crashing on asserts. This is fine :)
2. Open `AppDelegate` and select example to start: SecureMessage or SecureSession. Just uncomment one of the modes.
0. [Install Pods](https://docs.cossacklabs.com/pages/objective-c-howto/#installing-stable-version-from-cocoapods)
1. Run the app (yes, it crashes on asserts – this is fine :)
2. Open `AppDelegate` and choose a Client example for either SMessage ([Secure Message](https://docs.cossacklabs.com/pages/secure-message-cryptosystem/)) or SSession ([Secure Session](https://docs.cossacklabs.com/pages/secure-session-cryptosystem/)). Uncomment the necessary mode to start.


![appdelegate](pics/appdelegate.png)


## SecureSession mode

Let's assume you want to play with SecureSession.
Let's assume, you want to play with [Secure Session](https://docs.cossacklabs.com/pages/secure-session-cryptosystem/).

3. Open `SSessionClient.m` file.

### Client key generation

4. Find these lines:
4. Find the following lines:

```objc
// ---------------------- KEY GENERATION ---------------------------------------
Expand All @@ -25,30 +25,34 @@ Let's assume you want to play with SecureSession.

// ---------------------- END KEY GENERATION -----------------------------------
```
5. Uncomment key generation and run example. You should see output in console, like this:
5. Uncomment key generation and run the example. The console output will look something like this:

```objc
------------ running SSession Client example
client private key "UkVDMgAAAC0lV2hOAKFJZyAOLFkzavGzxP8v0Byrs9r5N4u1rm4qYSTLqf+2";
client public key "VUVDMgAAAC1hdEZpAlxrxhaWHW23X9ILnXgeZRNHRJ2lt/w4e4tdzablr/WS";
```

6. Copy keys to text file :)
7. Comment key generation lines (`[self generateClientKeys]`) function, we don't need them anymore.
6. Copy the keys to a text file.
7. Comment the lines of the key generation function (`[self generateClientKeys]`), you no longer need it.
8. Find client keys constants in code and paste generated keys, like this:

```objc
static NSString * kClientPrivateKey = @"UkVDMgAAAC0lV2hOAKFJZyAOLFkzavGzxP8v0Byrs9r5N4u1rm4qYSTLqf+2"
static NSString * kClientPublicKey = @"VUVDMgAAAC1hdEZpAlxrxhaWHW23X9ILnXgeZRNHRJ2lt/w4e4tdzablr/WS"
static NSString* kClientPrivateKey = @"UkVDMgAAAC0lV2hOAKFJZyAOLFkzavGzxP8v0Byrs9r5N4u1rm4qYSTLqf+2";
static NSString* kClientPublicKey = @"VUVDMgAAAC1hdEZpAlxrxhaWHW23X9ILnXgeZRNHRJ2lt/w4e4tdzablr/WS";
```

### Server key generation

The idea is to let server know client public key, and let client know server id and public key.
The idea is to let the Server know the Client's public key, and let the Client know the Server ID and the public key.


9. Open https://docs.cossacklabs.com/simulator/interactive/
9. Open [Themis Server](https://docs.cossacklabs.com/simulator/interactive/).
10. Log in with your existing Themis Server credentials or [register](https://docs.cossacklabs.com/pages/using-themis-server/#registration).

>Note: The UI of Themis Server is gradually (albeit constantly) evolving. Don’t be surprised to see that some of the UI elements have changed their colour or that some buttons have moved around a little. The core functionality of Themis Server stays the same.

11. After logging in:
- Copy User ID from server interface to `kUserId` in code.
- Copy Server ID from server interface to `kServerId` in code.
- Copy Server Key from server interface to `kServerPublicKey` in code.
Expand All @@ -57,33 +61,32 @@ The idea is to let server know client public key, and let client know server id

![sever dashboard](pics/server-dashboard.png)

Code will look like this:
The code will now look something like this:

```objc
static NSString * kUserId = @"gUOosYEgpqbGXJf";
static NSString * kServerId = @"shfVaKYXvlbAMoD";
static NSString * kServerPublicKey = @"VUVDMgAAAC2TKF6QAyMjQXtKmAAfNOSeW6D1BeXKx6XIX8bWFG3Tfjo74ldm";
static NSString* kUserId = @"gUOosYEgpqbGXJf";
static NSString* kServerId = @"shfVaKYXvlbAMoD";
static NSString* kServerPublicKey = @"VUVDMgAAAC2TKF6QAyMjQXtKmAAfNOSeW6D1BeXKx6XIX8bWFG3Tfjo74ldm";

static NSString * kClientPrivateKey = @"UkVDMgAAAC0lV2hOAKFJZyAOLFkzavGzxP8v0Byrs9r5N4u1rm4qYSTLqf+2"
static NSString * kClientPublicKey = @"VUVDMgAAAC1hdEZpAlxrxhaWHW23X9ILnXgeZRNHRJ2lt/w4e4tdzablr/WS"
static NSString* kClientPrivateKey = @"UkVDMgAAAC0lV2hOAKFJZyAOLFkzavGzxP8v0Byrs9r5N4u1rm4qYSTLqf+2";
static NSString* kClientPublicKey = @"VUVDMgAAAC1hdEZpAlxrxhaWHW23X9ILnXgeZRNHRJ2lt/w4e4tdzablr/WS";
```

### Start all the things!
### Launching everything

10. Start server in SecureSession mode (press corresponded button).
11. Run app on SecureSession mode.
- don't forget to uncomment SecureSession mode in AppDelegate
12. Start Themis Server in Secure Session mode (press the corresponding button).
13. Run the app in Secure Session mode.
- don't forget to uncomment the Secure Session mode in AppDelegate
- don't forget to comment out key generation

12. Enjoy
14. Enjoy playing around with Themis Server!


## Secure Message mode
## Secure Message mode

Do the same steps as described above, but for `SMessageClient.m` file :) Run server in Secure Message mode.
Follow the same steps as described above, but do it for `SMessageClient` file :) Run Themis Server in Secure Message mode.


## Read more!
## Useful reading

Read How Themis Server Simulator works:
https://docs.cossacklabs.com/pages/documentation-themis/#interactive-simulator-themis-server
To get most of Themis Server, read a [detailed explanation of how Themis Server Simulator works](https://docs.cossacklabs.com/pages/using-themis-server/).
63 changes: 34 additions & 29 deletions docs/examples/Themis-server/swift/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
0. Install Pods
1. Run app, see that it's crashing on asserts. This is fine :)
2. Open `AppDelegate` and select example to start: SecureMessage or SecureSession. Just uncomment one of the modes.
# How to use Themis Server with Swift

0. [Install Pods](https://docs.cossacklabs.com/pages/swift-howto/#installing-stable-version-from-cocoapods)
1. Run the app (yes, it crashes on asserts – this is fine :)
2. Open `AppDelegate` and choose a Client example for either SMessage ([Secure Message](https://docs.cossacklabs.com/pages/secure-message-cryptosystem/)) or SSession ([Secure Session](https://docs.cossacklabs.com/pages/secure-session-cryptosystem/)). Uncomment the necessary mode to start.


![appdelegate](pics/appdelegate.png)


## SecureSession mode
## Secure Session mode

Let's assume you want to play with SecureSession.
Let's assume, you want to play with [Secure Session](https://docs.cossacklabs.com/pages/secure-session-cryptosystem/).

3. Open `SSessionClient` file.

### Client key generation
### Client key generation

4. Find these lines:
4. Find the following lines:

```swift
// ---------------------- KEY GENERATION ---------------------------------------
Expand All @@ -25,39 +27,43 @@ Let's assume you want to play with SecureSession.

// ---------------------- END KEY GENERATION -----------------------------------
```
5. Uncomment key generation and run example. You should see output in console, like this:
5. Uncomment key generation and run the example. The console output will look something like this:

```swift
------------ running SSession Client example
EC privateKey = UkVDMgAAAC0lV2hOAKFJZyAOLFkzavGzxP8v0Byrs9r5N4u1rm4qYSTLqf+2
EC publicKey = VUVDMgAAAC1hdEZpAlxrxhaWHW23X9ILnXgeZRNHRJ2lt/w4e4tdzablr/WS
```

6. Copy keys to text file :)
7. Comment key generation lines (`generateClientKeys()`) function, we don't need them anymore.
8. Find client keys constants in code and paste generated keys, like this:
6. Copy the keys to a text file.
7. Comment the lines of the key generation function (`generateClientKeys()`), you no longer need it.
8. Find the constants of the Client keys in the code and paste the generated keys:

```swift
let kClientPrivateKey: String = "UkVDMgAAAC0lV2hOAKFJZyAOLFkzavGzxP8v0Byrs9r5N4u1rm4qYSTLqf+2"
let kClientPublicKey: String = "VUVDMgAAAC1hdEZpAlxrxhaWHW23X9ILnXgeZRNHRJ2lt/w4e4tdzablr/WS"
```

### Server key generation
### Server key generation

The idea is to let server know client public key, and let client know server id and public key.
The idea is to let the Server know the Client's public key, and let the Client know the Server ID and the public key.


9. Open https://docs.cossacklabs.com/simulator/interactive/
9. Open [Themis Server](https://docs.cossacklabs.com/simulator/interactive/).
10. Log in with your existing Themis Server credentials or [register](https://docs.cossacklabs.com/pages/using-themis-server/#registration).

>Note: The UI of Themis Server is gradually (albeit constantly) evolving. Don’t be surprised to see that some of the UI elements have changed their colour or that some buttons have moved around a little. The core functionality of Themis Server stays the same.

- Copy User ID from server interface to `kUserId` in code.
- Copy Server ID from server interface to `kServerId` in code.
- Copy Server Key from server interface to `kServerPublicKey` in code.
- Paste `kClientPublicKey` to Client public key in server interface.
11. After logging in:
- Copy the User ID from the Server interface to `kUserId` in code.
- Copy Server ID from the Server interface to `kServerId` in code.
- Copy the Server Key from the Server interface to `kServerPublicKey` in code.
- Paste `kClientPublicKey` to the Client public key in the Server interface.


![sever dashboard](pics/server-dashboard.png)

Code will look like this:
The code will now look something like this:

```swift
let kUserId: String = "gUOosYEgpqbGXJf"
Expand All @@ -68,22 +74,21 @@ let kClientPrivateKey: String = "UkVDMgAAAC0lV2hOAKFJZyAOLFkzavGzxP8v0Byrs9r5N4u
let kClientPublicKey: String = "VUVDMgAAAC1hdEZpAlxrxhaWHW23X9ILnXgeZRNHRJ2lt/w4e4tdzablr/WS"
```

### Start all the things!
### Launching everything

10. Start server in SecureSession mode (press corresponded button).
11. Run app on SecureSession mode.
- don't forget to uncomment SecureSession mode in AppDelegate
12. Start Themis Server in Secure Session mode (press the corresponding button).
13. Run the app in Secure Session mode.
- don't forget to uncomment the Secure Session mode in AppDelegate
- don't forget to comment out key generation

12. Enjoy
14. Enjoy playing around with Themis Server!


## Secure Message mode
## Secure Message mode

Do the same steps as described above, but for `SMessageClient` file :) Run server in Secure Message mode.
Follow the same steps as described above, but do it for `SMessageClient` file :) Run Themis Server in Secure Message mode.


## Read more!
## Useful reading

Read How Themis Server Simulator works:
https://docs.cossacklabs.com/pages/documentation-themis/#interactive-simulator-themis-server
To get most of Themis Server, read a [detailed explanation of how Themis Server Simulator works](https://docs.cossacklabs.com/pages/using-themis-server/).
2 changes: 1 addition & 1 deletion src/wrappers/themis/rust/libthemis-sys/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# libthemis-sys

A customary `*-sys` crate that contains raw FFI bindings to **libthemis**.
This is a customary `*-sys` crate that contains raw FFI bindings to **libthemis**.
It is not expected to be used directly.

## Licensing
Expand Down