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

feat: 🎸 Add verifier for w3c-did identityProof #80

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ node_modules/
dist/
.idea
*.iml
.vscode/
91 changes: 58 additions & 33 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"dependencies": {
"@govtechsg/dnsprove": "^2.0.5",
"@govtechsg/open-attestation": "3.1.0",
"ethers": "^4.0.40"
"@types/request-promise-native": "^1.0.17",
"ethers": "^4.0.40",
"request-promise-native": "^1.0.8"
Copy link
Contributor

Choose a reason for hiding this comment

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

we usually use axios with async/await

},
"devDependencies": {
"@commitlint/cli": "8.2.0",
Expand Down
9 changes: 9 additions & 0 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -1 +1,10 @@
export const INFURA_API_KEY = "92c9a51428b946c1b8c1ac5a237616e4";

// DID Universal Resolver parameters
export const BASE_RESOLVER_URL = "https://uniresolver.io";
export const RESOLVER_VERSION = "1.0";
export const RESOLVER_PATH = "identifiers";

// w3c-dids
export const ETHR_DID_METHOD = "ethr";
export const SUPPORTED_DID_AUTH = ["Secp256k1SignatureAuthentication2018"];
63 changes: 63 additions & 0 deletions src/types/w3c-did.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
export interface Identity {
identified: true;
ethereumAddress: string;
smartContract: string;
}

export interface DIDDocument {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

would it make sense to then install it as a dependency and use the exported types?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That feels like a good solution. Then also as types inevitably evolve we can just bump version of the package instead of having to replicate changes manually... I like it.

"@context": "https://w3id.org/did/v1";
id: string;
publicKey: PublicKey[];
authentication?: Authentication[];
uportProfile?: any;
service?: ServiceEndpoint[];
created?: string;
updated?: string;
proof?: LinkedDataProof;
}

export interface ServiceEndpoint {
id: string;
type: string;
serviceEndpoint: string;
description?: string;
}

export interface PublicKey {
id: string;
type: string;
owner: string;
ethereumAddress?: string;
publicKeyBase64?: string;
publicKeyBase58?: string;
publicKeyHex?: string;
publicKeyPem?: string;
}

export interface Authentication {
type: string;
publicKey: string[];
}

export interface LinkedDataProof {
type: string;
created: string;
creator: string;
nonce: string;
signatureValue: string;
}

export interface Params {
[index: string]: string;
}

export interface ParsedDID {
did: string;
didUrl: string;
method: string;
id: string;
path?: string;
fragment?: string;
query?: string;
params?: Params;
}
Loading