From 5d183a0b93b112abfc5be93702b5c70837c92992 Mon Sep 17 00:00:00 2001 From: Metachaser24 Date: Fri, 19 Apr 2024 08:10:59 +0300 Subject: [PATCH] added missing templtes in docs --- README.md | 2 +- packages/circuits/README.md | 69 +++++++++++++++++++++++++++++++++++++ packages/helpers/README.md | 2 +- 3 files changed, 71 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 6d7be9386..0319b982f 100644 --- a/README.md +++ b/README.md @@ -38,4 +38,4 @@ A heartfelt thank you goes to all of our contributors! ## Licensing -Everything we write is MIT licensed. Note that circom and circomlib is GPL. Broadly we are pro permissive open source usage with attribution! We hope that those who derive profit from this, contribute that money altruistically back to this technology and open source public good. +Everything we write is MIT-licensed. Note that circom and circomlib is GPL. Broadly we are pro permissive open source usage with attribution! We hope that those who derive profit from this, contribute that money altruistically back to this technology and open source public goods. diff --git a/packages/circuits/README.md b/packages/circuits/README.md index 8785d0fbf..6367a74b8 100644 --- a/packages/circuits/README.md +++ b/packages/circuits/README.md @@ -29,6 +29,8 @@ include "@zk-email/circuits/email-verifier.circom"; - `n`: Number of bits per chunk the RSA key is split into. Recommended to be 121. - `k`: Number of chunks the RSA key is split into. Recommended to be 17. - `ignoreBodyHashCheck`: Set 1 to skip body hash check in case data to prove/extract is only in the headers. + + `Note`: We use these values for n and k because their product (n * k) needs to be more than 2048 (RSA constraint) and n has to be less than half of 255 to fit in a circom signal. - **Input Signals**: - `emailHeader[maxHeadersLength]`: Email headers that are signed (ones in `DKIM-Signature` header) as ASCII int[], padded as per SHA-256 block size. @@ -138,6 +140,73 @@ AssertZeroPadding: Asserts that the input array is zero-padded from the given `s - **Inputs**: - `in`: The input array. - `startIndex`: The index from which the array should be zero-padded. + + + +
+ +ItemAtIndex: Selects an item at a given index from the input array. + + +- **[Source](utils/array.circom#L15-L42)** +- **Parameters**: + - `maxArrayLen`: The number of elements in the array. +- **Inputs**: + - `in`: The input array. + - `index`: The index of the element to select. +- **Output**: + - `out`: The selected element. + +
+ +
+ +CalculateTotal: Calculates the sum of an array. + + +- **[Source](utils/array.circom#L54-L67)** +- **Parameters**: + - `n`: The number of elements in the array. +- **Inputs**: + - `nums`: The input array. +- **Output**: + - `sum`: The sum of the input array. + +
+ +
+ +SelectSubArray: Selects a subarray from an array given a `startIndex` and `length`. + + +- **[Source](utils/array.circom#L80-L104)** +- **Parameters**: + - `maxArrayLen`: The maximum number of bytes in the input array. + - `maxSubArrayLen`: The maximum number of integers in the output array. +- **Inputs**: + - `in`: The input byte array. + - `startIndex`: The start index of the subarray. + - `length`: The length of the subarray. +- **Output**: + - `out`: Array of `maxSubArrayLen` size, items starting from `startIndex`, and items after `length` set to zero. + +
+ +
+ +VarShiftLeft: Shifts input array by `shift` indices to the left. + + +- **[Source](utils/array.circom#L116-L140)** +- **Parameters**: + - `maxArrayLen`: The maximum length of the input array. + - `maxOutArrayLen`: The maximum length of the output array. +- **Inputs**: + - `in`: The input array. + - `shift`: The number of indices to shift the array to the left. +- **Output**: + - `out`: Shifted subarray. +
diff --git a/packages/helpers/README.md b/packages/helpers/README.md index 9e1719842..a7c146397 100644 --- a/packages/helpers/README.md +++ b/packages/helpers/README.md @@ -65,7 +65,7 @@ To verify the DKIM signature of an email, import and call the `verifyDKIMSignatu ### binary-format.ts -The `binary-format.ts` file provides functions for converting between strings, byte arrays, and other binary formats.This is particularly useful for handling data encoding and decoding within an application. +The `binary-format.ts` file provides functions for converting between strings, byte arrays, and other binary formats. This is particularly useful for handling data encoding and decoding within an application. - [**stringToBytes**](https://github.com/zkemail/zk-email-verify/blob/main/packages/helpers/src/binary-format.ts#L8-L12): Converts a string into its byte representation. - [**bytesToString**](https://github.com/zkemail/zk-email-verify/blob/main/packages/helpers/src/binary-format.ts#L3-L5): Converts a byte array back into a string. Useful for decoding data received in binary format.