attestation icon indicating copy to clipboard operation
attestation copied to clipboard

Feature: dynamic asn parser

Open micwallace opened this issue 2 years ago β€’ 4 comments

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.

micwallace avatar Aug 01 '22 06:08 micwallace

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.:grey_question:
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.:grey_question:
File Statements Branches Functions Lines
🟒
... / SchemaGenerator.ts
90.91% 70% 100% 92.31%
Show files with reduced coverage πŸ”»
St.:grey_question:
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 e4e43ec78bc62354ddf1dad6038bb274c4a992da

github-actions[bot] avatar Aug 01 '22 06:08 github-actions[bot]

@micwallace what is the status on this PR? It seems to becoming stale πŸ˜…

jot2re avatar Aug 24 '22 09:08 jot2re

@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.

micwallace avatar Aug 25 '22 03:08 micwallace

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

jot2re avatar Aug 25 '22 07:08 jot2re