Skip to content

Commit

Permalink
docs: update .NET documentation on using BouncyCastle with `Ready…
Browse files Browse the repository at this point in the history
  • Loading branch information
box-sdk-build authored Nov 14, 2024
1 parent 9ebf59a commit 09a0db0
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .codegen.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{ "engineHash": "108d2d7", "specHash": "c2c76f3", "version": "1.4.0" }
{ "engineHash": "513fdf8", "specHash": "c2c76f3", "version": "1.4.0" }
22 changes: 22 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30

# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7

# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- enhancement
- dontstale
- needs-triage

# Label to use when marking an issue as stale
staleLabel: stale

# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not been updated in the last 30 days. It will be closed if no further activity occurs within the next 7 days. Feel free to reach out or mention Box SDK team member for further help and resources if they are needed.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: >
This issue has been automatically closed due to maximum period of being stale. Thank you for your contribution to Box SDK and feel free to open another PR/issue at any time.
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@ public SearchManagerTests() {
[TestMethod]
public async System.Threading.Tasks.Task TestCreateMetaDataQueryExecuteRead() {
string templateKey = string.Concat("key", Utils.GetUUID());
MetadataTemplate template = await client.MetadataTemplates.CreateMetadataTemplateAsync(requestBody: new CreateMetadataTemplateRequestBody(scope: "enterprise", displayName: templateKey) { TemplateKey = templateKey, Fields = Array.AsReadOnly(new [] {new CreateMetadataTemplateRequestBodyFieldsField(type: CreateMetadataTemplateRequestBodyFieldsTypeField.MultiSelect, key: "testColor", displayName: "testColor") { Options = Array.AsReadOnly(new [] {new CreateMetadataTemplateRequestBodyFieldsOptionsField(key: "red"),new CreateMetadataTemplateRequestBodyFieldsOptionsField(key: "green"),new CreateMetadataTemplateRequestBodyFieldsOptionsField(key: "blue")}) }}) });
MetadataTemplate template = await client.MetadataTemplates.CreateMetadataTemplateAsync(requestBody: new CreateMetadataTemplateRequestBody(scope: "enterprise", displayName: templateKey) { TemplateKey = templateKey, Fields = Array.AsReadOnly(new [] {new CreateMetadataTemplateRequestBodyFieldsField(type: CreateMetadataTemplateRequestBodyFieldsTypeField.String, key: "name", displayName: "name"),new CreateMetadataTemplateRequestBodyFieldsField(type: CreateMetadataTemplateRequestBodyFieldsTypeField.Float, key: "age", displayName: "age"),new CreateMetadataTemplateRequestBodyFieldsField(type: CreateMetadataTemplateRequestBodyFieldsTypeField.Date, key: "birthDate", displayName: "birthDate"),new CreateMetadataTemplateRequestBodyFieldsField(type: CreateMetadataTemplateRequestBodyFieldsTypeField.Enum, key: "countryCode", displayName: "countryCode") { Options = Array.AsReadOnly(new [] {new CreateMetadataTemplateRequestBodyFieldsOptionsField(key: "US"),new CreateMetadataTemplateRequestBodyFieldsOptionsField(key: "CA")}) },new CreateMetadataTemplateRequestBodyFieldsField(type: CreateMetadataTemplateRequestBodyFieldsTypeField.MultiSelect, key: "sports", displayName: "sports") { Options = Array.AsReadOnly(new [] {new CreateMetadataTemplateRequestBodyFieldsOptionsField(key: "basketball"),new CreateMetadataTemplateRequestBodyFieldsOptionsField(key: "football"),new CreateMetadataTemplateRequestBodyFieldsOptionsField(key: "tennis")}) }}) });
Assert.IsTrue(template.TemplateKey == templateKey);
Files files = await client.Uploads.UploadFileAsync(requestBody: new UploadFileRequestBody(attributes: new UploadFileRequestBodyAttributesField(name: Utils.GetUUID(), parent: new UploadFileRequestBodyAttributesParentField(id: "0")), file: Utils.GenerateByteStream(size: 10)));
FileFull file = NullableUtils.Unwrap(files.Entries)[0];
MetadataFull metadata = await client.FileMetadata.CreateFileMetadataByIdAsync(fileId: file.Id, scope: CreateFileMetadataByIdScope.Enterprise, templateKey: templateKey, requestBody: new Dictionary<string, object>() { { "testColor", Array.AsReadOnly(new [] {"red","blue"}) } });
MetadataFull metadata = await client.FileMetadata.CreateFileMetadataByIdAsync(fileId: file.Id, scope: CreateFileMetadataByIdScope.Enterprise, templateKey: templateKey, requestBody: new Dictionary<string, object>() { { "name", "John" }, { "age", 23 }, { "birthDate", "2001-01-03T02:20:50.520Z" }, { "countryCode", "US" }, { "sports", Array.AsReadOnly(new [] {"basketball","tennis"}) } });
Assert.IsTrue(metadata.Template == templateKey);
Assert.IsTrue(metadata.Scope == template.Scope);
string searchFrom = string.Concat(NullableUtils.Unwrap(template.Scope), ".", template.TemplateKey);
MetadataQueryResults query = await client.Search.SearchByMetadataQueryAsync(requestBody: new MetadataQuery(ancestorFolderId: "0", from: searchFrom) { Query = "testColor = :value", QueryParams = new Dictionary<string, object>() { { "value", Array.AsReadOnly(new [] {"red","blue"}) } } });
Assert.IsTrue(NullableUtils.Unwrap(query.Entries).Count >= 0);
MetadataQueryResults query = await client.Search.SearchByMetadataQueryAsync(requestBody: new MetadataQuery(ancestorFolderId: "0", from: searchFrom) { Query = "name = :name AND age < :age AND birthDate >= :birthDate AND countryCode = :countryCode AND sports = :sports", QueryParams = new Dictionary<string, object>() { { "name", "John" }, { "age", 50 }, { "birthDate", "2001-01-01T02:20:10.120Z" }, { "countryCode", "US" }, { "sports", Array.AsReadOnly(new [] {"basketball","tennis"}) } } });
Assert.IsTrue(NullableUtils.Unwrap(query.Entries).Count >= 1);
await client.MetadataTemplates.DeleteMetadataTemplateAsync(scope: DeleteMetadataTemplateScope.Enterprise, templateKey: template.TemplateKey);
await client.Files.DeleteFileByIdAsync(fileId: file.Id);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public async System.Threading.Tasks.Task TestCreateSignRequestWithSignerGroupId(
FolderFull destinationFolder = await new CommonsManager().CreateNewFolderAsync();
SignRequest createdSignRequest = await client.SignRequests.CreateSignRequestAsync(requestBody: new SignRequestCreateRequest(signers: Array.AsReadOnly(new [] {new SignRequestCreateSigner() { Email = signer1Email, SignerGroupId = "user" },new SignRequestCreateSigner() { Email = signer2Email, SignerGroupId = "user" }})) { ParentFolder = new FolderMini(id: destinationFolder.Id), SourceFiles = Array.AsReadOnly(new [] {new FileBase(id: fileToSign.Id)}) });
Assert.IsTrue(NullableUtils.Unwrap(createdSignRequest.Signers).Count == 3);
Assert.IsTrue(NullableUtils.Unwrap(createdSignRequest.Signers)[1].SignerGroupId != null);
Assert.IsTrue(NullableUtils.Unwrap(createdSignRequest.Signers)[1].SignerGroupId == NullableUtils.Unwrap(createdSignRequest.Signers)[2].SignerGroupId);
await client.Folders.DeleteFolderByIdAsync(folderId: destinationFolder.Id, queryParams: new DeleteFolderByIdQueryParams() { Recursive = true });
await client.Files.DeleteFileByIdAsync(fileId: fileToSign.Id);
Expand Down
16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ Embrace the new generation of Box SDKs and unlock the full potential of the Box
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

- [Box Dotnet SDK GENERATED](#box-dotnet-sdk-generated)
- [Table of contents](#table-of-contents)
- [Installing](#installing)
- [BouncyCastle runtime integrity check](#bouncycastle-runtime-integrity-check)
- [Getting Started](#getting-started)
- [Documentation](#documentation)
- [Upgrades](#upgrades)
Expand Down Expand Up @@ -58,6 +61,19 @@ Alternatively, you can find this package and it's latest version [on nuget](http
</ItemGroup>
```

