Skip to content

Secrets plugin api#1902

Merged
RohitKushvaha01 merged 5 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:main
Feb 28, 2026
Merged

Secrets plugin api#1902
RohitKushvaha01 merged 5 commits intoAcode-Foundation:mainfrom
RohitKushvaha01:main

Conversation

@RohitKushvaha01
Copy link
Member

@RohitKushvaha01 RohitKushvaha01 commented Feb 26, 2026

Closes #1791

@RohitKushvaha01 RohitKushvaha01 marked this pull request as draft February 26, 2026 09:02
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Feb 26, 2026

Greptile Summary

Adds encrypted secrets storage API to the plugin system, allowing plugins to securely store and retrieve sensitive data.

  • Introduced get_secret and set_secret actions in Java that use EncryptedPreferenceManager for secure storage
  • Added corresponding getSecret() and setSecret() methods in JavaScript API
  • Properly validates plugin tokens before allowing access to secrets
  • Each plugin's secrets are isolated using the plugin ID as the preference namespace

Confidence Score: 4/5

  • This PR is safe to merge with minimal risk
  • Clean implementation following existing patterns, with proper token validation and secure encrypted storage. The getPluginIdFromToken reverse lookup has O(n) complexity but is acceptable for typical plugin counts.
  • No files require special attention

Important Files Changed

Filename Overview
src/plugins/pluginContext/src/android/Tee.java Adds encrypted secret storage with get_secret and set_secret actions, using token validation and EncryptedPreferenceManager for secure storage
src/plugins/pluginContext/www/PluginContext.js Adds getSecret and setSecret methods that call the Java secrets API, following existing method patterns

Sequence Diagram

sequenceDiagram
    participant Plugin as Plugin (JS)
    participant PC as PluginContext.js
    participant Tee as Tee.java
    participant EPM as EncryptedPreferenceManager
    
    Plugin->>PC: getSecret(key, defaultValue)
    PC->>Tee: exec("get_secret", [uuid, key, defaultValue])
    Tee->>Tee: getPluginIdFromToken(uuid)
    alt token invalid
        Tee-->>PC: error("INVALID_TOKEN")
    else token valid
        Tee->>EPM: new EncryptedPreferenceManager(context, pluginId)
        Tee->>EPM: getString(key, defaultValue)
        EPM-->>Tee: encrypted value
        Tee-->>PC: success(value)
    end
    PC-->>Plugin: resolve(value)
    
    Plugin->>PC: setSecret(key, value)
    PC->>Tee: exec("set_secret", [uuid, key, value])
    Tee->>Tee: getPluginIdFromToken(uuid)
    alt token invalid
        Tee-->>PC: error("INVALID_TOKEN")
    else token valid
        Tee->>EPM: new EncryptedPreferenceManager(context, pluginId)
        Tee->>EPM: setString(key, value)
        EPM-->>Tee: success
        Tee-->>PC: success()
    end
    PC-->>Plugin: resolve()
Loading

Last reviewed commit: 728f743

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

RohitKushvaha01 and others added 3 commits February 28, 2026 11:26
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
@RohitKushvaha01
Copy link
Member Author

@greptileai

@RohitKushvaha01 RohitKushvaha01 self-assigned this Feb 28, 2026
@RohitKushvaha01 RohitKushvaha01 marked this pull request as ready for review February 28, 2026 06:06
@RohitKushvaha01 RohitKushvaha01 added the plugin api It represents, plugins specific apis enhancement label Feb 28, 2026
Copy link
Member

@UnschooledGamer UnschooledGamer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@RohitKushvaha01 RohitKushvaha01 merged commit edee414 into Acode-Foundation:main Feb 28, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin api It represents, plugins specific apis enhancement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

isolated secrets API for plugins

2 participants