Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from 1 commit
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/
94 changes: 59 additions & 35 deletions package-lock.json

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

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,10 @@
"license": "GPL-3.0",
"dependencies": {
"@govtechsg/dnsprove": "^2.0.5",
"@govtechsg/open-attestation": "3.0.4",
"ethers": "^4.0.40"
"@govtechsg/open-attestation": "3.1.0",
"@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