CryptoModule class
Constructors
- CryptoModule.new(TonSdkCore core)
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
chacha20(
ParamsOfChaCha20 params) → Future< ResultOfChaCha20> -
Performs symmetric
chacha20
encryption. -
clear_crypto_box_secret_cache(
RegisteredCryptoBox params) → Future< void> - Removes cached secrets (overwrites with zeroes) from all signing and encryption boxes, derived from crypto box.
-
convert_public_key_to_ton_safe_format(
ParamsOfConvertPublicKeyToTonSafeFormat params) → Future< ResultOfConvertPublicKeyToTonSafeFormat> - Converts public key to ton safe_format
-
create_crypto_box(
ParamsOfCreateCryptoBox params) → Future< RegisteredCryptoBox> - Crypto Box is a root crypto object, that encapsulates some secret (seed phrase usually) in encrypted form and acts as a factory for all crypto primitives used in SDK: keys for signing and encryption, derived from this secret.
-
create_encryption_box(
ParamsOfCreateEncryptionBox params) → Future< RegisteredEncryptionBox> - Creates encryption box with specified algorithm
-
encryption_box_decrypt(
ParamsOfEncryptionBoxDecrypt params) → Future< ResultOfEncryptionBoxDecrypt> - Block cipher algorithms pad data to cipher block size so encrypted data can be longer then original data. Client should store the original data size after encryption and use it after decryption to retrieve the original data from decrypted data.
-
encryption_box_encrypt(
ParamsOfEncryptionBoxEncrypt params) → Future< ResultOfEncryptionBoxEncrypt> - Block cipher algorithms pad data to cipher block size so encrypted data can be longer then original data. Client should store the original data size after encryption and use it after decryption to retrieve the original data from decrypted data.
-
encryption_box_get_info(
ParamsOfEncryptionBoxGetInfo params) → Future< ResultOfEncryptionBoxGetInfo> - Queries info from the given encryption box
-
factorize(
ParamsOfFactorize params) → Future< ResultOfFactorize> -
Performs prime factorization – decomposition of a composite number
into a product of smaller prime integers (factors).
See
https://en.wikipedia.org/wiki/Integer_factorization
-
generate_random_bytes(
ParamsOfGenerateRandomBytes params) → Future< ResultOfGenerateRandomBytes> -
Generates random byte array of the specified length and returns it in
base64
format -
generate_random_sign_keys(
) → Future< KeyPair> - Generates random ed25519 key pair.
-
get_crypto_box_info(
RegisteredCryptoBox params) → Future< ResultOfGetCryptoBoxInfo> -
Get Crypto Box Info. Used to get
encrypted_secret
that should be used for all the cryptobox initializations except the first one. -
get_crypto_box_seed_phrase(
RegisteredCryptoBox params) → Future< ResultOfGetCryptoBoxSeedPhrase> - Attention! Store this data in your application for a very short period of time and overwrite it with zeroes ASAP.
-
get_encryption_box_from_crypto_box(
ParamsOfGetEncryptionBoxFromCryptoBox params) → Future< RegisteredEncryptionBox> -
Derives encryption keypair from cryptobox secret and hdpath and
stores it in cache for
secret_lifetime
or until explicitly cleared byclear_crypto_box_secret_cache
method. Ifsecret_lifetime
is not specified - overwrites encryption secret with zeroes immediately after encryption operation. -
get_signing_box(
KeyPair params) → Future< RegisteredSigningBox> - Creates a default signing box implementation.
-
get_signing_box_from_crypto_box(
ParamsOfGetSigningBoxFromCryptoBox params) → Future< RegisteredSigningBox> - Get handle of Signing Box derived from Crypto Box.
-
hdkey_derive_from_xprv(
ParamsOfHDKeyDeriveFromXPrv params) → Future< ResultOfHDKeyDeriveFromXPrv> - Returns extended private key derived from the specified extended private key and child index
-
hdkey_derive_from_xprv_path(
ParamsOfHDKeyDeriveFromXPrvPath params) → Future< ResultOfHDKeyDeriveFromXPrvPath> - Derives the extended private key from the specified key and path
-
hdkey_public_from_xprv(
ParamsOfHDKeyPublicFromXPrv params) → Future< ResultOfHDKeyPublicFromXPrv> - Extracts the public key from the serialized extended private key
-
hdkey_secret_from_xprv(
ParamsOfHDKeySecretFromXPrv params) → Future< ResultOfHDKeySecretFromXPrv> - Extracts the private key from the serialized extended private key
-
hdkey_xprv_from_mnemonic(
ParamsOfHDKeyXPrvFromMnemonic params) → Future< ResultOfHDKeyXPrvFromMnemonic> - Generates an extended master private key that will be the root for all the derived keys
-
mnemonic_derive_sign_keys(
ParamsOfMnemonicDeriveSignKeys params) → Future< KeyPair> - Validates the seed phrase, generates master key and then derives the key pair from the master key and the specified path
-
mnemonic_from_entropy(
ParamsOfMnemonicFromEntropy params) → Future< ResultOfMnemonicFromEntropy> - Generates mnemonic from pre-generated entropy
-
mnemonic_from_random(
ParamsOfMnemonicFromRandom params) → Future< ResultOfMnemonicFromRandom> - Generates a random mnemonic from the specified dictionary and word count
-
mnemonic_verify(
ParamsOfMnemonicVerify params) → Future< ResultOfMnemonicVerify> - The phrase supplied will be checked for word length and validated according to the checksum specified in BIP0039.
-
mnemonic_words(
ParamsOfMnemonicWords params) → Future< ResultOfMnemonicWords> - Prints the list of words from the specified dictionary
-
modular_power(
ParamsOfModularPower params) → Future< ResultOfModularPower> -
Performs modular exponentiation for big integers (
base
^exponent
modmodulus
). Seehttps://en.wikipedia.org/wiki/Modular_exponentiation
-
nacl_box(
ParamsOfNaclBox params) → Future< ResultOfNaclBox> - Encrypt and authenticate a message using the senders secret key, the receivers public key, and a nonce.
-
nacl_box_keypair(
) → Future< KeyPair> - Generates a random NaCl key pair
-
nacl_box_keypair_from_secret_key(
ParamsOfNaclBoxKeyPairFromSecret params) → Future< KeyPair> - Generates key pair from a secret key
-
nacl_box_open(
ParamsOfNaclBoxOpen params) → Future< ResultOfNaclBoxOpen> - Decrypt and verify the cipher text using the receivers secret key, the senders public key, and the nonce.
-
nacl_secret_box(
ParamsOfNaclSecretBox params) → Future< ResultOfNaclBox> - Encrypt and authenticate message using nonce and secret key.
-
nacl_secret_box_open(
ParamsOfNaclSecretBoxOpen params) → Future< ResultOfNaclBoxOpen> -
Decrypts and verifies cipher text using
nonce
and secretkey
. -
nacl_sign(
ParamsOfNaclSign params) → Future< ResultOfNaclSign> - Signs data using the signer's secret key.
-
nacl_sign_detached(
ParamsOfNaclSign params) → Future< ResultOfNaclSignDetached> -
Signs the message
unsigned
using the secret keysecret
and returns a signaturesignature
. -
nacl_sign_detached_verify(
ParamsOfNaclSignDetachedVerify params) → Future< ResultOfNaclSignDetachedVerify> -
Verifies the signature with public key and
unsigned
data. -
nacl_sign_keypair_from_secret_key(
ParamsOfNaclSignKeyPairFromSecret params) → Future< KeyPair> - NOTE: In the result the secret key is actually the concatenation of secret and public keys (128 symbols hex string) by design of NaCL. See also the stackexchange question.
-
nacl_sign_open(
ParamsOfNaclSignOpen params) → Future< ResultOfNaclSignOpen> -
Verifies the signature in
signed
using the signer's public keypublic
and returns the messageunsigned
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
register_encryption_box(
Function params) → Future< RegisteredEncryptionBox> - Register an application implemented encryption box.
-
register_signing_box(
Function params) → Future< RegisteredSigningBox> - Register an application implemented signing box.
-
remove_crypto_box(
RegisteredCryptoBox params) → Future< void> - Removes Crypto Box. Clears all secret data.
-
remove_encryption_box(
RegisteredEncryptionBox params) → Future< void> - Removes encryption box from SDK
-
remove_signing_box(
RegisteredSigningBox params) → Future< void> - Removes signing box from SDK.
-
scrypt(
ParamsOfScrypt params) → Future< ResultOfScrypt> -
Derives key from
password
andkey
usingscrypt
algorithm. Seehttps://en.wikipedia.org/wiki/Scrypt
. -
sha256(
ParamsOfHash params) → Future< ResultOfHash> - Calculates SHA256 hash of the specified data.
-
sha512(
ParamsOfHash params) → Future< ResultOfHash> - Calculates SHA512 hash of the specified data.
-
sign(
ParamsOfSign params) → Future< ResultOfSign> - Signs a data using the provided keys.
-
signing_box_get_public_key(
RegisteredSigningBox params) → Future< ResultOfSigningBoxGetPublicKey> - Returns public key of signing key pair.
-
signing_box_sign(
ParamsOfSigningBoxSign params) → Future< ResultOfSigningBoxSign> - Returns signed user data.
-
ton_crc16(
ParamsOfTonCrc16 params) → Future< ResultOfTonCrc16> - Calculates CRC16 using TON algorithm.
-
toString(
) → String -
A string representation of this object.
inherited
-
verify_signature(
ParamsOfVerifySignature params) → Future< ResultOfVerifySignature> - Verifies signed data using the provided public key. Raises error if verification is failed.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited