@rolly-dev/wasm-signer 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -7
- package/dist/node/README.md +7 -7
- package/dist/web/README.md +7 -7
- package/js/browser.d.mts +13 -0
- package/js/index.d.ts +11 -0
- package/js/react.d.mts +15 -0
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @rolly/wasm-signer
|
|
1
|
+
# @rolly-dev/wasm-signer
|
|
2
2
|
|
|
3
3
|
Client-side Poseidon2 hashing and bet authentication for the Rolly ZK-Rollup casino.
|
|
4
4
|
|
|
@@ -24,7 +24,7 @@ const {
|
|
|
24
24
|
derive_session_key,
|
|
25
25
|
session_public_key,
|
|
26
26
|
create_bet_auth,
|
|
27
|
-
} = require('@rolly/wasm-signer');
|
|
27
|
+
} = require('@rolly-dev/wasm-signer');
|
|
28
28
|
|
|
29
29
|
const hash = poseidon2_hash(BigUint64Array.from([1n, 2n, 3n]));
|
|
30
30
|
// → BigUint64Array(4)
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
poseidon2_hash,
|
|
38
38
|
derive_session_key,
|
|
39
39
|
create_bet_auth,
|
|
40
|
-
} from '@rolly/wasm-signer';
|
|
40
|
+
} from '@rolly-dev/wasm-signer';
|
|
41
41
|
|
|
42
42
|
const hash = poseidon2_hash(BigUint64Array.from([1n, 2n, 3n]));
|
|
43
43
|
```
|
|
@@ -45,7 +45,7 @@ const hash = poseidon2_hash(BigUint64Array.from([1n, 2n, 3n]));
|
|
|
45
45
|
### React
|
|
46
46
|
|
|
47
47
|
```jsx
|
|
48
|
-
import { useRollyWasm } from '@rolly/wasm-signer/react';
|
|
48
|
+
import { useRollyWasm } from '@rolly-dev/wasm-signer/react';
|
|
49
49
|
|
|
50
50
|
function BetButton({ sessionKey, amount, nonce }) {
|
|
51
51
|
const { ready, create_bet_auth } = useRollyWasm();
|
|
@@ -65,7 +65,7 @@ function BetButton({ sessionKey, amount, nonce }) {
|
|
|
65
65
|
|
|
66
66
|
```html
|
|
67
67
|
<script type="module">
|
|
68
|
-
import { init, poseidon2_hash } from '@rolly/wasm-signer';
|
|
68
|
+
import { init, poseidon2_hash } from '@rolly-dev/wasm-signer';
|
|
69
69
|
|
|
70
70
|
await init(); // loads .wasm, must be called once
|
|
71
71
|
const h = poseidon2_hash(BigUint64Array.from([1n, 2n]));
|
|
@@ -75,7 +75,7 @@ function BetButton({ sessionKey, amount, nonce }) {
|
|
|
75
75
|
### Manual init (advanced)
|
|
76
76
|
|
|
77
77
|
```javascript
|
|
78
|
-
import init, { poseidon2_hash } from '@rolly/wasm-signer/init';
|
|
78
|
+
import init, { poseidon2_hash } from '@rolly-dev/wasm-signer/init';
|
|
79
79
|
|
|
80
80
|
// custom wasm URL or ArrayBuffer
|
|
81
81
|
await init('/assets/rolly_wasm_signer_bg.wasm');
|
|
@@ -100,7 +100,7 @@ poseidon2_hash(BigUint64Array.from([1n]));
|
|
|
100
100
|
|
|
101
101
|
**Vite** — add to `optimizeDeps.exclude`:
|
|
102
102
|
```js
|
|
103
|
-
optimizeDeps: { exclude: ['@rolly/wasm-signer'] }
|
|
103
|
+
optimizeDeps: { exclude: ['@rolly-dev/wasm-signer'] }
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
**Webpack 5** — enable WASM experiments:
|
package/dist/node/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @rolly/wasm-signer
|
|
1
|
+
# @rolly-dev/wasm-signer
|
|
2
2
|
|
|
3
3
|
Client-side Poseidon2 hashing and bet authentication for the Rolly ZK-Rollup casino.
|
|
4
4
|
|
|
@@ -24,7 +24,7 @@ const {
|
|
|
24
24
|
derive_session_key,
|
|
25
25
|
session_public_key,
|
|
26
26
|
create_bet_auth,
|
|
27
|
-
} = require('@rolly/wasm-signer');
|
|
27
|
+
} = require('@rolly-dev/wasm-signer');
|
|
28
28
|
|
|
29
29
|
const hash = poseidon2_hash(BigUint64Array.from([1n, 2n, 3n]));
|
|
30
30
|
// → BigUint64Array(4)
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
poseidon2_hash,
|
|
38
38
|
derive_session_key,
|
|
39
39
|
create_bet_auth,
|
|
40
|
-
} from '@rolly/wasm-signer';
|
|
40
|
+
} from '@rolly-dev/wasm-signer';
|
|
41
41
|
|
|
42
42
|
const hash = poseidon2_hash(BigUint64Array.from([1n, 2n, 3n]));
|
|
43
43
|
```
|
|
@@ -45,7 +45,7 @@ const hash = poseidon2_hash(BigUint64Array.from([1n, 2n, 3n]));
|
|
|
45
45
|
### React
|
|
46
46
|
|
|
47
47
|
```jsx
|
|
48
|
-
import { useRollyWasm } from '@rolly/wasm-signer/react';
|
|
48
|
+
import { useRollyWasm } from '@rolly-dev/wasm-signer/react';
|
|
49
49
|
|
|
50
50
|
function BetButton({ sessionKey, amount, nonce }) {
|
|
51
51
|
const { ready, create_bet_auth } = useRollyWasm();
|
|
@@ -65,7 +65,7 @@ function BetButton({ sessionKey, amount, nonce }) {
|
|
|
65
65
|
|
|
66
66
|
```html
|
|
67
67
|
<script type="module">
|
|
68
|
-
import { init, poseidon2_hash } from '@rolly/wasm-signer';
|
|
68
|
+
import { init, poseidon2_hash } from '@rolly-dev/wasm-signer';
|
|
69
69
|
|
|
70
70
|
await init(); // loads .wasm, must be called once
|
|
71
71
|
const h = poseidon2_hash(BigUint64Array.from([1n, 2n]));
|
|
@@ -75,7 +75,7 @@ function BetButton({ sessionKey, amount, nonce }) {
|
|
|
75
75
|
### Manual init (advanced)
|
|
76
76
|
|
|
77
77
|
```javascript
|
|
78
|
-
import init, { poseidon2_hash } from '@rolly/wasm-signer/init';
|
|
78
|
+
import init, { poseidon2_hash } from '@rolly-dev/wasm-signer/init';
|
|
79
79
|
|
|
80
80
|
// custom wasm URL or ArrayBuffer
|
|
81
81
|
await init('/assets/rolly_wasm_signer_bg.wasm');
|
|
@@ -100,7 +100,7 @@ poseidon2_hash(BigUint64Array.from([1n]));
|
|
|
100
100
|
|
|
101
101
|
**Vite** — add to `optimizeDeps.exclude`:
|
|
102
102
|
```js
|
|
103
|
-
optimizeDeps: { exclude: ['@rolly/wasm-signer'] }
|
|
103
|
+
optimizeDeps: { exclude: ['@rolly-dev/wasm-signer'] }
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
**Webpack 5** — enable WASM experiments:
|
package/dist/web/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @rolly/wasm-signer
|
|
1
|
+
# @rolly-dev/wasm-signer
|
|
2
2
|
|
|
3
3
|
Client-side Poseidon2 hashing and bet authentication for the Rolly ZK-Rollup casino.
|
|
4
4
|
|
|
@@ -24,7 +24,7 @@ const {
|
|
|
24
24
|
derive_session_key,
|
|
25
25
|
session_public_key,
|
|
26
26
|
create_bet_auth,
|
|
27
|
-
} = require('@rolly/wasm-signer');
|
|
27
|
+
} = require('@rolly-dev/wasm-signer');
|
|
28
28
|
|
|
29
29
|
const hash = poseidon2_hash(BigUint64Array.from([1n, 2n, 3n]));
|
|
30
30
|
// → BigUint64Array(4)
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
poseidon2_hash,
|
|
38
38
|
derive_session_key,
|
|
39
39
|
create_bet_auth,
|
|
40
|
-
} from '@rolly/wasm-signer';
|
|
40
|
+
} from '@rolly-dev/wasm-signer';
|
|
41
41
|
|
|
42
42
|
const hash = poseidon2_hash(BigUint64Array.from([1n, 2n, 3n]));
|
|
43
43
|
```
|
|
@@ -45,7 +45,7 @@ const hash = poseidon2_hash(BigUint64Array.from([1n, 2n, 3n]));
|
|
|
45
45
|
### React
|
|
46
46
|
|
|
47
47
|
```jsx
|
|
48
|
-
import { useRollyWasm } from '@rolly/wasm-signer/react';
|
|
48
|
+
import { useRollyWasm } from '@rolly-dev/wasm-signer/react';
|
|
49
49
|
|
|
50
50
|
function BetButton({ sessionKey, amount, nonce }) {
|
|
51
51
|
const { ready, create_bet_auth } = useRollyWasm();
|
|
@@ -65,7 +65,7 @@ function BetButton({ sessionKey, amount, nonce }) {
|
|
|
65
65
|
|
|
66
66
|
```html
|
|
67
67
|
<script type="module">
|
|
68
|
-
import { init, poseidon2_hash } from '@rolly/wasm-signer';
|
|
68
|
+
import { init, poseidon2_hash } from '@rolly-dev/wasm-signer';
|
|
69
69
|
|
|
70
70
|
await init(); // loads .wasm, must be called once
|
|
71
71
|
const h = poseidon2_hash(BigUint64Array.from([1n, 2n]));
|
|
@@ -75,7 +75,7 @@ function BetButton({ sessionKey, amount, nonce }) {
|
|
|
75
75
|
### Manual init (advanced)
|
|
76
76
|
|
|
77
77
|
```javascript
|
|
78
|
-
import init, { poseidon2_hash } from '@rolly/wasm-signer/init';
|
|
78
|
+
import init, { poseidon2_hash } from '@rolly-dev/wasm-signer/init';
|
|
79
79
|
|
|
80
80
|
// custom wasm URL or ArrayBuffer
|
|
81
81
|
await init('/assets/rolly_wasm_signer_bg.wasm');
|
|
@@ -100,7 +100,7 @@ poseidon2_hash(BigUint64Array.from([1n]));
|
|
|
100
100
|
|
|
101
101
|
**Vite** — add to `optimizeDeps.exclude`:
|
|
102
102
|
```js
|
|
103
|
-
optimizeDeps: { exclude: ['@rolly/wasm-signer'] }
|
|
103
|
+
optimizeDeps: { exclude: ['@rolly-dev/wasm-signer'] }
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
**Webpack 5** — enable WASM experiments:
|
package/js/browser.d.mts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export {
|
|
2
|
+
poseidon2_hash,
|
|
3
|
+
poseidon2_two_to_one,
|
|
4
|
+
derive_session_key,
|
|
5
|
+
session_public_key,
|
|
6
|
+
create_bet_auth,
|
|
7
|
+
compute_server_seed_hash,
|
|
8
|
+
seed_hash_truncated,
|
|
9
|
+
goldilocks_modulus,
|
|
10
|
+
goldilocks_reduce,
|
|
11
|
+
} from '../dist/web/rolly_wasm_signer.js';
|
|
12
|
+
|
|
13
|
+
export { default as init } from '../dist/web/rolly_wasm_signer.js';
|
package/js/index.d.ts
ADDED
package/js/react.d.mts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export interface RollyWasmResult {
|
|
2
|
+
ready: boolean;
|
|
3
|
+
error: Error | null;
|
|
4
|
+
poseidon2_hash: ((input: BigUint64Array) => BigUint64Array) | null;
|
|
5
|
+
poseidon2_two_to_one: ((left: BigUint64Array, right: BigUint64Array) => BigUint64Array) | null;
|
|
6
|
+
derive_session_key: ((sig_bytes: Uint8Array) => BigUint64Array) | null;
|
|
7
|
+
session_public_key: ((session_key: BigUint64Array) => BigUint64Array) | null;
|
|
8
|
+
create_bet_auth: ((session_key: BigUint64Array, bet_amount: bigint, nonce: bigint) => BigUint64Array) | null;
|
|
9
|
+
compute_server_seed_hash: ((server_seed: BigUint64Array) => BigUint64Array) | null;
|
|
10
|
+
seed_hash_truncated: ((server_seed: BigUint64Array) => BigUint64Array) | null;
|
|
11
|
+
goldilocks_modulus: (() => bigint) | null;
|
|
12
|
+
goldilocks_reduce: ((value: bigint) => bigint) | null;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function useRollyWasm(): RollyWasmResult;
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolly-dev/wasm-signer",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Poseidon2 hashing & bet signing for Rolly ZK-Rollup (WASM, Goldilocks field)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
7
7
|
".": {
|
|
8
|
+
"types": "./js/index.d.ts",
|
|
8
9
|
"node": {
|
|
9
10
|
"require": "./js/node.cjs",
|
|
10
11
|
"import": "./js/node.mjs"
|
|
@@ -13,15 +14,17 @@
|
|
|
13
14
|
"default": "./js/browser.mjs"
|
|
14
15
|
},
|
|
15
16
|
"./react": {
|
|
17
|
+
"types": "./js/react.d.mts",
|
|
16
18
|
"default": "./js/react.mjs"
|
|
17
19
|
},
|
|
18
20
|
"./init": {
|
|
21
|
+
"types": "./dist/web/rolly_wasm_signer.d.ts",
|
|
19
22
|
"default": "./dist/web/rolly_wasm_signer.js"
|
|
20
23
|
}
|
|
21
24
|
},
|
|
22
25
|
"main": "./js/node.cjs",
|
|
23
26
|
"module": "./js/browser.mjs",
|
|
24
|
-
"types": "./
|
|
27
|
+
"types": "./js/index.d.ts",
|
|
25
28
|
"files": [
|
|
26
29
|
"dist/",
|
|
27
30
|
"js/"
|