Skip to content

Commit 8bdc625

Browse files
committed
docs(logic): document base64url/2 and base64/2 predicates
1 parent e046713 commit 8bdc625

28 files changed

+113
-28
lines changed

docs/predicate/base64_2.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
sidebar_position: 9
3+
---
4+
[//]: # (This file is auto-generated. Please do not modify it yourself.)
5+
6+
# base64/2
7+
8+
## Description
9+
10+
`base64/2` is a predicate that unifies a string to a `base64/2` encoded string.
11+
12+
The output is returned as an atom with padding included.
13+
14+
The signature is as follows:
15+
16+
```text
17+
base64(+Plain, -Encoded) is det
18+
base64(-Plain, +Encoded) is det
19+
```
20+
21+
Where:
22+
23+
- Plain is an atom, a list of characters, or character codes representing the unencoded text.
24+
- Encoded is an atom, a list of characters, or character codes representing the `base64/2` encoded form.
25+
26+
The predicate is equivalent to base64\_encoded/3 with options: \[as\(atom\), encoding\(utf8\), charset\(classic\), padding\(true\)\].
27+
28+
## Examples
29+
30+
### Encode and decode a string into a Base64 encoded atom
31+
32+
This scenario demonstrates how to encode an decode a plain string into a Base64-encoded atom using the `base64/2`
33+
predicate.
34+
35+
Here are the steps of the scenario:
36+
37+
- **Given** the query:
38+
39+
``` prolog
40+
base64('Hello world', Encoded),
41+
base64(Decoded, 'SGVsbG8gd29ybGQ=').
42+
```
43+
44+
- **When** the query is run
45+
- **Then** the answer we get is:
46+
47+
``` yaml
48+
height: 42
49+
gas_used: 3976
50+
answer:
51+
has_more: false
52+
variables: ["Encoded", "Decoded"]
53+
results:
54+
- substitutions:
55+
- variable: Encoded
56+
expression: "'SGVsbG8gd29ybGQ='"
57+
- variable: Decoded
58+
expression: "'Hello world'"
59+
```

docs/predicate/base64_encoded_3.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
---
2-
sidebar_position: 9
2+
sidebar_position: 10
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

66
# base64_encoded/3
77

88
## Description
99

10-
`base64_encoded/3` is a predicate that unifies a string to a base64 encoded string as specified by [RFC 4648](<https://rfc-editor.org/rfc/rfc4648.html>).
10+
`base64_encoded/3` is a predicate that unifies a string to a Base64 encoded string as specified by [RFC 4648](<https://rfc-editor.org/rfc/rfc4648.html>).
1111

1212
The signature is as follows:
1313

@@ -20,7 +20,7 @@ base64_encoded(+Plain, +Encoded, +Options) is det
2020
Where:
2121

2222
- Plain is an atom, a list of character codes, or list of characters containing the unencoded \(plain\) text.
23-
- Encoded is an atom or string containing the base64 encoded text.
23+
- Encoded is an atom or string containing the Base64 encoded text.
2424
- Options is a list of options that can be used to control the encoding process.
2525

2626
## Options

docs/predicate/base64_url_2.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
sidebar_position: 11
3+
---
4+
[//]: # (This file is auto-generated. Please do not modify it yourself.)
5+
6+
# base64_url/2
7+
8+
## Description
9+
10+
`base64_url/2` is a predicate that unifies a string to a Base64 URL\-safe encoded string.
11+
12+
Encoded values are safe for use in URLs and filenames: "\+" is replaced by "\-", "/" by "\_", and padding is omitted.
13+
14+
The signature is as follows:
15+
16+
```text
17+
base64url(+Plain, -Encoded) is det
18+
base64url(-Plain, +Encoded) is det
19+
```
20+
21+
Where:
22+
23+
- Plain is an atom, a list of characters, or character codes representing the unencoded text.
24+
- Encoded is an atom, a list of characters, or character codes representing the Base64 URL\-safe encoded form.
25+
26+
The predicate is equivalent to base64\_encoded/3 with options: \[as\(atom\), encoding\(utf8\), charset\(url\), padding\(false\)\].

docs/predicate/bech32_address_2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 10
2+
sidebar_position: 12
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/block_header_1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 11
2+
sidebar_position: 13
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/block_height_1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 12
2+
sidebar_position: 14
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/block_time_1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 13
2+
sidebar_position: 15
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/chain_id_1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 14
2+
sidebar_position: 16
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/consult_1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 15
2+
sidebar_position: 17
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/crypto_data_hash_3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 16
2+
sidebar_position: 18
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/current_output_1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 17
2+
sidebar_position: 19
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/did_components_2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 18
2+
sidebar_position: 20
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/ecdsa_verify_4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 19
2+
sidebar_position: 21
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/eddsa_verify_4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 20
2+
sidebar_position: 22
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/hex_bytes_2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 21
2+
sidebar_position: 23
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/json_prolog_2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 22
2+
sidebar_position: 24
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/json_read_2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 23
2+
sidebar_position: 25
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/json_write_2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 24
2+
sidebar_position: 26
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/open_3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 26
2+
sidebar_position: 28
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/open_4.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 25
2+
sidebar_position: 27
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/read_string_3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 27
2+
sidebar_position: 29
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/read_term_3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 28
2+
sidebar_position: 30
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/retract_1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 29
2+
sidebar_position: 31
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/source_file_1.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 30
2+
sidebar_position: 32
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/string_bytes_3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 31
2+
sidebar_position: 33
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/term_to_atom_2.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 32
2+
sidebar_position: 34
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/uri_encoded_3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 33
2+
sidebar_position: 35
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

docs/predicate/write_term_3.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
sidebar_position: 34
2+
sidebar_position: 36
33
---
44
[//]: # (This file is auto-generated. Please do not modify it yourself.)
55

0 commit comments

Comments
 (0)