https://github.com/hansemannn/ti.onepassword
🔐 Support the 1Password App Extension with Titanium Mobile
https://github.com/hansemannn/ti.onepassword
1password appcelerator titanium
Last synced: 11 months ago
JSON representation
🔐 Support the 1Password App Extension with Titanium Mobile
- Host: GitHub
- URL: https://github.com/hansemannn/ti.onepassword
- Owner: hansemannn
- License: other
- Created: 2016-09-25T22:27:31.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2021-04-06T12:02:34.000Z (about 5 years ago)
- Last Synced: 2025-03-29T01:11:23.215Z (about 1 year ago)
- Topics: 1password, appcelerator, titanium
- Language: Objective-C
- Homepage:
- Size: 1 MB
- Stars: 20
- Watchers: 4
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ti.OnePassword
Support for the AgileBits [1Password App Extention](https://github.com/AgileBits/onepassword-app-extension) in Titanium Mobile to open 1Password for selecting credentials.

Requirements
---------------
- [x] iOS 11+
- [x] Titanium SDK 9.2.0+
Features
---------------
- [x] Check if 1Password is installed and can be used
- [x] Receive login credentials from 1Password
- [x] Store login credentials in 1Password
- [x] Change login credentials in 1Password
Usage
---------------
Add the following url-scheme to the `` section of your `tiapp.xml` like this:
```xml
LSApplicationQueriesSchemes
org-appextension-feature-password-management
```
Require the module:
```js
import OnePassword from 'ti.onepassword';
```
Check if the application supports the 1Password App Extension to show/hide a custom 1Password button:
```js
const isAvailable = OnePassword.isAppExtensionAvailable();
```
Request login credentials from 1Password:
```js
OnePassword.findLoginForURLString({
url: 'https://appcelerator.com',
callback: event => {
// Check if the operation succeeded
if (!event.success) {
alert(`Login could not be received: ${event.error}`);
return;
}
// Success - Prefill the form fields
usernameField.setValue(event.credentials.username);
passwordField.setValue(event.credentials.password);
}
});
```
Add a new login to 1Password:
```js
OnePassword.storeLoginForURLString({
url: 'https://appcelerator.com',
credentials: {
username: 'my_username',
password: 'my_password'
},
options: {
password_min_length: 6,
password_max_length: 18
},
callback: event => {
if (!event.success) {
alert(`Credentials could not be added to 1Password: ${event.error}`);
return;
}
// <-- Success case
}
});
```
Change an existing login in 1Password:
```js
OnePassword.changePasswordForLoginForURLString({
url: 'https://appcelerator.com',
credentials: {
username: 'my_username',
password: 'my_new_password'
},
options: {
password_min_length: 6,
password_max_length: 18
},
callback: event => {
if (!e.success) {
alert(`Credentials could not be updated in 1Password: ${event.error}`);
return;
}
// <-- Success case
}
});
```
#### Available credentials
- [x] url_string
- [x] username
- [x] password
- [x] totp
- [x] login_title
- [x] notes
- [x] section_title
- [x] fields
- [x] returned_fields
- [x] old_password
- [x] password_generator_options
#### Available options
- [x] password_min_length
- [x] password_max_length
- [x] password_require_digits
- [x] password_require_symbols
- [x] password_forbidden_characters
Example
---------------
Check `example/app.js` for a basic example.
Author
---------------
Hans Knoechel ([@hansemannnn](https://twitter.com/hansemannnn) / [Web](http://hans-knoechel.de))
License
---------------
Apache 2.0
Contributing
---------------
Code contributions are greatly appreciated, please submit a new [pull request](https://github.com/hansemannn/ti.onepassword/pull/new/master)!