Skip to content
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

Feature: dynamic asn parser #289

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

micwallace
Copy link
Collaborator

Hey @weiwu-zhang

Here is an examples of how the asn1-schema library can be utilized to serialize & parse ASN using a schema provided at runtime.
The schema input is currently in JSON, but we can easily bridge the gap from .asd by writing an XML converter that can output this structure. Choice functionality will also need to be added to provide full support for ASN1.

- Cleanup HTML test, move out of main class file.
- Improve verbosity of API & private members.
- Add hex & base64 format support.
@micwallace micwallace marked this pull request as draft August 1, 2022 06:18
@github-actions
Copy link

github-actions bot commented Aug 1, 2022

Coverage report for src/main/javascript/crypto/

❌ An unexpected error occurred. For more details, check console

Error: The process '/opt/hostedtoolcache/node/16.16.0/x64/bin/npm' failed with exit code 1
St.
Category Percentage Covered / Total
🟡 Statements 70.95% 1903/2682
🔴 Branches
46.53% (+1.08% 🔼)
275/591
🟡 Functions 76.26% 347/455
🟡 Lines 71.11% 1861/2617
Show new covered files 🐣
St.
File Statements Branches Functions Lines
🟢
... / SchemaGenerator.ts
90.91% 70% 100% 92.31%
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢 libs/utils.ts 87.16%
65.28% (-1.39% 🔻)
94.12% 88.44%

Test suite run failed

Failed tests: 1/39. Failed suites: 1/2.
  ● read attested object › validate attestation

    Could not validate object

      104 |         me.fromBytes(bytes);
      105 |         if (!me.checkValidity()) {
    > 106 |             throw new Error("Could not validate object");
          |                   ^
      107 |         }
      108 |         if (me.getVersion() == IdentifierAttestation.NFT_VERSION) {
      109 |             let x500Arr = Asn1Der.parseX500Names(me.getSubject());

      at Function.fromBytes (src/libs/IdentifierAttestation.ts:106:19)
      at Function.fromBytes [as fromASNType] (src/libs/SignedIdentifierAttestation.ts:33:40)
      at Function.fromASNType [as fromBytes] (src/libs/SignedIdentifierAttestation.ts:25:21)
      at Function.fromBytes (src/libs/AttestedObject.ts:144:46)
      at Object.<anonymous> (src/main.spec.ts:668:37)

Report generated by 🧪jest coverage report action from e4e43ec

@jot2re
Copy link
Collaborator

jot2re commented Aug 24, 2022

@micwallace what is the status on this PR? It seems to becoming stale 😅

@micwallace
Copy link
Collaborator Author

micwallace commented Aug 25, 2022

@jot2re We don't really have a use case at this stage but it will be needed if we want to integrate attestations into tokenscript XML or JSON config for example.

@jot2re
Copy link
Collaborator

jot2re commented Aug 25, 2022

@micwallace thanks for the update Miccy! I will keep the PR open then.

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.

2 participants