-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Simon
committed
May 1, 2021
1 parent
c35be5e
commit d9ff198
Showing
6 changed files
with
4,551 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
// import Expression from '../index'; | ||
|
||
test('Dummy test', () => { | ||
expect(0).toBe(0); | ||
}); | ||
|
||
// test('Text with substring', () => { | ||
// expect(new Expression("'${VALUE}'.includes('${ARG_1}')", 'Zurich', ['ich']).evaluate()).toBe(true); | ||
// }); | ||
|
||
// test('String part of array', () => { | ||
// expect(new Expression("${ARG_1}.includes('${VALUE}')", 'Zürich', ["['Zürich', 'Flims', 'Luzern']"]).evaluate()).toBe( | ||
// true, | ||
// ); | ||
// }); | ||
|
||
// test('Number with <= operator', () => { | ||
// expect(new Expression('${VALUE} <= ${ARG_1}', '1', ['2']).evaluate()).toBe(true); | ||
// }); | ||
|
||
// test('Number with multiple arguments', () => { | ||
// expect(new Expression('${VALUE} <= ${ARG_1} && ${VALUE} <= ${ARG_2}', '1', ['2', '1']).evaluate()).toBe(true); | ||
// }); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,114 @@ | ||
export const Greeter = (name: string) => `Hello ${name}`; | ||
import { ICredentialRequestInput } from '@veramo/selective-disclosure'; | ||
|
||
/** | ||
* Interface that captures the DAG architecture of JSON-LD documents. | ||
*/ | ||
export interface ISchemaNode { | ||
key: string; | ||
name?: string; | ||
url?: string; | ||
children?: ISchemaNode[]; | ||
dataType?: DataType; | ||
} | ||
|
||
/** | ||
* Data types that are used in the claim context. | ||
*/ | ||
export type DataType = 'NUMBER' | 'DATE' | 'BOOLEAN' | 'TEXT'; | ||
|
||
/** | ||
* Schemas that create a common context among different parties. | ||
* Used to quickly bootstrap verifiable credentials, presentations and selective disclosure requests. | ||
* TODO: add additional schemas from schema.org and others. | ||
*/ | ||
export const schemas: [ISchemaNode] = [ | ||
{ | ||
key: 'https://schema.org', | ||
children: [ | ||
{ | ||
key: 'Person', | ||
url: 'https://schema.org/Person', | ||
children: [ | ||
{ | ||
key: 'birthDate', | ||
url: 'https://schema.org/birthDate', | ||
dataType: 'DATE', | ||
}, | ||
{ | ||
key: 'PostalAddress', | ||
url: 'https://schema.org/Person', | ||
children: [ | ||
{ | ||
key: 'postalCode', | ||
url: 'https://schema.org/postalCode', | ||
dataType: 'TEXT', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
{ | ||
key: 'Ticket', | ||
url: 'https://schema.org/Ticket', | ||
children: [ | ||
{ | ||
key: 'dateIssued', | ||
url: 'https://schema.org/dateIssued', | ||
dataType: 'DATE', | ||
}, | ||
{ | ||
key: 'ticketNumber', | ||
url: 'https://schema.org/ticketNumber', | ||
dataType: 'TEXT', | ||
}, | ||
{ | ||
key: 'totalPrice', | ||
url: 'https://schema.org/totalPrice', | ||
dataType: 'NUMBER', | ||
}, | ||
], | ||
}, | ||
{ | ||
key: 'VoteAction', | ||
url: 'https://schema.org/VoteAction', | ||
children: [ | ||
{ | ||
key: 'name', | ||
url: 'https://schema.org/name', | ||
dataType: 'TEXT', | ||
}, | ||
], | ||
}, | ||
{ | ||
key: 'Place', | ||
url: 'https://schema.org/Place', | ||
children: [ | ||
{ | ||
key: 'publicAccess', | ||
url: 'https://schema.org/publicAccess', | ||
dataType: 'BOOLEAN', | ||
}, | ||
], | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
/** | ||
* Interface that captures a constraint configuration. | ||
* The `js` string is a JS expression that can be evaluated with `eval()`. | ||
*/ | ||
export interface IConstraint { | ||
js: string; | ||
desc: string; | ||
} | ||
|
||
/** | ||
* Interface that captures a combination of a claim and a constraint. | ||
* The claim is used to create selective disclouse requets in the authentication process. (ex. reveal your brithDate) | ||
* The constraint is used to evaluate the value that is revealed in the authentication process. (ex. is your birthDay before some date) | ||
*/ | ||
export interface IClaimConstraintConfig { | ||
claim: ICredentialRequestInput; | ||
constraint: IConstraint; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.