@meer-js/crypto
Advanced tools
Comparing version 6.6.21 to 6.6.24
@@ -8,46 +8,12 @@ import { KeyPairBase } from './key_pair_base.js'; | ||
export declare class KeyPairEd25519 extends KeyPairBase { | ||
readonly publicKey: PublicKey; | ||
readonly secretKey: string; | ||
readonly extendedSecretKey: string; | ||
/** | ||
* Construct an instance of key pair given a secret key. | ||
* It's generally assumed that these are encoded in base58. | ||
* @param extendedSecretKey | ||
*/ | ||
readonly publicKey: PublicKey; | ||
constructor(extendedSecretKey: string); | ||
/** | ||
* Generate a new random keypair. | ||
* @example | ||
* const keyRandom = KeyPair.fromRandom(); | ||
* keyRandom.publicKey | ||
* // returns [PUBLIC_KEY] | ||
* | ||
* keyRandom.secretKey | ||
* // returns [SECRET_KEY] | ||
*/ | ||
static fromRandom(): KeyPairEd25519; | ||
/** | ||
* Signs a message using the key pair's secret key. | ||
* @param message The message to be signed. | ||
* @returns {Signature} The signature object containing the signature and the public key. | ||
*/ | ||
sign(message: Uint8Array): ISignatureCrypto; | ||
/** | ||
* Verifies the signature of a message using the key pair's public key. | ||
* @param message The message to be verified. | ||
* @param signature The signature to be verified. | ||
* @returns {boolean} `true` if the signature is valid, otherwise `false`. | ||
*/ | ||
verify(message: Uint8Array, signature: Uint8Array): boolean; | ||
/** | ||
* Returns a string representation of the key pair in the format 'ed25519:[extendedSecretKey]'. | ||
* @returns {string} The string representation of the key pair. | ||
*/ | ||
toString(): KeyPairString; | ||
/** | ||
* Retrieves the public key associated with the key pair. | ||
* @returns {PublicKey} The public key. | ||
*/ | ||
getPublicKey(): PublicKey; | ||
} | ||
//# sourceMappingURL=key_pair_ed25519.d.ts.map |
@@ -17,10 +17,5 @@ "use strict"; | ||
class KeyPairEd25519 extends key_pair_base_js_1.KeyPairBase { | ||
publicKey; | ||
secretKey; | ||
extendedSecretKey; | ||
/** | ||
* Construct an instance of key pair given a secret key. | ||
* It's generally assumed that these are encoded in base58. | ||
* @param extendedSecretKey | ||
*/ | ||
publicKey; | ||
constructor(extendedSecretKey) { | ||
@@ -35,12 +30,3 @@ super(); | ||
} | ||
/** | ||
* Generate a new random keypair. | ||
* @example | ||
* const keyRandom = KeyPair.fromRandom(); | ||
* keyRandom.publicKey | ||
* // returns [PUBLIC_KEY] | ||
* | ||
* keyRandom.secretKey | ||
* // returns [SECRET_KEY] | ||
*/ | ||
// Static factory method should remain public | ||
static fromRandom() { | ||
@@ -52,7 +38,3 @@ const secretKey = (0, randombytes_1.default)(constants_js_1.KeySize.SECRET_KEY); | ||
} | ||
/** | ||
* Signs a message using the key pair's secret key. | ||
* @param message The message to be signed. | ||
* @returns {Signature} The signature object containing the signature and the public key. | ||
*/ | ||
// These methods should be public as they're core functionality | ||
sign(message) { | ||
@@ -62,8 +44,2 @@ const signature = ed25519_1.ed25519.sign(message, (0, utils_1.baseDecode)(this.secretKey)); | ||
} | ||
/** | ||
* Verifies the signature of a message using the key pair's public key. | ||
* @param message The message to be verified. | ||
* @param signature The signature to be verified. | ||
* @returns {boolean} `true` if the signature is valid, otherwise `false`. | ||
*/ | ||
verify(message, signature) { | ||
@@ -73,17 +49,8 @@ if (this.publicKey?.verify) { | ||
} | ||
else { | ||
throw new Error("Public key or verify method is not defined."); | ||
} | ||
throw new Error("Public key or verify method is not defined."); | ||
} | ||
/** | ||
* Returns a string representation of the key pair in the format 'ed25519:[extendedSecretKey]'. | ||
* @returns {string} The string representation of the key pair. | ||
*/ | ||
// These should be public as they're part of the interface | ||
toString() { | ||
return `ed25519:${this.extendedSecretKey}`; | ||
} | ||
/** | ||
* Retrieves the public key associated with the key pair. | ||
* @returns {PublicKey} The public key. | ||
*/ | ||
getPublicKey() { | ||
@@ -90,0 +57,0 @@ return this.publicKey; |
@@ -8,46 +8,12 @@ import { KeyPairBase } from './key_pair_base.js'; | ||
export declare class KeyPairEd25519 extends KeyPairBase { | ||
readonly publicKey: PublicKey; | ||
readonly secretKey: string; | ||
readonly extendedSecretKey: string; | ||
/** | ||
* Construct an instance of key pair given a secret key. | ||
* It's generally assumed that these are encoded in base58. | ||
* @param extendedSecretKey | ||
*/ | ||
readonly publicKey: PublicKey; | ||
constructor(extendedSecretKey: string); | ||
/** | ||
* Generate a new random keypair. | ||
* @example | ||
* const keyRandom = KeyPair.fromRandom(); | ||
* keyRandom.publicKey | ||
* // returns [PUBLIC_KEY] | ||
* | ||
* keyRandom.secretKey | ||
* // returns [SECRET_KEY] | ||
*/ | ||
static fromRandom(): KeyPairEd25519; | ||
/** | ||
* Signs a message using the key pair's secret key. | ||
* @param message The message to be signed. | ||
* @returns {Signature} The signature object containing the signature and the public key. | ||
*/ | ||
sign(message: Uint8Array): ISignatureCrypto; | ||
/** | ||
* Verifies the signature of a message using the key pair's public key. | ||
* @param message The message to be verified. | ||
* @param signature The signature to be verified. | ||
* @returns {boolean} `true` if the signature is valid, otherwise `false`. | ||
*/ | ||
verify(message: Uint8Array, signature: Uint8Array): boolean; | ||
/** | ||
* Returns a string representation of the key pair in the format 'ed25519:[extendedSecretKey]'. | ||
* @returns {string} The string representation of the key pair. | ||
*/ | ||
toString(): KeyPairString; | ||
/** | ||
* Retrieves the public key associated with the key pair. | ||
* @returns {PublicKey} The public key. | ||
*/ | ||
getPublicKey(): PublicKey; | ||
} | ||
//# sourceMappingURL=key_pair_ed25519.d.ts.map |
@@ -11,10 +11,5 @@ import { baseEncode, baseDecode } from '@meer-js/utils'; | ||
export class KeyPairEd25519 extends KeyPairBase { | ||
publicKey; | ||
secretKey; | ||
extendedSecretKey; | ||
/** | ||
* Construct an instance of key pair given a secret key. | ||
* It's generally assumed that these are encoded in base58. | ||
* @param extendedSecretKey | ||
*/ | ||
publicKey; | ||
constructor(extendedSecretKey) { | ||
@@ -29,12 +24,3 @@ super(); | ||
} | ||
/** | ||
* Generate a new random keypair. | ||
* @example | ||
* const keyRandom = KeyPair.fromRandom(); | ||
* keyRandom.publicKey | ||
* // returns [PUBLIC_KEY] | ||
* | ||
* keyRandom.secretKey | ||
* // returns [SECRET_KEY] | ||
*/ | ||
// Static factory method should remain public | ||
static fromRandom() { | ||
@@ -46,7 +32,3 @@ const secretKey = randombytes(KeySize.SECRET_KEY); | ||
} | ||
/** | ||
* Signs a message using the key pair's secret key. | ||
* @param message The message to be signed. | ||
* @returns {Signature} The signature object containing the signature and the public key. | ||
*/ | ||
// These methods should be public as they're core functionality | ||
sign(message) { | ||
@@ -56,8 +38,2 @@ const signature = ed25519.sign(message, baseDecode(this.secretKey)); | ||
} | ||
/** | ||
* Verifies the signature of a message using the key pair's public key. | ||
* @param message The message to be verified. | ||
* @param signature The signature to be verified. | ||
* @returns {boolean} `true` if the signature is valid, otherwise `false`. | ||
*/ | ||
verify(message, signature) { | ||
@@ -67,17 +43,8 @@ if (this.publicKey?.verify) { | ||
} | ||
else { | ||
throw new Error("Public key or verify method is not defined."); | ||
} | ||
throw new Error("Public key or verify method is not defined."); | ||
} | ||
/** | ||
* Returns a string representation of the key pair in the format 'ed25519:[extendedSecretKey]'. | ||
* @returns {string} The string representation of the key pair. | ||
*/ | ||
// These should be public as they're part of the interface | ||
toString() { | ||
return `ed25519:${this.extendedSecretKey}`; | ||
} | ||
/** | ||
* Retrieves the public key associated with the key pair. | ||
* @returns {PublicKey} The public key. | ||
*/ | ||
getPublicKey() { | ||
@@ -84,0 +51,0 @@ return this.publicKey; |
{ | ||
"name": "@meer-js/crypto", | ||
"version": "6.6.21", | ||
"version": "6.6.24", | ||
"description": "Abstractions around NEAR-compatible elliptical curves and cryptographic keys", | ||
@@ -22,3 +22,3 @@ "types": "./dist/esm/crypto/src/index.d.ts", | ||
"dependencies": { | ||
"@meer-js/utils": "6.6.21", | ||
"@meer-js/utils": "6.6.24", | ||
"@noble/curves": "*", | ||
@@ -33,3 +33,3 @@ "@noble/hashes": "*", | ||
"@jest/globals": "^29.7.0", | ||
"@meer-js/types": "6.6.21", | ||
"@meer-js/types": "6.6.24", | ||
"@types/node": "*", | ||
@@ -36,0 +36,0 @@ "jest": "29.7.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
Possible typosquat attack
Supply chain riskThere is a package with a similar name that is downloaded much more often.
Did you mean |
---|
@near-js/crypto |
0
304288
7237
1
+ Added@meer-js/utils@6.6.24(transitive)
- Removed@meer-js/utils@6.6.21(transitive)
Updated@meer-js/utils@6.6.24