lib/universa/contract.rb in universa-3.14.2.1 vs lib/universa/contract.rb in universa-3.14.2.2

- old
+ new

@@ -33,10 +33,19 @@ salt = salt.force_encoding('binary') if salt && salt.is_a?(String) invoke_static :derive, hash, password, salt, rounds, length end end + # Safe58 allows human-friendly binary-to-characters codec. It automatically corrects recognition + # errors like 0 instead of 0 and 1 instead of I. The code does not use characters that look alike and + # uses only encglish letters and digits that also simplify select-copy-paste routine. + # + # important! arguments MUST be binary strings, so use + # + # str.force_encoding('binary') + # + # as need, otherwise it will not work as expected. class Safe58 < RemoteAdapter remote_class "net.sergeych.utils.Safe58" static_method :encode static_method :decode @@ -251,11 +260,11 @@ # @param [Time] expires_at defaults to 90 days # @param [Boolean] use_short_address set to true to use short address of the issuer key_address in the role # @return [Contract] simple contact, not sealed def self.create issuer_key, expires_at: (Time.now + 90 * 24 * 60 * 60), use_short_address: false contract = Contract.new - contract.set_expires_at expires_at + contract.set_expires_at expires_at.utc contract.set_issuer_keys(use_short_address ? issuer_key.short_address : issuer_key.long_address) contract.register_role(contract.issuer.link_as("owner")) contract.register_role(contract.issuer.link_as("creator")) contract.add_permission ChangeOwnerPermission.new(contract.owner.link_as "@owner") contract.add_permission RevokePermission.new(contract.owner.link_as "@owner") @@ -331,10 +340,10 @@ end # set +expires_at+ field # @param [Time] time when this contract will be expired, if yet +APPROVED+. def expires_at=(time) - set_expires_at time + set_expires_at time.utc end # @return definition data def definition @definition ||= get_definition.get_data