Module: EverSdk::Crypto

Defined in:
lib/ever_sdk_client/crypto.rb

Defined Under Namespace

Modules: ErrorCode Classes: BoxEncryptionAlgorithm, CryptoBoxSecret, EncryptionAlgorithm, ParamsOfAppEncryptionBox, ParamsOfAppSigningBox, ParamsOfHDKeyDeriveFromXPrv, ParamsOfHDKeyXPrvFromMnemonic

Constant Summary collapse

ParamsOfFactorize =
KwStruct.new(:composite)
ResultOfFactorize =
KwStruct.new(:factors)
ParamsOfModularPower =
KwStruct.new(:base, :exponent, :modulus)
ResultOfModularPower =
KwStruct.new(:modular_power)
ParamsOfTonCrc16 =
KwStruct.new(:data)
ResultOfTonCrc16 =
KwStruct.new(:crc)
ParamsOfGenerateRandomBytes =
KwStruct.new(:length)
ResultOfGenerateRandomBytes =
KwStruct.new(:bytes)
ParamsOfConvertPublicKeyToTonSafeFormat =
KwStruct.new(:public_key)
ResultOfConvertPublicKeyToTonSafeFormat =
KwStruct.new(:ton_public_key)
KeyPair =
KwStruct.new(:public_, :secret) do
  def to_h
    {
      public: public_,
      secret: secret
    }
  end
end
ParamsOfSign =
KwStruct.new(:unsigned, :keys) do
  def to_h
    {
      unsigned: unsigned,
      keys: keys&.to_h
    }
  end
end
ResultOfSign =
KwStruct.new(:signed, :signature)
ParamsOfVerifySignature =
KwStruct.new(:signed, :public_) do
  def to_h
    {
      signed: signed,
      public: public_
    }
  end
end
ResultOfVerifySignature =
KwStruct.new(:unsigned)
ParamsOfHash =
KwStruct.new(:data)
ResultOfHash =
KwStruct.new(:hash)
ParamsOfScrypt =
KwStruct.new(:password, :salt, :log_n, :r, :p, :dk_len)
ResultOfScrypt =
KwStruct.new(:key)
ParamsOfNaclSignKeyPairFromSecret =
KwStruct.new(:secret)
ParamsOfNaclSign =
KwStruct.new(:unsigned, :secret)
ResultOfNaclSign =
KwStruct.new(:signed)
ParamsOfNaclSignOpen =
KwStruct.new(:signed, :public_) do
  def to_h
    {
      signed: signed,
      public: public_
    }
  end
