Skip to content

Commit

Permalink
docs: Remove examples
Browse files Browse the repository at this point in the history
  • Loading branch information
sorairolake committed Oct 14, 2024
1 parent 4393abb commit c5f34f4
Show file tree
Hide file tree
Showing 7 changed files with 0 additions and 153 deletions.
23 changes: 0 additions & 23 deletions crates/abcrypt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,6 @@ Add this to your `Cargo.toml`:
abcrypt = "0.3.6"
```

### Example

```rust
use abcrypt::Params;

let data = b"Hello, world!\n";
let passphrase = "passphrase";

// Encrypt `data` using `passphrase`.
let ciphertext = abcrypt::encrypt(data, passphrase).unwrap();
assert_ne!(ciphertext, data);

// And extract the Argon2 parameters from it.
let params = Params::new(&ciphertext).unwrap();
assert_eq!(params.memory_cost(), 19456);
assert_eq!(params.time_cost(), 2);
assert_eq!(params.parallelism(), 1);

// And decrypt it back.
let plaintext = abcrypt::decrypt(ciphertext, passphrase).unwrap();
assert_eq!(plaintext, data);
```

### Crate features

#### `alloc`
Expand Down
25 changes: 0 additions & 25 deletions crates/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,31 +26,6 @@ To install this library:
pip install abcrypt-py
```

### Example

```py
from typing import Final

import abcrypt_py

DATA: Final[bytes] = b"Hello, world!\n"
PASSPHRASE: Final[bytes] = b"passphrase"

# Encrypt `DATA` using `PASSPHRASE`.
ciphertext = abcrypt_py.encrypt(DATA, PASSPHRASE)
assert ciphertext != DATA

# And extract the Argon2 parameters from it.
params = abcrypt_py.Params(ciphertext)
assert params.memory_cost == 19456
assert params.time_cost == 2
assert params.parallelism == 1

# And decrypt it back.
plaintext = abcrypt_py.decrypt(ciphertext, PASSPHRASE)
assert plaintext == DATA
```

### Documentation

See the [documentation][docs-url] for more details.
Expand Down
25 changes: 0 additions & 25 deletions crates/wasm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,31 +35,6 @@ wasm-pack build

This will generate build artifacts in the `pkg` directory.

### Example

```ts
import * as assert from "jsr:@std/assert";

import * as abcrypt from "./pkg/abcrypt_wasm.js";

const data = new TextEncoder().encode("Hello, world!\n");
const passphrase = new TextEncoder().encode("passphrase");

// Encrypt `data` using `passphrase`.
const ciphertext = abcrypt.encrypt(data, passphrase);
assert.assertNotEquals(ciphertext, data);

// And extract the Argon2 parameters from it.
const params = new abcrypt.Params(ciphertext);
assert.assertEquals(params.memoryCost, 19456);
assert.assertEquals(params.timeCost, 2);
assert.assertEquals(params.parallelism, 1);

// And decrypt it back.
const plaintext = abcrypt.decrypt(ciphertext, passphrase);
assert.assertEquals(plaintext, data);
```

### Documentation

See the [documentation][docs-url] for more details.
Expand Down
1 change: 0 additions & 1 deletion docs/book/modules/lib/nav.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,5 @@
.Library
* xref:index.adoc[Introduction]
* xref:usage.adoc[]
* xref:examples.adoc[]
* https://docs.rs/abcrypt[API Reference]
* xref:changelog.adoc[]
27 changes: 0 additions & 27 deletions docs/book/modules/lib/pages/examples.adoc

This file was deleted.

26 changes: 0 additions & 26 deletions docs/book/modules/python/pages/usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -11,29 +11,3 @@
----
pip install abcrypt-py
----

== Example

[source,py]
----
from typing import Final
import abcrypt_py
DATA: Final[bytes] = b"Hello, world!\n"
PASSPHRASE: Final[bytes] = b"passphrase"
# Encrypt `DATA` using `PASSPHRASE`.
ciphertext = abcrypt_py.encrypt(DATA, PASSPHRASE)
assert ciphertext != DATA
# And extract the Argon2 parameters from it.
params = abcrypt_py.Params(ciphertext)
assert params.memory_cost == 19456
assert params.time_cost == 2
assert params.parallelism == 1
# And decrypt it back.
plaintext = abcrypt_py.decrypt(ciphertext, PASSPHRASE)
assert plaintext == DATA
----
26 changes: 0 additions & 26 deletions docs/book/modules/wasm/pages/usage.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -23,29 +23,3 @@ wasm-pack build
----

This will generate build artifacts in the `pkg` directory.

== Example

[source,ts]
----
import * as assert from "jsr:@std/assert";
import * as abcrypt from "./pkg/abcrypt_wasm.js";
const data = new TextEncoder().encode("Hello, world!\n");
const passphrase = new TextEncoder().encode("passphrase");
// Encrypt `data` using `passphrase`.
const ciphertext = abcrypt.encrypt(data, passphrase);
assert.assertNotEquals(ciphertext, data);
// And extract the Argon2 parameters from it.
const params = new abcrypt.Params(ciphertext);
assert.assertEquals(params.memoryCost, 19456);
assert.assertEquals(params.timeCost, 2);
assert.assertEquals(params.parallelism, 1);
// And decrypt it back.
const plaintext = abcrypt.decrypt(ciphertext, passphrase);
assert.assertEquals(plaintext, data);
----

0 comments on commit c5f34f4

Please sign in to comment.