OSDN Git Service

update the method for verify password
authorZhiting Lin <zlin035@uottawa.ca>
Thu, 3 Sep 2020 02:01:10 +0000 (10:01 +0800)
committerZhiting Lin <zlin035@uottawa.ca>
Thu, 3 Sep 2020 02:01:10 +0000 (10:01 +0800)
src/sdk/keys.js

index ed71fa2..576a722 100644 (file)
@@ -252,6 +252,21 @@ keysSDK.prototype.isValidMnemonic = function(mnemonic) {
 
 /**
  * Create a new key.
+ *
+ * @param {String} alias - User specified, unique identifier.
+ * @param {String} password - User specified, key password.
+ */
+keysSDK.prototype.verifyPassword = function(keystore, password) {
+    try{
+        decryptKey(keystore, password);
+    }catch (e){
+        return false;
+    }
+    return true;
+};
+
+/**
+ * Create a new key.
  * 
  * @param {String} alias - User specified, unique identifier.
  * @param {String} password - User specified, key password.