cozy-keys-lib 4.1.9 → 4.2.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cozy-keys-lib",
3
- "version": "4.1.9",
3
+ "version": "4.2.0",
4
4
  "description": "Interactions between cozy-keys and a bitwarden server",
5
5
  "browser": "transpiled/index.js",
6
6
  "main": "transpiled/index.node.js",
@@ -127,6 +127,10 @@ const withVaultClient = BaseComponent => {
127
127
 
128
128
  const useVaultClient = () => {
129
129
  const ctx = useContext(VaultContext)
130
+
131
+ if (!ctx) {
132
+ throw new Error('useVaultClient must be used within a VaultProvider')
133
+ }
130
134
  return ctx.vaultClient
131
135
  }
132
136
 
@@ -178,6 +178,11 @@ var withVaultClient = function withVaultClient(BaseComponent) {
178
178
 
179
179
  var useVaultClient = function useVaultClient() {
180
180
  var ctx = useContext(VaultContext);
181
+
182
+ if (!ctx) {
183
+ throw new Error('useVaultClient must be used within a VaultProvider');
184
+ }
185
+
181
186
  return ctx.vaultClient;
182
187
  };
183
188