Skip to content

Commit

Permalink
Various fixes & enhancements for Devcon use cases (#297)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
micwallace authored Sep 30, 2022
1 parent 4e2d83d commit 6b5789b
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/main/javascript/crypto/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tokenscript/attestation",
"version": "0.3.9-sc.6",
"version": "0.3.9-dc.3",
"description": "A library for integrating cryptographic attestations into applications",
"type": "commonjs",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion src/main/javascript/crypto/src/Authenticator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ export class Authenticator {
}

// TODO: Pass in Ticket schema object
static validateUseTicket(proof:string, base64attestorPublicKey:string, base64issuerPublicKeys: {[key: string]: KeyPair|string}, userEthKey:string){
static validateUseTicket(proof:string, base64attestorPublicKey:string, base64issuerPublicKeys: {[key: string]: KeyPair|string}, userEthKey: string|null){

let attestorKey = KeyPair.publicFromBase64orPEM(base64attestorPublicKey);
let issuerKeys = KeyPair.parseKeyArrayStrings(base64issuerPublicKeys);
Expand Down
4 changes: 4 additions & 0 deletions src/main/javascript/crypto/src/Ticket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ export class Ticket extends AttestableObject implements Attestable {
return this.ticketClass;
}

public getDevconId(){
return this.devconId;
}

public getSignature(): string {
return this.signature;
}
Expand Down
3 changes: 3 additions & 0 deletions src/main/javascript/crypto/src/libs/AttestedObject.ts
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,9 @@ export class AttestedObject implements ASNEncodable, Verifiable {
return false;
}

if (ethAddress === null)
return true;

try {

// CHECK: the Ethereum address on the attestation matches receivers signing key
Expand Down

1 comment on commit 6b5789b

@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.33% 2154/2898
🔴 Branches 47.32% 283/598
🟡 Functions 79.21% 381/481
🟡 Lines 74.53% 2113/2835

Test suite run success

56 tests passing in 2 suites.

Report generated by 🧪jest coverage report action from 6b5789b

Please sign in to comment.