@@ -21,14 +21,14 @@ export class KeyPair {
2121 /**
2222 * Creates a key pair from a private key string.
2323 * @param {string } privateKeyString A hex encoded private key string.
24- * @param {SignSchema } signSchema The Sign Schema (NIS / Catapult )
24+ * @param {SignSchema } signSchema The Sign Schema. (KECCAK_REVERSED_KEY / SHA3 )
2525 * @returns {module:crypto/keyPair~KeyPair } The key pair.
2626 */
27- public static createKeyPairFromPrivateKeyString = ( privateKeyString , signSchema = SignSchema . Catapult ) => {
27+ public static createKeyPairFromPrivateKeyString = ( privateKeyString , signSchema = SignSchema . SHA3 ) => {
2828 const privateKey = convert . hexToUint8 ( privateKeyString ) ;
2929
30- // NIS use reversed private key.
31- const secretKey = signSchema === SignSchema . Catapult ? privateKey : convert . hexToUint8Reverse ( privateKeyString ) ;
30+ // KECCAK_REVERSED_KEY uses reversed private key.
31+ const secretKey = signSchema === SignSchema . SHA3 ? privateKey : convert . hexToUint8Reverse ( privateKeyString ) ;
3232 if ( Utility . Key_Size !== privateKey . length ) {
3333 throw Error ( `private key has unexpected size: ${ privateKey . length } ` ) ;
3434 }
@@ -43,13 +43,13 @@ export class KeyPair {
4343 * Signs a data buffer with a key pair.
4444 * @param {module:crypto/keyPair~KeyPair } keyPair The key pair to use for signing.
4545 * @param {Uint8Array } data The data to sign.
46- * @param {SignSchema } signSchema The Sign Schema (NIS / Catapult )
46+ * @param {SignSchema } signSchema The Sign Schema. (KECCAK_REVERSED_KEY / SHA3 )
4747 * @returns {Uint8Array } The signature.
4848 */
49- public static sign = ( keyPair , data , signSchema = SignSchema . Catapult ) => {
49+ public static sign = ( keyPair , data , signSchema = SignSchema . SHA3 ) => {
5050 let secretKey = keyPair . privateKey ;
51- // NIS use reversed private key.
52- if ( signSchema === SignSchema . NIS ) {
51+ // KECCAK_REVERSED_KEY uses reversed private key.
52+ if ( signSchema === SignSchema . KECCAK_REVERSED_KEY ) {
5353 secretKey = convert . hexToUint8Reverse ( convert . uint8ToHex ( secretKey ) ) ;
5454 }
5555 return Utility . catapult_crypto . sign ( data , keyPair . publicKey , secretKey ,
@@ -61,10 +61,10 @@ export class KeyPair {
6161 * @param {module:crypto/keyPair~PublicKey } publicKey The public key to use for verification.
6262 * @param {Uint8Array } data The data to verify.
6363 * @param {Uint8Array } signature The signature to verify.
64- * @param {SignSchema } signSchema The Sign Schema (NIS / Catapult )
64+ * @param {SignSchema } signSchema The Sign Schema. (KECCAK_REVERSED_KEY / SHA3 )
6565 * @returns {boolean } true if the signature is verifiable, false otherwise.
6666 */
67- public static verify = ( publicKey , data , signature , signSchema = SignSchema . Catapult ) => {
67+ public static verify = ( publicKey , data , signature , signSchema = SignSchema . SHA3 ) => {
6868 return Utility . catapult_crypto . verify ( publicKey , data , signature , Utility . catapult_hash . createHasher ( 64 , signSchema ) ) ;
6969 }
7070
@@ -74,19 +74,19 @@ export class KeyPair {
7474 * @param {module:crypto/keyPair~KeyPair } keyPair The key pair for which to create the shared key.
7575 * @param {Uint8Array } publicKey The public key for which to create the shared key.
7676 * @param {Uint8Array } salt A salt that should be applied to the shared key.
77- * @param {SignSchema } signSchema The Sign Schema (NIS / Catapult )
77+ * @param {SignSchema } signSchema The Sign Schema. (KECCAK_REVERSED_KEY / SHA3 )
7878 * @returns {Uint8Array } The shared key.
7979 */
80- public static deriveSharedKey = ( keyPair , publicKey , salt , signSchema = SignSchema . Catapult ) => {
80+ public static deriveSharedKey = ( keyPair , publicKey , salt , signSchema = SignSchema . SHA3 ) => {
8181 if ( Utility . Key_Size !== salt . length ) {
8282 throw Error ( `salt has unexpected size: ${ salt . length } ` ) ;
8383 }
8484 if ( Utility . Key_Size !== publicKey . length ) {
8585 throw Error ( `public key has unexpected size: ${ salt . length } ` ) ;
8686 }
8787 let secretKey = keyPair . privateKey ;
88- // NIS use reversed private key.
89- if ( signSchema === SignSchema . NIS ) {
88+ // KECCAK_REVERSED_KEY uses reversed private key.
89+ if ( signSchema === SignSchema . KECCAK_REVERSED_KEY ) {
9090 secretKey = convert . hexToUint8Reverse ( convert . uint8ToHex ( secretKey ) ) ;
9191 }
9292 return Utility . catapult_crypto . deriveSharedKey ( salt , secretKey , publicKey , Utility . catapult_hash . func , signSchema ) ;
0 commit comments