Skip to content
Snippets Groups Projects
CryptoData.js 1.23 KiB
Newer Older
  • Learn to ignore specific revisions
  • function CryptoData() {}
    
    CryptoData.prototype.set = function(obj) {
      for(var member in obj) {
        this[member] = JSON.parse(JSON.stringify(obj[member]))
      }
    };
    
    CryptoData.prototype.serialize = function() {
      return JSON.stringify(this)
    };
    
    CryptoData.prototype.deserialize = function(serialized) {
      var obj = JSON.parse(serialized);
      this.set(obj)
    };
    
    CryptoData.prototype.setPublicKey = function(publicKey) {
      this["publicKey"] = publicKey
    };
    
    CryptoData.prototype.getPublicKey = function() {
      return this["publicKey"]
    };
    
    CryptoData.prototype.setPrivateKey = function(privateKey) {
      this["privateKey"] = privateKey
    };
    
    CryptoData.prototype.getPrivateKey = function() {
      return this["privateKey"]
    };
    
    CryptoData.prototype.setx509Certificate = function(x509Certificate) {
      this["x509Certificate"] = x509Certificate
    };
    
    CryptoData.prototype.getx509Certificate = function() {
      return this["x509Certificate"]
    };
    
    CryptoData.prototype.setKeyUUID = function(keyUUID) {
      this["keyUUID"] = keyUUID
    };
    
    CryptoData.prototype.getKeyUUID = function() {
      return this["keyUUID"]
    };
    
    CryptoData.prototype.setChain = function(chain) {
      this["chain"] = chain
    };
    
    CryptoData.prototype.getChain = function() {
      return this["chain"]
    };
    
    export default CryptoData;