Skip to content

fix(docs): DSPX-2409 replace SDK README code example with working code#3055

Merged
marythought merged 5 commits intomainfrom
fix/dspx-2409
Feb 11, 2026
Merged

fix(docs): DSPX-2409 replace SDK README code example with working code#3055
marythought merged 5 commits intomainfrom
fix/dspx-2409

Conversation

@marythought
Copy link
Copy Markdown
Contributor

@marythought marythought commented Feb 6, 2026

Proposed Changes

Fixed Issues

  • Removed incorrect mtls import reference - The README referenced a non-existent mtls.NewGRPCAuthorizer(creds) function
  • Fixed API method calls - Changed NewTDFReader() to LoadTDF() and corrected CreateTDF() parameters
  • Fixed incomplete imports - Added all necessary imports that were missing

Improvements to Example Code

  • Made example fully functional - All variables are now properly defined with realistic localhost values
  • Added comprehensive comments - Explains what each section does, including the authorization/entitlement flow
  • Used quickstart attribute - Changed to https://opentdf.io/attr/department/value/finance which is created in the quickstart guide
  • Added HTTP support - Included sdk.WithInsecurePlaintextConn() for local development

Documentation Enhancements

  • Added link to SDK Quickstart Guide at the top of the README
  • Changed header from "Quick Start" to "Example code" to differentiate from supported SDK quickstart
  • Added Configuration Values table - Shows exactly which values need to be replaced and their defaults
  • Added Prerequisites section - Clear steps needed before running the example
  • Added Expected Output - Shows what users should see when they run the code
  • Added hosted version option - Notes that users can use a hosted platform instead of local quickstart

Developer Experience

  • Verified example compiles - Tested that the code builds without errors
  • Made copy-paste ready - All placeholder values are clearly marked and documented
  • Aligned with quickstart guide - Uses same ports and configuration as the official quickstart

Checklist

  • I have added or updated unit tests
  • I have added or updated integration tests (if appropriate)
  • I have added or updated documentation

Testing Instructions

@marythought marythought requested review from a team as code owners February 6, 2026 23:54
@github-actions github-actions Bot added the comp:sdk A software development kit, including library, for client applications and inter-service communicati label Feb 6, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @marythought, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the sdk/README.md by revamping the Go SDK code example. The primary goal is to provide a fully functional, accurate, and user-friendly demonstration of TDF creation and decryption, addressing previous inaccuracies and improving the overall developer experience. The changes include correcting API usage, adding comprehensive documentation, and ensuring the example is ready for immediate use with local OpenTDF quickstart environments.

Highlights

  • Code Example Correction: Replaced a non-existent mtls import, fixed CreateTDF parameters and NewTDFReader to LoadTDF calls, and added all necessary imports to ensure the Go SDK example is functional.
  • Enhanced Example Functionality: The example now uses realistic localhost values, includes comprehensive comments, utilizes a quickstart attribute, and supports HTTP for local development, making it fully operational and easy to understand.
  • Improved Documentation: Added a link to the SDK Quickstart Guide, renamed the section header to "Example code," and included detailed tables for configuration values, prerequisites, and expected output, alongside an option for hosted platforms.
  • Developer Experience Focus: The updated example is verified to compile, designed to be copy-paste ready with clear placeholders, and aligns with the official quickstart guide's ports and configurations.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • sdk/README.md
    • Added a prominent link to the OpenTDF SDK Quickstart Guide at the top.
    • Renamed the "Quick Start" section to "Example code" to better reflect its content.
    • Replaced the previous non-functional Go code snippet with a complete, working example demonstrating TDF creation and decryption.
    • Corrected SDK initialization, CreateTDF parameters (now takes a pointer to bytes.Buffer), and changed NewTDFReader to LoadTDF.
    • Ensured all necessary Go imports are present and added error handling with log.Fatalf.
    • Introduced placeholder configuration values for platformEndpoint, clientID, clientSecret, keycloakURL, and dataAttribute, aligning with a local quickstart setup.
    • Added sdk.WithInsecurePlaintextConn() for local HTTP development.
    • Included detailed sections for "Configuration Values," "Prerequisites," and "Expected Output" to guide users.
    • Expanded on "Authentication Options" by providing code snippets for Client Credentials, TLS/mTLS, Custom OAuth2 Token Source, and Token Exchange.
Activity
  • The author, marythought, has outlined a comprehensive set of proposed changes covering bug fixes, example code improvements, documentation enhancements, and developer experience considerations.
  • The checklist for unit tests, integration tests, and documentation updates remains unchecked, indicating these aspects are either pending or not applicable to this specific change.
  • No specific testing instructions were provided beyond the general expectation that the example compiles and is copy-paste ready.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.