end
ResultOfNaclSignOpen =
KwStruct.new(:unsigned)
ParamsOfNaclSignDetached =
KwStruct.new(:unsigned, :secret)
ResultOfNaclSignDetached =
KwStruct.new(:signature)
ParamsOfNaclBoxKeyPairFromSecret =
KwStruct.new(:secret)
ParamsOfNaclBox =
KwStruct.new(:decrypted, :nonce, :their_public, :secret)
ResultOfNaclBox =
KwStruct.new(:encrypted)
ParamsOfNaclBoxOpen =
KwStruct.new(:encrypted, :nonce, :their_public, :secret)
ResultOfNaclBoxOpen =
KwStruct.new(:decrypted)
ParamsOfNaclSecretBox =
KwStruct.new(:decrypted, :nonce, :key)
ParamsOfNaclSecretBoxOpen =
KwStruct.new(:encrypted, :nonce, :key)
ParamsOfMnemonicWords =
KwStruct.new(:dictionary)
ResultOfMnemonicWords =
KwStruct.new(:words)
ParamsOfMnemonicFromRandom =
KwStruct.new(:dictionary, :word_count)
ResultOfMnemonicFromRandom =
KwStruct.new(:phrase)
ParamsOfMnemonicFromEntropy =
KwStruct.new(:entropy, :dictionary, :word_count)
ResultOfMnemonicFromEntropy =
KwStruct.new(:phrase)
ParamsOfMnemonicVerify =
KwStruct.new(:phrase, :dictionary, :word_count)
ResultOfMnemonicVerify =
KwStruct.new(:valid)
ParamsOfMnemonicDeriveSignKeys =
KwStruct.new(:phrase, :path, :dictionary, :word_count)
ResultOfHDKeyXPrvFromMnemonic =
KwStruct.new(:xprv)
ResultOfHDKeyDeriveFromXPrv =
KwStruct.new(:xprv)
ParamsOfHDKeySecretFromXPrv =
KwStruct.new(:xprv)
ResultOfHDKeySecretFromXPrv =
KwStruct.new(:secret)
ParamsOfHDKeyPublicFromXPrv =
KwStruct.new(:xprv)
ResultOfHDKeyPublicFromXPrv =
KwStruct.new(:public_)
ParamsOfHDKeyDeriveFromXPrvPath =
KwStruct.new(:xprv, :path)
ResultOfHDKeyDeriveFromXPrvPath =
KwStruct.new(:xprv)
ParamsOfChaCha20 =
KwStruct.new(:data, :key, :nonce)
ResultOfChaCha20 =
KwStruct.new(:data)
ParamsOfSigningBoxSign =
KwStruct.new(:signing_box, :unsigned)
ResultOfSigningBoxSign =
KwStruct.new(:signature)
RegisteredSigningBox =
KwStruct.new(:handle)
ResultOfSigningBoxGetPublicKey =
KwStruct.new(:pubkey)
ParamsOfNaclSignDetachedVerify =
KwStruct.new(:unsigned, :signature, :public_) do
  def to_h
    {
      unsigned: unsigned,
      signature: signature,
      public: public_
    }
  end
end
ResultOfNaclSignDetachedVerify =
KwStruct.new(:succeeded)
EncryptionBoxInfo =
KwStruct.new(:hdpath, :algorithm, :options, :public)
ParamsOfEncryptionBoxGetInfo =
KwStruct.new(:encryption_box)
ResultOfEncryptionBoxGetInfo =
KwStruct.new(:info)
ParamsOfEncryptionBoxEncrypt =
KwStruct.new(:encryption_box, :data)
RegisteredEncryptionBox =
KwStruct.new(:handle)
ResultOfEncryptionBoxEncrypt =
KwStruct.new(:data)
ParamsOfEncryptionBoxDecrypt =
KwStruct.new(:encryption_box, :data)
ResultOfEncryptionBoxDecrypt =
KwStruct.new(:data)
ParamsOfCreateEncryptionBox =
KwStruct.new(:algorithm)
ParamsOfCreateCryptoBox =
KwStruct.new(:secret_encryption_salt, :secret)
RegisteredCryptoBox =
KwStruct.new(:handle)
ParamsOfAppPasswordProvider =
KwStruct.new(:encryption_public_key) do
  attr_reader :type, :encryption_public_key

  def initialize(encryption_public_key:)
    @type = "GetPassword"
    @encryption_public_key = encryption_public_key
  end

  def to_h
    {
      type: type,
      encryption_public_key: encryption_public_key
    }
  end
end
ResultOfAppPasswordProvider =
KwStruct.new(:type, :encrypted_password, :app_encryption_pubkey)
ResultOfGetCryptoBoxInfo =
KwStruct.new(:encrypted_secret)
ResultOfGetCryptoBoxSeedPhrase =
KwStruct.new(:phrase, :dictionary, :wordcount)
ParamsOfGetSigningBoxFromCryptoBox =
KwStruct.new(:handle, :hdpath, :secret_lifetime)
ParamsOfGetEncryptionBoxFromCryptoBox =
KwStruct.new(:handle, :hdpath, :algorithm, :secret_lifetime)

Class Method Summary collapse

Class Method Details

.chacha20(ctx, params) ⇒ Object



786
787
788
789
790
791
792
793
794
795
796
# File 'lib/ever_sdk_client/crypto.rb', line 786

