diff --git a/README.md b/README.md index b60d7d2..5791ff9 100644 --- a/README.md +++ b/README.md @@ -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; - setFetch: (fetchFunction: FetchFunction) => Status; - setLogger: (logger: Logger) => Status; - - 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; - - loginMetadata: { - authorizationCode: string; - codeVerifier: string; - accessToken: string; - } - - documents: Document[]; - issuers: Issuer[]; - - refreshIssuers:() => Promise; - refreshDocuments:() => Promise; - searchDocument:(documentSearchFilter: DocumentSearchFilter) => Promise; - searchIssuer:(issuerSearchFilter: IssuerSearchFilter) => Promise); - logout:() => Promise; - - refreshAccessToken: () => Promise; - - update:(user: User) => Promise; - getDocumentByType:(type: DocumentType) => Promise; - - // Globals from Digilocker - persist: PersistFunction; - fetch: FetchFunction; - log: Logger; - - // Frontend UserData - public getData: () => Promise>; -} - -interface PersistFunction { (user: User) => Promise>} - -// 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) diff --git a/dist/digilocker-sdk.cjs.development.js b/dist/digilocker-sdk.cjs.development.js deleted file mode 100644 index 3c804f9..0000000 --- a/dist/digilocker-sdk.cjs.development.js +++ /dev/null @@ -1,13 +0,0 @@ -'use strict'; - -Object.defineProperty(exports, '__esModule', { value: true }); - -var sum = function sum(a, b) { - { - console.log('boop'); - } - return a + b; -}; - -exports.sum = sum; -//# sourceMappingURL=digilocker-sdk.cjs.development.js.map diff --git a/dist/digilocker-sdk.cjs.development.js.map b/dist/digilocker-sdk.cjs.development.js.map deleted file mode 100644 index 077aba9..0000000 --- a/dist/digilocker-sdk.cjs.development.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"digilocker-sdk.cjs.development.js","sources":["../src/index.ts"],"sourcesContent":["export const sum = (a: number, b: number) => {\n if ('development' === process.env.NODE_ENV) {\n console.log('boop');\n }\n return a + b;\n};\n"],"names":["sum","a","b","console","log"],"mappings":";;;;IAAaA,GAAG,GAAG,SAANA,GAAGA,CAAIC,CAAS,EAAEC,CAAS;EACM;IAC1CC,OAAO,CAACC,GAAG,CAAC,MAAM,CAAC;;EAErB,OAAOH,CAAC,GAAGC,CAAC;AACd;;;;"} \ No newline at end of file diff --git a/dist/digilocker-sdk.cjs.production.min.js b/dist/digilocker-sdk.cjs.production.min.js deleted file mode 100644 index a314da0..0000000 --- a/dist/digilocker-sdk.cjs.production.min.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.sum=function(e,t){return e+t}; -//# sourceMappingURL=digilocker-sdk.cjs.production.min.js.map diff --git a/dist/digilocker-sdk.cjs.production.min.js.map b/dist/digilocker-sdk.cjs.production.min.js.map deleted file mode 100644 index e774979..0000000 --- a/dist/digilocker-sdk.cjs.production.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"digilocker-sdk.cjs.production.min.js","sources":["../src/index.ts"],"sourcesContent":["export const sum = (a: number, b: number) => {\n if ('development' === process.env.NODE_ENV) {\n console.log('boop');\n }\n return a + b;\n};\n"],"names":["a","b"],"mappings":"gFAAmB,SAACA,EAAWC,GAI7B,OAAOD,EAAIC"} \ No newline at end of file diff --git a/dist/digilocker-sdk.esm.js b/dist/digilocker-sdk.esm.js deleted file mode 100644 index ef5444b..0000000 --- a/dist/digilocker-sdk.esm.js +++ /dev/null @@ -1,9 +0,0 @@ -var sum = function sum(a, b) { - if ('development' === process.env.NODE_ENV) { - console.log('boop'); - } - return a + b; -}; - -export { sum }; -//# sourceMappingURL=digilocker-sdk.esm.js.map diff --git a/dist/digilocker-sdk.esm.js.map b/dist/digilocker-sdk.esm.js.map deleted file mode 100644 index 0cd527c..0000000 --- a/dist/digilocker-sdk.esm.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"digilocker-sdk.esm.js","sources":["../src/index.ts"],"sourcesContent":["export const sum = (a: number, b: number) => {\n if ('development' === process.env.NODE_ENV) {\n console.log('boop');\n }\n return a + b;\n};\n"],"names":["sum","a","b","process","env","NODE_ENV","console","log"],"mappings":"IAAaA,GAAG,GAAG,SAANA,GAAGA,CAAIC,CAAS,EAAEC,CAAS;EACtC,IAAI,aAAa,KAAKC,OAAO,CAACC,GAAG,CAACC,QAAQ,EAAE;IAC1CC,OAAO,CAACC,GAAG,CAAC,MAAM,CAAC;;EAErB,OAAON,CAAC,GAAGC,CAAC;AACd;;;;"} \ No newline at end of file diff --git a/dist/index.d.ts b/dist/index.d.ts deleted file mode 100644 index 0568255..0000000 --- a/dist/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export declare const sum: (a: number, b: number) => number; diff --git a/dist/index.js b/dist/index.js deleted file mode 100644 index e177071..0000000 --- a/dist/index.js +++ /dev/null @@ -1,8 +0,0 @@ - -'use strict' - -if (process.env.NODE_ENV === 'production') { - module.exports = require('./digilocker-sdk.cjs.production.min.js') -} else { - module.exports = require('./digilocker-sdk.cjs.development.js') -}