Skip to content

Commit

Permalink
Fix: Update Docs; Remove dist tracking
Browse files Browse the repository at this point in the history
  • Loading branch information
ChakshuGautam committed Jun 24, 2023
1 parent 96bb73a commit 9ab05f6
Show file tree
Hide file tree
Showing 9 changed files with 5 additions and 165 deletions.
134 changes: 5 additions & 129 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,139 +8,15 @@
4. eSign (WIP)

## Usage

### Frontend

### Backend

### Digilocker
```ts

interface Config {
// Application level config
clientId: string;
clientSecret: string;
callbackURL: string;
}

interface Digilocker {
init: (config: Config) => Digilocker;
generateUser: (userId: string) => User;
setPersistence: (persistFunction: PersistFunction) => Status<PersistFunction>;
setFetch: (fetchFunction: FetchFunction) => Status<FetchFunction>;
setLogger: (logger: Logger) => Status<Logger>;

utility: {
generateCodeChallenge: (codeVerifier?: string) => string;
};
}
```

### DocumentType
```ts
enum DocumentType {
AADHAAR = 1,
...
}

// Digilocker to DocumentTypeMapping
private interface DocumentMapping {
name: string
type: DocumentType
description: string
id: string
digilockerId: string
}
```

### Document
```ts
interface Document {
name: string
type: string
size: string
date: string
parent: string
mime: [
{}
]
uri: string
doctype: DocumentType
description: string
issuerid: string
issuer: string
}
```

### Issuer
```ts
interface Issuer {
id: string,
name: string,
description: string
}
```

### User
```ts
interface User {
userId: string;
isLoggedIn: boolean;

// User goes and logs in on the frontend => authorizationCode;
constructURL: () => string;
loginCallback: (authorizationCode: string) => User;

login:() => Promise<LoginError || User>;

loginMetadata: {
authorizationCode: string;
codeVerifier: string;
accessToken: string;
}

documents: Document[];
issuers: Issuer[];

refreshIssuers:() => Promise<void>;
refreshDocuments:() => Promise<void>;
searchDocument:(documentSearchFilter: DocumentSearchFilter) => Promise<Document[] || DocumentType>;
searchIssuer:(issuerSearchFilter: IssuerSearchFilter) => Promise<Issuer[]>);
logout:() => Promise<void>;

refreshAccessToken: () => Promise<void>;

update:(user: User) => Promise<User>;
getDocumentByType:(type: DocumentType) => Promise<Document>;

// Globals from Digilocker
persist: PersistFunction;
fetch: FetchFunction;
log: Logger;

// Frontend UserData
public getData: () => Promise<Partial<User>>;
}

interface PersistFunction { (user: User) => Promise<PersistResponse<User>>}

// AND and string are matched by contains
interface DocumentSearchFilter {
documentType: DocumentType[];
issuer: Issuer;
name: string;
date__gte: string;
date__lte: string;
}
### Type Definitions

// AND and string are matched by contains
interface IssuerSearchFilter {
id: string,
name: string
}
See all the types [here](./src/types.ts)

interface LoginError {
...
}
```
## References

Digilocker APIs: [Link](https://partners.digitallocker.gov.in/assets/img/Digital%20Locker%20Authorized%20Partner%20API%20Specification%20v1.8.pdf)
Digilocker APIs: [Link](https://partners.digitallocker.gov.in/assets/img/Digital%20Locker%20Authorized%20Partner%20API%20Specification%20v1.8.pdf)
13 changes: 0 additions & 13 deletions dist/digilocker-sdk.cjs.development.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/digilocker-sdk.cjs.development.js.map

This file was deleted.

2 changes: 0 additions & 2 deletions dist/digilocker-sdk.cjs.production.min.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/digilocker-sdk.cjs.production.min.js.map

This file was deleted.

9 changes: 0 additions & 9 deletions dist/digilocker-sdk.esm.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/digilocker-sdk.esm.js.map

This file was deleted.

1 change: 0 additions & 1 deletion dist/index.d.ts

This file was deleted.

8 changes: 0 additions & 8 deletions dist/index.js

This file was deleted.

0 comments on commit 9ab05f6

Please sign in to comment.