@withautonomi/autonomi 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/Cargo.toml +2 -2
  2. package/package.json +5 -5
  3. package/src/lib.rs +48 -12
package/Cargo.toml CHANGED
@@ -1,7 +1,7 @@
1
1
  [package]
2
2
  edition = "2024"
3
3
  name = "autonomi-nodejs"
4
- version = "0.2.0"
4
+ version = "0.2.1"
5
5
  description = "NodeJS bindings for the autonomi client"
6
6
  license = "GPL-3.0"
7
7
 
@@ -9,7 +9,7 @@ license = "GPL-3.0"
9
9
  crate-type = ["cdylib"]
10
10
 
11
11
  [dependencies]
12
- autonomi = { path = "../autonomi", version = "0.6.0" }
12
+ autonomi = { path = "../autonomi", version = "0.6.1" }
13
13
  bytes = { version = "1.0.1", features = ["serde"] }
14
14
  eyre = "0.6.12"
15
15
  futures = "0.3"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@withautonomi/autonomi",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "NodeJS bindings for Autonomi client",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -57,9 +57,9 @@
57
57
  "includeVersion": true
58
58
  },
59
59
  "optionalDependencies": {
60
- "@withautonomi/autonomi-win32-x64-msvc": "0.6.0",
61
- "@withautonomi/autonomi-darwin-x64": "0.6.0",
62
- "@withautonomi/autonomi-linux-x64-gnu": "0.6.0",
63
- "@withautonomi/autonomi-darwin-arm64": "0.6.0"
60
+ "@withautonomi/autonomi-win32-x64-msvc": "0.6.1",
61
+ "@withautonomi/autonomi-darwin-x64": "0.6.1",
62
+ "@withautonomi/autonomi-linux-x64-gnu": "0.6.1",
63
+ "@withautonomi/autonomi-darwin-arm64": "0.6.1"
64
64
  }
65
65
  }
package/src/lib.rs CHANGED
@@ -787,9 +787,9 @@ impl Client {
787
787
 
788
788
  /// Get the user data from the vault
789
789
  #[napi]
790
- pub async fn get_user_data_from_vault(&self, secret_key: &VaultSecretKey) -> Result<UserData> {
790
+ pub async fn vault_get_user_data(&self, secret_key: &VaultSecretKey) -> Result<UserData> {
791
791
  self.0
792
- .get_user_data_from_vault(&secret_key.0)
792
+ .vault_get_user_data(&secret_key.0)
793
793
  .await
794
794
  .map(UserData)
795
795
  .map_err(map_error)
@@ -799,14 +799,14 @@ impl Client {
799
799
  ///
800
800
  /// Returns the total cost of the put operation
801
801
  #[napi]
802
- pub async fn put_user_data_to_vault(
802
+ pub async fn vault_put_user_data(
803
803
  &self,
804
804
  secret_key: &VaultSecretKey,
805
805
  payment_option: &PaymentOption,
806
806
  user_data: &UserData,
807
807
  ) -> Result</* AttoTokens */ String> {
808
808
  self.0
809
- .put_user_data_to_vault(&secret_key.0, payment_option.0.clone(), user_data.0.clone())
809
+ .vault_put_user_data(&secret_key.0, payment_option.0.clone(), user_data.0.clone())
810
810
  .await
811
811
  .map(|c| c.to_string())
812
812
  .map_err(map_error)
@@ -816,15 +816,11 @@ impl Client {
816
816
  ///
817
817
  /// Returns the content type of the bytes in the vault.
818
818
  #[napi]
819
- pub async fn fetch_and_decrypt_vault(
819
+ pub async fn vault_get(
820
820
  &self,
821
821
  secret_key: &VaultSecretKey,
822
822
  ) -> Result</* (Bytes, VaultContentType) */ tuple_result::FetchAndDecryptVault> {
823
- let (data, content_type) = self
824
- .0
825
- .fetch_and_decrypt_vault(&secret_key.0)
826
- .await
827
- .map_err(map_error)?;
823
+ let (data, content_type) = self.0.vault_get(&secret_key.0).await.map_err(map_error)?;
828
824
 
829
825
  Ok(tuple_result::FetchAndDecryptVault { data, content_type })
830
826
  }
@@ -855,7 +851,7 @@ impl Client {
855
851
  /// It is recommended to use the hash of the app name or unique identifier as the content type.
856
852
 
857
853
  #[napi]
858
- pub async fn write_bytes_to_vault(
854
+ pub async fn vault_put(
859
855
  &self,
860
856
  data: Buffer,
861
857
  payment_option: &PaymentOption,
@@ -865,7 +861,7 @@ impl Client {
865
861
  let data = Bytes::copy_from_slice(&data);
866
862
 
867
863
  self.0
868
- .write_bytes_to_vault(
864
+ .vault_put(
869
865
  data,
870
866
  payment_option.0.clone(),
871
867
  &secret_key.0,
@@ -876,6 +872,46 @@ impl Client {
876
872
  .map_err(map_error)
877
873
  }
878
874
 
875
+ /// @deprecated Use `vault_get_user_data` instead. This function will be removed in a future version.
876
+ #[napi]
877
+ pub async fn get_user_data_from_vault(&self, secret_key: &VaultSecretKey) -> Result<UserData> {
878
+ self.vault_get_user_data(secret_key).await
879
+ }
880
+
881
+ /// @deprecated Use `vault_put_user_data` instead. This function will be removed in a future version.
882
+ #[napi]
883
+ pub async fn put_user_data_to_vault(
884
+ &self,
885
+ secret_key: &VaultSecretKey,
886
+ payment_option: &PaymentOption,
887
+ user_data: &UserData,
888
+ ) -> Result</* AttoTokens */ String> {
889
+ self.vault_put_user_data(secret_key, payment_option, user_data)
890
+ .await
891
+ }
892
+
893
+ /// @deprecated Use `vault_get` instead. This function will be removed in a future version.
894
+ #[napi]
895
+ pub async fn fetch_and_decrypt_vault(
896
+ &self,
897
+ secret_key: &VaultSecretKey,
898
+ ) -> Result</* (Bytes, VaultContentType) */ tuple_result::FetchAndDecryptVault> {
899
+ self.vault_get(secret_key).await
900
+ }
901
+
902
+ /// @deprecated Use `vault_put` instead. This function will be removed in a future version.
903
+ #[napi]
904
+ pub async fn write_bytes_to_vault(
905
+ &self,
906
+ data: Buffer,
907
+ payment_option: &PaymentOption,
908
+ secret_key: &VaultSecretKey,
909
+ content_type: &VaultContentType,
910
+ ) -> Result</* AttoTokens */ String> {
911
+ self.vault_put(data, payment_option, secret_key, content_type)
912
+ .await
913
+ }
914
+
879
915
  // Registers
880
916
 
881
917
  /// Get the register history, starting from the root to the latest entry.