Skip to content

Commit 9bb3d3e

Browse files
committed
WIP
Signed-off-by: lovesh <lovesh.bond@gmail.com>
0 parents  commit 9bb3d3e

23 files changed

+2683
-0
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
node_modules
2+
yarn.lock
3+
.idea

package.json

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"name": "@docknetwork/crypto-wasm-ts",
3+
"version": "0.1.0",
4+
"main": "src/index.ts",
5+
"license": "Apache-2.0",
6+
"private": false,
7+
"dependencies": {
8+
"@types/node": "^16.11.6",
9+
"typescript": "^4.4.4"
10+
},
11+
"devDependencies": {
12+
"ts-node": "^10.4.0"
13+
}
14+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/**
2+
* Interface for accumulator state. This should be implemented by the persistence layer that stores the accumulator
3+
* members. It is advised to update the state when elements are added or removed from the accumulator.
4+
*/
5+
export interface IAccumulatorState {
6+
add(element: Uint8Array): Promise<void>;
7+
remove(element: Uint8Array): Promise<void>;
8+
9+
/**
10+
* Check if element is a member of the state.
11+
* @param element
12+
*/
13+
has(element: Uint8Array): Promise<boolean>;
14+
}
15+
16+
/**
17+
* Additional interface for universal accumulator to expose a method that allows to iterate over the
18+
* accumulator members.
19+
*/
20+
export interface IUniversalAccumulatorState extends IAccumulatorState {
21+
elements(): Promise<Iterable<Uint8Array>>;
22+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
/**
2+
* Interface for persistence layer storing the elements of the universal accumulator created during initialization.
3+
* This persistence layer should not be modified once the accumulator is initialized. It is only read after initialization.
4+
*/
5+
export interface IInitialElementsStore {
6+
add(element: Uint8Array): Promise<void>;
7+
has(element: Uint8Array): Promise<boolean>;
8+
}

0 commit comments

Comments
 (0)