module TonSdk::Crypto
Constants
- EncryptionBoxInfo
- KeyPair
- ParamsOfChaCha20
- ParamsOfConvertPublicKeyToTonSafeFormat
- ParamsOfCreateEncryptionBox
- ParamsOfEncryptionBoxGetInfo
- ParamsOfFactorize
- ParamsOfGenerateRandomBytes
- ParamsOfHDKeyDeriveFromXPrvPath
- ParamsOfHDKeyPublicFromXPrv
- ParamsOfHDKeySecretFromXPrv
- ParamsOfHash
- ParamsOfMnemonicFromRandom
- ParamsOfMnemonicWords
- ParamsOfModularPower
- ParamsOfNaclBox
- ParamsOfNaclBoxKeyPairFromSecret
- ParamsOfNaclBoxOpen
- ParamsOfNaclSecretBox
- ParamsOfNaclSecretBoxOpen
- ParamsOfNaclSign
- ParamsOfNaclSignKeyPairFromSecret
- ParamsOfNaclSignOpen
- ParamsOfScrypt
- ParamsOfSign
- ParamsOfSigningBoxSign
- ParamsOfTonCrc16
- ParamsOfVerifySignature
- RegisteredEncryptionBox
- RegisteredSigningBox
- ResultOfChaCha20
- ResultOfConvertPublicKeyToTonSafeFormat
- ResultOfEncryptionBoxGetInfo
- ResultOfFactorize
- ResultOfGenerateRandomBytes
- ResultOfHDKeyDeriveFromXPrv
- ResultOfHDKeyDeriveFromXPrvPath
- ResultOfHDKeyPublicFromXPrv
- ResultOfHDKeySecretFromXPrv
- ResultOfHDKeyXPrvFromMnemonic
- ResultOfHash
- ResultOfMnemonicFromEntropy
- ResultOfMnemonicFromRandom
- ResultOfMnemonicVerify
- ResultOfMnemonicWords
- ResultOfModularPower
- ResultOfNaclBox
- ResultOfNaclBoxOpen
- ResultOfNaclSign
- ResultOfNaclSignDetached
- ResultOfNaclSignDetachedVerify
- ResultOfNaclSignOpen
- ResultOfScrypt
- ResultOfSign
- ResultOfSigningBoxGetPublicKey
- ResultOfSigningBoxSign
- ResultOfTonCrc16
- ResultOfVerifySignature
Public Class Methods
chacha20(ctx, params) { |native_lib_responset_result( result: result_of_cha_cha20| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 688 def self.chacha20(ctx, params) Interop::request_to_native_lib(ctx, "crypto.chacha20", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfChaCha20.new(resp.result["data"]) ) else yield resp end end end
convert_public_key_to_ton_safe_format(ctx, params) { |native_lib_responset_result( result: result_of_convert_public_key_to_ton_safe_format| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 346 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 NativeLibResponsetResult.new( result: ResultOfConvertPublicKeyToTonSafeFormat.new(resp.result["ton_public_key"]) ) else yield resp end end end
create_encryption_box(ctx, params) { |native_lib_responset_result( result: registered_encryption_box| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 843 def self.create_encryption_box(ctx, params) Interop::request_to_native_lib(ctx, "crypto.create_encryption_box", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: RegisteredEncryptionBox.new(resp.result["handle"]) ) else yield resp end end end
encryption_box_get_info(ctx, params) { |native_lib_responset_result( result: result_of_encryption_box_get_info| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 831 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 NativeLibResponsetResult.new( result: ResultOfEncryptionBoxGetInfo.new(resp.result["info"]) ) else yield resp end end end
factorize(ctx, params) { |native_lib_responset_result( result: result_of_factorize| ... }
click to toggle source
functions
# File lib/ton_sdk_client/crypto.rb, line 298 def self.factorize(ctx, params) Interop::request_to_native_lib(ctx, "crypto.factorize", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfFactorize.new(resp.result["factors"]) ) else yield resp end end end
generate_random_bytes(ctx, params) { |native_lib_responset_result( result: result_of_generate_random_bytes| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 334 def self.generate_random_bytes(ctx, params) Interop::request_to_native_lib(ctx, "crypto.generate_random_bytes", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfGenerateRandomBytes.new(resp.result["bytes"]) ) else yield resp end end end
generate_random_sign_keys(ctx, is_single_thread_only: false) { |native_lib_responset_result( result: key_pair( public_: result, secret: result| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 358 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 NativeLibResponsetResult.new( result: KeyPair.new( public_: resp.result["public"], secret: resp.result["secret"] ) ) else yield resp end end end
get_signing_box(ctx, params) { |native_lib_responset_result( result: registered_signing_box| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 739 def self.get_signing_box(ctx, params) Interop::request_to_native_lib(ctx, "crypto.get_signing_box", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: RegisteredSigningBox.new(resp.result["handle"]) ) else yield resp end end end
hdkey_derive_from_xprv(ctx, params) { |native_lib_responset_result( result: result_of_hd_key_derive_from_x_prv| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 640 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 NativeLibResponsetResult.new( result: ResultOfHDKeyDeriveFromXPrv.new(resp.result["xprv"]) ) else yield resp end end end
hdkey_derive_from_xprv_path(ctx, params) { |native_lib_responset_result( result: result_of_hd_key_derive_from_x_prv_path| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 652 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 NativeLibResponsetResult.new( result: ResultOfHDKeyDeriveFromXPrvPath.new(resp.result["xprv"]) ) else yield resp end end end
hdkey_public_from_xprv(ctx, params) { |native_lib_responset_result( result: result_of_hd_key_public_from_x_prv| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 676 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 NativeLibResponsetResult.new( result: ResultOfHDKeyPublicFromXPrv.new(resp.result["public"]) ) else yield resp end end end
hdkey_secret_from_xprv(ctx, params) { |native_lib_responset_result( result: result_of_hd_key_secret_from_x_prv| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 664 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 NativeLibResponsetResult.new( result: ResultOfHDKeySecretFromXPrv.new(resp.result["secret"]) ) else yield resp end end end
hdkey_xprv_from_mnemonic(ctx, params) { |native_lib_responset_result( result: result_of_hd_key_x_prv_from_mnemonic| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 628 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 NativeLibResponsetResult.new( result: ResultOfHDKeyXPrvFromMnemonic.new(resp.result["xprv"]) ) else yield resp end end end
mnemonic_derive_sign_keys(ctx, params) { |native_lib_responset_result( result: key_pair(public_: result, secret: result)| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 616 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 NativeLibResponsetResult.new( result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"]) ) else yield resp end end end
mnemonic_from_entropy(ctx, params) { |native_lib_responset_result( result: result_of_mnemonic_from_entropy| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 592 def self.mnemonic_from_entropy(ctx, params) Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_entropy", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfMnemonicFromEntropy.new(resp.result["phrase"]) ) else yield resp end end end
mnemonic_from_random(ctx, params) { |native_lib_responset_result( result: result_of_mnemonic_from_random| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 580 def self.mnemonic_from_random(ctx, params) Interop::request_to_native_lib(ctx, "crypto.mnemonic_from_random", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfMnemonicFromRandom.new(resp.result["phrase"]) ) else yield resp end end end
mnemonic_verify(ctx, params) { |native_lib_responset_result( result: result_of_mnemonic_verify| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 604 def self.mnemonic_verify(ctx, params) Interop::request_to_native_lib(ctx, "crypto.mnemonic_verify", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfMnemonicVerify.new(resp.result["valid"]) ) else yield resp end end end
mnemonic_words(ctx, params) { |native_lib_responset_result( result: result_of_mnemonic_words| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 568 def self.mnemonic_words(ctx, params) Interop::request_to_native_lib(ctx, "crypto.mnemonic_words", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfMnemonicWords.new(resp.result["words"]) ) else yield resp end end end
modular_power(ctx, params) { |native_lib_responset_result( result: result_of_modular_power| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 310 def self.modular_power(ctx, params) Interop::request_to_native_lib(ctx, "crypto.modular_power", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfModularPower.new(resp.result["modular_power"]) ) else yield resp end end end
nacl_box(ctx, params) { |native_lib_responset_result( result: result_of_nacl_box| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 520 def self.nacl_box(ctx, params) Interop::request_to_native_lib(ctx, "crypto.nacl_box", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfNaclBox.new(resp.result["encrypted"]) ) else yield resp end end end
nacl_box_keypair(ctx) { |native_lib_responset_result( result: key_pair(public_: result, secret: result)| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 496 def self.nacl_box_keypair(ctx) Interop::request_to_native_lib(ctx, "crypto.nacl_box_keypair") do |resp| if resp.success? yield NativeLibResponsetResult.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) { |native_lib_responset_result( result: key_pair(public_: result, secret: result)| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 508 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 NativeLibResponsetResult.new( result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"]) ) else yield resp end end end
nacl_box_open(ctx, params) { |native_lib_responset_result( result: result_of_nacl_box_open| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 532 def self.nacl_box_open(ctx, params) Interop::request_to_native_lib(ctx, "crypto.nacl_box_open", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfNaclBoxOpen.new(resp.result["decrypted"]) ) else yield resp end end end
nacl_secret_box(ctx, params) { |native_lib_responset_result( result: result_of_nacl_box| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 544 def self.nacl_secret_box(ctx, params) Interop::request_to_native_lib(ctx, "crypto.nacl_secret_box", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfNaclBox.new(resp.result["encrypted"]) ) else yield resp end end end
nacl_secret_box_open(ctx, params) { |native_lib_responset_result( result: result_of_nacl_box_open| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 556 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 NativeLibResponsetResult.new( result: ResultOfNaclBoxOpen.new(resp.result["decrypted"]) ) else yield resp end end end
nacl_sign(ctx, params) { |native_lib_responset_result( result: result_of_nacl_sign| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 448 def self.nacl_sign(ctx, params) Interop::request_to_native_lib(ctx, "crypto.nacl_sign", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfNaclSign.new(resp.result["signed"]) ) else yield resp end end end
nacl_sign_detached(ctx, params) { |native_lib_responset_result( result: result_of_nacl_sign_detached| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 472 def self.nacl_sign_detached(ctx, params) Interop::request_to_native_lib(ctx, "crypto.nacl_sign_detached", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfNaclSignDetached.new(resp.result["signature"]) ) else yield resp end end end
nacl_sign_detached_verify(ctx, params) { |native_lib_responset_result( result: result_of_nacl_sign_detached_verify| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 484 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 NativeLibResponsetResult.new( result: ResultOfNaclSignDetachedVerify.new(resp.result["succeeded"]) ) else yield resp end end end
nacl_sign_keypair_from_secret_key(ctx, params) { |native_lib_responset_result( result: key_pair(public_: result, secret: result)| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 436 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 NativeLibResponsetResult.new( result: KeyPair.new(public_: resp.result["public"], secret: resp.result["secret"]) ) else yield resp end end end
nacl_sign_open(ctx, params) { |native_lib_responset_result( result: result_of_nacl_sign_open| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 460 def self.nacl_sign_open(ctx, params) Interop::request_to_native_lib(ctx, "crypto.nacl_sign_open", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfNaclSignOpen.new(resp.result["unsigned"]) ) else yield resp end end end
register_encryption_box(ctx, app_obj:) { |native_lib_responset_result( result: registered_encryption_box| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 791 def self.register_encryption_box(ctx, app_obj:) client_callback = Proc.new do |type_, x| app_res = app_obj.request(x["request_data"]) app_req_result = case app_res in [:success, result] TonSdk::Client::AppRequestResult.new( type_: :ok, result: result ) in [:error, text] TonSdk::Client::AppRequestResult.new( type_: :error, text: text ) end params = TonSdk::Client::ParamsOfResolveAppRequest.new( app_request_id: x["app_request_id"], result: app_req_result ) TonSdk::Client.resolve_app_request(ctx, params) end Interop::request_to_native_lib( ctx, "crypto.register_encryption_box", nil, client_callback: client_callback, is_single_thread_only: false ) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: RegisteredEncryptionBox.new(resp.result["handle"]) ) else yield resp end end end
register_signing_box(ctx, app_obj:, is_single_thread_only: false) { |native_lib_responset_result( result: registered_signing_box| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 700 def self.register_signing_box(ctx, app_obj:, is_single_thread_only: false) client_callback = Proc.new do |type_, x| app_res = app_obj.request(x["request_data"]) app_req_result = case app_res in [:success, result] TonSdk::Client::AppRequestResult.new( type_: :ok, result: result ) in [:error, text] TonSdk::Client::AppRequestResult.new( type_: :error, text: text ) end params = TonSdk::Client::ParamsOfResolveAppRequest.new( app_request_id: x["app_request_id"], result: app_req_result ) TonSdk::Client.resolve_app_request(ctx, params) end Interop::request_to_native_lib( ctx, "crypto.register_signing_box", nil, is_single_thread_only: is_single_thread_only ) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: RegisteredSigningBox.new(resp.result["handle"]) ) else yield resp end end end
remove_signing_box(ctx, params) { |native_lib_responset_result( result: nil| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 779 def self.remove_signing_box(ctx, params) Interop::request_to_native_lib(ctx, "crypto.remove_signing_box", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: nil ) else yield resp end end end
scrypt(ctx, params) { |native_lib_responset_result( result: result_of_scrypt| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 424 def self.scrypt(ctx, params) Interop::request_to_native_lib(ctx, "crypto.scrypt", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfScrypt.new(resp.result["key"]) ) else yield resp end end end
sha256(ctx, params) { |native_lib_responset_result( result: result_of_hash| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 400 def self.sha256(ctx, params) Interop::request_to_native_lib(ctx, "crypto.sha256", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfHash.new(resp.result["hash"]) ) else yield resp end end end
sha512(ctx, params) { |native_lib_responset_result( result: result_of_hash| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 412 def self.sha512(ctx, params) Interop::request_to_native_lib(ctx, "crypto.sha512", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfHash.new(resp.result["hash"]) ) else yield resp end end end
sign(ctx, params) { |native_lib_responset_result( result: result_of_sign( signed: result, signature: result| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 373 def self.sign(ctx, params) Interop::request_to_native_lib(ctx, "crypto.sign", params) do |resp| if resp.success? yield NativeLibResponsetResult.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) { |native_lib_responset_result( result: result_of_signing_box_get_public_key| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 751 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", is_single_thread_only: is_single_thread_only ) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfSigningBoxGetPublicKey.new(resp.result["pubkey"]) ) else yield resp end end end
signing_box_sign(ctx, params) { |native_lib_responset_result( result: result_of_signing_box_sign| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 767 def self.signing_box_sign(ctx, params) Interop::request_to_native_lib(ctx, "crypto.signing_box_sign", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfSigningBoxSign.new(resp.result["signature"]) ) else yield resp end end end
ton_crc16(ctx, params) { |native_lib_responset_result( result: result_of_ton_crc16| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 322 def self.ton_crc16(ctx, params) Interop::request_to_native_lib(ctx, "crypto.ton_crc16", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfTonCrc16.new(resp.result["crc"]) ) else yield resp end end end
verify_signature(ctx, params) { |native_lib_responset_result( result: result_of_verify_signature| ... }
click to toggle source
# File lib/ton_sdk_client/crypto.rb, line 388 def self.verify_signature(ctx, params) Interop::request_to_native_lib(ctx, "crypto.verify_signature", params) do |resp| if resp.success? yield NativeLibResponsetResult.new( result: ResultOfVerifySignature.new(resp.result["unsigned"]) ) else yield resp end end end