## BouncyCastle runtime integrity check

The version of BouncyCastle included in the SDK performs a checksum validation at runtime. As a result, any modifications to the .dll file, such as those introduced by optimizations like [ReadyToRun (R2R)](https://learn.microsoft.com/en-us/dotnet/core/deploying/ready-to-run) compilation, can alter the checksum, causing the validation to fail. This can lead to issues with SDK functionalities that rely on BouncyCastle, such as JWT authentication unusable.

You can exclude BouncyCastle from ReadyToRun compilation by adding the following to your `.csproj` file:

```xml
<ItemGroup>
<PublishReadyToRunExclude Include="bc-fips-1.0.2.dll" />
<PublishReadyToRunExclude Include="bcpkix-fips-1.0.2.dll" />
</ItemGroup>
```

# Getting Started

To get started with the SDK, get a Developer Token from the Configuration page of your app in the [Box Developer
Expand Down
2 changes: 1 addition & 1 deletion docs/Search.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ See the endpoint docs at

<!-- sample post_metadata_queries_execute_read -->
```
await client.Search.SearchByMetadataQueryAsync(requestBody: new MetadataQuery(ancestorFolderId: "0", from: searchFrom) { Query = "testColor = :value", QueryParams = new Dictionary<string, object>() { { "value", Array.AsReadOnly(new [] {"red","blue"}) } } });
await client.Search.SearchByMetadataQueryAsync(requestBody: new MetadataQuery(ancestorFolderId: "0", from: searchFrom) { Query = "name = :name AND age < :age AND birthDate >= :birthDate AND countryCode = :countryCode AND sports = :sports", QueryParams = new Dictionary<string, object>() { { "name", "John" }, { "age", 50 }, { "birthDate", "2001-01-01T02:20:10.120Z" }, { "countryCode", "US" }, { "sports", Array.AsReadOnly(new [] {"basketball","tennis"}) } } });
```

### Arguments
Expand Down

0 comments on commit 09a0db0

Please sign in to comment.