Code once broken, now made new, Docs updated, clear and true. SDK shines, a guiding light, For TDF, day and night.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@github-actions github-actions Bot added the size/m label Feb 6, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request significantly improves the SDK's README by replacing a broken code example with a fully functional and well-documented one. The new example is much clearer, follows best practices, and is aligned with the quickstart guide. The addition of prerequisites, configuration details, and expected output makes it much easier for new users to get started. I have one minor suggestion to improve the clarity of an authentication snippet.

Comment thread sdk/README.md
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 6, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 183.341077ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 103.044963ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 368.842703ms
Throughput 271.12 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 39.384806951s
Average Latency 392.010373ms
Throughput 126.95 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 7, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 193.931599ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 104.585103ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 359.101718ms
Throughput 278.47 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 40.270902692s
Average Latency 401.147421ms
Throughput 124.16 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 7, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 193.424887ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 102.345505ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 369.074502ms
Throughput 270.95 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 38.94492211s
Average Latency 387.650003ms
Throughput 128.39 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Feb 7, 2026

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 194.609108ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 105.719332ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 384.763832ms
Throughput 259.90 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 39.911035363s
Average Latency 396.998721ms
Throughput 125.28 requests/second

@dmihalcik-virtru
Copy link
Copy Markdown
Member

You'll need to rebase/merge past #3065 to get a green PR

Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
@github-actions
Copy link
Copy Markdown
Contributor

X-Test Failure Report

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 195.399698ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 104.999901ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 364.636729ms
Throughput 274.25 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 39.692232438s
Average Latency 395.139349ms
Throughput 125.97 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 198.774967ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 101.775801ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 370.209122ms
Throughput 270.12 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 38.661838143s
Average Latency 385.186068ms
Throughput 129.33 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

@marythought marythought requested a review from a team as a code owner February 11, 2026 19:22
Signed-off-by: Mary Dickson <mary.dickson@virtru.com>
@github-actions
Copy link
Copy Markdown
Contributor

X-Test Failure Report

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 198.149383ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 99.81593ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 359.630821ms
Throughput 278.06 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 40.525226929s
Average Latency 403.427893ms
Throughput 123.38 requests/second

@github-actions
Copy link
Copy Markdown
Contributor

Benchmark results, click to expand

Benchmark authorization.GetDecisions Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 205.433745ms

Benchmark authorization.v2.GetMultiResourceDecision Results:

Metric Value
Approved Decision Requests 1000
Denied Decision Requests 0
Total Time 103.860335ms

Benchmark Statistics

Name № Requests Avg Duration Min Duration Max Duration

Bulk Benchmark Results

Metric Value
Total Decrypts 100
Successful Decrypts 100
Failed Decrypts 0
Total Time 404.052636ms
Throughput 247.49 requests/second

TDF3 Benchmark Results:

Metric Value
Total Requests 5000
Successful Requests 5000
Failed Requests 0
Concurrent Requests 50
Total Time 40.152126509s
Average Latency 399.588882ms
Throughput 124.53 requests/second

Comment thread CLAUDE.md
@github-actions
Copy link
Copy Markdown
Contributor

@opentdf opentdf deleted a comment from github-actions Bot Feb 11, 2026
@opentdf opentdf deleted a comment from github-actions Bot Feb 11, 2026
@opentdf opentdf deleted a comment from github-actions Bot Feb 11, 2026
@marythought marythought added this pull request to the merge queue Feb 11, 2026
Merged via the queue into main with commit 566cb6f Feb 11, 2026
39 checks passed
@marythought marythought deleted the fix/dspx-2409 branch February 11, 2026 20:43
github-merge-queue Bot pushed a commit that referenced this pull request Feb 17, 2026
🤖 I have created a release *beep* *boop*
---


##
[0.13.0](sdk/v0.12.0...sdk/v0.13.0)
(2026-02-17)


### ⚠ BREAKING CHANGES

* **policy:** remove namespace certificate feature
([#3051](#3051))

### Bug Fixes

* **deps:** bump github.com/opentdf/platform/lib/ocrypto from 0.9.0 to
0.10.0 in /sdk
([#3078](#3078))
([527c34d](527c34d))
* **deps:** bump github.com/opentdf/platform/protocol/go from 0.15.0 to
0.16.0 in /sdk
([#3081](#3081))
([3d4ce33](3d4ce33))
* **docs:** DSPX-2409 replace SDK README code example with working code
([#3055](#3055))
([566cb6f](566cb6f))
* Go 1.25 ([#3053](#3053))
([65eb7c3](65eb7c3))
* **kas:** Fix EC P-521 typo
([#3075](#3075))
([abc088d](abc088d))
* **sdk:** conditionally set client_id based on auth method
([#2968](#2968))
([abdeb69](abdeb69))


### Code Refactoring

* **policy:** remove namespace certificate feature
([#3051](#3051))
([48abb81](48abb81))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: opentdf-automation[bot] <149537512+opentdf-automation[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:sdk A software development kit, including library, for client applications and inter-service communicati size/m

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants