lajg-dev_Obsidian-Plugin-GP.../styles.css
scott 99b77ff3c2 [Implement the openpgpjs encryption backend that 1.1.5 already scaffolds
in settings. Selecting the "openpgpjs" GPG Library now performs all
crypto in-app via OpenPGP.js instead of the native gpg binary, so the
plugin works on mobile (Android/iOS) as well as desktop. The native
"CLI commands" path is unchanged and remains the choice for OS keychain
and YubiKey users.]

feat: implement OpenPGP.js backend for mobile support

The pgpLibrary setting and its "openpgpjs" option already existed in
1.1.5, but choosing it hid the native UI without providing an
implementation. This adds that implementation as an opt-in second
backend, leaving the native gpg path fully intact.

Changes:
- src/openpgp.ts: OpenPGP.js getListPublicKey/gpgEncrypt/gpgDecrypt,
  an in-memory passphrase cache, and browser-safe base64 helpers.
- src/PassphraseModal.ts: prompts for the private-key passphrase
  (mobile has no pinentry/gpg-agent).
- src/gpg.ts: the three crypto functions dispatch on settings.pgpLibrary;
  child_process is now required lazily so the module loads on mobile.
- src/Settings.ts: adds pgpPublicKeyArmored, pgpPrivateKeyArmored,
  pgpPassphrase, pgpPassphraseCacheMinutes; guards process.platform.
- src/SettingsTab.ts: renders armored-key/passphrase/cache UI in the
  openpgpjs branch (instead of only hiding native settings); fs is now
  required lazily; hides the native sign toggle in openpgpjs mode.
- src/EncryptModal.ts / src/DecryptPreviewModal.ts: openpgpjs branches
  (single configured key, passphrase prompt + cache, browser-safe base64).
- manifest.json: isDesktopOnly false. styles.css: .gpg-key-textarea.
- README.md: documents the openpgpjs library option.

The base64 wire format is identical between backends, so blocks encrypted
with native gpg and with OpenPGP.js are interchangeable for the same key.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-26 11:17:31 +10:00

52 lines
No EOL
5.9 KiB
CSS

