@ocap/mcrypto
Advanced tools
Comparing version 1.18.35 to 1.18.36
@@ -12,3 +12,3 @@ import { BytesType, KeyPairType, EncodingType } from '@ocap/util'; | ||
constructor(); | ||
isValidSK(sk: BytesType): boolean; | ||
isValidSK(sk: Uint8Array): boolean; | ||
/** | ||
@@ -15,0 +15,0 @@ * @public |
@@ -28,2 +28,5 @@ "use strict"; | ||
isValidSK(sk) { | ||
if (sk.byteLength !== 32) { | ||
return false; | ||
} | ||
const bn = new util_1.BN(sk); | ||
@@ -54,2 +57,5 @@ return bn.cmp(secp256k1.curve.n) < 0 && !bn.isZero(); | ||
getPublicKey(sk, encoding = 'hex') { | ||
if (!this.isValidSK((0, util_1.toUint8Array)(sk))) { | ||
throw new Error('Invalid secret key'); | ||
} | ||
let pk = secp256k1.keyFromPrivate((0, util_1.toBuffer)(sk)).getPublic(this.pkCompressed, 'hex'); | ||
@@ -56,0 +62,0 @@ if (this.pkHasFormatPrefix === false) { |
{ | ||
"name": "@ocap/mcrypto", | ||
"version": "1.18.35", | ||
"version": "1.18.36", | ||
"description": "Crypto lib that provides signer,crypter,hasher interface", | ||
@@ -59,3 +59,3 @@ "keywords": [ | ||
"dependencies": { | ||
"@ocap/util": "1.18.35", | ||
"@ocap/util": "1.18.36", | ||
"bn.js": "5.2.1", | ||
@@ -76,3 +76,3 @@ "crypto-js": "^4.1.1", | ||
}, | ||
"gitHead": "21178573bd44a1fb3a3a71f21bb8e81433322a69" | ||
"gitHead": "507eaab0fc94d92a88c49c2e3441c5f6b0e3788f" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41551
1091
+ Added@ocap/util@1.18.36(transitive)
- Removed@ocap/util@1.18.35(transitive)
Updated@ocap/util@1.18.36