Skip to content

Commit

Permalink
Add input and clean up strict
Browse files Browse the repository at this point in the history
  • Loading branch information
leighmcculloch committed Feb 15, 2024
1 parent b80b7a6 commit dea4cba
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions core/cap-0052.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,6 @@ value of 0xfffffffe is used it indicates decoding should fail if the trailing
padding bits are not zero.

```diff mddiffcheck.ignore=true mddiffcheck.base=v20.1.0
diff --git a/soroban-env-common/env.json b/soroban-env-common/env.json
index df7d5c4..ba82167 100644
--- a/soroban-env-common/env.json
+++ b/soroban-env-common/env.json
@@ -1890,6 +1890,38 @@
Expand All @@ -88,6 +86,10 @@ index df7d5c4..ba82167 100644
+ "name": "base64_encode",
+ "args": [
+ {
+ "name": "input",
+ "type": "BytesObject"
+ },
+ {
+ "name": "alphabet",
+ "type": "Symbol"
+ },
Expand All @@ -104,16 +106,24 @@ index df7d5c4..ba82167 100644
+ "name": "base64_decode",
+ "args": [
+ {
+ "name": "input",
+ "type": "BytesObject"
+ },
+ {
+ "name": "alphabet",
+ "type": "Symbol"
+ },
+ {
+ "name": "padding",
+ "type": "U32Val"
+ },
+ {
+ "name": "strict",
+ "type": "Bool"
+ }
+ ],
+ "return": "BytesObject",
+ "docs": "Base64 decodes as specified in RFC4648 the input BytesObject, using the alphabet specified as a symbol 'std' or 'url' that respectively encode with the standard alphabet or the URL/filename-safe alphabet, expecting padding with the u8 byte stored in the low 8-bits of the padding U32Val, or not padded if the padding is 0xffffffff, or strictly not padded if the padding is 0xfffffffe, returning a BytesObject with the encoded value. If no padding is strict, decoding fails if trailing padding bits are not zero. If decoding fails, the function returns ScError."
+ "docs": "Base64 decodes as specified in RFC4648 the input BytesObject, using the alphabet specified as a symbol 'std' or 'url' that respectively encode with the standard alphabet or the URL/filename-safe alphabet, expecting padding with the u8 byte stored in the low 8-bits of the padding U32Val, or not padded if the padding is 0xffffffff, returning a BytesObject with the encoded value. If strict is specified, decoding fails if trailing padding is not exactly the number of bits required to pad. If decoding fails, the function returns ScError."
}
]
},
Expand Down

0 comments on commit dea4cba

Please sign in to comment.