Skip to content

Commit

Permalink
Candidate for 0.4 (#298)
Browse files Browse the repository at this point in the history
* feat: added sourcify-verify

* chore: remove stub empty line

* fix: πŸ› issue#276 fix. Added eip712 domain validations

βœ… Closes: #276

* docs: ✏️ removed commented code, added comment to explain undef

* fix: πŸ› add getters/setters for EIP712 params

* ci: 🎑 trigger tn CI after prerelease

* test: adding dumping of generated material for tests in attestation.jar (#283)

* test: implemented an object dumber and updated java tests to write object dumps, along with handling linter feedback on the touched files

* ci: 🎑 trigger tn CI after prerelease

Co-authored-by: Tore Kasper Frederiksen <[email protected]>
Co-authored-by: Feng Yu <[email protected]>

* bug: added domain validation to AttestationUsage and AttestationRequestWUsage (#285)

* ci: 🎑 trigger tn CI after prerelease

* test: adding dumping of generated material for tests in attestation.jar (#283)

* test: implemented an object dumber and updated java tests to write object dumps, along with handling linter feedback on the touched files

* ci: 🎑 trigger tn CI after prerelease

Co-authored-by: Tore Kasper Frederiksen <[email protected]>
Co-authored-by: Feng Yu <[email protected]>

* bug: added domain validation to AttestationUsage and AttestationRequestWUsage

* fix: πŸ› issue#276 fix. Added eip712 domain validations

βœ… Closes: #276

* docs: ✏️ removed commented code, added comment to explain undef

* fix: πŸ› add getters/setters for EIP712 params

Co-authored-by: Feng Yu <[email protected]>
Co-authored-by: Tore Kasper Frederiksen <[email protected]>
Co-authored-by: Oleh Hryb <[email protected]>

* fix: added domain validation to AttestationRequestWithUsage and AttestationUsage

* fix: πŸ› asn_decoding fix(patch), attestation timestamp check (#273)

Added patch to fix ASN1_schema bug for Integers, added Attestation
validate timestamp

* fix: fixed integration tests with attested object (#290)

Co-authored-by: Tore Kasper Frederiksen <[email protected]>

* fix: updated peculiar asn1 to latest version which contains the fix that is otherwise included in the patch (#294)

Co-authored-by: Tore Kasper Frederiksen <[email protected]>

* feat: signature-based UN and possibility of adding context to UN (#284)

* feat: wrote a UN based on signature and refactored things to allow an optional context for both MAC-based UNs and signature-based UNs

* test: adding dumping of generated material for tests in attestation.jar (#283)

* test: implemented an object dumber and updated java tests to write object dumps, along with handling linter feedback on the touched files

* ci: 🎑 trigger tn CI after prerelease

Co-authored-by: Tore Kasper Frederiksen <[email protected]>
Co-authored-by: Feng Yu <[email protected]>

* feat: wrote a UN based on signature and refactored things to allow an optional context for both MAC-based UNs and signature-based UNs

* docs: added comments

* fix: made some fixes and tried to get a consistent version working between TS and Java

* fix: updated java code to be able to integration test JS generated UNs

* fix: updated JS code to be able to integration test with java generated UNs and added tests

* Removed unnneeded test

* test: updated tests and ensured consistent and deterministic code when needed

* test: updated and expanded integration tests to ensure consistency with Java implementation

* fix: fixed issues related to deterministic keys

* test: fixed missing references in js test

* fix: fixed directory typo

Co-authored-by: Feng Yu <[email protected]>

* feat: ✨ safeconnect (#279)

* docs(core): adding asn1 draft for nftownership attestation and ethereum linking attestation

* docs(core): adding asn1 draft for nftownership attestation and ethereum linking attestation in asd format as well

* docs(core): fixed typos in old asd format

* docs(core): updates description to reuse old type for erc721 token

* docs(core): updated asn format description after discussion with Miccy

* docs(core): fixed bug in old asn1 notation

* docs(core): updated asd format too

* refactor:core refactored representation of erc721 tokens to fit with what we also need

* feat(core): added first draft of signed NFT Ownership Attestation

* test(core): added sunshine tests to signed NFT Ownership Attestation

* Draft JS schemas.

* Bump version - JS patch release 0.3.8

* fix(core): updated format to match the new format from Miccy

* Update JS schemas for safe connect.

* feat(core) added draft of ethereum key link attestation along with refactoring

* fix(core) added missing file

* feat(core) added draft of ethereum address attestation

* refactor(core) removed redundant decoder code

* test(core) added test to ownership attestations

* test(core) added test to key linking attestation

* Fixes for node.js support

- Fix window debug ENV check.
- Fix uint8array to base64 encoding.

* refactor: refactoring and improved testing

* test: added more testing along with file writing and reading of test data

* fix: changed to assume the issuer uses Ethereum keys and refactored OID identification

* fix: updated failing tests

* Migrate safe connect attestation and verification code WIP.

* Migrate safe connect attestation and verification code WIP.

* Migrate safe connect attestation and verification code WIP.

* Fix parsing

* Add validity checking & optional parameter validFrom.

* feat: move smart contract

* chore: Refactor test attestations to be generated using javascript lib.

* chore: Add javascript lib tests

* feature: NFT Attestation solidity library

* chore: Add test mint contract & fix attestation validity issues with tests.

* fix: added missing tag to java version

* fix: added fixes to get the MVP integration working

* test: added integration test for JS safeconnect version

* feature: JS context & various other enhancements

- Add optional context field to Javascript attestation creation.
- Move signing function to AbstractLinkedAttestation.
- Add multi-token support to JS NFT attestation creation.
- Implement test to validate Java attestation in Javascript.
- Add method to get linked attestation data from EthereumKeyLinkingAttestation.

* chore: Bump JS pre-release version to 0.3.9-sc.3

* test: added more safeconnect integration tests

* test: added integration test of JS with Java

* test: added console printing of right value

* fix: missing NFT_ADDRESS variable in test

* test: enable JS -> Java test

* feat: made chainID mandatory on ERC721 tokens

* fix: make github CI/CD pass

* fix: added schema for address linking

* refactor: improved variable naming

* feat: added support for array of tokens in java version

* feature: multi-token ID support for JS and solidity library.

* refactor: changed format of Erc721 token to have IDs at the end and always store things as an array

* test: updated java test

* chore: bump version

* fix: silly bug :-(

* fix: context field type

* test: added test for context

* test: added test for context

* fix: issuer keys being overwritten when provided in base64/PEM format
feat: return attested object in validateUseTicket function.

* fix: remove temporary patch for asn1-schema integer parsing issue

ref: ae8c45b updated peculiar asn1
to latest version which contains the fix that is otherwise included
in the patch (#294).

Co-authored-by: Michael Wallace <[email protected]>
Co-authored-by: snowwhitedev <[email protected]>

* update contracts to use standard ERC721 and in-line library to reduce gas cost. Also update tests in line with these changes (#292)

* Various fixes & enhancements for Devcon use cases (#297)

* feature: validateUseTicket - allow validation to skip ethAddress check.

Allow skipping of ethereum address by explicitly passing null
as userEthKey value.

* Bump version for devcon release

* Bump version for devcon release

* feature: add getDevconId function to Ticket class

* build: updated dependencies

* build: updated dependencies

* build: updated version

* build: updated version

* Devcon (#299)

* feature: validateUseTicket - allow validation to skip ethAddress check.

Allow skipping of ethereum address by explicitly passing null
as userEthKey value.

* Bump version for devcon release

* Bump version for devcon release

* feature: add getDevconId function to Ticket class

* feature: allow multiple keys for validation of a single conference ID

* fix/disabled blockchain enabled tests (#303)

* build: upgraded dependencies

Co-authored-by: snowwhitedev <[email protected]>
Co-authored-by: oleggrib <[email protected]>
Co-authored-by: Feng Yu <[email protected]>
Co-authored-by: Michael Wallace <[email protected]>
Co-authored-by: James Brown <[email protected]>
  • Loading branch information
6 people authored Nov 14, 2022
1 parent 5e9ef6c commit 4539243
Show file tree
Hide file tree
Showing 128 changed files with 9,058 additions and 1,680 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

downstream-ci:
downstream-attestation_id-ci:
needs:
- prerelease
runs-on: ubuntu-latest
Expand All @@ -65,3 +65,17 @@ jobs:
github_token: ${{ secrets.PERSONAL_TOKEN }}
workflow_file_name: frontend-p1.yml
client_payload: '{ "attestation_ver": "${{ needs.prerelease.outputs.version }}", "use_github_packages": "true" }'

downstream-token-negotiator-ci:
needs:
- prerelease
runs-on: ubuntu-latest
steps:
- name: Trigger Downstream CI
uses: convictional/[email protected]
with:
owner: TokenScript
repo: token-negotiator
github_token: ${{ secrets.PERSONAL_TOKEN }}
workflow_file_name: tn-p1.yml
client_payload: '{ "attestation_ver": "${{ needs.prerelease.outputs.version }}", "use_github_packages": "true" }'
24 changes: 12 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,24 @@ configurations {
}

dependencies {
runtimeOnly 'ch.qos.logback:logback-classic:[1.2.11, 2)'
runtimeOnly 'ch.qos.logback:logback-classic:1.4.4'
implementation 'org.bouncycastle:bcprov-jdk15on:[1.70,)'
implementation 'org.bouncycastle:bcpkix-jdk15on:[1.70,)'
implementation 'org.apache.logging.log4j:log4j-to-slf4j:[2.17.2, 3)'
testImplementation 'org.junit.jupiter:junit-jupiter-params:[5.8.2, 6)'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-params:[5.8.2, 6)'
testImplementation 'org.junit.jupiter:junit-jupiter-api:[5.8.2, 6)'
intTestImplementation 'org.junit.jupiter:junit-jupiter-api:[5.8.2, 6)'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:[5.8.2, 6)'
intTestRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:[5.8.2, 6)'
implementation 'org.apache.logging.log4j:log4j-to-slf4j:2.19.0'
testImplementation 'org.junit.jupiter:junit-jupiter-params:5.9.0'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
intTestImplementation 'org.junit.jupiter:junit-jupiter-api:5.9.0'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
intTestRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.9.0'
// TODO very obsolete and should be refactored out or updated
implementation 'org.web3j:core:[4,5.0.0)'
implementation 'com.auth0:java-jwt:[3.19.1, 4)'
implementation 'org.json:json:20220320' // To ensure obsolete trulioo code can compile
implementation 'com.auth0:java-jwt:4.2.1'
implementation 'org.json:json:20220924' // To ensure obsolete trulioo code can compile
implementation group: 'com.github.cliftonlabs', name: 'json-simple', version: '[4.0.1, 5)'
implementation group: 'commons-cli', name: 'commons-cli', version: '[1.5.0, 2)'
implementation group: 'com.google.code.gson', name: 'gson', version: '[2.9.0, 3)'
testImplementation 'org.mockito:mockito-core:[4.5.1, 5)'
implementation 'com.fasterxml.jackson.core:jackson-databind:[2.13.2.2,)'
testImplementation 'org.mockito:mockito-inline:4.8.0'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.14.0'
implementation group: 'org.java-websocket', name: 'Java-WebSocket', version: '[1.5.2,)'
}

Expand Down
5 changes: 3 additions & 2 deletions data-modules/output/asn/NFTAttestation.asn
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@ Digest ::= OCTET STRING (SIZE(32..MAX))

-- See https://eips.ethereum.org/EIPS/eip-721 for details --
ERC721 ::= SEQUENCE {
tokenId TokenId,
address Address
address Address,
chainId INTEGER,
tokenIds SEQUENCE OF TokenId OPTIONAL
}

-- The 256 bit non-negative integer uniquely representing the ERC721 token in question in binary --
Expand Down
31 changes: 31 additions & 0 deletions data-modules/output/asn/SignedEthereumAddressAttestation.asn
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
SignedEthereumAddressLinkingAttestation

DEFINITIONS ::=
BEGIN

IMPORTS
Address
FROM NFTAttestation
AlgorithmIdentifier,
SubjectPublicKeyInfoValue
FROM AuthenticationFramework;

Validity ::= SEQUENCE {
notBefore INTEGER, -- NotBefore time since epoch in seconds
notAfter INTEGER -- NotAfter time since epoch in seconds
}

EthereumAddressLinkingAttestation ::= SEQUENCE {
subtlePublicKey SubjectPublicKeyInfoValue,
subjectAddress Address,
validity Validity,
context OCTET STRING OPTIONAL
}

SignedEthereumAddressLinkingAttestation ::= SEQUENCE {
ethereumAddressAttestation EthereumAddressLinkingAttestation,
signingAlgorithm AlgorithmIdentifier,
signatureValue BIT STRING
}

END
35 changes: 35 additions & 0 deletions data-modules/output/asn/SignedEthereumKeyLinkingAttestation.asn
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
SignedEthereumKeyLinkingAttestation

DEFINITIONS ::=
BEGIN

IMPORTS
Address
FROM NFTAttestation
AlgorithmIdentifier
FROM AuthenticationFramework
SignedEthereumAddressLinkingAttestation
FROM SignedEthereumAddressLinkingAttestation
SignedNFTOwnershipAttestation,
Validity
FROM SignedNFTOwnershipAttestation;

SignedLinkedAttestation ::= CHOICE {
signedNFTOwnershipAttestation [0] EXPLICIT SignedNFTOwnershipAttestation,
signedEthereumAddressLinkingAttestation [1] EXPLICIT SignedEthereumAddressLinkingAttestation
}

EthereumKeyLinkingAttestation ::= SEQUENCE {
subjectEthereumAddress Address,
signedLinkedAttestation SignedLinkedAttestation,
validity Validity,
context OCTET STRING OPTIONAL
}

SignedEthereumKeyLinkingAttestation ::= SEQUENCE {
ethereumKeyLinkingAttestation EthereumKeyLinkingAttestation,
signingAlgorithm AlgorithmIdentifier,
signatureValue BIT STRING
}

END
31 changes: 31 additions & 0 deletions data-modules/output/asn/SignedNFTOwnershipAttestation.asn
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
SignedNFTOwnershipAttestation

DEFINITIONS ::=
BEGIN

IMPORTS
Tokens
FROM NFTAttestation
AlgorithmIdentifier,
SubjectPublicKeyInfoValue
FROM AuthenticationFramework;

Validity ::= SEQUENCE {
notBefore INTEGER, -- NotBefore time since epoch in seconds
notAfter INTEGER -- NotAfter time since epoch in seconds
}

NFTOwnershipAttestation ::= SEQUENCE {
subtlePublicKey SubjectPublicKeyInfoValue,
tokens Tokens,
validity Validity,
context OCTET STRING OPTIONAL
}

SignedNFTOwnershipAttestation ::= SEQUENCE {
nftOwnershipAttestation NFTOwnershipAttestation,
signingAlgorithm AlgorithmIdentifier,
signatureValue BIT STRING
}

END
13 changes: 11 additions & 2 deletions data-modules/src/NFTAttestation.asd
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,17 @@
<namedType name="ERC721">
<type>
<sequence>
<element name="tokenId" type="TokenId"/>
<element name="address" type="Address"/>
<element name="address" type="Address"/>
<element name="chainID" type="asnx:INTEGER"/>
<optional>
<element name="tokenIds">
<type>
<sequenceOf>
<element name="multipleTokenIds" type="TokenId"/>
</sequenceOf>
</type>
</element>
</optional>
</sequence>
</type>
</namedType>
Expand Down
42 changes: 42 additions & 0 deletions data-modules/src/SignedEthereumAddressLinkingAttestation.asd
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<asnx:module xmlns:asnx="urn:ietf:params:xml:ns:asnx" name="SignedEthereumAddressLinkingAttestation">

<import name="Address"
schemaLocation="NFTAttestation.asd"/>
<import name="AlgorithmIdentifier"
schemaLocation="AuthenticationFramework.asd"/>
<import name="SubjectPublicKeyInfoValue"
schemaLocation="AuthenticationFramework.asd"/>

<namedType name="Validity">
<type>
<sequence>
<element name="notBefore" type="asnx:INTEGER"/> <!-- time in seconds since epoch -->
<element name="notAfter" type="asnx:INTEGER"/> <!-- time in seconds since epoch -->
</sequence>
</type>
</namedType>

<namedType name="EthereumAddressLinkingAttestation">
<type>
<sequence>
<element name="subtlePublicKey" type="SubjectPublicKeyInfoValue"/>
<element name="address" type="Address"/>
<element name="validity" type="Validity"/>
<optional>
<element name="context" type="asnx:OCTET-STRING"/>
</optional>
</sequence>
</type>
</namedType>

<namedType name="SignedEthereumAddressLinkingAttestation">
<type>
<sequence>
<element name="ethereumAddressLinkingAttestation" type="EthereumAddressLinkingAttestation"/>
<element name="signingAlgorithm" type="AlgorithmIdentifier"/>
<element name="signatureValue" type="asnx:BIT-STRING"/>
</sequence>
</type>
</namedType>
</asnx:module>
54 changes: 54 additions & 0 deletions data-modules/src/SignedEthereumKeyLinkingAttestation.asd
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?xml version="1.0" encoding="UTF-8"?>
<asnx:module name="SignedEthereumKeyLinkingAttestation" xmlns:asnx="urn:ietf:params:xml:ns:asnx">

<import name="Address"
schemaLocation="NFTAttestation.asd"/>
<import name="AlgorithmIdentifier"
schemaLocation="AuthenticationFramework.asd"/>
<import name="SignedEthereumAddressLinkingAttestation"
schemaLocation="SignedEthereumAddressLinkingAttestation.asd"/>
<import name="SignedNFTOwnershipAttestation"
schemaLocation="SignedNFTOwnershipAttestation.asd"/>
<import name="Validity"
schemaLocation="SignedNFTOwnershipAttestation.asd"/>

<namedType name="SignedLinkedAttestation">
<type>
<choice>
<element name="signedNFTOwnershipAttestation">
<type>
<tagged number="0" tagging="explicit" type="SignedNFTOwnershipAttestation"/>
</type>
</element>
<element name="signedEthereumAddressLinkingAttestation">
<type>
<tagged number="1" tagging="explicit" type="SignedEthereumAddressLinkingAttestation"/>
</type>
</element>
</choice>
</type>
</namedType>

<namedType name="EthereumKeyLinkingAttestation">
<type>
<sequence>
<element name="subjectEthereumAddress" type="Address"/>
<element name="signedLinkedAttestation" type="SignedLinkedAttestation"/>
<element name="validity" type="Validity"/>
<optional>
<element name="context" type="asnx:OCTET-STRING"/>
</optional>
</sequence>
</type>
</namedType>

<namedType name="SignedEthereumKeyLinkingAttestation">
<type>
<sequence>
<element name="ethereumKeyLinkingAttestation" type="EthereumKeyLinkingAttestation"/>
<element name="signingAlgorithm" type="AlgorithmIdentifier"/>
<element name="signatureValue" type="asnx:BIT-STRING"/>
</sequence>
</type>
</namedType>
</asnx:module>
6 changes: 3 additions & 3 deletions data-modules/src/SignedNFTAttestation.asd
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
Version 2 indicates that a compressed signature is used.
-->
<optional>
</element name="signingVersion" type="asnx:INTEGER">
<element name="signingVersion" type="asnx:INTEGER"/>
</optional>
</element name="signingAlgorithm" type="AlgorithmIdentifier">
</element name="signatureValue" type="asnx:BIT-STRING">
<element name="signingAlgorithm" type="AlgorithmIdentifier"/>
<element name="signatureValue" type="asnx:BIT-STRING"/>
</sequence>
</type>
</namedType>
Expand Down
42 changes: 42 additions & 0 deletions data-modules/src/SignedNFTOwnershipAttestation.asd
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<asnx:module name="SignedNFTOwnershipAttestation" xmlns:asnx="urn:ietf:params:xml:ns:asnx">

<import name="Tokens"
schemaLocation="NFTAttestation.asd"/>
<import name="AlgorithmIdentifier"
schemaLocation="AuthenticationFramework.asd"/>
<import name="SubjectPublicKeyInfoValue"
schemaLocation="AuthenticationFramework.asd"/>

<namedType name="Validity">
<type>
<sequence>
<element name="notBefore" type="asnx:INTEGER"/> <!-- time in seconds since epoch -->
<element name="notAfter" type="asnx:INTEGER"/> <!-- time in seconds since epoch -->
</sequence>
</type>
</namedType>

<namedType name="NFTOwnershipAttestation">
<type>
<sequence>
<element name="subtlePublicKey" type="SubjectPublicKeyInfoValue"/>
<element name="tokens" type="Tokens"/>
<element name="validity" type="Validity"/>
<optional>
<element name="context" type="asnx:OCTET-STRING"/>
</optional>
</sequence>
</type>
</namedType>

<namedType name="SignedNFTOwnershipAttestation">
<type>
<sequence>
<element name="nftOwnershipAttestation" type="NFTOwnershipAttestation"/>
<element name="signingAlgorithm" type="AlgorithmIdentifier"/>
<element name="signatureValue" type="asnx:BIT-STRING"/>
</sequence>
</type>
</namedType>
</asnx:module>
12 changes: 11 additions & 1 deletion ethereum/attestation-test/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,14 @@ npm test
```
```shell
npx hardhat test
```
```

### Deploy
```shell
npm run <network-name>:deploy
```

### Sourcify
```shell
npm run <network-name>:sourcify
```
Loading

2 comments on commit 4539243

@github-actions
Copy link

Choose a reason for hiding this comment

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

Coverage report for src/main/javascript/crypto/

St.❔
Category Percentage Covered / Total
🟑 Statements 74.53% 2177/2921
πŸ”΄ Branches 47.26% 285/603
🟑 Functions 79.46% 383/482
🟑 Lines 74.74% 2136/2858

Test suite run success

56 tests passing in 2 suites.

Report generated by πŸ§ͺjest coverage report action from 4539243

@github-actions
Copy link

Choose a reason for hiding this comment

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

Coverage report for src/main/javascript/crypto/

St.❔
Category Percentage Covered / Total
🟑 Statements 74.53% 2177/2921
πŸ”΄ Branches 47.1% 284/603
🟑 Functions 79.46% 383/482
🟑 Lines 74.74% 2136/2858

Test suite run success

56 tests passing in 2 suites.

Report generated by πŸ§ͺjest coverage report action from 4539243

Please sign in to comment.