Skip to content

Conversation

@itzTheMeow
Copy link

@itzTheMeow itzTheMeow commented Nov 28, 2025

Adds an environment variable OP_SHARED_LIB_PATH to support loading a custom shared library file location.

Adds a WithSharedLibraryPath option to support loading a custom shared library file location.

This is useful for sandboxed contexts (such as nix) which don't have access to the /opt/1Password (or other) directory and must copy the library into the sandbox.

Related SDK PRs:

@itzTheMeow
Copy link
Author

Perhaps I could also PR this to the other SDKs if this is approved?

@Marton6
Copy link
Member

Marton6 commented Dec 2, 2025

Thank you for the contribution! I like the idea of making the shared library path configurable in the SDKs.

However, I'm not convinced is the best way to achieve this. This approach conflicts with one of the design goals we had for the SDKs. Essentially, with this change, every app that uses the SDKs (with the desktop app integration) will start to behave differently depending on the value of an environment variable read by the SDKs (OP_SHARED_LIB_PATH).

This is not something a typical developer would expect of an SDK.

In my opinion, a better way to make this configurable would be to let integration developers opt into this behavior explicitly, e.g. by using a custom configuration function:

	onepassword.NewClient(context.Background(),
		onepassword.WithDesktopAppIntegration("YourAccountName"),
		onepassword.WithCustomDesktopAppPath("/my/custom/path/"),
	)

I think we can achieve this by adding a new field to the config and passing it into the GetSharedLibCore function here.

What do you think, @AndyTitu ?

@AndyTitu
Copy link
Contributor

AndyTitu commented Dec 2, 2025

I agree with the above comment. Moreover, we should make sure this change is consistent across all SDKs (including python and JS).

@itzTheMeow
Copy link
Author

itzTheMeow commented Dec 5, 2025

I changed this to add a WithSharedLibraryPath function.
I opted to pass the custom path to find1PasswordLibPath() so that if the custom path is not found, it will fall back to the desktop app locations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants