-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Transparency client - allow the use of offline keys for the transparent statement verification #54259
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ivarprudnikov
merged 15 commits into
Azure:main
from
ivarprudnikov:confidentialledger/offline-receipt-verification
Dec 5, 2025
Merged
Transparency client - allow the use of offline keys for the transparent statement verification #54259
Changes from 6 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
f95d554
New verification option to provide CodeTransparencyVerificationKeys
ivarprudnikov be0b5ac
emphasise that keys are offline
ivarprudnikov 7b7f245
fix offline key verification, linting
ivarprudnikov 407716f
add network behavior for offline keys
ivarprudnikov 11f9029
update public API
ivarprudnikov 8b4e934
update changelog
ivarprudnikov 7993183
use using when parsing JsonDocument
ivarprudnikov af9a803
update test comment
ivarprudnikov 7443b7d
copilot suggestions
ivarprudnikov 333f69d
add test coverage for CodeTransparencyOfflineKeys
ivarprudnikov b9070bc
rename ByDomain to ByIssuer to better reflect binding of the keys
ivarprudnikov d9f59a3
fix verification logic when no authorized keys are provided like in a…
ivarprudnikov bffa39a
comment fix
ivarprudnikov 12d7796
adds sample and test to do offline verification
ivarprudnikov 36f1614
regenerate external api
ivarprudnikov File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
71 changes: 71 additions & 0 deletions
71
sdk/confidentialledger/Azure.Security.CodeTransparency/src/CodeTransparencyOfflineKeys.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using System.ClientModel.Primitives; | ||
| using System.Collections.Generic; | ||
| using System.Collections.ObjectModel; | ||
| using System.Diagnostics.CodeAnalysis; | ||
| using System.Linq; | ||
| using System.Text.Json; | ||
| using System.Text.Json.Serialization; | ||
ivarprudnikov marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| using Azure.Core; | ||
|
|
||
| namespace Azure.Security.CodeTransparency | ||
| { | ||
| /// <summary> | ||
| /// A case-insensitive dictionary mapping ledger domains to their JWKS documents for offline verification. | ||
| /// </summary> | ||
| public sealed class CodeTransparencyOfflineKeys | ||
| { | ||
| private IDictionary<string, JwksDocument> _keysByDomain; | ||
ivarprudnikov marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// <summary> | ||
| /// Initializes a new instance of CodeTransparencyOfflineKeys. | ||
| /// </summary> | ||
| public CodeTransparencyOfflineKeys() | ||
| { | ||
| _keysByDomain = new Dictionary<string, JwksDocument>(StringComparer.OrdinalIgnoreCase); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets the dictionary of ledger domains to their JWKS documents. | ||
| /// </summary> | ||
| public IReadOnlyDictionary<string, JwksDocument> ByDomain => new ReadOnlyDictionary<string, JwksDocument>(_keysByDomain); | ||
ivarprudnikov marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| /// <summary> | ||
| /// Adds or updates a JWKS document for the specified ledger domain. | ||
| /// </summary> | ||
| public void Add(string ledgerDomain, JwksDocument jwksDocument) | ||
| { | ||
ivarprudnikov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| _keysByDomain[ledgerDomain] = jwksDocument; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Creates a CodeTransparencyOfflineKeys instance from a BinaryData containing JSON. | ||
| /// </summary> | ||
| public static CodeTransparencyOfflineKeys FromBinaryData(BinaryData json) | ||
| { | ||
| return FromJsonDocument(JsonDocument.Parse(json.ToString())); | ||
ivarprudnikov marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
ivarprudnikov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| internal static CodeTransparencyOfflineKeys FromJsonDocument(JsonDocument jsonDocument) | ||
| { | ||
| return DeserializeKeys(jsonDocument.RootElement); | ||
| } | ||
|
|
||
| internal static CodeTransparencyOfflineKeys DeserializeKeys(JsonElement element, ModelReaderWriterOptions options = null) | ||
| { | ||
| var keys = new CodeTransparencyOfflineKeys(); | ||
|
|
||
| foreach (var property in element.EnumerateObject()) | ||
| { | ||
| var ledgerDomain = property.Name; | ||
| var jwksDocument = JwksDocument.DeserializeJwksDocument(property.Value, options); | ||
| keys.Add(ledgerDomain, jwksDocument); | ||
| } | ||
|
|
||
| return keys; | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.