@interrupted/murk-secrets 0.14.1 → 0.15.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.
Files changed (3) hide show
  1. package/README.md +99 -36
  2. package/index.js +112 -55
  3. package/package.json +10 -10
package/README.md CHANGED
@@ -4,11 +4,11 @@
4
4
 
5
5
  > **Experimental writes.** Reading secrets (`load`, `get`, `exportAll`) is stable. Writing (`add`, `describe`) is experimental: the write API is new and may change. See [Feature status](https://murk.interrupted.sh/reference/feature-status/).
6
6
 
7
- Node.js/TypeScript bindings for [murk](https://github.com/interrupted-sh/murk) — an encrypted secrets manager for developers.
7
+ Node.js/TypeScript bindings for [murk](https://github.com/interrupted-sh/murk), an encrypted secrets manager for developers.
8
8
 
9
9
  ## Prerequisites
10
10
 
11
- You need the [murk CLI](https://github.com/interrupted-sh/murk) to create and manage vaults. This package can read them and store secrets into them; trust-changing operations (rotation, recipient/group changes, agent grants) stay CLI-only.
11
+ You need the [murk CLI](https://murk.interrupted.sh/install/) to create and manage vaults. This package can read them and store secrets into them. Trust-changing operations (rotation, recipient and group changes, agent grants) stay CLI-only.
12
12
 
13
13
  ```bash
14
14
  # Install the CLI first
@@ -52,7 +52,7 @@ exportAll()
52
52
 
53
53
  // Store a secret (encrypted to everyone by default)
54
54
  vault.add('NEW_TOKEN', 'value')
55
- vault.add('MY_TOKEN', 'value', { tier: 'me' }) // personal, scoped to you
55
+ vault.add('MY_TOKEN', 'value', { tier: 'me' }) // a private value, encrypted to you only
56
56
  vault.add('TEAM_TOKEN', 'value', { tier: 'backend' }) // to a named group
57
57
  add('NEW_TOKEN', 'value') // one-liner
58
58
  ```
@@ -71,9 +71,9 @@ One-liner: load the vault and get a single value.
71
71
 
72
72
  One-liner: load the vault and export all secrets as an object.
73
73
 
74
- ### `add(key, value, options?, vaultPath?): void`
74
+ ### `add(key: string, value: string, options?: AddOptions, vaultPath?: string): void`
75
75
 
76
- One-liner: load the vault and store a secret. See `vault.add` below.
76
+ One-liner: load the vault and store a secret. See `vault.add` in [Writing secrets](#writing-secrets).
77
77
 
78
78
  ### `hasIdentity(): boolean`
79
79
 
@@ -83,69 +83,132 @@ Returns `true` if murk can find a key for `./.murk`: `MURK_KEY`, `MURK_KEY_FILE`
83
83
 
84
84
  | Method | Returns | Description |
85
85
  |--------|---------|-------------|
86
- | `vault.get(key)` | `string \| null` | Decrypted value, or `null` if no value is readable for the key |
86
+ | `vault.get(key)` | `string \| null` | Decrypted value, or `null` if no value is readable for the secret |
87
87
  | `vault.export()` | `Record<string, string>` | All secrets as an object |
88
- | `vault.keys()` | `string[]` | Key names in the vault schema, including keys you cannot read |
89
- | `vault.has(key)` | `boolean` | `true` if the key is in the schema, even if you cannot read its value |
90
- | `vault.length` | `number` | Number of keys in the schema |
91
- | `vault.add(key, value, options?)` | `void` | Store a secret (see below) |
92
- | `vault.describe(key, description, options?)` | `void` | Set a key's description/tags/example |
88
+ | `vault.keys()` | `string[]` | Names of all secrets in the vault schema, including secrets you cannot read |
89
+ | `vault.has(key)` | `boolean` | `true` if the secret is in the schema, even if you cannot read its value |
90
+ | `vault.length` | `number` | Number of secrets in the schema |
91
+ | `vault.add(key, value, options?: AddOptions)` | `void` | Store a secret (see below) |
92
+ | `vault.describe(key, description, options?: DescribeOptions)` | `void` | Set a secret's description, tags or example |
93
93
  | `vault.warnings` | `string[]` | Warnings about an accepted vault, the ones the CLI prints as `warn …` (empty for a clean load) |
94
94
 
95
- Scoped (per-user) overrides are applied automatically — if you have a scoped value for a key, it takes priority over the shared value.
95
+ `get()` and `export()` pick a value in this order: your private value, then a group value you can read, then the shared value. A private value is one you added with the `me` tier (`murk add KEY --group me`).
96
96
 
97
97
  ### Trust
98
98
 
99
- Every call that reads the vault (`load`, `get`, `exportAll`, `add`, `vault.add`, `vault.describe`) applies the same trust check as the CLI. A vault this machine does not trust — unsigned when your key could have signed it, signed by a key this machine hasn't accepted, rolled back, or tampered with — throws an `Error` whose `code` is `'MURK_TRUST'`, with the CLI's message. Nothing in the binding skips the check. Run `murk trust` once from a shell to accept a vault, or set `MURK_TRUSTED_SIGNERS` in CI. An agent grant key reads only through the trusted signers in its key file or `MURK_TRUSTED_SIGNERS`.
99
+ Every call that reads the vault (`load`, `get`, `exportAll`, `add`, `vault.add`, `vault.describe`) applies the same trust check as the CLI. The check refuses a vault that this machine does not trust. That means a vault that is unsigned when your key could have signed it, signed by a key this machine has not accepted, rolled back, or tampered with. The binding throws an `Error` whose `code` is `'MURK_TRUST'`, with the CLI's message. Nothing in the binding skips the check.
100
+
101
+ To accept a vault, run `murk trust` once from a shell. In CI, set `MURK_TRUSTED_SIGNERS` to the signers you allow. Set it only from a CI secret or the real process environment, never from a file in the repository or a `.env` that an app's dotenv loader reads, because it decides which signers this machine trusts.
102
+
103
+ The binding reads `MURK_TRUSTED_SIGNERS` from the process environment. An app that calls `dotenv.config()` before `load()` lets a repository `.env` choose the trust anchor. The CLI does not read `.env` itself.
104
+
105
+ An agent grant key reads only through the trusted signers in its key file or `MURK_TRUSTED_SIGNERS`.
100
106
 
101
107
  ### Writing secrets
102
108
 
103
- `vault.add(key, value, options?)` mirrors `murk add`: it encrypts the value, re-signs the vault, and writes it back to disk under an exclusive lock (safe against concurrent writers). An `everyone` or group write replaces the key's base value. A group write removes the shared value, and a shared write removes the group assignment. A `me` write leaves the shared value alone. `tags` are added to the key's existing tags. Options:
109
+ `vault.add(key, value, options?)` works like `murk add`. It encrypts the value, signs the vault when your key can sign, and writes it back to disk under an exclusive lock, so concurrent writers are safe. The loaded `Vault` refreshes, so later reads on the same handle see the write. A secret name must start with a letter or underscore and contain only `A-Z`, `a-z`, `0-9` and `_`.
110
+
111
+ `options` is an `AddOptions` object. All fields are optional:
112
+
113
+ - `tier`: where the value lives (see below).
114
+ - `desc`: a human-readable description recorded in the schema.
115
+ - `tags`: tags recorded on the secret. Tags are the unit the agent allow-tag policy gates on.
116
+
117
+ `tier` is one of:
118
+
119
+ - `'everyone'`: encrypted to every recipient except agent grants.
120
+ - `'me'`: a private value, encrypted to you only.
121
+ - A group name: encrypted to that group's members. You must be a member.
122
+
123
+ Omit `tier` to keep an existing secret in its tier. A new secret is shared. You cannot update a secret held by a group you are not a member of, except with `'me'`. A secret that holds only other recipients' private values needs an explicit `tier`.
104
124
 
105
- - `tier` — where the value lives: `'everyone'` (encrypted to every recipient except agent grants), `'me'` (a personal value encrypted to you only), or a **group name** (encrypted to that group's members; you must be a member). Omit it to keep an existing key in its tier (a new key is shared). A key held by a group you are not a member of can't be updated, except with `'me'`, and a key holding only other recipients' overrides needs an explicit `tier`.
106
- - `desc` — a human-readable description recorded in the schema.
107
- - `tags` — tags recorded on the key; tags are the unit the agent allow-tag policy gates on.
125
+ `tier` accepts aliases. `'all'` and `'shared'` mean `'everyone'`. `'self'` and `'mine'` mean `'me'`. These six names are reserved and cannot name a group. Matching is case-sensitive, so `'Everyone'` names a group. Any other string names a group. A misspelled tier fails with `group not found` unless a group with that name exists.
108
126
 
109
- `vault.describe(key, description, options?)` works like `murk describe`, without `--rotate-every` and `--expires`. It never touches the value and always replaces the description. `options.tags` replaces the existing tags when it is non-empty. Leaving out `options.example` clears the current example. If the key does not exist yet, `describe` creates a documented entry with no value.
127
+ An `everyone` or group write replaces the secret's base value. A group write removes the shared value, and a shared write removes the group assignment. A `me` write leaves the shared value alone. `tags` are added to the secret's existing tags.
110
128
 
111
- Trust-changing operations — rotation, adding/removing recipients or group members, and minting agent grants — are deliberately **not** exposed here; use the CLI for those.
129
+ `vault.describe(key, description, options?)` works like `murk describe`, without `--rotate-every` and `--expires`. It never touches the value and always replaces the description. `options` is a `DescribeOptions` object with two optional fields:
130
+
131
+ - `tags`: replaces the existing tags when it is non-empty.
132
+ - `example`: the example value. Leaving it out clears the current example.
133
+
134
+ If the secret does not exist yet, `describe` creates a documented entry with no value.
135
+
136
+ Trust-changing operations (rotation, adding or removing recipients or group members, and minting agent grants) are deliberately **not** exposed here. Use the CLI for those.
112
137
 
113
138
  ## Memory hygiene
114
139
 
115
- Every decrypted value murk returns is a plain host-language string. murk zeroes plaintext
116
- from its own memory when a value is dropped, but that guarantee ends at the FFI
117
- boundary: once a value crosses into JavaScript the runtime owns it, and its
118
- garbage collector — not murk — controls its lifetime. This is inherent to
119
- reading secrets into a process (see the
120
- [threat model](https://github.com/interrupted-sh/murk/blob/main/THREAT_MODEL.md)); avoid
121
- holding decrypted values longer than you need them.
122
-
123
- The write path makes this sharper. To call `vault.add(key, value)` you already hold
124
- the plaintext as a JavaScript `String` *before* the call — it lives in V8's heap, is
125
- copied across the FFI boundary into a Rust `String`, and is zeroized on neither side.
126
- Reads only ever expose plaintext murk itself produced during decryption; a write means
127
- the plaintext originated in your process and lingers there under the GC's control. Build
128
- the value as late as possible, pass it straight into `add`, and don't keep it around.
140
+ Every decrypted value murk returns is a plain JavaScript string. murk zeroes plaintext from its own memory when a value is dropped. That guarantee ends at the FFI boundary. Once a value crosses into JavaScript, the runtime owns it, and its garbage collector controls its lifetime, not murk. This is inherent to reading secrets into a process (see the [threat model](https://github.com/interrupted-sh/murk/blob/main/THREAT_MODEL.md)). Avoid holding decrypted values longer than you need them.
141
+
142
+ The write path makes this sharper. To call `vault.add(key, value)`, you already hold the plaintext as a JavaScript string before the call. It lives in V8's heap, is copied across the FFI boundary into a Rust `String`, and is zeroized on neither side. Reads only expose plaintext that murk itself produced during decryption. With a write, the plaintext starts in your process and lingers there under the garbage collector's control. Build the value as late as possible, pass it straight into `add`, and do not keep it around.
129
143
 
130
144
  ## Agent policy
131
145
 
132
- If the loaded key is an agent grant (from `murk agent grant`), the bindings enforce the vault's agent policy on reads, as `murk agent exec` does. `get()` and `export()` throw when the policy forbids a key they can read. A grant key can't write at all: `add()` and `describe()` throw `agent grants are read-only` and leave the vault unchanged, whatever the policy says. For an operator key under `MURK_SELF_SCOPE` or `MURK_AGENT`, they check the resulting key against the policy before saving and throw without changing the vault. Once the grant's TTL has passed, `export()` and `get()` of a readable key throw too. `keys()`, `has()` and `length` read only the schema and never check the policy. A plain operator key skips the check unless `MURK_SELF_SCOPE` or `MURK_AGENT` is set. A grant also cannot decrypt out-of-scope secrets, because its key is not a recipient of them, so the policy check is a second guard.
146
+ If the loaded key is an agent grant (from `murk agent grant`), the bindings enforce the vault's agent policy on reads, as `murk agent exec` does.
133
147
 
134
- `get()` and `export()` use the values and policy from the vault's last load. Policy changes and revocations reach them only after you call `load()` again or write through the handle. `add()` and `describe()` reload the vault from disk first, so they always check the current policy, and they refresh the handle afterwards. Grant expiry is checked again on each value read.
148
+ - `get()` and `export()` throw when the policy forbids a secret they can read.
149
+ - A grant key cannot write at all. `add()` and `describe()` throw `agent grants are read-only` and leave the vault unchanged, whatever the policy says.
150
+ - A plain operator key skips the policy check unless `MURK_SELF_SCOPE` or `MURK_AGENT` is set. With either set, `add()` and `describe()` check the resulting secret against the policy before saving. A forbidden write throws and leaves the vault unchanged.
151
+ - `keys()`, `has()` and `length` read only the schema. They never check the policy.
152
+ - A grant cannot decrypt out-of-scope secrets, because its key is not a recipient of them. The policy check is a second guard.
153
+
154
+ `get()` and `export()` use the values and policy from the vault's last load. Policy changes and revocations reach them only after you call `load()` again or write through the handle. `add()` and `describe()` reload the vault from disk first, so they always check the current policy. They refresh the handle afterwards.
155
+
156
+ Expiry is different. Once the grant's TTL has passed, a fresh `load()` fails. A handle loaded earlier fails on `get()` and `export()`.
135
157
 
136
158
  ## Key lookup
137
159
 
138
160
  `load()` finds your key the same way the CLI does:
139
161
 
140
162
  1. `MURK_KEY` (your age secret key) or `MURK_KEY_FILE` (the path to a key file). Set one, not both. murk refuses to load when both are set.
141
- 2. The key file that `murk init` stored under `~/.config/murk/keys/`.
163
+ 2. The key file that `murk init` stored under `~/.config/murk/keys/`. murk finds it by the vault's path, so a key stored for `.murk` does not open a vault at another path.
142
164
 
143
165
  `murk init` also writes a `.env` that points `MURK_KEY_FILE` at that file. On the machine where you ran `murk init`, you do not need to source it. Set the variable yourself in CI, in containers and whenever `MURK_STRICT` or `MURK_AGENT` is set, because both turn off step 2.
144
166
 
167
+ ## Errors
168
+
169
+ Every failure throws an `Error`. When the trust check refuses the vault, its `code` is `'MURK_TRUST'` (see [Trust](#trust)). Every other error has `code` `'GenericFailure'`. The other causes are:
170
+
171
+ - No key is found. See [Key lookup](#key-lookup).
172
+ - Both `MURK_KEY` and `MURK_KEY_FILE` are set.
173
+ - The vault file is missing or invalid. The bindings read `.murk` unless you pass a path. They ignore `MURK_VAULT`, so pass `vaultPath` for any other file.
174
+ - The agent policy forbids a read or a write. See [Agent policy](#agent-policy).
175
+ - A write names an invalid secret or an unknown group.
176
+ - The binding is too old for the vault. See [Unsupported vault version](#unsupported-vault-version).
177
+
178
+ ### Unsupported vault version
179
+
180
+ murk 0.14 saves vaults in format 3.0. A binding older than 0.14 cannot read a 3.0 vault. It throws a plain `Error` with `code` `'GenericFailure'`, not `'MURK_TRUST'`, because the vault is unsupported, not untrusted. A 0.13 binding says:
181
+
182
+ ```text
183
+ vault parse error: unsupported vault version: 3.0. This build of murk supports version 2.x
184
+ ```
185
+
186
+ The fix is to upgrade the package:
187
+
188
+ ```bash
189
+ npm install @interrupted/murk-secrets@latest
190
+ ```
191
+
192
+ From 0.14.1, the message also names the binding and the versions it supports. For a vault with version 99.0, a 0.14.1 binding says:
193
+
194
+ ```text
195
+ vault parse error: unsupported vault version: 99.0. murk-secrets node binding 0.14.1 supports vault versions 2.x and 3.x
196
+ ```
197
+
145
198
  ## Requirements
146
199
 
147
200
  Node.js 18.17 or later on Node 18, or 20.3 or later (not Node 19), the murk CLI, a `.murk` vault in your project and a key (see [Key lookup](#key-lookup)). The addon needs Node-API version 9.
148
201
 
202
+ Prebuilt addons cover these platforms:
203
+
204
+ - macOS on Intel (x64)
205
+ - macOS on Apple silicon (arm64)
206
+ - Linux x64 (glibc)
207
+ - Linux x64 (musl)
208
+ - Linux arm64 (glibc)
209
+ - Linux arm64 (musl)
210
+ - Windows x64
211
+
149
212
  ## License
150
213
 
151
214
  MIT OR Apache-2.0
package/index.js CHANGED
@@ -6,8 +6,13 @@ const { readFileSync } = require('fs')
6
6
  let nativeBinding = null
7
7
  // Which artifact actually loaded. The WASI fallback chain overwrites it with
8
8
  // the flavor it resolved; the late native retry below leaves it alone because
9
- // it only runs while no WASI candidate has been loaded.
9
+ // it only runs while no WASI candidate has been loaded. The take-over check
10
+ // after the load-failure block can also set it.
10
11
  let __napiLoadedBindingTarget = 'native'
12
+ // What this loader's own `requireNative()` calls returned. The check after
13
+ // the load-failure block compares it with `nativeBinding` to tell a binding
14
+ // this loader loaded from one that code outside it put in its place.
15
+ let __napiRequiredNativeBinding = null
11
16
  const loadErrors = []
12
17
 
13
18
  const isMusl = () => {
@@ -89,8 +94,8 @@ function requireNative() {
89
94
  try {
90
95
  const binding = require('@interrupted/murk-secrets-android-arm64')
91
96
  const bindingPackageVersion = require('@interrupted/murk-secrets-android-arm64/package.json').version
92
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
93
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
97
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
98
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
94
99
  }
95
100
  return binding
96
101
  } catch (e) {
@@ -105,8 +110,8 @@ function requireNative() {
105
110
  try {
106
111
  const binding = require('@interrupted/murk-secrets-android-arm-eabi')
107
112
  const bindingPackageVersion = require('@interrupted/murk-secrets-android-arm-eabi/package.json').version
108
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
109
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
113
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
114
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
110
115
  }
111
116
  return binding
112
117
  } catch (e) {
@@ -126,8 +131,8 @@ function requireNative() {
126
131
  try {
127
132
  const binding = require('@interrupted/murk-secrets-win32-x64-gnu')
128
133
  const bindingPackageVersion = require('@interrupted/murk-secrets-win32-x64-gnu/package.json').version
129
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
130
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
134
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
135
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
131
136
  }
132
137
  return binding
133
138
  } catch (e) {
@@ -142,8 +147,8 @@ function requireNative() {
142
147
  try {
143
148
  const binding = require('@interrupted/murk-secrets-win32-x64-msvc')
144
149
  const bindingPackageVersion = require('@interrupted/murk-secrets-win32-x64-msvc/package.json').version
145
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
146
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
150
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
151
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
147
152
  }
148
153
  return binding
149
154
  } catch (e) {
@@ -159,8 +164,8 @@ function requireNative() {
159
164
  try {
160
165
  const binding = require('@interrupted/murk-secrets-win32-ia32-msvc')
161
166
  const bindingPackageVersion = require('@interrupted/murk-secrets-win32-ia32-msvc/package.json').version
162
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
163
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
167
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
168
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
164
169
  }
165
170
  return binding
166
171
  } catch (e) {
@@ -175,8 +180,8 @@ function requireNative() {
175
180
  try {
176
181
  const binding = require('@interrupted/murk-secrets-win32-arm64-msvc')
177
182
  const bindingPackageVersion = require('@interrupted/murk-secrets-win32-arm64-msvc/package.json').version
178
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
179
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
183
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
184
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
180
185
  }
181
186
  return binding
182
187
  } catch (e) {
@@ -194,8 +199,8 @@ function requireNative() {
194
199
  try {
195
200
  const binding = require('@interrupted/murk-secrets-darwin-universal')
196
201
  const bindingPackageVersion = require('@interrupted/murk-secrets-darwin-universal/package.json').version
197
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
198
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
202
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
203
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
199
204
  }
200
205
  return binding
201
206
  } catch (e) {
@@ -210,8 +215,8 @@ function requireNative() {
210
215
  try {
211
216
  const binding = require('@interrupted/murk-secrets-darwin-x64')
212
217
  const bindingPackageVersion = require('@interrupted/murk-secrets-darwin-x64/package.json').version
213
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
214
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
218
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
219
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
215
220
  }
216
221
  return binding
217
222
  } catch (e) {
@@ -226,8 +231,8 @@ function requireNative() {
226
231
  try {
227
232
  const binding = require('@interrupted/murk-secrets-darwin-arm64')
228
233
  const bindingPackageVersion = require('@interrupted/murk-secrets-darwin-arm64/package.json').version
229
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
230
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
234
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
235
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
231
236
  }
232
237
  return binding
233
238
  } catch (e) {
@@ -246,8 +251,8 @@ function requireNative() {
246
251
  try {
247
252
  const binding = require('@interrupted/murk-secrets-freebsd-x64')
248
253
  const bindingPackageVersion = require('@interrupted/murk-secrets-freebsd-x64/package.json').version
249
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
250
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
254
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
255
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
251
256
  }
252
257
  return binding
253
258
  } catch (e) {
@@ -262,8 +267,24 @@ function requireNative() {
262
267
  try {
263
268
  const binding = require('@interrupted/murk-secrets-freebsd-arm64')
264
269
  const bindingPackageVersion = require('@interrupted/murk-secrets-freebsd-arm64/package.json').version
265
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
266
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
270
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
271
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
272
+ }
273
+ return binding
274
+ } catch (e) {
275
+ loadErrors.push(e)
276
+ }
277
+ } else if (process.arch === 'ppc64') {
278
+ try {
279
+ return require('./murk-secrets.freebsd-ppc64.node')
280
+ } catch (e) {
281
+ loadErrors.push(e)
282
+ }
283
+ try {
284
+ const binding = require('@interrupted/murk-secrets-freebsd-ppc64')
285
+ const bindingPackageVersion = require('@interrupted/murk-secrets-freebsd-ppc64/package.json').version
286
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
267
288
  }
268
289
  return binding
269
290
  } catch (e) {
@@ -283,8 +304,8 @@ function requireNative() {
283
304
  try {
284
305
  const binding = require('@interrupted/murk-secrets-linux-x64-musl')
285
306
  const bindingPackageVersion = require('@interrupted/murk-secrets-linux-x64-musl/package.json').version
286
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
287
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
307
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
308
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
288
309
  }
289
310
  return binding
290
311
  } catch (e) {
@@ -299,8 +320,8 @@ function requireNative() {
299
320
  try {
300
321
  const binding = require('@interrupted/murk-secrets-linux-x64-gnu')
301
322
  const bindingPackageVersion = require('@interrupted/murk-secrets-linux-x64-gnu/package.json').version
302
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
303
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
323
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
324
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
304
325
  }
305
326
  return binding
306
327
  } catch (e) {
@@ -317,8 +338,8 @@ function requireNative() {
317
338
  try {
318
339
  const binding = require('@interrupted/murk-secrets-linux-arm64-musl')
319
340
  const bindingPackageVersion = require('@interrupted/murk-secrets-linux-arm64-musl/package.json').version
320
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
321
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
341
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
342
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
322
343
  }
323
344
  return binding
324
345
  } catch (e) {
@@ -333,8 +354,8 @@ function requireNative() {
333
354
  try {
334
355
  const binding = require('@interrupted/murk-secrets-linux-arm64-gnu')
335
356
  const bindingPackageVersion = require('@interrupted/murk-secrets-linux-arm64-gnu/package.json').version
336
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
337
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
357
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
358
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
338
359
  }
339
360
  return binding
340
361
  } catch (e) {
@@ -351,8 +372,8 @@ function requireNative() {
351
372
  try {
352
373
  const binding = require('@interrupted/murk-secrets-linux-arm-musleabihf')
353
374
  const bindingPackageVersion = require('@interrupted/murk-secrets-linux-arm-musleabihf/package.json').version
354
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
355
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
375
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
376
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
356
377
  }
357
378
  return binding
358
379
  } catch (e) {
@@ -367,8 +388,8 @@ function requireNative() {
367
388
  try {
368
389
  const binding = require('@interrupted/murk-secrets-linux-arm-gnueabihf')
369
390
  const bindingPackageVersion = require('@interrupted/murk-secrets-linux-arm-gnueabihf/package.json').version
370
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
371
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
391
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
392
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
372
393
  }
373
394
  return binding
374
395
  } catch (e) {
@@ -385,8 +406,8 @@ function requireNative() {
385
406
  try {
386
407
  const binding = require('@interrupted/murk-secrets-linux-loong64-musl')
387
408
  const bindingPackageVersion = require('@interrupted/murk-secrets-linux-loong64-musl/package.json').version
388
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
389
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
409
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
410
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
390
411
  }
391
412
  return binding
392
413
  } catch (e) {
@@ -401,8 +422,8 @@ function requireNative() {
401
422
  try {
402
423
  const binding = require('@interrupted/murk-secrets-linux-loong64-gnu')
403
424
  const bindingPackageVersion = require('@interrupted/murk-secrets-linux-loong64-gnu/package.json').version
404
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
405
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
425
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
426
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
406
427
  }
407
428
  return binding
408
429
  } catch (e) {
@@ -419,8 +440,8 @@ function requireNative() {
419
440
  try {
420
441
  const binding = require('@interrupted/murk-secrets-linux-riscv64-musl')
421
442
  const bindingPackageVersion = require('@interrupted/murk-secrets-linux-riscv64-musl/package.json').version
422
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
423
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
443
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
444
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
424
445
  }
425
446
  return binding
426
447
  } catch (e) {
@@ -435,8 +456,8 @@ function requireNative() {
435
456
  try {
436
457
  const binding = require('@interrupted/murk-secrets-linux-riscv64-gnu')
437
458
  const bindingPackageVersion = require('@interrupted/murk-secrets-linux-riscv64-gnu/package.json').version
438
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
439
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
459
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
460
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
440
461
  }
441
462
  return binding
442
463
  } catch (e) {
@@ -452,8 +473,8 @@ function requireNative() {
452
473
  try {
453
474
  const binding = require('@interrupted/murk-secrets-linux-ppc64-gnu')
454
475
  const bindingPackageVersion = require('@interrupted/murk-secrets-linux-ppc64-gnu/package.json').version
455
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
456
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
476
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
477
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
457
478
  }
458
479
  return binding
459
480
  } catch (e) {
@@ -468,8 +489,8 @@ function requireNative() {
468
489
  try {
469
490
  const binding = require('@interrupted/murk-secrets-linux-s390x-gnu')
470
491
  const bindingPackageVersion = require('@interrupted/murk-secrets-linux-s390x-gnu/package.json').version
471
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
472
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
492
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
493
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
473
494
  }
474
495
  return binding
475
496
  } catch (e) {
@@ -488,8 +509,8 @@ function requireNative() {
488
509
  try {
489
510
  const binding = require('@interrupted/murk-secrets-openharmony-arm64')
490
511
  const bindingPackageVersion = require('@interrupted/murk-secrets-openharmony-arm64/package.json').version
491
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
492
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
512
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
513
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
493
514
  }
494
515
  return binding
495
516
  } catch (e) {
@@ -504,8 +525,8 @@ function requireNative() {
504
525
  try {
505
526
  const binding = require('@interrupted/murk-secrets-openharmony-x64')
506
527
  const bindingPackageVersion = require('@interrupted/murk-secrets-openharmony-x64/package.json').version
507
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
508
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
528
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
529
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
509
530
  }
510
531
  return binding
511
532
  } catch (e) {
@@ -520,8 +541,8 @@ function requireNative() {
520
541
  try {
521
542
  const binding = require('@interrupted/murk-secrets-openharmony-arm')
522
543
  const bindingPackageVersion = require('@interrupted/murk-secrets-openharmony-arm/package.json').version
523
- if (bindingPackageVersion !== '0.14.1' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
524
- throw new Error(`Native binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
544
+ if (bindingPackageVersion !== '0.15.0' && process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
545
+ throw new Error(`Native binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
525
546
  }
526
547
  return binding
527
548
  } catch (e) {
@@ -585,6 +606,7 @@ const forceWasi =
585
606
 
586
607
  if (!forceWasi) {
587
608
  nativeBinding = requireNative()
609
+ __napiRequiredNativeBinding = nativeBinding
588
610
  }
589
611
 
590
612
  if (!nativeBinding || forceWasi) {
@@ -661,8 +683,8 @@ if (!nativeBinding || forceWasi) {
661
683
  if (!candidateFailed) {
662
684
  if (process.env.NAPI_RS_ENFORCE_VERSION_CHECK && process.env.NAPI_RS_ENFORCE_VERSION_CHECK !== '0') {
663
685
  const bindingPackageVersion = require('@interrupted/murk-secrets-wasm32-wasi/package.json').version
664
- if (bindingPackageVersion !== '0.14.1') {
665
- throw new Error(`WASI binding package version mismatch, expected 0.14.1 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
686
+ if (bindingPackageVersion !== '0.15.0') {
687
+ throw new Error(`WASI binding package version mismatch, expected 0.15.0 but got ${bindingPackageVersion}. You can reinstall dependencies to fix this issue.`)
666
688
  }
667
689
  }
668
690
  wasiBinding = require('@interrupted/murk-secrets-wasm32-wasi')
@@ -686,6 +708,7 @@ if (!nativeBinding || forceWasi) {
686
708
  !__napiWasiFlavorRequested
687
709
  ) {
688
710
  nativeBinding = requireNative()
711
+ __napiRequiredNativeBinding = nativeBinding
689
712
  }
690
713
  if ((forceWasiError || __napiWasiFlavorRequested) && !wasiBindingLoaded) {
691
714
  const error = new Error(
@@ -713,6 +736,40 @@ if (!nativeBinding) {
713
736
  throw new Error(`Failed to load native binding`)
714
737
  }
715
738
 
739
+ // A package can patch its own fallback in front of the load-failure check
740
+ // above, e.g. a WebContainer download through `napi-postinstall/fallback`.
741
+ // That fallback swaps `nativeBinding` for a generated WASI loader, which has
742
+ // already stamped its own flavor, while the target above still says 'native'.
743
+ // Take that flavor over, or the CommonJS stamp throws a conflict and the ESM
744
+ // export reports the wrong artifact. Three limits keep the conflict check:
745
+ // - only a binding this loader did not load itself, so a native addon whose
746
+ // `#[napi(module_exports)]` hook claims the name is still rejected;
747
+ // - only an own data property, read through its descriptor, so no addon
748
+ // getter runs here, and it must read back the same, as the stamp reads it;
749
+ // - only a flavor in `__napiWasiFlavors`, the ones this loader's own WASI
750
+ // chain can report ('wasm32-wasi' for a package without a WASI target).
751
+ // This is metadata and never fails a load: a throwing Proxy trap keeps 'native'.
752
+ if (
753
+ __napiLoadedBindingTarget === 'native' &&
754
+ nativeBinding !== __napiRequiredNativeBinding
755
+ ) {
756
+ try {
757
+ const __napiBindingTargetDescriptor = Object.getOwnPropertyDescriptor(
758
+ nativeBinding,
759
+ '__napiBindingTarget',
760
+ )
761
+ if (
762
+ __napiBindingTargetDescriptor &&
763
+ __napiWasiFlavors.indexOf(__napiBindingTargetDescriptor.value) !== -1 &&
764
+ nativeBinding.__napiBindingTarget === __napiBindingTargetDescriptor.value
765
+ ) {
766
+ __napiLoadedBindingTarget = __napiBindingTargetDescriptor.value
767
+ }
768
+ } catch {
769
+ // keep 'native'
770
+ }
771
+ }
772
+
716
773
  function __napiStampBindingTarget(exportsObject, target) {
717
774
  if (
718
775
  Object.prototype.hasOwnProperty.call(exportsObject, '__napiBindingTarget')
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@interrupted/murk-secrets",
3
- "version": "0.14.1",
4
- "description": "Node.js/TypeScript bindings for murk — encrypted secrets manager",
3
+ "version": "0.15.0",
4
+ "description": "Node.js/TypeScript bindings for murk, an encrypted secrets manager for developers",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "license": "MIT OR Apache-2.0",
@@ -41,7 +41,7 @@
41
41
  "format": "biome check --write"
42
42
  },
43
43
  "devDependencies": {
44
- "@biomejs/biome": "^2.4.9",
44
+ "@biomejs/biome": "^2.6.5",
45
45
  "@napi-rs/cli": "^3"
46
46
  },
47
47
  "engines": {
@@ -54,12 +54,12 @@
54
54
  "LICENSE-APACHE"
55
55
  ],
56
56
  "optionalDependencies": {
57
- "@interrupted/murk-secrets-darwin-x64": "0.14.1",
58
- "@interrupted/murk-secrets-darwin-arm64": "0.14.1",
59
- "@interrupted/murk-secrets-linux-x64-gnu": "0.14.1",
60
- "@interrupted/murk-secrets-linux-x64-musl": "0.14.1",
61
- "@interrupted/murk-secrets-linux-arm64-gnu": "0.14.1",
62
- "@interrupted/murk-secrets-linux-arm64-musl": "0.14.1",
63
- "@interrupted/murk-secrets-win32-x64-msvc": "0.14.1"
57
+ "@interrupted/murk-secrets-darwin-x64": "0.15.0",
58
+ "@interrupted/murk-secrets-darwin-arm64": "0.15.0",
59
+ "@interrupted/murk-secrets-linux-x64-gnu": "0.15.0",
60
+ "@interrupted/murk-secrets-linux-x64-musl": "0.15.0",
61
+ "@interrupted/murk-secrets-linux-arm64-gnu": "0.15.0",
62
+ "@interrupted/murk-secrets-linux-arm64-musl": "0.15.0",
63
+ "@interrupted/murk-secrets-win32-x64-msvc": "0.15.0"
64
64
  }
65
65
  }