def self.chacha20(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.chacha20", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfChaCha20.new(data: resp.result["data"])
      )
    else
      yield resp
    end
  end
end

.clear_crypto_box_secret_cache(ctx, params) ⇒ Object



1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
# File 'lib/ever_sdk_client/crypto.rb', line 1031

def self.clear_crypto_box_secret_cache(ctx, params)
  Interop::request_to_native_lib(
    ctx,
    "crypto.clear_crypto_box_secret_cache",
    params
  ) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: nil
      )
    else
      yield resp
    end
  end
end

.convert_public_key_to_ton_safe_format(ctx, params) ⇒ Object



432
433
434
435
436
437
438
439
440
441
442
# File 'lib/ever_sdk_client/crypto.rb', line 432

def self.convert_public_key_to_ton_safe_format(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.convert_public_key_to_ton_safe_format", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfConvertPublicKeyToTonSafeFormat.new(ton_public_key: resp.result["ton_public_key"])
      )
    else
      yield resp
    end
  end
end

.create_crypto_box(ctx, params, callback:) ⇒ Object



947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
# File 'lib/ever_sdk_client/crypto.rb', line 947

def self.create_crypto_box(ctx, params, callback:)
  Interop::request_to_native_lib(
    ctx,
    "crypto.create_crypto_box",
    params,
    client_callback: callback,
    is_single_thread_only: false
  ) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: RegisteredCryptoBox.new(handle: resp.result["handle"])
      )
    else
      yield resp
    end
  end
end

.create_encryption_box(ctx, params) ⇒ Object



935
936
937
938
939
940
941
942
943
944
945
# File 'lib/ever_sdk_client/crypto.rb', line 935

def self.create_encryption_box(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.create_encryption_box", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: RegisteredEncryptionBox.new(handle: resp.result["handle"])
      )
    else
      yield resp
    end
  end
end

.encryption_box_decrypt(ctx, params) ⇒ Object



923
924
925
926
927
928
929
930
931
932
933
# File 'lib/ever_sdk_client/crypto.rb', line 923

def self.encryption_box_decrypt(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.encryption_box_decrypt", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfEncryptionBoxDecrypt.new(data: resp.result["data"])
      )
    else
      yield resp
    end
  end
end

.encryption_box_encrypt(ctx, params) ⇒ Object



911
912
913
914
915
916
917
918
919
920
921
# File 'lib/ever_sdk_client/crypto.rb', line 911

def self.encryption_box_encrypt(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.encryption_box_encrypt", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfEncryptionBoxEncrypt.new(data: resp.result["data"])
      )
    else
      yield resp
    end
  end
end

.encryption_box_get_info(ctx, params) ⇒ Object



899
900
901
902
903
904
905
906
907
908
909
# File 'lib/ever_sdk_client/crypto.rb', line 899

def self.encryption_box_get_info(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.encryption_box_get_info", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfEncryptionBoxGetInfo.new(info: resp.result["info"])
      )
    else
      yield resp
    end
  end
end

.factorize(ctx, params) ⇒ Object

functions



384
385
386
387
388
389
390
391
392
393
394
# File 'lib/ever_sdk_client/crypto.rb', line 384

def self.factorize(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.factorize", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfFactorize.new(factors: resp.result["factors"])
      )
    else
      yield resp
    end
  end
end

.generate_random_bytes(ctx, params) ⇒ Object



420
421
422
423
424
425
426
427
428
429
430
# File 'lib/ever_sdk_client/crypto.rb', line 420

def self.generate_random_bytes(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.generate_random_bytes", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfGenerateRandomBytes.new(bytes: resp.result["bytes"])
      )
    else
      yield resp
    end
  end
end

.generate_random_sign_keys(ctx, is_single_thread_only: false) ⇒ Object



444
445
446
447
448
449
450
451
452
453
454
455
456
457
# File 'lib/ever_sdk_client/crypto.rb', line 444

