Skip to content
This repository has been archived by the owner on Jun 14, 2024. It is now read-only.

72/WAKU-RLN-KEYSTORE: add new RFC #631

Closed
wants to merge 68 commits into from
Closed
Changes from 7 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
05774a2
Create pushNotification.md
jimstir Oct 9, 2023
8482057
Update pushNotification.md
jimstir Oct 9, 2023
789da9f
Update pushNotification.md
jimstir Oct 9, 2023
7d6e110
Update pushNotification.md
jimstir Oct 9, 2023
d480749
Update pushNotification.md
jimstir Oct 10, 2023
54d00f4
Update pushNotification.md
jimstir Oct 10, 2023
3f98728
Update and rename content/docs/rfcs/pushNotification.md to content/do…
jimstir Oct 31, 2023
56f529b
Update README.md
jimstir Nov 1, 2023
91bf1f9
Update README.md
jimstir Nov 1, 2023
e261d70
Update README.md
jimstir Nov 1, 2023
a59cbc0
Update README.md
jimstir Nov 1, 2023
ff67c9c
Update content/docs/rfcs/71/README.md
jimstir Nov 1, 2023
5bc2998
Update content/docs/rfcs/71/README.md
jimstir Nov 1, 2023
d9369aa
Update content/docs/rfcs/71/README.md
jimstir Nov 1, 2023
0f6b38d
Update content/docs/rfcs/71/README.md
jimstir Nov 1, 2023
7651f85
Update content/docs/rfcs/71/README.md
jimstir Nov 1, 2023
5ee2f79
Update content/docs/rfcs/71/README.md
jimstir Nov 1, 2023
07d8d3c
Update README.md
jimstir Nov 1, 2023
f2537fd
Add Status spec link
jimstir Nov 1, 2023
7ca9747
Removed mailserver, added some references
jimstir Nov 7, 2023
0ea85b8
Update README.md
jimstir Nov 7, 2023
21c606a
Create waku-keystore.md
jimstir Nov 10, 2023
2b5003f
Update waku-keystore.md
jimstir Nov 10, 2023
a4ce749
Update and rename
jimstir Nov 10, 2023
5838105
Delete content/docs/rfcs/71 directory
jimstir Nov 10, 2023
3780b73
Update README.md
jimstir Nov 10, 2023
44fdac5
Update README.md
jimstir Nov 17, 2023
1c2cb23
Update README.md
jimstir Nov 17, 2023
7d92cf1
Update README.md
jimstir Nov 17, 2023
34dffbd
Update README.md
jimstir Nov 17, 2023
20dc741
Update README.md
jimstir Nov 17, 2023
7bb67dc
Update README.md
jimstir Nov 17, 2023
ebabff9
Update README.md
jimstir Nov 17, 2023
ec4f919
Update README.md
jimstir Nov 17, 2023
9dd5b8e
Update README.md
jimstir Nov 18, 2023
f3131fe
Update README.md
jimstir Nov 18, 2023
ab283d8
Update README.md
jimstir Nov 18, 2023
afe76c5
Update README.md
jimstir Nov 18, 2023
c07ed83
Update README.md
jimstir Nov 18, 2023
d6a28e4
Update README.md
jimstir Nov 18, 2023
85482b6
Update README.md
jimstir Nov 19, 2023
20b1d74
Update README.md
jimstir Nov 23, 2023
cb1b36a
Update README.md
jimstir Nov 23, 2023
486f29b
Update README.md
jimstir Nov 23, 2023
6d4c4e2
Update index.md
jimstir Nov 23, 2023
69e7e4f
Update README.md
jimstir Nov 26, 2023
107e597
Update README.md
jimstir Dec 8, 2023
0d9031f
Merge branch 'master' into jimstir-waku-keystore-1
jimstir Dec 19, 2023
db2f25c
Update README.md
jimstir Dec 20, 2023
77ea5e4
Update README.md
jimstir Dec 20, 2023
e52467e
Update README.md
jimstir Dec 21, 2023
203db41
Update README.md
jimstir Dec 21, 2023
d2c59d1
Update README.md
jimstir Dec 21, 2023
b47509e
Update README.md
jimstir Dec 30, 2023
fc6e517
Update README.md
jimstir Dec 31, 2023
570fd0d
Update README.md
jimstir Jan 8, 2024
b55d7dd
Update README.md
jimstir Jan 9, 2024
521967f
Update README.md
jimstir Jan 9, 2024
c130e26
Update README.md
jimstir Jan 9, 2024
956289f
Update README.md
jimstir Jan 12, 2024
e4aba48
Update README.md
jimstir Jan 12, 2024
8af8f71
Update README.md
jimstir Jan 12, 2024
6636245
Update README.md
jimstir Jan 13, 2024
056d87b
Update README.md
jimstir Jan 17, 2024
67cc9dd
Update README.md
jimstir Jan 17, 2024
12bc8d3
Update README.md
jimstir Jan 21, 2024
905260f
Update README.md
jimstir Jan 22, 2024
dc64cc5
Update README.md
jimstir Feb 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 33 additions & 31 deletions content/docs/rfcs/72/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,37 +86,39 @@ There COULD be multiple credentials stored in a keystore, categorized by the `me
Each contruct MUST include the keypair:
> key: [`membershipHash`]: pair: [`WakuCredential`]

### membershipHash
### membershipHash

The `membershipHash` SHOULD be generated by user's participating in a membership group.
The `membershipHash` SHOULD be generated by user's participating in a membership group,
as decribed in [32/RLN-V1](/spec/32/).
Each user SHOULD register to the group with an `identity_commitment` stored in a Merkle tree.
A cryptographic hash function that SHOULD be used to generate the `membershipHash` is [SHA256](https://www.rfc-editor.org/rfc/rfc4634.txt).
A cryptographic hash function that SHOULD be used to generate the `membershipHash` is [SHA256](https://www.rfc-editor.org/rfc/rfc4634.txt),
other hash functions MAY be used.
jimstir marked this conversation as resolved.
Show resolved Hide resolved
The hash function that is used,
SHOULD be mentioned in the `verison` attribute.

To generate the `membershipHash`,
the `treeIndex`, `membershipContract`, `contractId` and `identityCredential` attributes SHOULD be used to create a hexadecimal string.
the `treeIndex`, `membershipContract`, `chainId` and `identityCredential` attributes SHOULD be used to create a hexadecimal string.
- it MUST NOT already exist in the keystore.

#### treeIndex
#### `treeIndex`

After a user registers to a group,
a `treeIndex` value of the position in the Merkle tree SHOULD be returned.
- it MUST be a Merkle tree data structure filled with `identity_commitment` from user registrations.
- it MUST be a hexadecimal string

#### membershipContract
#### `membershipContract`

For decentralized membership registrations,
the `membershipContract` SHOULD be derived from a public blockchain using smart contracts.
- it MUST be a hash of a `contractAddress`
- `contractAddess` MUST be a string.
the `membershipContract` SHOULD be a `contractAddress` from a public blockchain using smart contracts.
- it MUST be a string.

#### contractId
#### `chainId`

The `contractId` SHOULD be the blockchain identifier used for `membershipcontract`.
The `chainId` SHOULD be the blockchain identifier used for `membershipcontract`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `chainId` SHOULD be the blockchain identifier used for `membershipcontract`.
The `chainId` SHOULD be the blockchain identifier used for `membershipcontract`. It uniquely defines the chain upon which the registration has occurred.

- it MUST be a string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


#### identityCredential
#### `identityCredential`

The `identityCredential` MUST be derived after a succussful decryption of the keystore.

Expand All @@ -138,14 +140,17 @@ as a private input for zero-knowledge proof generation.
- This secret hash SHOULD be kept private by the user.

##### `identity_commitment`
- it MUST be created with `identity_secret_hash` by using hashing function as described in [Poseidon Paper](https://eprint.iacr.org/2019/458.pdf).
- it SHOULD be created with `identity_secret_hash` by using the hash function Poseidon,
as described in [Poseidon Paper](https://eprint.iacr.org/2019/458.pdf).
- it MUST be used by a user for group registering.

### `WakuCredential`
### WakuCredential

The `WakuCredential` will store values used for encrytion and decrypting user's credentials.
The `WakuCredential` will store values used for encryting and decrypting user's keystores.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The `WakuCredential` will store values used for encryting and decrypting user's keystores.
The `WakuCredential` will store values used for encrypting and decrypting user's keystores.

- it MUST be used for password verification.
- it MUST follow [EIP-2335](https://eips.ethereum.org/EIPS/eip-2335)
- it MUST follow [EIP-2335](https://eips.ethereum.org/EIPS/eip-2335)
- it MAY use [SHA256](https://www.rfc-editor.org/rfc/rfc4634.txt) as the hash function
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- it MAY use [SHA256](https://www.rfc-editor.org/rfc/rfc4634.txt) as the hash function
- it SHOULD use [SHA256](https://www.rfc-editor.org/rfc/rfc4634.txt) as the hash function to derive the `membershipHash`



### KDF

Expand All @@ -161,7 +166,7 @@ A `WakuCredential` object MUST include:
| secret | key to be encrypted |
| pubKey | public key |
| path | HD, hardened derivation, path used to generate the secret |
| checksum | hashing function |
| checksum | hash function |
| cipher | cipher function |

```js
Expand All @@ -187,29 +192,27 @@ crypto: {
```

### Decryption
The keystore SHOULD decrypt a user's credentials using a password and
a Merkle proof, the `membershipHASh`, using PBKDF2 that returns the `decryptionKey` key.
The keystore SHOULD decrypt a user's credentials using a password and the `membershipHash`,
using PBKDF2 that returns the `decryptionKey` key.
The decryption key is used to verify the keystore is correct.
- To generate the `decryptionKey`, it MUST be constructed from a password and KDF,
as desrcibed in [ERC-2335: BLS12-381 Keystore](https://eips.ethereum.org/EIPS/eip-2335).
- The `decryptionKey`, is derived from the cipher function and
cipher parameters described in the KDF used in the keystore.

## Test Vectors
### Input:
Hashing function used: Poseidon Hash, as described in [Poseidon Paper](https://eprint.iacr.org/2019/458.pdf)

`application`: "waku-rln-relay"

`appIdentifier`: "01234567890abcdef"

`version`: "0.2"

`hashFunction`: "poseidonHash"

`password`: "sup3rsecure"
RLN uses Poseidon hash algorithm to generate the `identityCredential`,
as described in [Poseidon Paper](https://eprint.iacr.org/2019/458.pdf).
The keystore hash algorithm used is [SHA256](https://www.rfc-editor.org/rfc/rfc4634.txt).

### Input:

- `application`: "waku-rln-relay"
- `appIdentifier`: "01234567890abcdef"
- `version`: "0.2"
- `hashFunction`: "poseidonHash"
- `password`: "sup3rsecure"

```js

Expand Down Expand Up @@ -269,7 +272,6 @@ version: "0.2",
},
}


```

# Security Considerations
Expand Down