lib/universa/keys.rb in universa-3.10.2.1 vs lib/universa/keys.rb in universa-3.10.5.1

- old
+ new

@@ -37,9 +37,22 @@ # A +com.icodici.crypto.PublicKey+ extension. As the key is immutable, # caching is used to avoid unnecessary UMI calls. class PublicKey < RemoteAdapter remote_class 'com.icodici.crypto.PublicKey' + # Load key from packed, optinally, using the password + # + # @param [String] packed binary string with packed key + # @param [String] password optional password + def self.from_packed(packed, password: nil) + packed.force_encoding 'binary' + if password + invoke_static "unpackWithPassword", packed, password + else + PublicKey.new packed + end + end + # @return [KeyAddress] short address def short_address @short_address ||= get_short_address() end