@nuggetslife/vc 0.0.4 → 0.0.6
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/package.json +2 -2
- package/src/lib.rs +16 -16
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nuggetslife/vc",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
6
|
"napi": {
|
|
@@ -38,6 +38,6 @@
|
|
|
38
38
|
},
|
|
39
39
|
"packageManager": "yarn@4.3.1",
|
|
40
40
|
"optionalDependencies": {
|
|
41
|
-
"@nuggetslife/vc-darwin-arm64": "0.0.
|
|
41
|
+
"@nuggetslife/vc-darwin-arm64": "0.0.6"
|
|
42
42
|
}
|
|
43
43
|
}
|
package/src/lib.rs
CHANGED
|
@@ -42,26 +42,26 @@ impl Bls12381G2KeyPair {
|
|
|
42
42
|
// which means the base58 encoded publicKey can be either 65 or 66 chars
|
|
43
43
|
// 5.85 = log base 2 (58) which is equivalent to the number of bits
|
|
44
44
|
// encoded per character of a base58 encoded string.
|
|
45
|
-
if let Some(ref pubkey_bs58) = o.public_key_base58 {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
};
|
|
45
|
+
// if let Some(ref pubkey_bs58) = o.public_key_base58 {
|
|
46
|
+
// if pubkey_bs58.len() != 131 && pubkey_bs58.len() != 132 {
|
|
47
|
+
// panic!(
|
|
48
|
+
// "public_key_base58 invalid length. expected 131 or 132. got {}",
|
|
49
|
+
// pubkey_bs58.len()
|
|
50
|
+
// )
|
|
51
|
+
// }
|
|
52
|
+
// };
|
|
53
53
|
|
|
54
54
|
// Validates the size of the private key if one is included
|
|
55
55
|
// This is done by 256 bits / 5.85 = 43.7 which means
|
|
56
56
|
// the base58 encoded privateKey can be either 43 or 44 chars
|
|
57
|
-
if let Some(ref privkey_bs58) = o.private_key_base58 {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
};
|
|
57
|
+
// if let Some(ref privkey_bs58) = o.private_key_base58 {
|
|
58
|
+
// if privkey_bs58.len() != 43 && privkey_bs58.len() != 44 {
|
|
59
|
+
// panic!(
|
|
60
|
+
// "private_key_base58 invalid length. expected 43 or 44. got {}",
|
|
61
|
+
// privkey_bs58.len()
|
|
62
|
+
// )
|
|
63
|
+
// }
|
|
64
|
+
// };
|
|
65
65
|
|
|
66
66
|
let private_key_buffer = o
|
|
67
67
|
.private_key_base58
|