def self.generate_random_sign_keys(ctx, is_single_thread_only: false)
  Interop::request_to_native_lib(ctx, "crypto.generate_random_sign_keys", nil, is_single_thread_only: is_single_thread_only) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: KeyPair.new(
          public_: resp.result["public"],
          secret: resp.result["secret"]
        )
      )
    else
      yield resp
    end
  end
end

.get_crypto_box_info(ctx, params) ⇒ Object



977
978
979
980
981
982
983
984
985
986
987
988
989
# File 'lib/ever_sdk_client/crypto.rb', line 977

def self.get_crypto_box_info(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.get_crypto_box_info", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfGetCryptoBoxInfo.new(
          encrypted_secret: resp.result["encrypted_secret"]
        )
      )
    else
      yield resp
    end
  end
end

.get_crypto_box_seed_phrase(ctx, params) ⇒ Object



991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
# File 'lib/ever_sdk_client/crypto.rb', line 991

def self.get_crypto_box_seed_phrase(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.get_crypto_box_seed_phrase", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfGetCryptoBoxSeedPhrase.new(
          phrase: resp.result["phrase"],
          dictionary: resp.result["dictionary"],
          wordcount: resp.result["wordcount"]
        )
      )
    else
      yield resp
    end
  end
end

.get_encryption_box_from_crypto_box(ctx, params) ⇒ Object



1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
# File 'lib/ever_sdk_client/crypto.rb', line 1019

def self.get_encryption_box_from_crypto_box(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.get_encryption_box_from_crypto_box", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: RegisteredEncryptionBox.new(handle: resp.result["handle"])
      )
    else
      yield resp
    end
  end
end

.get_signing_box(ctx, params) ⇒ Object



816
817
818
819
820
821
822
823
824
825
826
# File 'lib/ever_sdk_client/crypto.rb', line 816

def self.get_signing_box(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.get_signing_box", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: RegisteredSigningBox.new(handle: resp.result["handle"])
      )
    else
      yield resp
    end
  end
end

.get_signing_box_from_crypto_box(ctx, params) ⇒ Object



1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
# File 'lib/ever_sdk_client/crypto.rb', line 1007

def self.get_signing_box_from_crypto_box(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.get_signing_box_from_crypto_box", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: RegisteredSigningBox.new(handle: resp.result["handle"])
      )
    else
      yield resp
    end
  end
end

.hdkey_derive_from_xprv(ctx, params) ⇒ Object



738
739
740
741
742
743
744
745
746
747
748
# File 'lib/ever_sdk_client/crypto.rb', line 738

def self.hdkey_derive_from_xprv(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfHDKeyDeriveFromXPrv.new(xprv: resp.result["xprv"])
      )
    else
      yield resp
    end
  end
end

.hdkey_derive_from_xprv_path(ctx, params) ⇒ Object



750
751
752
753
754
755
756
757
758
759
760
# File 'lib/ever_sdk_client/crypto.rb', line 750

def self.hdkey_derive_from_xprv_path(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.hdkey_derive_from_xprv_path", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfHDKeyDeriveFromXPrvPath.new(xprv: resp.result["xprv"])
      )
    else
      yield resp
    end
  end
end

.hdkey_public_from_xprv(ctx, params) ⇒ Object



774
775
776
777
778
779
780
781
782
783
784
# File 'lib/ever_sdk_client/crypto.rb', line 774

def self.hdkey_public_from_xprv(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.hdkey_public_from_xprv", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfHDKeyPublicFromXPrv.new(public_: resp.result["public"])
      )
    else
      yield resp
    end
  end
end

.hdkey_secret_from_xprv(ctx, params) ⇒ Object



762
763
764
765
766
767
768
769
770
771
772
# File 'lib/ever_sdk_client/crypto.rb', line 762

def self.hdkey_secret_from_xprv(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.hdkey_secret_from_xprv", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfHDKeySecretFromXPrv.new(secret: resp.result["secret"])
      )
    else
      yield resp
    end
  end
