@opensecret/react 0.1.2 → 0.1.4

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.
package/README.md CHANGED
@@ -17,7 +17,7 @@ import { OpenSecretProvider } from "@opensecret/react";
17
17
 
18
18
  function App() {
19
19
  return (
20
- <OpenSecretProvider apiUrl="https://preview.opensecret.ai">
20
+ <OpenSecretProvider apiUrl="https://preview-enclave.opensecret.cloud">
21
21
  <App />
22
22
  </OpenSecretProvider>
23
23
  );
@@ -35,7 +35,7 @@ function App() {
35
35
  return (
36
36
  <div>
37
37
  <button onClick={() => os.signIn("email", "password")}>Sign In</button>
38
- <button onClick={() => os.signUp("name", "email", "password", "inviteCode")}>Sign Up</button>
38
+ <button onClick={() => os.signUp("name", "email", "password")}>Sign Up</button>
39
39
  <button onClick={() => os.signOut()}>Sign Out</button>
40
40
  <button onClick={() => os.get("key")}>Get Value</button>
41
41
  <button onClick={() => os.put("key", "value")}>Put Value</button>
@@ -53,7 +53,7 @@ function App() {
53
53
  The `OpenSecretProvider` component is the main entry point for the SDK. It requires a single prop, `apiUrl`, which should be set to the URL of your OpenSecret backend.
54
54
 
55
55
  ```tsx
56
- <OpenSecretProvider apiUrl="https://preview.opensecret.ai">
56
+ <OpenSecretProvider apiUrl="https://preview-enclave.opensecret.cloud">
57
57
  <App />
58
58
  </OpenSecretProvider>
59
59
  ```
@@ -62,16 +62,30 @@ The `OpenSecretProvider` component is the main entry point for the SDK. It requi
62
62
 
63
63
  The `useOpenSecret` hook provides access to the OpenSecret API. It returns an object with the following methods:
64
64
 
65
+ #### Authentication Methods
65
66
  - `signIn(email: string, password: string): Promise<void>`: Signs in a user with the provided email and password.
66
67
  - `signUp(name: string, email: string, password: string, inviteCode: string): Promise<void>`: Signs up a new user with the provided name, email, password, and invite code.
67
68
  - `signOut(): Promise<void>`: Signs out the current user.
69
+
70
+ #### Key-Value Storage Methods
68
71
  - `get(key: string): Promise<string | undefined>`: Retrieves the value associated with the provided key.
69
72
  - `put(key: string, value: string): Promise<string>`: Stores the provided value with the provided key.
70
73
  - `list(): Promise<KVListItem[]>`: Retrieves all key-value pairs stored by the user.
71
74
  - `del(key: string): Promise<void>`: Deletes the value associated with the provided key.
75
+
76
+ #### Account Management Methods
72
77
  - `refetchUser(): Promise<void>`: Refreshes the user's authentication state.
73
78
  - `changePassword(currentPassword: string, newPassword: string): Promise<void>`: Changes the user's password.
74
79
 
80
+ #### Cryptographic Methods
81
+ - `getPrivateKey(): Promise<PrivateKeyResponse>`: Retrieves the user's private key mnemonic phrase. This is used for cryptographic operations and should be kept secure.
82
+
83
+ - `getPublicKey(algorithm: 'schnorr' | 'ecdsa'): Promise<PublicKeyResponse>`: Retrieves the user's public key for the specified signing algorithm. Supports two algorithms:
84
+ - `'schnorr'`: For Schnorr signatures
85
+ - `'ecdsa'`: For ECDSA signatures
86
+
87
+ - `signMessage(messageBytes: Uint8Array, algorithm: 'schnorr' | 'ecdsa'): Promise<SignatureResponse>`: Signs a message using the specified algorithm. The message must be provided as a Uint8Array of bytes. Returns a signature that can be verified using the corresponding public key.
88
+
75
89
  ### Library development
76
90
 
77
91
  This library uses [Bun](https://bun.sh/) for development.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opensecret/react",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "files": [
@@ -47,6 +47,8 @@
47
47
  "prettier": "^3.3.3",
48
48
  "typescript": "~5.6.2",
49
49
  "typescript-eslint": "^8.11.0",
50
- "vite": "^5.4.10"
50
+ "vite": "^5.4.10",
51
+ "@noble/curves": "^1.6.0",
52
+ "@noble/hashes": "^1.5.0"
51
53
  }
52
54
  }