Skip to content

Commit a923fa6

Browse files
authored
Define IETF RFC 4648 schemas (#40)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
1 parent 57b480f commit a923fa6

11 files changed

Lines changed: 2663 additions & 0 deletions

File tree

README.markdown

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ expressed as JSON Schema definitions.
5353
| IEEE | [IEEE Std 754-2019](https://ieeexplore.ieee.org/document/8766229) | IEEE Standard for Floating-Point Arithmetic |
5454
| IEEE | [IEEE Std 1003.1-2017](https://pubs.opengroup.org/onlinepubs/9699919799/) | IEEE Standard for Information Technology—Portable Operating System Interface (POSIX) Base Specifications, Issue 7 |
5555
| IETF | [RFC 3986](https://www.rfc-editor.org/rfc/rfc3986) | Uniform Resource Identifier (URI): Generic Syntax |
56+
| IETF | [RFC 4648](https://www.rfc-editor.org/rfc/rfc4648) | The Base16, Base32, and Base64 Data Encodings |
5657
| IETF | [RFC 4918](https://www.rfc-editor.org/rfc/rfc4918) | HTTP Extensions for Web Distributed Authoring and Versioning (WebDAV) |
5758
| IETF | [RFC 5322](https://www.rfc-editor.org/rfc/rfc5322) | Internet Message Format |
5859
| IETF | [RFC 5646](https://www.rfc-editor.org/rfc/rfc5646) | Tags for Identifying Languages (BCP 47) |

schemas/ietf/encoding/base16.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "RFC 4648 Base16 Encoding",
4+
"description": "Uses digits 0-9 and letters A-F (case-insensitive). Each byte encodes to exactly 2 characters, no padding required",
5+
"examples": [
6+
"48656C6C6F20576F726C6421",
7+
"DEADBEEF",
8+
"0FB7",
9+
"666F6F626172",
10+
""
11+
],
12+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
13+
"x-links": [ "https://www.rfc-editor.org/rfc/rfc4648.html#section-8" ],
14+
"type": "string",
15+
"not": {
16+
"pattern": "[\\x00-\\x1F]"
17+
},
18+
"pattern": "^([0-9A-Fa-f]{2})*$",
19+
"contentEncoding": "base16"
20+
}

schemas/ietf/encoding/base32.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "RFC 4648 Base32 Encoding",
4+
"description": "Uses uppercase letters A-Z and digits 2-7 (32 characters total). Padding with = to multiple of 8 characters",
5+
"examples": [
6+
"JBSWY3DPEBLW64TMMQ======",
7+
"MFRGG===",
8+
"MZXW6===",
9+
"MZXW6YQ=",
10+
"MZXW6YTB",
11+
""
12+
],
13+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
14+
"x-links": [ "https://www.rfc-editor.org/rfc/rfc4648.html#section-6" ],
15+
"type": "string",
16+
"pattern": "^([A-Z2-7]{8})*([A-Z2-7]{2}={6}|[A-Z2-7]{4}={4}|[A-Z2-7]{5}={3}|[A-Z2-7]{7}=)?$",
17+
"contentEncoding": "base32"
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "RFC 4648 Base32hex Encoding",
4+
"description": "Uses digits 0-9 and uppercase letters A-V (32 characters total). Padding with = to multiple of 8 characters",
5+
"examples": [
6+
"91IMOR3F41BMUSJCCG======",
7+
"C5H66===",
8+
"CPNMU===",
9+
"CPNMUO8=",
10+
"CPNMUOJ1",
11+
""
12+
],
13+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
14+
"x-links": [ "https://www.rfc-editor.org/rfc/rfc4648.html#section-7" ],
15+
"type": "string",
16+
"pattern": "^([0-9A-V]{8})*([0-9A-V]{2}={6}|[0-9A-V]{4}={4}|[0-9A-V]{5}={3}|[0-9A-V]{7}=)?$",
17+
"contentEncoding": "base32hex"
18+
}

schemas/ietf/encoding/base64.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "RFC 4648 Base64 Encoding",
4+
"description": "Uses uppercase letters A-Z, lowercase letters a-z, digits 0-9, plus sign (+), and forward slash (/), with equals sign (=) used for padding",
5+
"examples": [
6+
"R0lGODlhAQABAAAAACw=",
7+
"SGVsbG8gV29ybGQh",
8+
"YQ==",
9+
"YWI=",
10+
"YWJj",
11+
""
12+
],
13+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
14+
"x-links": [ "https://www.rfc-editor.org/rfc/rfc4648.html#section-4" ],
15+
"type": "string",
16+
"pattern": "^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$",
17+
"contentEncoding": "base64"
18+
}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "https://json-schema.org/draft/2020-12/schema",
3+
"title": "RFC 4648 Base64url Encoding",
4+
"description": "Base64 encoding with URL and filename safe alphabet as defined in RFC 4648 section 5. Uses hyphen (-) and underscore (_) instead of plus (+) and slash (/)",
5+
"examples": [
6+
"R0lGODlhAQABAAAAACw=",
7+
"SGVsbG8gV29ybGQh",
8+
"YQ==",
9+
"YWI=",
10+
"YWJj",
11+
""
12+
],
13+
"x-license": "https://github.com/sourcemeta/std/blob/main/LICENSE",
14+
"x-links": [ "https://www.rfc-editor.org/rfc/rfc4648.html#section-5" ],
15+
"type": "string",
16+
"pattern": "^([A-Za-z0-9_-]{4})*([A-Za-z0-9_-]{2}==|[A-Za-z0-9_-]{3}=)?$",
17+
"contentEncoding": "base64url"
18+
}

0 commit comments

Comments
 (0)