end

.hdkey_xprv_from_mnemonic(ctx, params) ⇒ Object



726
727
728
729
730
731
732
733
734
735
736
# File 'lib/ever_sdk_client/crypto.rb', line 726

def self.hdkey_xprv_from_mnemonic(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.hdkey_xprv_from_mnemonic", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfHDKeyXPrvFromMnemonic.new(xprv: resp.result["xprv"])
      )
    else
      yield resp
    end
  end
end

.mnemonic_derive_sign_keys(ctx, params) ⇒ Object



711
712
713
714
715
716
717
718
719
720
721
722
723
724
# File 'lib/ever_sdk_client/crypto.rb', line 711

def self.mnemonic_derive_sign_keys(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.mnemonic_derive_sign_keys", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: KeyPair.new(
          public_: resp.result["public"],
          secret: resp.result["secret"]
        )
      )
    else
      yield resp
    end
  end
end

.mnemonic_from_entropy(ctx, params) ⇒ Object



687
688
689
690
691
692
693
694
695
696
697
# File 'lib/ever_sdk_client/crypto.rb', line 687

def self.mnemonic_from_entropy(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_entropy", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfMnemonicFromEntropy.new(phrase: resp.result["phrase"])
      )
    else
      yield resp
    end
  end
end

.mnemonic_from_random(ctx, params) ⇒ Object



675
676
677
678
679
680
681
682
683
684
685
# File 'lib/ever_sdk_client/crypto.rb', line 675

def self.mnemonic_from_random(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_random", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfMnemonicFromRandom.new(phrase: resp.result["phrase"])
      )
    else
      yield resp
    end
  end
end

.mnemonic_verify(ctx, params) ⇒ Object



699
700
701
702
703
704
705
706
707
708
709
# File 'lib/ever_sdk_client/crypto.rb', line 699

def self.mnemonic_verify(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.mnemonic_verify", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfMnemonicVerify.new(valid: resp.result["valid"])
      )
    else
      yield resp
    end
  end
end

.mnemonic_words(ctx, params) ⇒ Object



663
664
665
666
667
668
669
670
671
672
673
# File 'lib/ever_sdk_client/crypto.rb', line 663

def self.mnemonic_words(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.mnemonic_words", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfMnemonicWords.new(words: resp.result["words"])
      )
    else
      yield resp
    end
  end
end

.modular_power(ctx, params) ⇒ Object



396
397
398
399
400
401
402
403
404
405
406
# File 'lib/ever_sdk_client/crypto.rb', line 396

def self.modular_power(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.modular_power", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfModularPower.new(modular_power: resp.result["modular_power"])
      )
    else
      yield resp
    end
  end
end

.nacl_box(ctx, params) ⇒ Object



615
616
617
618
619
620
621
622
623
624
625
# File 'lib/ever_sdk_client/crypto.rb', line 615

def self.nacl_box(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.nacl_box", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfNaclBox.new(encrypted: resp.result["encrypted"])
      )
    else
      yield resp
    end
  end
end

.nacl_box_keypair(ctx) ⇒ Object



585
586
587
588
589
590
591
592
593
594
595
596
597
598
# File 'lib/ever_sdk_client/crypto.rb', line 585

def self.nacl_box_keypair(ctx)
  Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair") do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: KeyPair.new(
          public_: resp.result["public"],
          secret: resp.result["secret"]
        )
      )
    else
      yield resp
    end
  end
end

.nacl_box_keypair_from_secret_key(ctx, params) ⇒ Object



600
601
602
603
604
605
606
607
608
609
610
611
612
613
# File 'lib/ever_sdk_client/crypto.rb', line 600

def self.nacl_box_keypair_from_secret_key(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair_from_secret_key", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: KeyPair.new(
          public_: resp.result["public"],
          secret: resp.result["secret"]
        )
      )
    else
      yield resp
    end
  end