.text-color-orange {
color: orange;
}
.text-color-green {
color: green;
}
.text-color-red {
color: red;
}
.div-spacer {
height: 20px;
}
.gpg-decrypt-div {
display: inline-block;
vertical-align: middle;
}
.gpg-decrypt-a {
background-color: var(--text-faint);
mask-image: url('data:image/svg+xml,<svg width="360" height="60" version="1.1" viewBox="0 0 95.25 15.875" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-67.168 -52.917)"><g stroke-width=".22324" aria-label="SECRET"><path d="m95.294 68.262q-2.0574 0-3.2766-1.0668-1.2192-1.0858-1.2192-2.9718h1.8859q0 1.1049 0.70485 1.7336t1.905 0.62865q1.143 0 1.8098-0.62865 0.6858-0.6477 0.6858-1.7145 0-0.8001-0.43815-1.3906-0.43815-0.6096-1.2382-0.81915l-2.0574-0.55245q-1.3526-0.381-2.1526-1.3716-0.78105-1.0096-0.78105-2.3812 0-1.124 0.4953-1.9622 0.51435-0.85725 1.4287-1.3144 0.9144-0.47625 2.1146-0.47625 1.2192 0 2.1336 0.47625 0.93345 0.4572 1.4478 1.2954t0.51435 1.9431h-1.8669q0-0.9144-0.62865-1.4859-0.6096-0.5715-1.6002-0.5715t-1.6002 0.5715q-0.59055 0.5715-0.59055 1.4859 0 0.74295 0.40005 1.2573 0.40005 0.4953 1.124 0.70485l2.1146 0.5715q1.4288 0.381 2.2288 1.4668 0.8001 1.0668 0.8001 2.5527 0 1.2192-0.5334 2.1336-0.5334 0.89535-1.524 1.3906-0.97155 0.4953-2.286 0.4953z"/><path d="m102.78 68.072v-13.906h8.0962v1.6954h-6.2293v4.1338h5.5626v1.6383h-5.5626v4.7434h6.2293v1.6954z"/><path d="m118.23 68.262q-1.924 0-3.067-1.0668-1.124-1.0858-1.124-2.9718v-6.2294q0-1.8669 1.124-2.9337 1.143-1.0858 3.067-1.0858 1.905 0 3.029 1.0858 1.143 1.0858 1.143 2.9337h-1.886q0-1.124-0.6096-1.7336t-1.6764-0.6096q-1.0858 0-1.6954 0.6096t-0.6096 1.7336v6.2294q0 1.143 0.6096 1.7526t1.6954 0.6096q1.0668 0 1.6764-0.6096t0.6096-1.7526h1.886q0 1.8669-1.143 2.9528-1.124 1.0858-3.029 1.0858z"/><path d="m125.49 68.072v-13.906h4.3053q1.2764 0 2.2288 0.51435 0.9525 0.4953 1.4859 1.4097 0.5334 0.89535 0.5334 2.1146 0 1.4097-0.7239 2.4194-0.70485 1.0096-1.886 1.4288l2.8004 6.0198h-2.0764l-2.648-5.8102h-2.1526v5.8102zm1.8669-7.4866h2.4384q1.0668 0 1.6764-0.6477 0.62865-0.6477 0.62865-1.7145 0-1.0858-0.62865-1.7336t-1.6764-0.6477h-2.4384z"/><path d="m137.07 68.072v-13.906h8.0962v1.6954h-6.2294v4.1338h5.5626v1.6383h-5.5626v4.7434h6.2294v1.6954z"/><path d="m151.43 68.072v-12.192h-3.7719v-1.7145h9.4107v1.7145h-3.7528v12.192z"/></g><g id="XMLID_509_" transform="matrix(.057518 0 0 .048106 70.113 52.917)"><path id="XMLID_510_" d="m65 330h200c8.284 0 15-6.716 15-15v-170c0-8.284-6.716-15-15-15h-15v-45c0-46.869-38.131-85-85-85s-85 38.131-85 85v45h-15c-8.284 0-15 6.716-15 15v170c0 8.284 6.716 15 15 15zm115-95.014v20.014c0 8.284-6.716 15-15 15s-15-6.716-15-15v-20.014c-6.068-4.565-10-11.824-10-19.986 0-13.785 11.215-25 25-25s25 11.215 25 25c0 8.162-3.932 15.421-10 19.986zm-70-149.99c0-30.327 24.673-55 55-55s55 24.673 55 55v45h-110z"/></g></g></svg>');
-webkit-mask-image: url('data:image/svg+xml,<svg width="360" height="60" version="1.1" viewBox="0 0 95.25 15.875" xmlns="http://www.w3.org/2000/svg"><g transform="translate(-67.168 -52.917)"><g stroke-width=".22324" aria-label="SECRET"><path d="m95.294 68.262q-2.0574 0-3.2766-1.0668-1.2192-1.0858-1.2192-2.9718h1.8859q0 1.1049 0.70485 1.7336t1.905 0.62865q1.143 0 1.8098-0.62865 0.6858-0.6477 0.6858-1.7145 0-0.8001-0.43815-1.3906-0.43815-0.6096-1.2382-0.81915l-2.0574-0.55245q-1.3526-0.381-2.1526-1.3716-0.78105-1.0096-0.78105-2.3812 0-1.124 0.4953-1.9622 0.51435-0.85725 1.4287-1.3144 0.9144-0.47625 2.1146-0.47625 1.2192 0 2.1336 0.47625 0.93345 0.4572 1.4478 1.2954t0.51435 1.9431h-1.8669q0-0.9144-0.62865-1.4859-0.6096-0.5715-1.6002-0.5715t-1.6002 0.5715q-0.59055 0.5715-0.59055 1.4859 0 0.74295 0.40005 1.2573 0.40005 0.4953 1.124 0.70485l2.1146 0.5715q1.4288 0.381 2.2288 1.4668 0.8001 1.0668 0.8001 2.5527 0 1.2192-0.5334 2.1336-0.5334 0.89535-1.524 1.3906-0.97155 0.4953-2.286 0.4953z"/><path d="m102.78 68.072v-13.906h8.0962v1.6954h-6.2293v4.1338h5.5626v1.6383h-5.5626v4.7434h6.2293v1.6954z"/><path d="m118.23 68.262q-1.924 0-3.067-1.0668-1.124-1.0858-1.124-2.9718v-6.2294q0-1.8669 1.124-2.9337 1.143-1.0858 3.067-1.0858 1.905 0 3.029 1.0858 1.143 1.0858 1.143 2.9337h-1.886q0-1.124-0.6096-1.7336t-1.6764-0.6096q-1.0858 0-1.6954 0.6096t-0.6096 1.7336v6.2294q0 1.143 0.6096 1.7526t1.6954 0.6096q1.0668 0 1.6764-0.6096t0.6096-1.7526h1.886q0 1.8669-1.143 2.9528-1.124 1.0858-3.029 1.0858z"/><path d="m125.49 68.072v-13.906h4.3053q1.2764 0 2.2288 0.51435 0.9525 0.4953 1.4859 1.4097 0.5334 0.89535 0.5334 2.1146 0 1.4097-0.7239 2.4194-0.70485 1.0096-1.886 1.4288l2.8004 6.0198h-2.0764l-2.648-5.8102h-2.1526v5.8102zm1.8669-7.4866h2.4384q1.0668 0 1.6764-0.6477 0.62865-0.6477 0.62865-1.7145 0-1.0858-0.62865-1.7336t-1.6764-0.6477h-2.4384z"/><path d="m137.07 68.072v-13.906h8.0962v1.6954h-6.2294v4.1338h5.5626v1.6383h-5.5626v4.7434h6.2294v1.6954z"/><path d="m151.43 68.072v-12.192h-3.7719v-1.7145h9.4107v1.7145h-3.7528v12.192z"/></g><g id="XMLID_509_" transform="matrix(.057518 0 0 .048106 70.113 52.917)"><path id="XMLID_510_" d="m65 330h200c8.284 0 15-6.716 15-15v-170c0-8.284-6.716-15-15-15h-15v-45c0-46.869-38.131-85-85-85s-85 38.131-85 85v45h-15c-8.284 0-15 6.716-15 15v170c0 8.284 6.716 15 15 15zm115-95.014v20.014c0 8.284-6.716 15-15 15s-15-6.716-15-15v-20.014c-6.068-4.565-10-11.824-10-19.986 0-13.785 11.215-25 25-25s25 11.215 25 25c0 8.162-3.932 15.421-10 19.986zm-70-149.99c0-30.327 24.673-55 55-55s55 24.673 55 55v45h-110z"/></g></g></svg>');
mask-size: contain;
-webkit-mask-size: contain;
display: inline-block;
width: 6em;
height: 1em;
vertical-align: text-top;
margin-left: 0px;
margin-top: 0px;
cursor: pointer;
}
.gpg-code-preview {
background-color: #e3e8f4;
color: black;
border-radius: 8px;
padding: 20px
}
.gpg-plain-text-area {
height: 200px;
width: 100%;
}
.gpg-code-sign-ok {
background-color: #e3f4e4;
color: black;
border-radius: 8px;
padding: 20px;
font-size: 0.7em;
}
.gpg-key-textarea {
width: 100%;
font-family: monospace;
font-size: 11px;
}