Skip to content

Commit

Permalink
added missing templtes in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Metachaser24 committed Apr 19, 2024
1 parent 86bfdbe commit 5d183a0
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
69 changes: 69 additions & 0 deletions packages/circuits/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.

</details>

<details>
<summary>
ItemAtIndex: Selects an item at a given index from the input array.
</summary>

- **[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.

</details>

<details>
<summary>
CalculateTotal: Calculates the sum of an array.
</summary>

- **[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.

</details>

<details>
<summary>
SelectSubArray: Selects a subarray from an array given a `startIndex` and `length`.
</summary>

- **[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.

</details>

<details>
<summary>
VarShiftLeft: Shifts input array by `shift` indices to the left.
</summary>

- **[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.

</details>


Expand Down
2 changes: 1 addition & 1 deletion packages/helpers/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down

0 comments on commit 5d183a0

Please sign in to comment.