end

.nacl_box_open(ctx, params) ⇒ Object



627
628
629
630
631
632
633
634
635
636
637
# File 'lib/ever_sdk_client/crypto.rb', line 627

def self.nacl_box_open(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.nacl_box_open", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfNaclBoxOpen.new(decrypted: resp.result["decrypted"])
      )
    else
      yield resp
    end
  end
end

.nacl_secret_box(ctx, params) ⇒ Object



639
640
641
642
643
644
645
646
647
648
649
# File 'lib/ever_sdk_client/crypto.rb', line 639

def self.nacl_secret_box(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfNaclBox.new(encrypted: resp.result["encrypted"])
      )
    else
      yield resp
    end
  end
end

.nacl_secret_box_open(ctx, params) ⇒ Object



651
652
653
654
655
656
657
658
659
660
661
# File 'lib/ever_sdk_client/crypto.rb', line 651

def self.nacl_secret_box_open(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box_open", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfNaclBoxOpen.new(decrypted: resp.result["decrypted"])
      )
    else
      yield resp
    end
  end
end

.nacl_sign(ctx, params) ⇒ Object



537
538
539
540
541
542
543
544
545
546
547
# File 'lib/ever_sdk_client/crypto.rb', line 537

def self.nacl_sign(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.nacl_sign", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfNaclSign.new(signed: resp.result["signed"])
      )
    else
      yield resp
    end
  end
end

.nacl_sign_detached(ctx, params) ⇒ Object



561
562
563
564
565
566
567
568
569
570
571
# File 'lib/ever_sdk_client/crypto.rb', line 561

def self.nacl_sign_detached(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfNaclSignDetached.new(signature: resp.result["signature"])
      )
    else
      yield resp
    end
  end
end

.nacl_sign_detached_verify(ctx, params) ⇒ Object



573
574
575
576
577
578
579
580
581
582
583
# File 'lib/ever_sdk_client/crypto.rb', line 573

def self.nacl_sign_detached_verify(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached_verify", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfNaclSignDetachedVerify.new(succeeded: resp.result["succeeded"])
      )
    else
      yield resp
    end
  end
end

.nacl_sign_keypair_from_secret_key(ctx, params) ⇒ Object



522
523
524
525
526
527
528
529
530
531
532
533
534
535
# File 'lib/ever_sdk_client/crypto.rb', line 522

def self.nacl_sign_keypair_from_secret_key(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.nacl_sign_keypair_from_secret_key", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: KeyPair.new(
          public_: resp.result["public"],
          secret: resp.result["secret"]
        )
      )
    else
      yield resp
    end
  end
end

.nacl_sign_open(ctx, params) ⇒ Object



549
550
551
552
553
554
555
556
557
558
559
# File 'lib/ever_sdk_client/crypto.rb', line 549

def self.nacl_sign_open(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.nacl_sign_open", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfNaclSignOpen.new(unsigned: resp.result["unsigned"])
      )
    else
      yield resp
    end
  end
end

.register_encryption_box(ctx, callback:) ⇒ Object



869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
# File 'lib/ever_sdk_client/crypto.rb', line 869

def self.register_encryption_box(ctx, callback:)
  Interop::request_to_native_lib(
    ctx,
    "crypto.register_encryption_box",
    nil,
    client_callback: callback,
    is_single_thread_only: false
  ) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: RegisteredEncryptionBox.new(handle: resp.result["handle"])
      )
    else
      yield resp
    end
  end
end

.register_signing_box(ctx, callback:) ⇒ Object



798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
# File 'lib/ever_sdk_client/crypto.rb', line 798

def self.register_signing_box(ctx, callback:)
  Interop::request_to_native_lib(
    ctx,
    "crypto.register_signing_box",
    nil,
    client_callback: callback,
    is_single_thread_only: false
  ) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: RegisteredSigningBox.new(handle: resp.result["handle"])
      )
    else
      yield resp
    end
  end
end

