Module: Universa

Included in:
Client
Defined in:
lib/universa.rb,
lib/universa/umi.rb,
lib/universa/keys.rb,
lib/universa/lazy.rb,
lib/universa/tools.rb,
lib/universa/binder.rb,
lib/universa/client.rb,
lib/universa/errors.rb,
lib/universa/service.rb,
lib/universa/version.rb,
lib/universa/contract.rb,
lib/universa/chain_store.rb,
lib/universa/string_utils.rb,
lib/universa/weak_reference.rb,
lib/universa/stored_contract.rb,
lib/universa/universa_helpers.rb

Overview

The Universa gem

Currently, only direct access to the Java API is available:

  • class UMI. Use it to get direct access to the Java API

Ruby-wrappers and tools are not yet available. Still direct access could be all you need at the time.

Defined Under Namespace

Modules: Checks, FSStore, Lazy, Parallel Classes: Binder, ChainStore, ChangeOwnerPermission, ChangeRolePermission, Client, Compound, Connection, Contract, ContractService, ContractState, Duration, Error, EscrowHelper, ExtendedSignature, HashId, IllegalStateError, InterchangeError, KeyAddress, KeyInfo, LazyValue, ListRole, ModifyDataPermission, NetworkError, NotFoundError, PBKDF2, Parcel, PrivateKey, PublicKey, QuorumVoteRole, Ref, Reference, ReferenceCreationData, RemoteAdapter, RevokePermission, Role, RoleLink, Safe58, SecureLoanHelper, Service, SimpleRole, SmartHash, SplitJoinPermission, StoreError, StoredContractBase, SymmetricKey, TransactionPack, UMI, UmiClient, UnsContract, WeakReference

Constant Summary collapse

ALNUMS =
(alnums + alnums.downcase + '_' + '0123456789').chars.to_ary
NUMBERS =
"0123456789".chars.to_ary
VERSION =

Current gem version

"3.14.2.1"

Instance Method Summary collapse

Instance Method Details

#derive_key(password, salt, rounds: 50000, prf: "HMAC_SHA256", tag: "default_tag") ⇒ Object

Derive symmetric key from a password using PBKDF2 algorithm



12
13
14
15
16
17
# File 'lib/universa/contract.rb', line 12

def derive_key(password, salt, rounds: 50000, prf: "HMAC_SHA256", tag: "default_tag")
  salt.is_a?(String) and salt = salt.force_encoding('binary')
  tag && tag.is_a?(String) and tag = tag.force_encoding('binary')
  ki = KeyInfo.new(prf, rounds, salt, tag)
  ki.derivePassword(password)
end

#retry_with_timeout(max_timeout = 25, max_times = 3, &block) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/universa/tools.rb', line 10

def retry_with_timeout(max_timeout = 25, max_times = 3, &block)
  attempt = 0
  begin
    Timeout::timeout(max_timeout, &block)
  rescue
    attempt += 1
    puts "timeout: retry (#$!): #{attempt}"
    retry if attempt < max_times
    raise
  end
end