@truvity/sdk 0.37.6 → 0.37.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Client.d.ts +3 -1
- package/Client.d.ts.map +1 -1
- package/Client.js +43 -1
- package/Client.js.map +1 -1
- package/ExtendedClient.d.ts +1 -2
- package/ExtendedClient.d.ts.map +1 -1
- package/ExtendedClient.js +1 -5
- package/ExtendedClient.js.map +1 -1
- package/api/resources/apiKeys/client/Client.d.ts +3 -1
- package/api/resources/apiKeys/client/Client.d.ts.map +1 -1
- package/api/resources/apiKeys/client/Client.js +28 -31
- package/api/resources/apiKeys/client/Client.js.map +1 -1
- package/api/resources/apiKeys/client/index.d.ts +1 -0
- package/api/resources/apiKeys/client/index.d.ts.map +1 -1
- package/api/resources/apiKeys/client/index.js.map +1 -1
- package/api/resources/credentials/client/Client.d.ts +4 -3
- package/api/resources/credentials/client/Client.d.ts.map +1 -1
- package/api/resources/credentials/client/Client.js +38 -41
- package/api/resources/credentials/client/Client.js.map +1 -1
- package/api/resources/credentials/client/index.d.ts +1 -0
- package/api/resources/credentials/client/index.d.ts.map +1 -1
- package/api/resources/credentials/client/index.js.map +1 -1
- package/api/resources/desk/client/Client.d.ts +3 -1
- package/api/resources/desk/client/Client.d.ts.map +1 -1
- package/api/resources/desk/client/Client.js +7 -10
- package/api/resources/desk/client/Client.js.map +1 -1
- package/api/resources/desk/client/index.d.ts +1 -0
- package/api/resources/desk/client/index.d.ts.map +1 -1
- package/api/resources/desk/client/index.js.map +1 -1
- package/api/resources/didcommMessages/client/Client.d.ts +3 -1
- package/api/resources/didcommMessages/client/Client.d.ts.map +1 -1
- package/api/resources/didcommMessages/client/Client.js +28 -31
- package/api/resources/didcommMessages/client/Client.js.map +1 -1
- package/api/resources/didcommMessages/client/index.d.ts +1 -0
- package/api/resources/didcommMessages/client/index.d.ts.map +1 -1
- package/api/resources/didcommMessages/client/index.js.map +1 -1
- package/api/resources/dids/client/Client.d.ts +3 -1
- package/api/resources/dids/client/Client.d.ts.map +1 -1
- package/api/resources/dids/client/Client.js +4 -7
- package/api/resources/dids/client/Client.js.map +1 -1
- package/api/resources/dids/client/index.d.ts +1 -0
- package/api/resources/dids/client/index.d.ts.map +1 -1
- package/api/resources/dids/client/index.js.map +1 -1
- package/api/resources/drafts/client/Client.d.ts +4 -3
- package/api/resources/drafts/client/Client.d.ts.map +1 -1
- package/api/resources/drafts/client/Client.js +38 -41
- package/api/resources/drafts/client/Client.js.map +1 -1
- package/api/resources/drafts/client/index.d.ts +1 -0
- package/api/resources/drafts/client/index.d.ts.map +1 -1
- package/api/resources/drafts/client/index.js.map +1 -1
- package/api/resources/files/client/Client.d.ts +4 -3
- package/api/resources/files/client/Client.d.ts.map +1 -1
- package/api/resources/files/client/Client.js +35 -38
- package/api/resources/files/client/Client.js.map +1 -1
- package/api/resources/files/client/index.d.ts +1 -0
- package/api/resources/files/client/index.d.ts.map +1 -1
- package/api/resources/files/client/index.js.map +1 -1
- package/api/resources/gdpr/client/Client.d.ts +3 -1
- package/api/resources/gdpr/client/Client.d.ts.map +1 -1
- package/api/resources/gdpr/client/Client.js +4 -7
- package/api/resources/gdpr/client/Client.js.map +1 -1
- package/api/resources/gdpr/client/index.d.ts +1 -0
- package/api/resources/gdpr/client/index.d.ts.map +1 -1
- package/api/resources/gdpr/client/index.js.map +1 -1
- package/api/resources/keys/client/Client.d.ts +6 -5
- package/api/resources/keys/client/Client.d.ts.map +1 -1
- package/api/resources/keys/client/Client.js +43 -46
- package/api/resources/keys/client/Client.js.map +1 -1
- package/api/resources/keys/client/index.d.ts +1 -0
- package/api/resources/keys/client/index.d.ts.map +1 -1
- package/api/resources/keys/client/index.js.map +1 -1
- package/api/resources/presentations/client/Client.d.ts +5 -4
- package/api/resources/presentations/client/Client.d.ts.map +1 -1
- package/api/resources/presentations/client/Client.js +45 -48
- package/api/resources/presentations/client/Client.js.map +1 -1
- package/api/resources/presentations/client/index.d.ts +1 -0
- package/api/resources/presentations/client/index.d.ts.map +1 -1
- package/api/resources/presentations/client/index.js.map +1 -1
- package/core/fetcher/BinaryResponse.d.ts +21 -0
- package/core/fetcher/BinaryResponse.d.ts.map +1 -0
- package/core/fetcher/BinaryResponse.js +18 -0
- package/core/fetcher/BinaryResponse.js.map +1 -0
- package/core/fetcher/Fetcher.d.ts +3 -2
- package/core/fetcher/Fetcher.d.ts.map +1 -1
- package/core/fetcher/Fetcher.js +25 -12
- package/core/fetcher/Fetcher.js.map +1 -1
- package/core/fetcher/ResponseWithBody.d.ts +5 -0
- package/core/fetcher/ResponseWithBody.d.ts.map +1 -0
- package/core/fetcher/ResponseWithBody.js +7 -0
- package/core/fetcher/ResponseWithBody.js.map +1 -0
- package/core/fetcher/createRequestUrl.d.ts +1 -1
- package/core/fetcher/createRequestUrl.d.ts.map +1 -1
- package/core/fetcher/createRequestUrl.js +3 -7
- package/core/fetcher/createRequestUrl.js.map +1 -1
- package/core/fetcher/getErrorResponseBody.d.ts +2 -0
- package/core/fetcher/getErrorResponseBody.d.ts.map +1 -0
- package/core/fetcher/getErrorResponseBody.js +45 -0
- package/core/fetcher/getErrorResponseBody.js.map +1 -0
- package/core/fetcher/getFetchFn.d.ts +1 -4
- package/core/fetcher/getFetchFn.d.ts.map +1 -1
- package/core/fetcher/getFetchFn.js +1 -52
- package/core/fetcher/getFetchFn.js.map +1 -1
- package/core/fetcher/getResponseBody.d.ts.map +1 -1
- package/core/fetcher/getResponseBody.js +34 -33
- package/core/fetcher/getResponseBody.js.map +1 -1
- package/core/fetcher/index.d.ts +1 -0
- package/core/fetcher/index.d.ts.map +1 -1
- package/core/fetcher/index.js.map +1 -1
- package/core/headers.d.ts +4 -0
- package/core/headers.d.ts.map +1 -0
- package/core/headers.js +30 -0
- package/core/headers.js.map +1 -0
- package/core/index.d.ts +1 -0
- package/core/index.d.ts.map +1 -1
- package/core/index.js +2 -1
- package/core/index.js.map +1 -1
- package/core/runtime/runtime.d.ts.map +1 -1
- package/core/runtime/runtime.js +0 -1
- package/core/runtime/runtime.js.map +1 -1
- package/core/url/index.d.ts +3 -0
- package/core/url/index.d.ts.map +1 -0
- package/core/url/index.js +8 -0
- package/core/url/index.js.map +1 -0
- package/core/url/join.d.ts +2 -0
- package/core/url/join.d.ts.map +1 -0
- package/core/url/join.js +50 -0
- package/core/url/join.js.map +1 -0
- package/core/url/qs.d.ts +7 -0
- package/core/url/qs.d.ts.map +1 -0
- package/core/url/qs.js +65 -0
- package/core/url/qs.js.map +1 -0
- package/documents/credential/document/vcdm.d.ts +1 -1
- package/documents/credential/document/vcdm.d.ts.map +1 -1
- package/documents/credential/document/vcdm.js +12 -1
- package/documents/credential/document/vcdm.js.map +1 -1
- package/documents/credential/document.d.ts +2 -2
- package/documents/credential/document.d.ts.map +1 -1
- package/documents/credential/document.js +21 -8
- package/documents/credential/document.js.map +1 -1
- package/documents/credential/draft/draft.d.ts +2 -2
- package/documents/credential/draft/draft.d.ts.map +1 -1
- package/documents/credential/draft/draft.js.map +1 -1
- package/documents/credential/flavor/vcdm1_1.d.ts +3 -3
- package/documents/credential/flavor/vcdm1_1.d.ts.map +1 -1
- package/documents/credential/flavor/vcdm1_1.js +27 -25
- package/documents/credential/flavor/vcdm1_1.js.map +1 -1
- package/documents/credential/flavor/vcdm2_0.d.ts +2 -2
- package/documents/credential/flavor/vcdm2_0.d.ts.map +1 -1
- package/documents/credential/flavor/vcdm2_0.js +29 -16
- package/documents/credential/flavor/vcdm2_0.js.map +1 -1
- package/documents/credential/flavor.d.ts +2 -2
- package/documents/credential/flavor.d.ts.map +1 -1
- package/documents/credential/flavor.js +25 -10
- package/documents/credential/flavor.js.map +1 -1
- package/documents/credential/flavor.spec.js +3 -3
- package/documents/credential/flavor.spec.js.map +1 -1
- package/documents/credential/types.d.ts +4 -4
- package/documents/credential/types.d.ts.map +1 -1
- package/documents/credential/types.js.map +1 -1
- package/documents/credential/verifiable/verifiable.d.ts.map +1 -1
- package/documents/credential/verifiable/verifiable.js +1 -2
- package/documents/credential/verifiable/verifiable.js.map +1 -1
- package/documents/credential/verifiable/with-claims.js +1 -1
- package/documents/credential/verifiable/with-claims.js.map +1 -1
- package/documents/credential.d.ts.map +1 -1
- package/documents/credential.js +1 -5
- package/documents/credential.js.map +1 -1
- package/documents/index.d.ts +0 -1
- package/documents/index.d.ts.map +1 -1
- package/documents/index.js +0 -1
- package/documents/index.js.map +1 -1
- package/documents/models.d.ts +1 -2
- package/documents/models.d.ts.map +1 -1
- package/documents/models.js +5 -3
- package/documents/models.js.map +1 -1
- package/documents/presentation.d.ts.map +1 -1
- package/documents/presentation.js +1 -5
- package/documents/presentation.js.map +1 -1
- package/documents/types.d.ts +2 -3
- package/documents/types.d.ts.map +1 -1
- package/documents/types.js.map +1 -1
- package/middlewares/csrf/csrf.d.ts.map +1 -1
- package/middlewares/csrf/csrf.js +1 -5
- package/middlewares/csrf/csrf.js.map +1 -1
- package/package.json +9 -14
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts +0 -31
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.d.ts.map +0 -1
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js +0 -248
- package/core/fetcher/stream-wrappers/Node18UniversalStreamWrapper.js.map +0 -1
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts +0 -22
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.d.ts.map +0 -1
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js +0 -127
- package/core/fetcher/stream-wrappers/NodePre18StreamWrapper.js.map +0 -1
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts +0 -32
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.d.ts.map +0 -1
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js +0 -230
- package/core/fetcher/stream-wrappers/UndiciStreamWrapper.js.map +0 -1
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts +0 -19
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.d.ts.map +0 -1
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js +0 -60
- package/core/fetcher/stream-wrappers/chooseStreamWrapper.js.map +0 -1
- package/documents/utils/stream.d.ts +0 -8
- package/documents/utils/stream.d.ts.map +0 -1
- package/documents/utils/stream.js +0 -50
- package/documents/utils/stream.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"headers.js","sourceRoot":"","sources":["../../src/core/headers.ts"],"names":[],"mappings":";;AAEA,oCAgBC;AAED,0DAcC;AAhCD,SAAgB,YAAY,CACxB,GAAG,YAAoG;IAEvG,MAAM,MAAM,GAA+D,EAAE,CAAC;IAE9E,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,YAAY;SAClC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,IAAI,IAAI,CAAC;SACpC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QACjD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAChB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACxB,CAAC;aAAM,IAAI,GAAG,IAAI,MAAM,EAAE,CAAC;YACvB,OAAO,MAAM,CAAC,GAAG,CAAC,CAAC;QACvB,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC;AAED,SAAgB,uBAAuB,CACnC,GAAG,YAAoG;IAEvG,MAAM,MAAM,GAA+D,EAAE,CAAC;IAE9E,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,YAAY;SAClC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,IAAI,IAAI,CAAC;SACpC,OAAO,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,EAAE,CAAC;QACjD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;YAChB,MAAM,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;QACxB,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC","sourcesContent":["import * as core from './index';\n\nexport function mergeHeaders(\n ...headersArray: (Record<string, string | core.Supplier<string | undefined> | undefined> | undefined)[]\n): Record<string, string | core.Supplier<string | undefined>> {\n const result: Record<string, string | core.Supplier<string | undefined>> = {};\n\n for (const [key, value] of headersArray\n .filter((headers) => headers != null)\n .flatMap((headers) => Object.entries(headers))) {\n if (value != null) {\n result[key] = value;\n } else if (key in result) {\n delete result[key];\n }\n }\n\n return result;\n}\n\nexport function mergeOnlyDefinedHeaders(\n ...headersArray: (Record<string, string | core.Supplier<string | undefined> | undefined> | undefined)[]\n): Record<string, string | core.Supplier<string | undefined>> {\n const result: Record<string, string | core.Supplier<string | undefined>> = {};\n\n for (const [key, value] of headersArray\n .filter((headers) => headers != null)\n .flatMap((headers) => Object.entries(headers))) {\n if (value != null) {\n result[key] = value;\n }\n }\n\n return result;\n}\n"]}
|
package/core/index.d.ts
CHANGED
package/core/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,OAAO,KAAK,aAAa,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,OAAO,KAAK,GAAG,MAAM,OAAO,CAAC;AAC7B,OAAO,KAAK,aAAa,MAAM,WAAW,CAAC"}
|
package/core/index.js
CHANGED
|
@@ -36,8 +36,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
36
36
|
};
|
|
37
37
|
})();
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.serialization = void 0;
|
|
39
|
+
exports.serialization = exports.url = void 0;
|
|
40
40
|
__exportStar(require("./fetcher"), exports);
|
|
41
41
|
__exportStar(require("./runtime"), exports);
|
|
42
|
+
exports.url = __importStar(require("./url"));
|
|
42
43
|
exports.serialization = __importStar(require("./schemas"));
|
|
43
44
|
//# sourceMappingURL=index.js.map
|
package/core/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,4CAA0B;AAC1B,2DAA2C","sourcesContent":["export * from './fetcher';\nexport * from './runtime';\nexport * as serialization from './schemas';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/core/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,4CAA0B;AAC1B,6CAA6B;AAC7B,2DAA2C","sourcesContent":["export * from './fetcher';\nexport * from './runtime';\nexport * as url from './url';\nexport * as serialization from './schemas';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/core/runtime/runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../../src/core/runtime/runtime.ts"],"names":[],"mappings":"AAiBA;;GAEG;AACH,eAAO,MAAM,OAAO,EAAE,OAA2B,CAAC;AAElD,MAAM,WAAW,OAAO;IACpB,IAAI,EAAE,SAAS,GAAG,YAAY,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,GAAG,cAAc,GAAG,SAAS,GAAG,SAAS,GAAG,cAAc,CAAC;IACnH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,aAAa,CAAC,EAAE,MAAM,CAAC;CAC1B"}
|
package/core/runtime/runtime.js
CHANGED
|
@@ -41,7 +41,6 @@ function evaluateRuntime() {
|
|
|
41
41
|
* A constant that indicates whether the environment the code is running is a Web Worker.
|
|
42
42
|
*/
|
|
43
43
|
const isWebWorker = typeof self === 'object' &&
|
|
44
|
-
// @ts-ignore
|
|
45
44
|
typeof (self === null || self === void 0 ? void 0 : self.importScripts) === 'function' &&
|
|
46
45
|
(((_b = self.constructor) === null || _b === void 0 ? void 0 : _b.name) === 'DedicatedWorkerGlobalScope' ||
|
|
47
46
|
((_c = self.constructor) === null || _c === void 0 ? void 0 : _c.name) === 'ServiceWorkerGlobalScope' ||
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/core/runtime/runtime.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../../../src/core/runtime/runtime.ts"],"names":[],"mappings":";;;AAiBA;;GAEG;AACU,QAAA,OAAO,GAAY,eAAe,EAAE,CAAC;AAQlD,SAAS,eAAe;;IACpB;;OAEG;IACH,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,WAAW,IAAI,OAAO,MAAM,CAAC,QAAQ,KAAK,WAAW,CAAC;IAC1F,IAAI,SAAS,EAAE,CAAC;QACZ,OAAO;YACH,IAAI,EAAE,SAAS;YACf,OAAO,EAAE,MAAM,CAAC,SAAS,CAAC,SAAS;SACtC,CAAC;IACN,CAAC;IAED;;;OAGG;IACH,MAAM,YAAY,GAAG,OAAO,UAAU,KAAK,WAAW,IAAI,CAAA,MAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,SAAS,0CAAE,SAAS,MAAK,oBAAoB,CAAC;IACpH,IAAI,YAAY,EAAE,CAAC;QACf,OAAO;YACH,IAAI,EAAE,SAAS;SAClB,CAAC;IACN,CAAC;IAED;;;OAGG;IACH,MAAM,aAAa,GAAG,OAAO,WAAW,KAAK,QAAQ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A,OAAO,CAAC,QAAQ,0CAAE,IAAI,CAAA,CAAC;IAC7B,IAAI,MAAM,EAAE,CAAC;QACT,OAAO;YACH,IAAI,EAAE,MAAM;YACZ,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI;YAC9B,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SAC7D,CAAC;IACN,CAAC;IAED;;;OAGG;IACH,MAAM,aAAa,GAAG,OAAO,SAAS,KAAK,WAAW,IAAI,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,OAAO,MAAK,aAAa,CAAC;IAC/F,IAAI,aAAa,EAAE,CAAC;QAChB,OAAO;YACH,IAAI,EAAE,cAAc;SACvB,CAAC;IACN,CAAC;IAED,OAAO;QACH,IAAI,EAAE,SAAS;KAClB,CAAC;AACN,CAAC","sourcesContent":["interface DenoGlobal {\n version: {\n deno: string;\n };\n}\n\ninterface BunGlobal {\n version: string;\n}\n\ndeclare const Deno: DenoGlobal | undefined;\ndeclare const Bun: BunGlobal | undefined;\ndeclare const EdgeRuntime: string | undefined;\ndeclare const self: typeof globalThis.self & {\n importScripts?: unknown;\n};\n\n/**\n * A constant that indicates which environment and version the SDK is running in.\n */\nexport const RUNTIME: Runtime = evaluateRuntime();\n\nexport interface Runtime {\n type: 'browser' | 'web-worker' | 'deno' | 'bun' | 'node' | 'react-native' | 'unknown' | 'workerd' | 'edge-runtime';\n version?: string;\n parsedVersion?: number;\n}\n\nfunction evaluateRuntime(): Runtime {\n /**\n * A constant that indicates whether the environment the code is running is a Web Browser.\n */\n const isBrowser = typeof window !== 'undefined' && typeof window.document !== 'undefined';\n if (isBrowser) {\n return {\n type: 'browser',\n version: window.navigator.userAgent,\n };\n }\n\n /**\n * A constant that indicates whether the environment the code is running is Cloudflare.\n * https://developers.cloudflare.com/workers/runtime-apis/web-standards/#navigatoruseragent\n */\n const isCloudflare = typeof globalThis !== 'undefined' && globalThis?.navigator?.userAgent === 'Cloudflare-Workers';\n if (isCloudflare) {\n return {\n type: 'workerd',\n };\n }\n\n /**\n * A constant that indicates whether the environment the code is running is Edge Runtime.\n * https://vercel.com/docs/functions/runtimes/edge-runtime#check-if-you're-running-on-the-edge-runtime\n */\n const isEdgeRuntime = typeof EdgeRuntime === 'string';\n if (isEdgeRuntime) {\n return {\n type: 'edge-runtime',\n };\n }\n\n /**\n * A constant that indicates whether the environment the code is running is a Web Worker.\n */\n const isWebWorker =\n typeof self === 'object' &&\n typeof self?.importScripts === 'function' &&\n (self.constructor?.name === 'DedicatedWorkerGlobalScope' ||\n self.constructor?.name === 'ServiceWorkerGlobalScope' ||\n self.constructor?.name === 'SharedWorkerGlobalScope');\n if (isWebWorker) {\n return {\n type: 'web-worker',\n };\n }\n\n /**\n * A constant that indicates whether the environment the code is running is Deno.\n * FYI Deno spoofs process.versions.node, see https://deno.land/std@0.177.0/node/process.ts?s=versions\n */\n const isDeno =\n typeof Deno !== 'undefined' && typeof Deno.version !== 'undefined' && typeof Deno.version.deno !== 'undefined';\n if (isDeno) {\n return {\n type: 'deno',\n version: Deno.version.deno,\n };\n }\n\n /**\n * A constant that indicates whether the environment the code is running is Bun.sh.\n */\n const isBun = typeof Bun !== 'undefined' && typeof Bun.version !== 'undefined';\n if (isBun) {\n return {\n type: 'bun',\n version: Bun.version,\n };\n }\n\n /**\n * A constant that indicates whether the environment the code is running is Node.JS.\n */\n const isNode =\n typeof process !== 'undefined' &&\n 'version' in process &&\n !!process.version &&\n 'versions' in process &&\n !!process.versions?.node;\n if (isNode) {\n return {\n type: 'node',\n version: process.versions.node,\n parsedVersion: Number(process.versions.node.split('.')[0]),\n };\n }\n\n /**\n * A constant that indicates whether the environment the code is running is in React-Native.\n * https://github.com/facebook/react-native/blob/main/packages/react-native/Libraries/Core/setUpNavigator.js\n */\n const isReactNative = typeof navigator !== 'undefined' && navigator?.product === 'ReactNative';\n if (isReactNative) {\n return {\n type: 'react-native',\n };\n }\n\n return {\n type: 'unknown',\n };\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/url/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAE,aAAa,EAAE,MAAM,MAAM,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toQueryString = exports.join = void 0;
|
|
4
|
+
var join_1 = require("./join");
|
|
5
|
+
Object.defineProperty(exports, "join", { enumerable: true, get: function () { return join_1.join; } });
|
|
6
|
+
var qs_1 = require("./qs");
|
|
7
|
+
Object.defineProperty(exports, "toQueryString", { enumerable: true, get: function () { return qs_1.toQueryString; } });
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/url/index.ts"],"names":[],"mappings":";;;AAAA,+BAA8B;AAArB,4FAAA,IAAI,OAAA;AACb,2BAAqC;AAA5B,mGAAA,aAAa,OAAA","sourcesContent":["export { join } from './join';\nexport { toQueryString } from './qs';\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join.d.ts","sourceRoot":"","sources":["../../../src/core/url/join.ts"],"names":[],"mappings":"AAAA,wBAAgB,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,MAAM,EAAE,GAAG,MAAM,CAyBhE"}
|
package/core/url/join.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.join = join;
|
|
4
|
+
function join(base, ...segments) {
|
|
5
|
+
if (!base) {
|
|
6
|
+
return '';
|
|
7
|
+
}
|
|
8
|
+
if (base.includes('://')) {
|
|
9
|
+
let url;
|
|
10
|
+
try {
|
|
11
|
+
url = new URL(base);
|
|
12
|
+
}
|
|
13
|
+
catch (_a) {
|
|
14
|
+
// Fallback to path joining if URL is malformed
|
|
15
|
+
return joinPath(base, ...segments);
|
|
16
|
+
}
|
|
17
|
+
for (const segment of segments) {
|
|
18
|
+
const cleanSegment = trimSlashes(segment);
|
|
19
|
+
if (cleanSegment) {
|
|
20
|
+
url.pathname = joinPathSegments(url.pathname, cleanSegment);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return url.toString();
|
|
24
|
+
}
|
|
25
|
+
return joinPath(base, ...segments);
|
|
26
|
+
}
|
|
27
|
+
function joinPath(base, ...segments) {
|
|
28
|
+
let result = base;
|
|
29
|
+
for (const segment of segments) {
|
|
30
|
+
const cleanSegment = trimSlashes(segment);
|
|
31
|
+
if (cleanSegment) {
|
|
32
|
+
result = joinPathSegments(result, cleanSegment);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return result;
|
|
36
|
+
}
|
|
37
|
+
function joinPathSegments(left, right) {
|
|
38
|
+
if (left.endsWith('/')) {
|
|
39
|
+
return left + right;
|
|
40
|
+
}
|
|
41
|
+
return left + '/' + right;
|
|
42
|
+
}
|
|
43
|
+
function trimSlashes(str) {
|
|
44
|
+
if (!str)
|
|
45
|
+
return str;
|
|
46
|
+
let start = str.startsWith('/') ? 1 : 0;
|
|
47
|
+
let end = str.endsWith('/') ? str.length - 1 : str.length;
|
|
48
|
+
return str.slice(start, end);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=join.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"join.js","sourceRoot":"","sources":["../../../src/core/url/join.ts"],"names":[],"mappings":";;AAAA,oBAyBC;AAzBD,SAAgB,IAAI,CAAC,IAAY,EAAE,GAAG,QAAkB;IACpD,IAAI,CAAC,IAAI,EAAE,CAAC;QACR,OAAO,E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AS,WAAW,CAAC,GAAW;IAC5B,IAAI,CAAC,GAAG;QAAE,OAAO,GAAG,CAAC;IAErB,IAAI,KAAK,GAAG,GAAG,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACxC,IAAI,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC;IAE1D,OAAO,GAAG,CAAC,KAAK,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC","sourcesContent":["export function join(base: string, ...segments: string[]): string {\n if (!base) {\n return '';\n }\n\n if (base.includes('://')) {\n let url: URL;\n try {\n url = new URL(base);\n } catch {\n // Fallback to path joining if URL is malformed\n return joinPath(base, ...segments);\n }\n\n for (const segment of segments) {\n const cleanSegment = trimSlashes(segment);\n if (cleanSegment) {\n url.pathname = joinPathSegments(url.pathname, cleanSegment);\n }\n }\n\n return url.toString();\n }\n\n return joinPath(base, ...segments);\n}\n\nfunction joinPath(base: string, ...segments: string[]): string {\n let result = base;\n\n for (const segment of segments) {\n const cleanSegment = trimSlashes(segment);\n if (cleanSegment) {\n result = joinPathSegments(result, cleanSegment);\n }\n }\n\n return result;\n}\n\nfunction joinPathSegments(left: string, right: string): string {\n if (left.endsWith('/')) {\n return left + right;\n }\n return left + '/' + right;\n}\n\nfunction trimSlashes(str: string): string {\n if (!str) return str;\n\n let start = str.startsWith('/') ? 1 : 0;\n let end = str.endsWith('/') ? str.length - 1 : str.length;\n\n return str.slice(start, end);\n}\n"]}
|
package/core/url/qs.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qs.d.ts","sourceRoot":"","sources":["../../../src/core/url/qs.ts"],"names":[],"mappings":"AAAA,UAAU,kBAAkB;IACxB,WAAW,CAAC,EAAE,SAAS,GAAG,QAAQ,CAAC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AA4DD,wBAAgB,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,kBAAkB,GAAG,MAAM,CAUhF"}
|
package/core/url/qs.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toQueryString = toQueryString;
|
|
4
|
+
const defaultQsOptions = {
|
|
5
|
+
arrayFormat: 'indices',
|
|
6
|
+
encode: true,
|
|
7
|
+
};
|
|
8
|
+
function encodeValue(value, shouldEncode) {
|
|
9
|
+
if (value === undefined) {
|
|
10
|
+
return '';
|
|
11
|
+
}
|
|
12
|
+
if (value === null) {
|
|
13
|
+
return '';
|
|
14
|
+
}
|
|
15
|
+
const stringValue = String(value);
|
|
16
|
+
return shouldEncode ? encodeURIComponent(stringValue) : stringValue;
|
|
17
|
+
}
|
|
18
|
+
function stringifyObject(obj, prefix = '', options) {
|
|
19
|
+
const parts = [];
|
|
20
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
21
|
+
const fullKey = prefix ? `${prefix}[${key}]` : key;
|
|
22
|
+
if (value === undefined) {
|
|
23
|
+
continue;
|
|
24
|
+
}
|
|
25
|
+
if (Array.isArray(value)) {
|
|
26
|
+
if (value.length === 0) {
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
for (let i = 0; i < value.length; i++) {
|
|
30
|
+
const item = value[i];
|
|
31
|
+
if (item === undefined) {
|
|
32
|
+
continue;
|
|
33
|
+
}
|
|
34
|
+
if (typeof item === 'object' && !Array.isArray(item) && item !== null) {
|
|
35
|
+
const arrayKey = options.arrayFormat === 'indices' ? `${fullKey}[${i}]` : fullKey;
|
|
36
|
+
parts.push(...stringifyObject(item, arrayKey, options));
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
const arrayKey = options.arrayFormat === 'indices' ? `${fullKey}[${i}]` : fullKey;
|
|
40
|
+
const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;
|
|
41
|
+
parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
else if (typeof value === 'object' && value !== null) {
|
|
46
|
+
if (Object.keys(value).length === 0) {
|
|
47
|
+
continue;
|
|
48
|
+
}
|
|
49
|
+
parts.push(...stringifyObject(value, fullKey, options));
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;
|
|
53
|
+
parts.push(`${encodedKey}=${encodeValue(value, options.encode)}`);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return parts;
|
|
57
|
+
}
|
|
58
|
+
function toQueryString(obj, options) {
|
|
59
|
+
if (obj == null || typeof obj !== 'object') {
|
|
60
|
+
return '';
|
|
61
|
+
}
|
|
62
|
+
const parts = stringifyObject(obj, '', Object.assign(Object.assign({}, defaultQsOptions), options));
|
|
63
|
+
return parts.join('&');
|
|
64
|
+
}
|
|
65
|
+
//# sourceMappingURL=qs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"qs.js","sourceRoot":"","sources":["../../../src/core/url/qs.ts"],"names":[],"mappings":";;AA+DA,sCAUC;AApED,MAAM,gBAAgB,GAAiC;IACnD,WAAW,EAAE,SAAS;IACtB,MAAM,EAAE,IAAI;CACN,CAAC;AAEX,SAAS,WAAW,CAAC,KAAc,EAAE,YAAqB;IACtD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACtB,OAAO,EAAE,CAAC;IACd,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;QACjB,OAAO,EAAE,CAAC;IACd,CAAC;IACD,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IAClC,OAAO,YAAY,CAAC,CAAC,CAAC,kBAAkB,CAAC,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AAG,CAAC,CAAC;AAC3B,CAAC","sourcesContent":["interface QueryStringOptions {\n arrayFormat?: 'indices' | 'repeat';\n encode?: boolean;\n}\n\nconst defaultQsOptions: Required<QueryStringOptions> = {\n arrayFormat: 'indices',\n encode: true,\n} as const;\n\nfunction encodeValue(value: unknown, shouldEncode: boolean): string {\n if (value === undefined) {\n return '';\n }\n if (value === null) {\n return '';\n }\n const stringValue = String(value);\n return shouldEncode ? encodeURIComponent(stringValue) : stringValue;\n}\n\nfunction stringifyObject(obj: Record<string, unknown>, prefix = '', options: Required<QueryStringOptions>): string[] {\n const parts: string[] = [];\n\n for (const [key, value] of Object.entries(obj)) {\n const fullKey = prefix ? `${prefix}[${key}]` : key;\n\n if (value === undefined) {\n continue;\n }\n\n if (Array.isArray(value)) {\n if (value.length === 0) {\n continue;\n }\n for (let i = 0; i < value.length; i++) {\n const item = value[i];\n if (item === undefined) {\n continue;\n }\n if (typeof item === 'object' && !Array.isArray(item) && item !== null) {\n const arrayKey = options.arrayFormat === 'indices' ? `${fullKey}[${i}]` : fullKey;\n parts.push(...stringifyObject(item as Record<string, unknown>, arrayKey, options));\n } else {\n const arrayKey = options.arrayFormat === 'indices' ? `${fullKey}[${i}]` : fullKey;\n const encodedKey = options.encode ? encodeURIComponent(arrayKey) : arrayKey;\n parts.push(`${encodedKey}=${encodeValue(item, options.encode)}`);\n }\n }\n } else if (typeof value === 'object' && value !== null) {\n if (Object.keys(value as Record<string, unknown>).length === 0) {\n continue;\n }\n parts.push(...stringifyObject(value as Record<string, unknown>, fullKey, options));\n } else {\n const encodedKey = options.encode ? encodeURIComponent(fullKey) : fullKey;\n parts.push(`${encodedKey}=${encodeValue(value, options.encode)}`);\n }\n }\n\n return parts;\n}\n\nexport function toQueryString(obj: unknown, options?: QueryStringOptions): string {\n if (obj == null || typeof obj !== 'object') {\n return '';\n }\n\n const parts = stringifyObject(obj as Record<string, unknown>, '', {\n ...defaultQsOptions,\n ...options,\n });\n return parts.join('&');\n}\n"]}
|
|
@@ -45,6 +45,6 @@ export declare const vcdmDocumentSchema: core.serialization.inferObjectSchemaFro
|
|
|
45
45
|
export type VcdmDocument = inferParsedObject<typeof vcdmDocumentSchema>;
|
|
46
46
|
export declare class VcdmCredentialDocument extends CredentialDocument {
|
|
47
47
|
protected jsonToVcdm(input: Json): VcdmDocument;
|
|
48
|
-
protected blobToVcdm(input: CredentialBlob): VcdmDocument
|
|
48
|
+
protected blobToVcdm(input: CredentialBlob): Promise<VcdmDocument>;
|
|
49
49
|
}
|
|
50
50
|
//# sourceMappingURL=vcdm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vcdm.d.ts","sourceRoot":"","sources":["../../../../src/documents/credential/document/vcdm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,eAAO,MAAM,iBAAiB,oKAG5B,CAAC;AAEH,eAAO,MAAM,mBAAmB,uTAG9B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;EAMjC,CAAC;AAEH,eAAO,MAAM,eAAe;;EAE1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;KAG7B,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;EAM5C,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;EAQ7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAExE,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC1D,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,GAAG,YAAY;
|
|
1
|
+
{"version":3,"file":"vcdm.d.ts","sourceRoot":"","sources":["../../../../src/documents/credential/document/vcdm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AACrD,OAAO,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAEjD,eAAO,MAAM,iBAAiB,oKAG5B,CAAC;AAEH,eAAO,MAAM,mBAAmB,uTAG9B,CAAC;AAEH,eAAO,MAAM,sBAAsB;;;EAMjC,CAAC;AAEH,eAAO,MAAM,eAAe;;EAE1B,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;KAG7B,CAAC;AAEH,eAAO,MAAM,iCAAiC;;;;;;EAM5C,CAAC;AAEH,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;EAQ7B,CAAC;AAEH,MAAM,MAAM,YAAY,GAAG,iBAAiB,CAAC,OAAO,kBAAkB,CAAC,CAAC;AAExE,qBAAa,sBAAuB,SAAQ,kBAAkB;IAC1D,SAAS,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,GAAG,YAAY;cAI/B,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;CAG3E"}
|
|
@@ -32,6 +32,15 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
32
32
|
return result;
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
36
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
37
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
38
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
39
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
40
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
41
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
42
|
+
});
|
|
43
|
+
};
|
|
35
44
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
45
|
exports.VcdmCredentialDocument = exports.vcdmDocumentSchema = exports.jsonSchemaCredentialSubjectSchema = exports.vcdmProofSetSchema = exports.vcdmProofSchema = exports.credentialSchemaSchema = exports.jsonldContextSchema = exports.jsonldVocabSchema = void 0;
|
|
37
46
|
const core = __importStar(require("../../../core"));
|
|
@@ -79,7 +88,9 @@ class VcdmCredentialDocument extends document_1.CredentialDocument {
|
|
|
79
88
|
return this.parseJson(exports.vcdmDocumentSchema, input);
|
|
80
89
|
}
|
|
81
90
|
blobToVcdm(input) {
|
|
82
|
-
return this
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
return this.parseBlob(exports.vcdmDocumentSchema, input);
|
|
93
|
+
});
|
|
83
94
|
}
|
|
84
95
|
}
|
|
85
96
|
exports.VcdmCredentialDocument = VcdmCredentialDocument;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vcdm.js","sourceRoot":"","sources":["../../../../src/documents/credential/document/vcdm.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vcdm.js","sourceRoot":"","sources":["../../../../src/documents/credential/document/vcdm.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AAGtC,0CAAiD;AAEpC,QAAA,iBAAiB,GAAG,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC;IACrE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE;IAC3B,IAAI,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE,CAAC;CAChC,CAAC,CAAC;AAEU,QAAA,mBAAmB,GAAG,IAAI,CAAC,aAAa,CAAC,oBAAoB,CAAC;IACvE,yBAAiB;IACjB,IAAI,CAAC,aAAa,CAAC,IAAI,CAA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C;QACzC,EAAE,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC1C,IAAI,EAAE,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC/C,CAAC;IACF,gBAAgB,EAAE,8BAAsB,CAAC,QAAQ,EAAE;CACtD,CAAC,CAAC;AAIH,MAAa,sBAAuB,SAAQ,6BAAkB;IAChD,UAAU,CAAC,KAAW;QAC5B,OAAO,IAAI,CAAC,SAAS,CAAC,0BAAkB,EAAE,KAAK,CAAC,CAAC;IACrD,CAAC;IAEe,UAAU,CAAC,KAAqB;;YAC5C,OAAO,IAAI,CAAC,SAAS,CAAC,0BAAkB,EAAE,KAAK,CAAC,CAAC;QACrD,CAAC;KAAA;CACJ;AARD,wDAQC","sourcesContent":["import * as core from '../../../core';\nimport { inferParsedObject } from '../../../core/schemas';\nimport type { CredentialBlob, Json } from '../types';\nimport { CredentialDocument } from '../document';\n\nexport const jsonldVocabSchema = core.serialization.undiscriminatedUnion([\n core.serialization.string(),\n core.serialization.object({}),\n]);\n\nexport const jsonldContextSchema = core.serialization.undiscriminatedUnion([\n jsonldVocabSchema,\n core.serialization.list(jsonldVocabSchema),\n]);\n\nexport const credentialSchemaSchema = core.serialization.object({\n id: core.serialization.string(),\n type: core.serialization.undiscriminatedUnion([\n core.serialization.string(),\n core.serialization.list(core.serialization.string()),\n ]),\n});\n\nexport const vcdmProofSchema = core.serialization.object({\n type: core.serialization.string(),\n});\n\nexport const vcdmProofSetSchema = core.serialization.undiscriminatedUnion([\n vcdmProofSchema,\n core.serialization.list(vcdmProofSchema),\n]);\n\nexport const jsonSchemaCredentialSubjectSchema = core.serialization.object({\n id: core.serialization.string(),\n type: core.serialization.stringLiteral('JsonSchema'),\n jsonSchema: core.serialization.object({\n $schema: core.serialization.stringLiteral('https://json-schema.org/draft/2020-12/schema'),\n }),\n});\n\nexport const vcdmDocumentSchema = core.serialization.object({\n '@context': jsonldContextSchema,\n type: core.serialization.list(core.serialization.string()),\n credentialSubject: core.serialization.object({\n id: core.serialization.string().optional(),\n type: core.serialization.string().optional(),\n }),\n credentialSchema: credentialSchemaSchema.optional(),\n});\n\nexport type VcdmDocument = inferParsedObject<typeof vcdmDocumentSchema>;\n\nexport class VcdmCredentialDocument extends CredentialDocument {\n protected jsonToVcdm(input: Json): VcdmDocument {\n return this.parseJson(vcdmDocumentSchema, input);\n }\n\n protected async blobToVcdm(input: CredentialBlob): Promise<VcdmDocument> {\n return this.parseBlob(vcdmDocumentSchema, input);\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { inferParsed, Schema } from '../../core/schemas';
|
|
2
2
|
import type { CredentialBlob, Json } from './types';
|
|
3
3
|
export declare class CredentialDocument {
|
|
4
|
-
protected blobToJson(input: CredentialBlob): Json
|
|
4
|
+
protected blobToJson(input: CredentialBlob): Promise<Json>;
|
|
5
5
|
protected parseJson<T extends Schema<any, any>>(schema: T, input: Json): inferParsed<T>;
|
|
6
|
-
protected parseBlob<T extends Schema<any, any>>(schema: T, input: CredentialBlob): inferParsed<T
|
|
6
|
+
protected parseBlob<T extends Schema<any, any>>(schema: T, input: CredentialBlob): Promise<inferParsed<T>>;
|
|
7
7
|
}
|
|
8
8
|
//# sourceMappingURL=document.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/documents/credential/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpD,qBAAa,kBAAkB;
|
|
1
|
+
{"version":3,"file":"document.d.ts","sourceRoot":"","sources":["../../../src/documents/credential/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAEpD,qBAAa,kBAAkB;cACX,UAAU,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC;IAShE,SAAS,CAAC,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,WAAW,CAAC,CAAC,CAAC;cAQvE,SAAS,CAAC,CAAC,SAAS,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC;CAGnH"}
|
|
@@ -1,15 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.CredentialDocument = void 0;
|
|
4
13
|
class CredentialDocument {
|
|
5
14
|
blobToJson(input) {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
15
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
16
|
+
try {
|
|
17
|
+
return JSON.parse(yield input.text());
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
console.error(err);
|
|
21
|
+
throw new Error('Invalid JSON in Credential Blob');
|
|
22
|
+
}
|
|
23
|
+
});
|
|
13
24
|
}
|
|
14
25
|
parseJson(schema, input) {
|
|
15
26
|
return schema.parseOrThrow(input, {
|
|
@@ -19,7 +30,9 @@ class CredentialDocument {
|
|
|
19
30
|
});
|
|
20
31
|
}
|
|
21
32
|
parseBlob(schema, input) {
|
|
22
|
-
return this
|
|
33
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
34
|
+
return this.parseJson(schema, yield this.blobToJson(input));
|
|
35
|
+
});
|
|
23
36
|
}
|
|
24
37
|
}
|
|
25
38
|
exports.CredentialDocument = CredentialDocument;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../../src/documents/credential/document.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"document.js","sourceRoot":"","sources":["../../../src/documents/credential/document.ts"],"names":[],"mappings":";;;;;;;;;;;;AAGA,MAAa,kBAAkB;IACX,UAAU,CAAC,KAAqB;;YAC5C,IAAI,CAAC;gBACD,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;YAC1C,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACX,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;gBACnB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;YACvD,CAAC;QACL,CAAC;KAAA;IAES,SAAS,CAA6B,MAAS,EAAE,KAAW;QAClE,OAAO,MAAM,CAAC,YAAY,CAAC,KAAK,EAAE;YAC9B,sBAAsB,EAAE,aAAa;YACrC,6BAA6B,EAAE,IAAI;YACnC,2BAA2B,EAAE,IAAI;SACpC,CAAC,CAAC;IACP,CAAC;IAEe,SAAS,CAA6B,MAAS,EAAE,KAAqB;;YAClF,OAAO,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC;QAChE,CAAC;KAAA;CACJ;AArBD,gDAqBC","sourcesContent":["import { inferParsed, Schema } from '../../core/schemas';\nimport type { CredentialBlob, Json } from './types';\n\nexport class CredentialDocument {\n protected async blobToJson(input: CredentialBlob): Promise<Json> {\n try {\n return JSON.parse(await input.text());\n } catch (err) {\n console.error(err);\n throw new Error('Invalid JSON in Credential Blob');\n }\n }\n\n protected parseJson<T extends Schema<any, any>>(schema: T, input: Json): inferParsed<T> {\n return schema.parseOrThrow(input, {\n unrecognizedObjectKeys: 'passthrough',\n allowUnrecognizedUnionMembers: true,\n allowUnrecognizedEnumValues: true,\n });\n }\n\n protected async parseBlob<T extends Schema<any, any>>(schema: T, input: CredentialBlob): Promise<inferParsed<T>> {\n return this.parseJson(schema, await this.blobToJson(input));\n }\n}\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { Readable } from 'stream';
|
|
2
1
|
import { ApiClient, DraftDescriptor } from '../../types';
|
|
3
2
|
import { DraftExportRequest, ResourceDraft } from '../../../api';
|
|
4
3
|
import { DraftDataDescriptor, DraftMetadata } from '../types';
|
|
5
4
|
import { LinkedCredential } from '../../models';
|
|
6
5
|
import { VerifiableCredential } from '../verifiable/verifiable';
|
|
6
|
+
import { BinaryResponse } from '../../../core';
|
|
7
7
|
export declare class DraftCredential {
|
|
8
8
|
protected client: ApiClient;
|
|
9
9
|
protected draftData: DraftDataDescriptor;
|
|
@@ -11,7 +11,7 @@ export declare class DraftCredential {
|
|
|
11
11
|
constructor(client: ApiClient, draftData: DraftDataDescriptor, descriptor: DraftDescriptor);
|
|
12
12
|
toLinkedCredential(): LinkedCredential<unknown>;
|
|
13
13
|
getMetaData(): Promise<DraftMetadata>;
|
|
14
|
-
export(params: DraftExportRequest): Promise<
|
|
14
|
+
export(params: DraftExportRequest): Promise<BinaryResponse>;
|
|
15
15
|
delete(): Promise<void>;
|
|
16
16
|
issue(privateKeyId: string): Promise<VerifiableCredential>;
|
|
17
17
|
toResource(): Promise<ResourceDraft>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../../../src/documents/credential/draft/draft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../../../src/documents/credential/draft/draft.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEzD,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,mBAAmB,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9D,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAGhE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,qBAAa,eAAe;IAEpB,SAAS,CAAC,MAAM,EAAE,SAAS;IAC3B,SAAS,CAAC,SAAS,EAAE,mBAAmB;IACjC,UAAU,EAAE,eAAe;gBAFxB,MAAM,EAAE,SAAS,EACjB,SAAS,EAAE,mBAAmB,EACjC,UAAU,EAAE,eAAe;IAGtC,kBAAkB,IAAI,gBAAgB,CAAC,OAAO,CAAC;IAIzC,WAAW,IAAI,OAAO,CAAC,aAAa,CAAC;IASrC,MAAM,CAAC,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,cAAc,CAAC;IAI3D,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC;IAOvB,KAAK,CAAC,YAAY,EAAE,MAAM,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAgB1D,UAAU,IAAI,OAAO,CAAC,aAAa,CAAC;CAG7C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draft.js","sourceRoot":"","sources":["../../../../src/documents/credential/draft/draft.ts"],"names":[],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"draft.js","sourceRoot":"","sources":["../../../../src/documents/credential/draft/draft.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,yDAAsD;AAGtD,yCAAgD;AAChD,yDAAgE;AAChE,uDAAkE;AAClE,2CAA+D;AAG/D,MAAa,eAAe;IACxB,YACc,MAAiB,EACjB,SAA8B,EACjC,UAA2B;QAFxB,WAAM,GAAN,MAAM,CAAW;QACjB,cAAS,GAAT,SAAS,CAAqB;QACjC,eAAU,GAAV,UAAU,CAAiB;IACnC,CAAC;IAEJ,kBAAkB;QACd,OAAO,IAAI,yBAAgB,CAAC,IAAI,CAAC,MAAM,EAAE,aAAa,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC;IAChF,CAAC;IAEK,WAAW;;YACb,MAAM,EAAE,OAAO,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,IAAI,EAAE,CAAC;YAE1D,OAAO;gBACH,OAAO;gBACP,UAAU;aACb,CAAC;QACN,CAAC;KAAA;IAEK,MAAM,CAAC,MAA0B;;YACnC,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAChG,CAAC;KAAA;IAEK,MAAM;;YACR,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE;gBACrD,OAAO,EAAE,IAAI,CAAC,UAAU,CAAC,IAAI;gBAC7B,cAAc,EAAE,IAAA,yBAAW,EAAC,QAAQ,CAAC;aACxC,CAAC,CAAC;QACP,CAAC;KAAA;IAEK,KAAK,CAAC,YAAoB;;YAC5B,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE;gBAC/F,KAAK,EAAE,YAAY;aACtB,CAAC,CAAC;YAEH,OAAO,IAAI,iCAAoB,CAAC,IAAI,CAAC,MAAM,EAAE;gBACzC,EAAE,EAAE,EAAE;gBACN,IAAI,EAAE,IAAI;gBACV,QAAQ,EAAE,QAAQ;gBAClB,IAAI,EAAE,IAAA,qCAAwB,EAAC,wCAA8B,EAAE;oBAC3D,EAAE,EAAE,IAAI,CAAC,EAAE;oBACX,eAAe,EAAE,IAAI,CAAC,eAAe;iBACxC,CAAC;aACL,CAAC,CAAC;QACP,CAAC;KAAA;IAEK,UAAU;;YACZ,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC1F,CAAC;KAAA;CACJ;AAlDD,0CAkDC","sourcesContent":["import { ApiClient, DraftDescriptor } from '../../types';\nimport { generateKey } from '../../utils/idempotency';\nimport { DraftExportRequest, ResourceDraft } from '../../../api';\nimport { DraftDataDescriptor, DraftMetadata } from '../types';\nimport { LinkedCredential } from '../../models';\nimport { VerifiableCredential } from '../verifiable/verifiable';\nimport { strictlyConvertToApiType } from '../../utils/converters';\nimport { verifiableCredentialDataSchema } from '../../schemas';\nimport { BinaryResponse } from '../../../core';\n\nexport class DraftCredential {\n constructor(\n protected client: ApiClient,\n protected draftData: DraftDataDescriptor,\n public descriptor: DraftDescriptor,\n ) {}\n\n toLinkedCredential(): LinkedCredential<unknown> {\n return new LinkedCredential(this.client, `urn:draft:${this.descriptor.id}`);\n }\n\n async getMetaData(): Promise<DraftMetadata> {\n const { subject, validUntil } = this.draftData.meta || {};\n\n return {\n subject,\n validUntil,\n };\n }\n\n async export(params: DraftExportRequest): Promise<BinaryResponse> {\n return this.client.drafts.draftExport(this.descriptor.id, this.descriptor.revision, params);\n }\n\n async delete(): Promise<void> {\n await this.client.drafts.draftDelete(this.descriptor.id, {\n ifMatch: this.descriptor.etag,\n idempotencyKey: generateKey('delete'),\n });\n }\n\n async issue(privateKeyId: string): Promise<VerifiableCredential> {\n const { id, etag, revision, data } = await this.client.drafts.draftLatestIssue(this.descriptor.id, {\n keyId: privateKeyId,\n });\n\n return new VerifiableCredential(this.client, {\n id: id,\n etag: etag,\n revision: revision,\n data: strictlyConvertToApiType(verifiableCredentialDataSchema, {\n id: data.id,\n digestMultibase: data.digestMultibase,\n }),\n });\n }\n\n async toResource(): Promise<ResourceDraft> {\n return this.client.drafts.draftRevision(this.descriptor.id, this.descriptor.revision);\n }\n}\n"]}
|
|
@@ -68,9 +68,9 @@ export declare class Vcdm11Flavor extends VcdmCredentialDocument implements Docu
|
|
|
68
68
|
kind: string;
|
|
69
69
|
private blobToVcdm11;
|
|
70
70
|
private loadJsonDocument;
|
|
71
|
-
isOfFlavor(blob: CredentialBlob): boolean
|
|
72
|
-
getClaims(blob: CredentialBlob): CredentialClaims
|
|
73
|
-
getMetadata(blob: CredentialBlob): CredentialMetadata
|
|
71
|
+
isOfFlavor(blob: CredentialBlob): Promise<boolean>;
|
|
72
|
+
getClaims(blob: CredentialBlob): Promise<CredentialClaims>;
|
|
73
|
+
getMetadata(blob: CredentialBlob): Promise<CredentialMetadata>;
|
|
74
74
|
getSchema(blob: CredentialBlob): Promise<CredentialSchema | undefined>;
|
|
75
75
|
}
|
|
76
76
|
//# sourceMappingURL=vcdm1_1.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vcdm1_1.d.ts","sourceRoot":"","sources":["../../../../src/documents/credential/flavor/vcdm1_1.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"vcdm1_1.d.ts","sourceRoot":"","sources":["../../../../src/documents/credential/flavor/vcdm1_1.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,eAAe,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EACR,cAAc,EACd,gBAAgB,EAChB,kBAAkB,EAClB,gBAAgB,EAChB,cAAc,EAEjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAEH,sBAAsB,EAGzB,MAAM,kBAAkB,CAAC;AAE1B,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;8CASF,CAAC;AAEhC,MAAM,MAAM,cAAc,GAAG,iBAAiB,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAE5E,qBAAa,YAAa,SAAQ,sBAAuB,YAAW,cAAc;IAC9E,IAAI,SAAa;IAEjB,OAAO,CAAC,YAAY;YAIN,gBAAgB;IAiBxB,UAAU,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,OAAO,CAAC;IASlD,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAO1D,WAAW,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAa9D,SAAS,CAAC,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,gBAAgB,GAAG,SAAS,CAAC;CAuC/E"}
|
|
@@ -52,12 +52,8 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
52
52
|
}
|
|
53
53
|
return t;
|
|
54
54
|
};
|
|
55
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
56
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
57
|
-
};
|
|
58
55
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
59
56
|
exports.Vcdm11Flavor = exports.vcdm11DocumentSchema = void 0;
|
|
60
|
-
const node_fetch_1 = __importDefault(require("node-fetch"));
|
|
61
57
|
const core = __importStar(require("../../../core"));
|
|
62
58
|
const vcdm_1 = require("../document/vcdm");
|
|
63
59
|
exports.vcdm11DocumentSchema = core.serialization
|
|
@@ -80,7 +76,7 @@ class Vcdm11Flavor extends vcdm_1.VcdmCredentialDocument {
|
|
|
80
76
|
}
|
|
81
77
|
loadJsonDocument(url) {
|
|
82
78
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
|
-
return (
|
|
79
|
+
return fetch(url)
|
|
84
80
|
.then((resp) => {
|
|
85
81
|
if (!resp.ok)
|
|
86
82
|
return Promise.reject(new Error(`Failed to fetch JSON document from ${url}. Server responded with status: ${resp.status} (${resp.statusText})`));
|
|
@@ -93,33 +89,39 @@ class Vcdm11Flavor extends vcdm_1.VcdmCredentialDocument {
|
|
|
93
89
|
});
|
|
94
90
|
}
|
|
95
91
|
isOfFlavor(blob) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
92
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
93
|
+
try {
|
|
94
|
+
yield this.blobToVcdm11(blob);
|
|
95
|
+
}
|
|
96
|
+
catch (_a) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
return true;
|
|
100
|
+
});
|
|
103
101
|
}
|
|
104
102
|
getClaims(blob) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
103
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
+
const credential = yield this.blobToVcdm(blob);
|
|
105
|
+
const _a = credential.credentialSubject, { id, type } = _a, claims = __rest(_a, ["id", "type"]);
|
|
106
|
+
return claims;
|
|
107
|
+
});
|
|
108
108
|
}
|
|
109
109
|
getMetadata(blob) {
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
const credential = yield this.blobToVcdm11(blob);
|
|
112
|
+
return {
|
|
113
|
+
id: credential.id,
|
|
114
|
+
issuer: credential.issuer,
|
|
115
|
+
validFrom: credential.issuanceDate,
|
|
116
|
+
validUntil: credential.expirationDate,
|
|
117
|
+
subject: credential.credentialSubject.id,
|
|
118
|
+
holder: credential.holder,
|
|
119
|
+
};
|
|
120
|
+
});
|
|
119
121
|
}
|
|
120
122
|
getSchema(blob) {
|
|
121
123
|
return __awaiter(this, void 0, void 0, function* () {
|
|
122
|
-
const credential = this.blobToVcdm(blob);
|
|
124
|
+
const credential = yield this.blobToVcdm(blob);
|
|
123
125
|
if (!credential.credentialSchema)
|
|
124
126
|
return undefined;
|
|
125
127
|
const schemaTypes = Array.isArray(credential.credentialSchema.type)
|