.remove_crypto_box(ctx, params) ⇒ Object



965
966
967
968
969
970
971
972
973
974
975
# File 'lib/ever_sdk_client/crypto.rb', line 965

def self.remove_crypto_box(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.remove_crypto_box", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: nil
      )
    else
      yield resp
    end
  end
end

.remove_encryption_box(ctx, params) ⇒ Object



887
888
889
890
891
892
893
894
895
896
897
# File 'lib/ever_sdk_client/crypto.rb', line 887

def self.remove_encryption_box(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.remove_encryption_box", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: nil
      )
    else
      yield resp
    end
  end
end

.remove_signing_box(ctx, params) ⇒ Object



857
858
859
860
861
862
863
864
865
866
867
# File 'lib/ever_sdk_client/crypto.rb', line 857

def self.remove_signing_box(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.remove_signing_box", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: nil
      )
    else
      yield resp
    end
  end
end

.scrypt(ctx, params) ⇒ Object



510
511
512
513
514
515
516
517
518
519
520
# File 'lib/ever_sdk_client/crypto.rb', line 510

def self.scrypt(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.scrypt", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfScrypt.new(key: resp.result["key"])
      )
    else
      yield resp
    end
  end
end

.sha256(ctx, params) ⇒ Object



486
487
488
489
490
491
492
493
494
495
496
# File 'lib/ever_sdk_client/crypto.rb', line 486

def self.sha256(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.sha256", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfHash.new(hash: resp.result["hash"])
      )
    else
      yield resp
    end
  end
end

.sha512(ctx, params) ⇒ Object



498
499
500
501
502
503
504
505
506
507
508
# File 'lib/ever_sdk_client/crypto.rb', line 498

def self.sha512(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.sha512", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfHash.new(hash: resp.result["hash"])
      )
    else
      yield resp
    end
  end
end

.sign(ctx, params) ⇒ Object



459
460
461
462
463
464
465
466
467
468
469
470
471
472
# File 'lib/ever_sdk_client/crypto.rb', line 459

def self.sign(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.sign", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfSign.new(
          signed: resp.result["signed"],
          signature: resp.result["signature"]
        )
      )
    else
      yield resp
    end
  end
end

.signing_box_get_public_key(ctx, params, is_single_thread_only: false) ⇒ Object



828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
# File 'lib/ever_sdk_client/crypto.rb', line 828

def self.signing_box_get_public_key(ctx, params, is_single_thread_only: false)
  Interop::request_to_native_lib(
    ctx,
    "crypto.signing_box_get_public_key",
    params,
    is_single_thread_only: is_single_thread_only
  ) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfSigningBoxGetPublicKey.new(pubkey: resp.result["pubkey"])
      )
    else
      yield resp
    end
  end
end

.signing_box_sign(ctx, params) ⇒ Object



845
846
847
848
849
850
851
852
853
854
855
# File 'lib/ever_sdk_client/crypto.rb', line 845

def self.signing_box_sign(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.signing_box_sign", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfSigningBoxSign.new(signature: resp.result["signature"])
      )
    else
      yield resp
    end
  end
end

.ton_crc16(ctx, params) ⇒ Object



408
409
410
411
412
413
414
415
416
417
418
# File 'lib/ever_sdk_client/crypto.rb', line 408

def self.ton_crc16(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.ton_crc16", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfTonCrc16.new(crc: resp.result["crc"])
      )
    else
      yield resp
    end
  end
end

.verify_signature(ctx, params) ⇒ Object



474
475
476
477
478
479
480
481
482
483
484
# File 'lib/ever_sdk_client/crypto.rb', line 474

def self.verify_signature(ctx, params)
  Interop::request_to_native_lib(ctx, "crypto.verify_signature", params) do |resp|
    if resp.success?
      yield NativeLibResponseResult.new(
        result: ResultOfVerifySignature.new(unsigned: resp.result["unsigned"])
      )
    else
      yield resp
    end
  end
end