Interface iChallengeDetails<T>

Codes
1. Generate N codes privately
2. Hash each code
3. Store the hashed codes publicly on IPFS via this struct
4. When a user enters a code, we hash it and check if it matches any of the hashed codes. This way, the codes are never stored publicly on IPFS and only known by the generator of the codes.
Whitelist
For storing a public whitelist of addresses (with useCreatorAddressAsLeaf = true), hashing complicates everything because the whitelist can be stored publicly.
1. Generate N whitelist addresses
2. Store the addresses publicly on IPFS via this struct
3. When a user enters an address, we check if it matches any of the addresses.
interface iChallengeDetails<T> {
    currCode?: T;
    isHashed: boolean;
    leaves: string[];
    numLeaves?: T;
    preimages?: string[];
    seedCode?: string;
    tree?: MerkleTree;
    treeOptions?: Options;
}

Type Parameters

Implemented by

Properties

currCode?: T

The current code being used for the challenge. Used behind the scenes

isHashed: boolean

True if the leaves are hashed. Hash(preimage[i]) = leaves[i]

leaves: string[]

The leaves of the Merkle tree. Leaves should be considered public. Use preimages for the private codes + isHashed. For whitelist trees, these can be the plaintext BitBadges addresses.

numLeaves?: T

The number of leaves in the Merkle tree. This takes priority over leaves.length if defined (used for buffer time between leaf generation and leaf length select)

preimages?: string[]

The preimages of the leaves (only used if isHashed = true). Oftentimes, this is used for private codes so should not be present when user-facing.

seedCode?: string

Seed code for generating the leaves

tree?: MerkleTree

The Merkle tree

treeOptions?: Options

The Merkle tree options for how to build it