Skip to content

Conversation

@pflynn-virtru
Copy link
Member

@pflynn-virtru pflynn-virtru commented Aug 2, 2024

Add support for identifiers in ResourceLocator

Introduced an IdentifierType enum to categorize different identifier lengths. Updated ResourceLocator constructors to handle identifiers, including parsing and setting appropriate identifier types. Modified ByteBuffer constructor to extract identifier information from the protocol byte.

Issue: opentdf/platform#1203
Specification: opentdf/spec#40
ADR: opentdf/platform#900

Introduced an IdentifierType enum to categorize different identifier lengths. Updated ResourceLocator constructors to handle identifiers, including parsing and setting appropriate identifier types. Modified ByteBuffer constructor to extract identifier information from the protocol byte.
Replaced string literals for protocol matching with constants and removed unnecessary identifier length variables, streamlining the class. Adjusted identifier handling to directly utilize the array length for type determination, enhancing readability and performance.
Corrected the byte manipulation for protocol and identifier nibbles in ResourceLocator. Removed commented-out identifier types in NanoTDFType and added a new method to retrieve the identifier in ResourceLocator. Added an assertion to ensure the identifier is not null during ResourceLocator creation in NanoTDF.
@pflynn-virtru pflynn-virtru marked this pull request as ready for review August 2, 2024 18:42
@pflynn-virtru pflynn-virtru requested review from a team as code owners August 2, 2024 18:42
Enhanced `ResourceLocator` to handle various identifier lengths and added JUnit tests to verify correctness. Updated the `writeIntoBuffer` method to accurately write the identifier based on its type, and added detailed class documentation for better understanding.
@pflynn-virtru pflynn-virtru changed the title feat(core): KID in NanoTDF KAS ResourceLocator borrowed from Protocol feat(core): Identifier in NanoTDF ResourceLocator borrowed from Protocol Aug 2, 2024
@pflynn-virtru pflynn-virtru marked this pull request as draft August 2, 2024 19:36
@pflynn-virtru pflynn-virtru marked this pull request as ready for review August 9, 2024 14:44
Added final modifiers to method parameters in ResourceLocator class. Introduced a new method setIdentifier and refactored identifier length handling with system array copy. Modified NanoTDFType to include identifier length constants, and updated tests to reflect these changes.
Copy link
Contributor

@mkleene mkleene left a comment

Choose a reason for hiding this comment

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

Looks good except for the one comment!

this.identifierType = NanoTDFType.IdentifierType.NONE;
this.identifier = new byte[0];
} else {
byte[] identifierBytes = identifier.getBytes();
Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should set the charset here. If we don't it uses the platform default

@dmihalcik-virtru
Copy link
Member

merged as #112

@pflynn-virtru pflynn-virtru deleted the feature/nano-kid-kasurl-protocol-enun branch October 7, 2024 18:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants