@sphereon/oid4vci-common 0.6.1-next.10 → 0.6.1-next.12

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.
@@ -1,3 +1,5 @@
1
1
  import { CredentialRequestV1_0_11 } from '../types';
2
- export declare function getIssuerStateAndPreAuthCode(credentialRequest: CredentialRequestV1_0_11): void;
2
+ export declare function getTypesFromRequest(credentialRequest: CredentialRequestV1_0_11, opts?: {
3
+ filterVerifiableCredential: boolean;
4
+ }): string[];
3
5
  //# sourceMappingURL=CredentialRequestUtil.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"CredentialRequestUtil.d.ts","sourceRoot":"","sources":["../../lib/functions/CredentialRequestUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEpD,wBAAgB,4BAA4B,CAAC,iBAAiB,EAAE,wBAAwB,QAEvF"}
1
+ {"version":3,"file":"CredentialRequestUtil.d.ts","sourceRoot":"","sources":["../../lib/functions/CredentialRequestUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,UAAU,CAAC;AAEpD,wBAAgB,mBAAmB,CAAC,iBAAiB,EAAE,wBAAwB,EAAE,IAAI,CAAC,EAAE;IAAE,0BAA0B,EAAE,OAAO,CAAA;CAAE,YAS9H"}
@@ -1,8 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getIssuerStateAndPreAuthCode = void 0;
4
- function getIssuerStateAndPreAuthCode(credentialRequest) {
5
- console.log('nothing yet: ' + credentialRequest);
3
+ exports.getTypesFromRequest = void 0;
4
+ function getTypesFromRequest(credentialRequest, opts) {
5
+ const types = 'types' in credentialRequest ? credentialRequest.types : credentialRequest.credential_definition.types;
6
+ if (!types || types.length === 0) {
7
+ throw Error('Could not deduce types from credential request');
8
+ }
9
+ if (opts === null || opts === void 0 ? void 0 : opts.filterVerifiableCredential) {
10
+ return types.filter((type) => type !== 'VerifiableCredential');
11
+ }
12
+ return types;
6
13
  }
7
- exports.getIssuerStateAndPreAuthCode = getIssuerStateAndPreAuthCode;
14
+ exports.getTypesFromRequest = getTypesFromRequest;
8
15
  //# sourceMappingURL=CredentialRequestUtil.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CredentialRequestUtil.js","sourceRoot":"","sources":["../../lib/functions/CredentialRequestUtil.ts"],"names":[],"mappings":";;;AAEA,SAAgB,4BAA4B,CAAC,iBAA2C;IACtF,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,iBAAiB,CAAC,CAAC;AACnD,CAAC;AAFD,oEAEC"}
1
+ {"version":3,"file":"CredentialRequestUtil.js","sourceRoot":"","sources":["../../lib/functions/CredentialRequestUtil.ts"],"names":[],"mappings":";;;AAEA,SAAgB,mBAAmB,CAAC,iBAA2C,EAAE,IAA8C;IAC7H,MAAM,KAAK,GAAG,OAAO,IAAI,iBAAiB,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,KAAK,CAAC;IACrH,IAAI,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE;QAChC,MAAM,KAAK,CAAC,gDAAgD,CAAC,CAAC;KAC/D;IACD,IAAI,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,0BAA0B,EAAE;QACpC,OAAO,KAAK,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,sBAAsB,CAAC,CAAC;KAChE;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AATD,kDASC"}
@@ -1,3 +1,4 @@
1
+ export * from './CredentialRequestUtil';
1
2
  export * from './CredentialOfferUtil';
2
3
  export * from './Encoding';
3
4
  export * from './TypeConversionUtils';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../lib/functions/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,YAAY,CAAC;AAC3B,cAAc,uBAAuB,CAAC"}
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
14
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./CredentialRequestUtil"), exports);
17
18
  __exportStar(require("./CredentialOfferUtil"), exports);
18
19
  __exportStar(require("./Encoding"), exports);
19
20
  __exportStar(require("./TypeConversionUtils"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wDAAsC;AACtC,6CAA2B;AAC3B,wDAAsC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../lib/functions/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0DAAwC;AACxC,wDAAsC;AACtC,6CAA2B;AAC3B,wDAAsC"}
@@ -35,7 +35,7 @@ export interface CommonCredentialOfferPayloadV1_0_11 {
35
35
  */
36
36
  grants?: Grant;
37
37
  }
38
- export interface CredentialOfferJwtVcJsonLdAndLdpVcV1_0_11 extends CommonCredentialOfferPayloadV1_0_11 {
38
+ export interface CredentialOfferLdpVcV1_0_11 extends CommonCredentialOfferPayloadV1_0_11 {
39
39
  /**
40
40
  * REQUIRED. JSON object containing (and isolating) the detailed description of the credential type.
41
41
  * This object MUST be processed using full JSON-LD processing. It consists of the following sub-claims:
@@ -45,8 +45,8 @@ export interface CredentialOfferJwtVcJsonLdAndLdpVcV1_0_11 extends CommonCredent
45
45
  */
46
46
  credential_definition: IssuerCredentialDefinition;
47
47
  }
48
- export type CredentialOfferJwtVcJsonV1_0_11 = CommonCredentialOfferPayloadV1_0_11;
49
- export type CredentialOfferPayloadV1_0_11 = CommonCredentialOfferPayloadV1_0_11 & (CredentialOfferJwtVcJsonLdAndLdpVcV1_0_11 | CredentialOfferJwtVcJsonV1_0_11);
48
+ export type CredentialOfferJwtVcV1_0_11 = CommonCredentialOfferPayloadV1_0_11;
49
+ export type CredentialOfferPayloadV1_0_11 = CommonCredentialOfferPayloadV1_0_11 & (CredentialOfferLdpVcV1_0_11 | CredentialOfferJwtVcV1_0_11);
50
50
  export type CredentialRequestV1_0_11 = CommonCredentialRequest & (CredentialRequestJwtVc | CredentialRequestLdpVc);
51
51
  export interface AuthorizationRequestV1_0_11 extends AuthorizationDetailsJwtVcJson, AuthorizationDetailsJwtVcJson {
52
52
  issuer_state?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"v1_0_11.types.d.ts","sourceRoot":"","sources":["../../lib/types/v1_0_11.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AAClG,OAAO,EACL,uBAAuB,EACvB,2BAA2B,EAC3B,qBAAqB,EACrB,sBAAsB,EACtB,sBAAsB,EACtB,KAAK,EACL,0BAA0B,EAC3B,MAAM,iBAAiB,CAAC;AAEzB,MAAM,WAAW,sBAAsB;IACrC,gBAAgB,CAAC,EAAE,6BAA6B,CAAC;IACjD,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,0BAA2B,SAAQ,sBAAsB;IACxE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2BAA2B,CAAC,EAAE,2BAA2B,CAAC;CAC3D;AAED,MAAM,WAAW,mCAAmC;IAClD;;OAEG;IACH,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,CAAC,EAAE,2BAA2B,CAAC;CAC3D;AAED,MAAM,WAAW,mCAAmC;IAClD;;OAEG;IACH,iBAAiB,EAAE,MAAM,CAAC;IAE1B;;;;;;;;OAQG;IACH,WAAW,EAAE,CAAC,qBAAqB,GAAG,MAAM,CAAC,EAAE,CAAC;IAChD;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,KAAK,CAAC;CAChB;AAED,MAAM,WAAW,2BAA4B,SAAQ,mCAAmC;IACtF;;;;;;OAMG;IACH,qBAAqB,EAAE,0BAA0B,CAAC;CACnD;AAED,MAAM,MAAM,2BAA2B,GAAG,mCAAmC,CAAC;AAE9E,MAAM,MAAM,6BAA6B,GAAG,mCAAmC,GAAG,CAAC,2BAA2B,GAAG,2BAA2B,CAAC,CAAC;AAE9I,MAAM,MAAM,wBAAwB,GAAG,uBAAuB,GAAG,CAAC,sBAAsB,GAAG,sBAAsB,CAAC,CAAC;AAEnH,MAAM,WAAW,2BAA4B,SAAQ,6BAA6B,EAAE,6BAA6B;IAC/G,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAGD,wBAAgB,6BAA6B,CAAC,OAAO,EAAE,0BAA0B,GAAG,OAAO,CAE1F"}
@@ -1 +1 @@
1
- {"version":3,"file":"v1_0_11.types.js","sourceRoot":"","sources":["../../lib/types/v1_0_11.types.ts"],"names":[],"mappings":";;;AAwEA,qDAAqD;AACrD,SAAgB,6BAA6B,CAAC,OAAmC;IAC/E,OAAO,OAAO,IAAI,cAAc,IAAI,OAAO,CAAC;AAC9C,CAAC;AAFD,sEAEC"}
1
+ {"version":3,"file":"v1_0_11.types.js","sourceRoot":"","sources":["../../lib/types/v1_0_11.types.ts"],"names":[],"mappings":";;;AAuEA,qDAAqD;AACrD,SAAgB,6BAA6B,CAAC,OAAmC;IAC/E,OAAO,OAAO,IAAI,cAAc,IAAI,OAAO,CAAC;AAC9C,CAAC;AAFD,sEAEC"}
@@ -1,5 +1,12 @@
1
1
  import { CredentialRequestV1_0_11 } from '../types';
2
2
 
3
- export function getIssuerStateAndPreAuthCode(credentialRequest: CredentialRequestV1_0_11) {
4
- console.log('nothing yet: ' + credentialRequest);
3
+ export function getTypesFromRequest(credentialRequest: CredentialRequestV1_0_11, opts?: { filterVerifiableCredential: boolean }) {
4
+ const types = 'types' in credentialRequest ? credentialRequest.types : credentialRequest.credential_definition.types;
5
+ if (!types || types.length === 0) {
6
+ throw Error('Could not deduce types from credential request');
7
+ }
8
+ if (opts?.filterVerifiableCredential) {
9
+ return types.filter((type) => type !== 'VerifiableCredential');
10
+ }
11
+ return types;
5
12
  }
@@ -1,3 +1,4 @@
1
+ export * from './CredentialRequestUtil';
1
2
  export * from './CredentialOfferUtil';
2
3
  export * from './Encoding';
3
4
  export * from './TypeConversionUtils';
@@ -48,7 +48,7 @@ export interface CommonCredentialOfferPayloadV1_0_11 {
48
48
  grants?: Grant;
49
49
  }
50
50
 
51
- export interface CredentialOfferJwtVcJsonLdAndLdpVcV1_0_11 extends CommonCredentialOfferPayloadV1_0_11 {
51
+ export interface CredentialOfferLdpVcV1_0_11 extends CommonCredentialOfferPayloadV1_0_11 {
52
52
  /**
53
53
  * REQUIRED. JSON object containing (and isolating) the detailed description of the credential type.
54
54
  * This object MUST be processed using full JSON-LD processing. It consists of the following sub-claims:
@@ -59,10 +59,9 @@ export interface CredentialOfferJwtVcJsonLdAndLdpVcV1_0_11 extends CommonCredent
59
59
  credential_definition: IssuerCredentialDefinition;
60
60
  }
61
61
 
62
- export type CredentialOfferJwtVcJsonV1_0_11 = CommonCredentialOfferPayloadV1_0_11;
62
+ export type CredentialOfferJwtVcV1_0_11 = CommonCredentialOfferPayloadV1_0_11;
63
63
 
64
- export type CredentialOfferPayloadV1_0_11 = CommonCredentialOfferPayloadV1_0_11 &
65
- (CredentialOfferJwtVcJsonLdAndLdpVcV1_0_11 | CredentialOfferJwtVcJsonV1_0_11);
64
+ export type CredentialOfferPayloadV1_0_11 = CommonCredentialOfferPayloadV1_0_11 & (CredentialOfferLdpVcV1_0_11 | CredentialOfferJwtVcV1_0_11);
66
65
 
67
66
  export type CredentialRequestV1_0_11 = CommonCredentialRequest & (CredentialRequestJwtVc | CredentialRequestLdpVc);
68
67
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sphereon/oid4vci-common",
3
- "version": "0.6.1-next.10+24d88ea",
3
+ "version": "0.6.1-next.12+14d6461",
4
4
  "description": "OpenID 4 Verifiable Credential Issuance Common Types",
5
5
  "source": "lib/index.ts",
6
6
  "main": "dist/index.js",
@@ -45,5 +45,5 @@
45
45
  "publishConfig": {
46
46
  "access": "public"
47
47
  },
48
- "gitHead": "24d88ead8d22798526fdacb1f0d072fedc268615"
48
+ "gitHead": "14d64614275f8cbeb5e4ece6e372c87ab7e33aaf"
49
49
  }