@sphereon/ssi-sdk.oid4vci-issuer-rest-client 0.34.1-next.7 → 0.34.1-next.85

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/dist/index.cjs CHANGED
@@ -44,11 +44,11 @@ var require_plugin_schema = __commonJS({
44
44
  },
45
45
  grants: {
46
46
  $ref: "#/components/schemas/Grant",
47
- description: "OPTIONAL. A JSON object indicating to the Wallet the Grant Types the Credential Issuer's AS is prepared to process for this credential offer. Every grant is represented by a key and an object. The key value is the Grant Type identifier, the object MAY contain parameters either determining the way the Wallet MUST use the particular grant and/or parameters the Wallet MUST send with the respective request(s). If grants is not present or empty, the Wallet MUST determine the Grant Types the Credential Issuer's AS supports using the respective metadata. When multiple grants are present, it's at the Wallet's discretion which one to use."
47
+ description: "OPTIONAL. Object indicating to the Wallet the Grant Types the Credential Issuer's Authorization Server is prepared to process for this Credential Offer. Every grant is represented by a name/value pair. The name is the Grant Type identifier; the value is an object that contains parameters either determining the way the Wallet MUST use the particular grant and/or parameters the Wallet MUST send with the respective request(s). If grants is not present or is empty, the Wallet MUST determine the Grant Types the Credential Issuer's Authorization Server supports using the respective metadata. When multiple grants are present, it is at the Wallet's discretion which one to use."
48
48
  },
49
49
  client_id: {
50
50
  type: "string",
51
- description: "Some implementations might include a client_id in the offer. For instance EBSI in a same-device flow. (Cross-device tucks it in the state JWT)"
51
+ description: "OPTIONAL. Some implementations might include a client_id in the offer. For instance EBSI in a same-device flow. (Cross-device tucks it in the state JWT)"
52
52
  },
53
53
  credentialDataSupplierInput: {
54
54
  $ref: "#/components/schemas/CredentialDataSupplierInput"
@@ -58,7 +58,10 @@ var require_plugin_schema = __commonJS({
58
58
  }
59
59
  },
60
60
  additionalProperties: false,
61
- required: ["credential_configuration_ids", "credential_issuer"]
61
+ required: [
62
+ "credential_configuration_ids",
63
+ "credential_issuer"
64
+ ]
62
65
  },
63
66
  Grant: {
64
67
  type: "object",
@@ -110,7 +113,9 @@ var require_plugin_schema = __commonJS({
110
113
  description: "OPTIONAL. Boolean value specifying whether the AS expects presentation of the End-User PIN along with the Token Request in a Pre-Authorized Code Flow. Default is false. This PIN is intended to bind the Pre-Authorized Code to a certain transaction to prevent replay of this code by an attacker that, for example, scanned the QR code while standing behind the legitimate End-User. It is RECOMMENDED to send a PIN via a separate channel. If the Wallet decides to use the Pre-Authorized Code Flow, a PIN value MUST be sent in the user_pin parameter with the respective Token Request."
111
114
  }
112
115
  },
113
- required: ["pre-authorized_code"],
116
+ required: [
117
+ "pre-authorized_code"
118
+ ],
114
119
  additionalProperties: false
115
120
  },
116
121
  TxCode: {
@@ -133,7 +138,10 @@ var require_plugin_schema = __commonJS({
133
138
  },
134
139
  InputCharSet: {
135
140
  type: "string",
136
- enum: ["numeric", "text"]
141
+ enum: [
142
+ "numeric",
143
+ "text"
144
+ ]
137
145
  },
138
146
  CredentialDataSupplierInput: {
139
147
  description: "Optional storage that can help the credential Data Supplier. For instance to store credential input data during offer creation, if no additional data can be supplied later on"
@@ -163,7 +171,10 @@ var require_plugin_schema = __commonJS({
163
171
  $ref: "#/components/schemas/TxCode"
164
172
  }
165
173
  },
166
- required: ["uri", "correlationId"],
174
+ required: [
175
+ "uri",
176
+ "correlationId"
177
+ ],
167
178
  additionalProperties: false
168
179
  },
169
180
  IOID4VCIClientGetIssueStatusArgs: {
@@ -176,7 +187,9 @@ var require_plugin_schema = __commonJS({
176
187
  type: "string"
177
188
  }
178
189
  },
179
- required: ["id"],
190
+ required: [
191
+ "id"
192
+ ],
180
193
  additionalProperties: false
181
194
  },
182
195
  IssueStatusResponse: {
@@ -207,7 +220,11 @@ var require_plugin_schema = __commonJS({
207
220
  }
208
221
  }
209
222
  },
210
- required: ["createdAt", "lastUpdatedAt", "status"],
223
+ required: [
224
+ "createdAt",
225
+ "lastUpdatedAt",
226
+ "status"
227
+ ],
211
228
  additionalProperties: false
212
229
  },
213
230
  IssueStatus: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../plugin.schema.json","../src/index.ts","../src/agent/OID4VCIRestClient.ts"],"sourcesContent":["{\n \"IOID4VCIRestClient\": {\n \"components\": {\n \"schemas\": {\n \"IOID4VCIClientCreateOfferUriRequestArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"credential_issuer\": {\n \"type\": \"string\",\n \"description\": \"REQUIRED. The URL of the Credential Issuer, as defined in Section 11.2.1, from which the Wallet is requested to obtain one or more Credentials. The Wallet uses it to obtain the Credential Issuer's Metadata following the steps defined in Section 11.2.2.\"\n },\n \"credential_configuration_ids\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"REQUIRED. Array of unique strings that each identify one of the keys in the name/value pairs stored in the credential_configurations_supported Credential Issuer metadata. The Wallet uses these string values to obtain the respective object that contains information about the Credential being offered as defined in Section 11.2.3. For example, these string values can be used to obtain scope values to be used in the Authorization Request.\"\n },\n \"grants\": {\n \"$ref\": \"#/components/schemas/Grant\",\n \"description\": \"OPTIONAL. A JSON object indicating to the Wallet the Grant Types the Credential Issuer's AS is prepared to process for this credential offer. Every grant is represented by a key and an object. The key value is the Grant Type identifier, the object MAY contain parameters either determining the way the Wallet MUST use the particular grant and/or parameters the Wallet MUST send with the respective request(s). If grants is not present or empty, the Wallet MUST determine the Grant Types the Credential Issuer's AS supports using the respective metadata. When multiple grants are present, it's at the Wallet's discretion which one to use.\"\n },\n \"client_id\": {\n \"type\": \"string\",\n \"description\": \"Some implementations might include a client_id in the offer. For instance EBSI in a same-device flow. (Cross-device tucks it in the state JWT)\"\n },\n \"credentialDataSupplierInput\": {\n \"$ref\": \"#/components/schemas/CredentialDataSupplierInput\"\n },\n \"agentBaseUrl\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false,\n \"required\": [\"credential_configuration_ids\", \"credential_issuer\"]\n },\n \"Grant\": {\n \"type\": \"object\",\n \"properties\": {\n \"authorization_code\": {\n \"$ref\": \"#/components/schemas/GrantAuthorizationCode\"\n },\n \"urn:ietf:params:oauth:grant-type:pre-authorized_code\": {\n \"$ref\": \"#/components/schemas/GrantUrnIetf\"\n }\n },\n \"additionalProperties\": false\n },\n \"GrantAuthorizationCode\": {\n \"type\": \"object\",\n \"properties\": {\n \"issuer_state\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL. String value created by the Credential Issuer and opaque to the Wallet that is used to bind the subsequent Authorization Request with the Credential Issuer to a context set up during previous steps.\"\n },\n \"authorization_server\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL string that the Wallet can use to identify the Authorization Server to use with this grant type when authorization_servers parameter in the Credential Issuer metadata has multiple entries. MUST NOT be used otherwise. The value of this parameter MUST match with one of the values in the authorization_servers array obtained from the Credential Issuer metadata\"\n }\n },\n \"additionalProperties\": false\n },\n \"GrantUrnIetf\": {\n \"type\": \"object\",\n \"properties\": {\n \"pre-authorized_code\": {\n \"type\": \"string\",\n \"description\": \"REQUIRED. The code representing the Credential Issuer's authorization for the Wallet to obtain Credentials of a certain type.\"\n },\n \"tx_code\": {\n \"$ref\": \"#/components/schemas/TxCode\",\n \"description\": \"OPTIONAL. Object specifying whether the Authorization Server expects presentation of a Transaction Code by the End-User along with the Token Request in a Pre-Authorized Code Flow. If the Authorization Server does not expect a Transaction Code, this object is absent; this is the default. The Transaction Code is intended to bind the Pre-Authorized Code to a certain transaction to prevent replay of this code by an attacker that, for example, scanned the QR code while standing behind the legitimate End-User. It is RECOMMENDED to send the Transaction Code via a separate channel. If the Wallet decides to use the Pre-Authorized Code Flow, the Transaction Code value MUST be sent in the tx_code parameter with the respective Token Request as defined in Section 6.1. If no length or description is given, this object may be empty, indicating that a Transaction Code is required.\"\n },\n \"interval\": {\n \"type\": \"number\",\n \"description\": \"OPTIONAL. The minimum amount of time in seconds that the Wallet SHOULD wait between polling requests to the token endpoint (in case the Authorization Server responds with error code authorization_pending - see Section 6.3). If no value is provided, Wallets MUST use 5 as the default.\"\n },\n \"authorization_server\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL string that the Wallet can use to identify the Authorization Server to use with this grant type when authorization_servers parameter in the Credential Issuer metadata has multiple entries. MUST NOT be used otherwise. The value of this parameter MUST match with one of the values in the authorization_servers array obtained from the Credential Issuer metadata\"\n },\n \"user_pin_required\": {\n \"type\": \"boolean\",\n \"description\": \"OPTIONAL. Boolean value specifying whether the AS expects presentation of the End-User PIN along with the Token Request in a Pre-Authorized Code Flow. Default is false. This PIN is intended to bind the Pre-Authorized Code to a certain transaction to prevent replay of this code by an attacker that, for example, scanned the QR code while standing behind the legitimate End-User. It is RECOMMENDED to send a PIN via a separate channel. If the Wallet decides to use the Pre-Authorized Code Flow, a PIN value MUST be sent in the user_pin parameter with the respective Token Request.\"\n }\n },\n \"required\": [\"pre-authorized_code\"],\n \"additionalProperties\": false\n },\n \"TxCode\": {\n \"type\": \"object\",\n \"properties\": {\n \"input_mode\": {\n \"$ref\": \"#/components/schemas/InputCharSet\",\n \"description\": \"OPTIONAL. String specifying the input character set. Possible values are numeric (only digits) and text (any characters). The default is numeric.\"\n },\n \"length\": {\n \"type\": \"number\",\n \"description\": \"OPTIONAL. Integer specifying the length of the Transaction Code. This helps the Wallet to render the input screen and improve the user experience.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL. String containing guidance for the Holder of the Wallet on how to obtain the Transaction Code, e.g., describing over which communication channel it is delivered. The Wallet is RECOMMENDED to display this description next to the Transaction Code input screen to improve the user experience. The length of the string MUST NOT exceed 300 characters. The description does not support internationalization, however the Issuer MAY detect the Holder's language by previous communication or an HTTP Accept-Language header within an HTTP GET request for a Credential Offer URI.\"\n }\n },\n \"additionalProperties\": false\n },\n \"InputCharSet\": {\n \"type\": \"string\",\n \"enum\": [\"numeric\", \"text\"]\n },\n \"CredentialDataSupplierInput\": {\n \"description\": \"Optional storage that can help the credential Data Supplier. For instance to store credential input data during offer creation, if no additional data can be supplied later on\"\n },\n \"IOID4VCIClientCreateOfferUriResponse\": {\n \"$ref\": \"#/components/schemas/Omit<CreateCredentialOfferURIResult,\\\"session\\\">\"\n },\n \"Omit<CreateCredentialOfferURIResult,\\\"session\\\">\": {\n \"$ref\": \"#/components/schemas/Pick<CreateCredentialOfferURIResult,Exclude<(\\\"uri\\\"|\\\"correlationId\\\"|\\\"qrCodeDataUri\\\"|\\\"session\\\"|\\\"userPin\\\"|\\\"txCode\\\"),\\\"session\\\">>\"\n },\n \"Pick<CreateCredentialOfferURIResult,Exclude<(\\\"uri\\\"|\\\"correlationId\\\"|\\\"qrCodeDataUri\\\"|\\\"session\\\"|\\\"userPin\\\"|\\\"txCode\\\"),\\\"session\\\">>\": {\n \"type\": \"object\",\n \"properties\": {\n \"uri\": {\n \"type\": \"string\"\n },\n \"correlationId\": {\n \"type\": \"string\"\n },\n \"qrCodeDataUri\": {\n \"type\": \"string\"\n },\n \"userPin\": {\n \"type\": \"string\"\n },\n \"txCode\": {\n \"$ref\": \"#/components/schemas/TxCode\"\n }\n },\n \"required\": [\"uri\", \"correlationId\"],\n \"additionalProperties\": false\n },\n \"IOID4VCIClientGetIssueStatusArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"baseUrl\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\"id\"],\n \"additionalProperties\": false\n },\n \"IssueStatusResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"createdAt\": {\n \"type\": \"number\"\n },\n \"lastUpdatedAt\": {\n \"type\": \"number\"\n },\n \"expiresAt\": {\n \"type\": \"number\"\n },\n \"status\": {\n \"$ref\": \"#/components/schemas/IssueStatus\"\n },\n \"error\": {\n \"type\": \"string\"\n },\n \"clientId\": {\n \"type\": \"string\"\n },\n \"statusLists\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/StatusListOpts\"\n }\n }\n },\n \"required\": [\"createdAt\", \"lastUpdatedAt\", \"status\"],\n \"additionalProperties\": false\n },\n \"IssueStatus\": {\n \"type\": \"string\",\n \"enum\": [\n \"OFFER_CREATED\",\n \"ACCESS_TOKEN_REQUESTED\",\n \"ACCESS_TOKEN_CREATED\",\n \"CREDENTIAL_REQUEST_RECEIVED\",\n \"CREDENTIAL_ISSUED\",\n \"NOTIFICATION_CREDENTIAL_ACCEPTED\",\n \"NOTIFICATION_CREDENTIAL_DELETED\",\n \"NOTIFICATION_CREDENTIAL_FAILURE\",\n \"ERROR\"\n ]\n },\n \"StatusListOpts\": {\n \"type\": \"object\",\n \"properties\": {\n \"statusListId\": {\n \"type\": \"string\"\n },\n \"statusListCorrelationId\": {\n \"type\": \"string\"\n },\n \"statusListIndex\": {\n \"type\": \"number\"\n },\n \"statusEntryCorrelationId\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false\n }\n },\n \"methods\": {\n \"oid4vciClientCreateOfferUri\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IOID4VCIClientCreateOfferUriRequestArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IOID4VCIClientCreateOfferUriResponse\"\n }\n },\n \"oid4vciClientGetIssueStatus\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IOID4VCIClientGetIssueStatusArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IssueStatusResponse\"\n }\n }\n }\n }\n }\n}\n","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { OID4VCIRestClient } from './agent/OID4VCIRestClient'\nexport type * from './types/IOID4VCIRestClient'\n","import { fetch } from 'cross-fetch'\nimport {\n IOID4VCIRestClient,\n IOID4VCIClientCreateOfferUriRequest,\n IOID4VCIClientCreateOfferUriRequestArgs,\n IOID4VCIClientCreateOfferUriResponse,\n IOID4VCIClientGetIssueStatusArgs,\n IRestClientAuthenticationOpts,\n} from '../types/IOID4VCIRestClient'\nimport { IssueStatusResponse } from '@sphereon/oid4vci-common'\nimport { IAgentPlugin } from '@veramo/core'\nimport { Loggers } from '@sphereon/ssi-types'\n\nconst logger = Loggers.DEFAULT.get('sphereon:ssi-sdk:oid4vci:issuer:rest-client')\n\n/**\n * {@inheritDoc IOID4VCIRestClient}\n */\nexport class OID4VCIRestClient implements IAgentPlugin {\n readonly methods: IOID4VCIRestClient = {\n oid4vciClientCreateOfferUri: this.oid4vciClientCreateOfferUri.bind(this),\n oid4vciClientGetIssueStatus: this.oid4vciClientGetIssueStatus.bind(this),\n }\n\n private readonly agentBaseUrl?: string\n private readonly authOpts?: IRestClientAuthenticationOpts\n\n constructor(args?: { baseUrl?: string; authentication?: IRestClientAuthenticationOpts }) {\n if (args?.baseUrl) {\n this.agentBaseUrl = args.baseUrl\n }\n this.authOpts = args?.authentication\n }\n\n private async createHeaders(existing?: Record<string, any>): Promise<HeadersInit> {\n const headers: HeadersInit = {\n ...existing,\n Accept: 'application/json',\n }\n if (this.authOpts?.enabled === true) {\n if (!this.authOpts.bearerToken) {\n throw Error(`Cannot have authentication enabled, whilst not enabling static bearer tokens at this point`)\n }\n headers.Authorization = `Bearer ${\n typeof this.authOpts.bearerToken === 'string' ? this.authOpts.bearerToken : await this.authOpts.bearerToken()\n }`\n }\n return headers\n }\n\n /** {@inheritDoc IOID4VCIRestClient.vciClientCreateOfferUri} */\n private async oid4vciClientCreateOfferUri(args: IOID4VCIClientCreateOfferUriRequestArgs): Promise<IOID4VCIClientCreateOfferUriResponse> {\n if (!args.credential_configuration_ids || !args.grants) {\n return Promise.reject(Error(\"Can't generate the credential offer url without credentials and grants params present.\"))\n }\n const baseUrl = this.assertedAgentBaseUrl(args.agentBaseUrl)\n const request: IOID4VCIClientCreateOfferUriRequest = {\n credential_configuration_ids: args.credential_configuration_ids,\n grants: args.grants,\n ...(args.credentialDataSupplierInput && { credentialDataSupplierInput: args.credentialDataSupplierInput }),\n }\n const url = OID4VCIRestClient.urlWithBase(`webapp/credential-offers`, baseUrl)\n logger.debug(`OID4VCIRestClient is going to send request: ${JSON.stringify(request)} to ${url}`)\n try {\n const origResponse = await fetch(url, {\n method: 'POST',\n headers: await this.createHeaders({ 'Content-Type': 'application/json' }),\n body: JSON.stringify(request),\n })\n if (!origResponse.ok) {\n return Promise.reject(Error(`request to ${url} returned ${origResponse.status}`))\n }\n return await origResponse.json()\n } catch (e) {\n logger.debug(`Error on posting to url ${url}: ${e}`)\n return Promise.reject(Error(`request to ${url} returned ${e}`))\n }\n }\n\n private async oid4vciClientGetIssueStatus(args: IOID4VCIClientGetIssueStatusArgs): Promise<IssueStatusResponse> {\n const baseUrl = this.assertedAgentBaseUrl(args.baseUrl)\n const url = OID4VCIRestClient.urlWithBase('/webapp/credential-offer-status', baseUrl)\n const statusResponse = await fetch(url, {\n method: 'POST',\n headers: await this.createHeaders({ 'Content-Type': 'application/json' }),\n body: JSON.stringify({\n id: args.id,\n }),\n })\n logger.debug(`issue status response: ${statusResponse}`)\n try {\n return await statusResponse.json()\n } catch (err) {\n throw Error(`Status has returned ${statusResponse.status}`)\n }\n }\n\n private assertedAgentBaseUrl(baseUrl?: string): string {\n if (baseUrl) {\n return baseUrl\n } else if (this.agentBaseUrl) {\n return this.agentBaseUrl\n }\n throw new Error('No base url has been provided')\n }\n\n private static urlWithBase(path: string, baseUrl: string): string {\n return `${baseUrl}${path.startsWith('/') ? path : `/${path}`}`\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,gCAAAA,SAAA;AAAA,IAAAA,QAAA;AAAA,MACE,oBAAsB;AAAA,QACpB,YAAc;AAAA,UACZ,SAAW;AAAA,YACT,yCAA2C;AAAA,cACzC,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,mBAAqB;AAAA,kBACnB,MAAQ;AAAA,kBACR,aAAe;AAAA,gBACjB;AAAA,gBACA,8BAAgC;AAAA,kBAC9B,MAAQ;AAAA,kBACR,OAAS;AAAA,oBACP,MAAQ;AAAA,kBACV;AAAA,kBACA,aAAe;AAAA,gBACjB;AAAA,gBACA,QAAU;AAAA,kBACR,MAAQ;AAAA,kBACR,aAAe;AAAA,gB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OD,OAAO,IAAIA,IAAAA,EAAM;EAC9D;AACF;;;AD1GA,IAAME,SAASC;","names":["module","logger","Loggers","DEFAULT","get","OID4VCIRestClient","methods","oid4vciClientCreateOfferUri","bind","oid4vciClientGetIssueStatus","agentBaseUrl","authOpts","args","baseUrl","authentication","createHeaders","existing","headers","Accept","enabled","bearerToken","Error","Authorization","credential_configuration_ids","grants","Promise","reject","assertedAgentBaseUrl","request","credentialDataSupplierInput","url","urlWithBase","debug","JSON","stringify","origResponse","fetch","method","body","ok","status","json","e","statusResponse","id","err","path","startsWith","schema","require"]}
1
+ {"version":3,"sources":["../plugin.schema.json","../src/index.ts","../src/agent/OID4VCIRestClient.ts"],"sourcesContent":["{\n \"IOID4VCIRestClient\": {\n \"components\": {\n \"schemas\": {\n \"IOID4VCIClientCreateOfferUriRequestArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"credential_issuer\": {\n \"type\": \"string\",\n \"description\": \"REQUIRED. The URL of the Credential Issuer, as defined in Section 11.2.1, from which the Wallet is requested to obtain one or more Credentials. The Wallet uses it to obtain the Credential Issuer's Metadata following the steps defined in Section 11.2.2.\"\n },\n \"credential_configuration_ids\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"REQUIRED. Array of unique strings that each identify one of the keys in the name/value pairs stored in the credential_configurations_supported Credential Issuer metadata. The Wallet uses these string values to obtain the respective object that contains information about the Credential being offered as defined in Section 11.2.3. For example, these string values can be used to obtain scope values to be used in the Authorization Request.\"\n },\n \"grants\": {\n \"$ref\": \"#/components/schemas/Grant\",\n \"description\": \"OPTIONAL. Object indicating to the Wallet the Grant Types the Credential Issuer's Authorization Server is prepared to process for this Credential Offer. Every grant is represented by a name/value pair. The name is the Grant Type identifier; the value is an object that contains parameters either determining the way the Wallet MUST use the particular grant and/or parameters the Wallet MUST send with the respective request(s). If grants is not present or is empty, the Wallet MUST determine the Grant Types the Credential Issuer's Authorization Server supports using the respective metadata. When multiple grants are present, it is at the Wallet's discretion which one to use.\"\n },\n \"client_id\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL. Some implementations might include a client_id in the offer. For instance EBSI in a same-device flow. (Cross-device tucks it in the state JWT)\"\n },\n \"credentialDataSupplierInput\": {\n \"$ref\": \"#/components/schemas/CredentialDataSupplierInput\"\n },\n \"agentBaseUrl\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false,\n \"required\": [\n \"credential_configuration_ids\",\n \"credential_issuer\"\n ]\n },\n \"Grant\": {\n \"type\": \"object\",\n \"properties\": {\n \"authorization_code\": {\n \"$ref\": \"#/components/schemas/GrantAuthorizationCode\"\n },\n \"urn:ietf:params:oauth:grant-type:pre-authorized_code\": {\n \"$ref\": \"#/components/schemas/GrantUrnIetf\"\n }\n },\n \"additionalProperties\": false\n },\n \"GrantAuthorizationCode\": {\n \"type\": \"object\",\n \"properties\": {\n \"issuer_state\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL. String value created by the Credential Issuer and opaque to the Wallet that is used to bind the subsequent Authorization Request with the Credential Issuer to a context set up during previous steps.\"\n },\n \"authorization_server\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL string that the Wallet can use to identify the Authorization Server to use with this grant type when authorization_servers parameter in the Credential Issuer metadata has multiple entries. MUST NOT be used otherwise. The value of this parameter MUST match with one of the values in the authorization_servers array obtained from the Credential Issuer metadata\"\n }\n },\n \"additionalProperties\": false\n },\n \"GrantUrnIetf\": {\n \"type\": \"object\",\n \"properties\": {\n \"pre-authorized_code\": {\n \"type\": \"string\",\n \"description\": \"REQUIRED. The code representing the Credential Issuer's authorization for the Wallet to obtain Credentials of a certain type.\"\n },\n \"tx_code\": {\n \"$ref\": \"#/components/schemas/TxCode\",\n \"description\": \"OPTIONAL. Object specifying whether the Authorization Server expects presentation of a Transaction Code by the End-User along with the Token Request in a Pre-Authorized Code Flow. If the Authorization Server does not expect a Transaction Code, this object is absent; this is the default. The Transaction Code is intended to bind the Pre-Authorized Code to a certain transaction to prevent replay of this code by an attacker that, for example, scanned the QR code while standing behind the legitimate End-User. It is RECOMMENDED to send the Transaction Code via a separate channel. If the Wallet decides to use the Pre-Authorized Code Flow, the Transaction Code value MUST be sent in the tx_code parameter with the respective Token Request as defined in Section 6.1. If no length or description is given, this object may be empty, indicating that a Transaction Code is required.\"\n },\n \"interval\": {\n \"type\": \"number\",\n \"description\": \"OPTIONAL. The minimum amount of time in seconds that the Wallet SHOULD wait between polling requests to the token endpoint (in case the Authorization Server responds with error code authorization_pending - see Section 6.3). If no value is provided, Wallets MUST use 5 as the default.\"\n },\n \"authorization_server\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL string that the Wallet can use to identify the Authorization Server to use with this grant type when authorization_servers parameter in the Credential Issuer metadata has multiple entries. MUST NOT be used otherwise. The value of this parameter MUST match with one of the values in the authorization_servers array obtained from the Credential Issuer metadata\"\n },\n \"user_pin_required\": {\n \"type\": \"boolean\",\n \"description\": \"OPTIONAL. Boolean value specifying whether the AS expects presentation of the End-User PIN along with the Token Request in a Pre-Authorized Code Flow. Default is false. This PIN is intended to bind the Pre-Authorized Code to a certain transaction to prevent replay of this code by an attacker that, for example, scanned the QR code while standing behind the legitimate End-User. It is RECOMMENDED to send a PIN via a separate channel. If the Wallet decides to use the Pre-Authorized Code Flow, a PIN value MUST be sent in the user_pin parameter with the respective Token Request.\"\n }\n },\n \"required\": [\n \"pre-authorized_code\"\n ],\n \"additionalProperties\": false\n },\n \"TxCode\": {\n \"type\": \"object\",\n \"properties\": {\n \"input_mode\": {\n \"$ref\": \"#/components/schemas/InputCharSet\",\n \"description\": \"OPTIONAL. String specifying the input character set. Possible values are numeric (only digits) and text (any characters). The default is numeric.\"\n },\n \"length\": {\n \"type\": \"number\",\n \"description\": \"OPTIONAL. Integer specifying the length of the Transaction Code. This helps the Wallet to render the input screen and improve the user experience.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL. String containing guidance for the Holder of the Wallet on how to obtain the Transaction Code, e.g., describing over which communication channel it is delivered. The Wallet is RECOMMENDED to display this description next to the Transaction Code input screen to improve the user experience. The length of the string MUST NOT exceed 300 characters. The description does not support internationalization, however the Issuer MAY detect the Holder's language by previous communication or an HTTP Accept-Language header within an HTTP GET request for a Credential Offer URI.\"\n }\n },\n \"additionalProperties\": false\n },\n \"InputCharSet\": {\n \"type\": \"string\",\n \"enum\": [\n \"numeric\",\n \"text\"\n ]\n },\n \"CredentialDataSupplierInput\": {\n \"description\": \"Optional storage that can help the credential Data Supplier. For instance to store credential input data during offer creation, if no additional data can be supplied later on\"\n },\n \"IOID4VCIClientCreateOfferUriResponse\": {\n \"$ref\": \"#/components/schemas/Omit<CreateCredentialOfferURIResult,\\\"session\\\">\"\n },\n \"Omit<CreateCredentialOfferURIResult,\\\"session\\\">\": {\n \"$ref\": \"#/components/schemas/Pick<CreateCredentialOfferURIResult,Exclude<(\\\"uri\\\"|\\\"correlationId\\\"|\\\"qrCodeDataUri\\\"|\\\"session\\\"|\\\"userPin\\\"|\\\"txCode\\\"),\\\"session\\\">>\"\n },\n \"Pick<CreateCredentialOfferURIResult,Exclude<(\\\"uri\\\"|\\\"correlationId\\\"|\\\"qrCodeDataUri\\\"|\\\"session\\\"|\\\"userPin\\\"|\\\"txCode\\\"),\\\"session\\\">>\": {\n \"type\": \"object\",\n \"properties\": {\n \"uri\": {\n \"type\": \"string\"\n },\n \"correlationId\": {\n \"type\": \"string\"\n },\n \"qrCodeDataUri\": {\n \"type\": \"string\"\n },\n \"userPin\": {\n \"type\": \"string\"\n },\n \"txCode\": {\n \"$ref\": \"#/components/schemas/TxCode\"\n }\n },\n \"required\": [\n \"uri\",\n \"correlationId\"\n ],\n \"additionalProperties\": false\n },\n \"IOID4VCIClientGetIssueStatusArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"baseUrl\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\"\n ],\n \"additionalProperties\": false\n },\n \"IssueStatusResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"createdAt\": {\n \"type\": \"number\"\n },\n \"lastUpdatedAt\": {\n \"type\": \"number\"\n },\n \"expiresAt\": {\n \"type\": \"number\"\n },\n \"status\": {\n \"$ref\": \"#/components/schemas/IssueStatus\"\n },\n \"error\": {\n \"type\": \"string\"\n },\n \"clientId\": {\n \"type\": \"string\"\n },\n \"statusLists\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/StatusListOpts\"\n }\n }\n },\n \"required\": [\n \"createdAt\",\n \"lastUpdatedAt\",\n \"status\"\n ],\n \"additionalProperties\": false\n },\n \"IssueStatus\": {\n \"type\": \"string\",\n \"enum\": [\n \"OFFER_CREATED\",\n \"ACCESS_TOKEN_REQUESTED\",\n \"ACCESS_TOKEN_CREATED\",\n \"CREDENTIAL_REQUEST_RECEIVED\",\n \"CREDENTIAL_ISSUED\",\n \"NOTIFICATION_CREDENTIAL_ACCEPTED\",\n \"NOTIFICATION_CREDENTIAL_DELETED\",\n \"NOTIFICATION_CREDENTIAL_FAILURE\",\n \"ERROR\"\n ]\n },\n \"StatusListOpts\": {\n \"type\": \"object\",\n \"properties\": {\n \"statusListId\": {\n \"type\": \"string\"\n },\n \"statusListCorrelationId\": {\n \"type\": \"string\"\n },\n \"statusListIndex\": {\n \"type\": \"number\"\n },\n \"statusEntryCorrelationId\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false\n }\n },\n \"methods\": {\n \"oid4vciClientCreateOfferUri\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IOID4VCIClientCreateOfferUriRequestArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IOID4VCIClientCreateOfferUriResponse\"\n }\n },\n \"oid4vciClientGetIssueStatus\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IOID4VCIClientGetIssueStatusArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IssueStatusResponse\"\n }\n }\n }\n }\n }\n}","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { OID4VCIRestClient } from './agent/OID4VCIRestClient'\nexport type * from './types/IOID4VCIRestClient'\n","import { fetch } from 'cross-fetch'\nimport {\n IOID4VCIRestClient,\n IOID4VCIClientCreateOfferUriRequest,\n IOID4VCIClientCreateOfferUriRequestArgs,\n IOID4VCIClientCreateOfferUriResponse,\n IOID4VCIClientGetIssueStatusArgs,\n IRestClientAuthenticationOpts,\n} from '../types/IOID4VCIRestClient'\nimport { IssueStatusResponse } from '@sphereon/oid4vci-common'\nimport { IAgentPlugin } from '@veramo/core'\nimport { Loggers } from '@sphereon/ssi-types'\n\nconst logger = Loggers.DEFAULT.get('sphereon:ssi-sdk:oid4vci:issuer:rest-client')\n\n/**\n * {@inheritDoc IOID4VCIRestClient}\n */\nexport class OID4VCIRestClient implements IAgentPlugin {\n readonly methods: IOID4VCIRestClient = {\n oid4vciClientCreateOfferUri: this.oid4vciClientCreateOfferUri.bind(this),\n oid4vciClientGetIssueStatus: this.oid4vciClientGetIssueStatus.bind(this),\n }\n\n private readonly agentBaseUrl?: string\n private readonly authOpts?: IRestClientAuthenticationOpts\n\n constructor(args?: { baseUrl?: string; authentication?: IRestClientAuthenticationOpts }) {\n if (args?.baseUrl) {\n this.agentBaseUrl = args.baseUrl\n }\n this.authOpts = args?.authentication\n }\n\n private async createHeaders(existing?: Record<string, any>): Promise<HeadersInit> {\n const headers: HeadersInit = {\n ...existing,\n Accept: 'application/json',\n }\n if (this.authOpts?.enabled === true) {\n if (!this.authOpts.bearerToken) {\n throw Error(`Cannot have authentication enabled, whilst not enabling static bearer tokens at this point`)\n }\n headers.Authorization = `Bearer ${\n typeof this.authOpts.bearerToken === 'string' ? this.authOpts.bearerToken : await this.authOpts.bearerToken()\n }`\n }\n return headers\n }\n\n /** {@inheritDoc IOID4VCIRestClient.vciClientCreateOfferUri} */\n private async oid4vciClientCreateOfferUri(args: IOID4VCIClientCreateOfferUriRequestArgs): Promise<IOID4VCIClientCreateOfferUriResponse> {\n if (!args.credential_configuration_ids || !args.grants) {\n return Promise.reject(Error(\"Can't generate the credential offer url without credentials and grants params present.\"))\n }\n const baseUrl = this.assertedAgentBaseUrl(args.agentBaseUrl)\n const request: IOID4VCIClientCreateOfferUriRequest = {\n credential_configuration_ids: args.credential_configuration_ids,\n grants: args.grants,\n ...(args.credentialDataSupplierInput && { credentialDataSupplierInput: args.credentialDataSupplierInput }),\n }\n const url = OID4VCIRestClient.urlWithBase(`webapp/credential-offers`, baseUrl)\n logger.debug(`OID4VCIRestClient is going to send request: ${JSON.stringify(request)} to ${url}`)\n try {\n const origResponse = await fetch(url, {\n method: 'POST',\n headers: await this.createHeaders({ 'Content-Type': 'application/json' }),\n body: JSON.stringify(request),\n })\n if (!origResponse.ok) {\n return Promise.reject(Error(`request to ${url} returned ${origResponse.status}`))\n }\n return await origResponse.json()\n } catch (e) {\n logger.debug(`Error on posting to url ${url}: ${e}`)\n return Promise.reject(Error(`request to ${url} returned ${e}`))\n }\n }\n\n private async oid4vciClientGetIssueStatus(args: IOID4VCIClientGetIssueStatusArgs): Promise<IssueStatusResponse> {\n const baseUrl = this.assertedAgentBaseUrl(args.baseUrl)\n const url = OID4VCIRestClient.urlWithBase('/webapp/credential-offer-status', baseUrl)\n const statusResponse = await fetch(url, {\n method: 'POST',\n headers: await this.createHeaders({ 'Content-Type': 'application/json' }),\n body: JSON.stringify({\n id: args.id,\n }),\n })\n logger.debug(`issue status response: ${statusResponse}`)\n try {\n return await statusResponse.json()\n } catch (err) {\n throw Error(`Status has returned ${statusResponse.status}`)\n }\n }\n\n private assertedAgentBaseUrl(baseUrl?: string): string {\n if (baseUrl) {\n return baseUrl\n } else if (this.agentBaseUrl) {\n return this.agentBaseUrl\n }\n throw new Error('No base url has been provided')\n }\n\n private static urlWithBase(path: string, baseUrl: string): string {\n return `${baseUrl}${path.startsWith('/') ? path : `/${path}`}`\n }\n}\n"],"mappings":";;;;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F,cAAc;QAAE,gBAAgB;MAAmB,CAAA;MACvEuB,MAAML,KAAKC,UAAU;QACnBU,IAAIhC,KAAKgC;MACX,CAAA;IACF,CAAA;AACA3C,WAAO+B,MAAM,0BAA0BW,cAAAA,EAAgB;AACvD,QAAI;AACF,aAAO,MAAMA,eAAeF,KAAI;IAClC,SAASI,KAAK;AACZ,YAAMxB,MAAM,uBAAuBsB,eAAeH,MAAM,EAAE;IAC5D;EACF;EAEQb,qBAAqBd,SAA0B;AACrD,QAAIA,SAAS;AACX,aAAOA;IACT,WAAW,KAAKH,cAAc;AAC5B,aAAO,KAAKA;IACd;AACA,UAAM,IAAIW,MAAM,+BAAA;EAClB;EAEA,OAAeU,YAAYe,MAAcjC,SAAyB;AAChE,WAAO,GAAGA,OAAAA,GAAUiC,KAAKC,WAAW,GAAA,IAAOD,OAAO,IAAIA,IAAAA,EAAM;EAC9D;AACF;;;AD1GA,IAAME,SAASC;","names":["module","logger","Loggers","DEFAULT","get","OID4VCIRestClient","methods","oid4vciClientCreateOfferUri","bind","oid4vciClientGetIssueStatus","agentBaseUrl","authOpts","args","baseUrl","authentication","createHeaders","existing","headers","Accept","enabled","bearerToken","Error","Authorization","credential_configuration_ids","grants","Promise","reject","assertedAgentBaseUrl","request","credentialDataSupplierInput","url","urlWithBase","debug","JSON","stringify","origResponse","fetch","method","body","ok","status","json","e","statusResponse","id","err","path","startsWith","schema","require"]}
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BearerTokenArg } from '@sphereon/ssi-types';
2
2
  import { IPluginMethodMap, IAgentContext, IAgentPlugin } from '@veramo/core';
3
- import { CredentialOfferPayloadV1_0_13, CredentialDataSupplierInput, CreateCredentialOfferURIResult, IssueStatusResponse } from '@sphereon/oid4vci-common';
3
+ import { CredentialOfferPayloadV1_0_15, CredentialDataSupplierInput, CreateCredentialOfferURIResult, IssueStatusResponse } from '@sphereon/oid4vci-common';
4
4
 
5
5
  interface IOID4VCIRestClient extends IPluginMethodMap {
6
6
  oid4vciClientCreateOfferUri(args: IOID4VCIClientCreateOfferUriRequestArgs, context: IRequiredContext): Promise<IOID4VCIClientCreateOfferUriResponse>;
@@ -18,7 +18,7 @@ interface IOID4VCIClientGetIssueStatusArgs {
18
18
  baseUrl?: string;
19
19
  }
20
20
  type IOID4VCIClientCreateOfferUriResponse = Omit<CreateCredentialOfferURIResult, 'session'>;
21
- interface IOID4VCIClientCreateOfferUriRequest extends CredentialOfferPayloadV1_0_13 {
21
+ interface IOID4VCIClientCreateOfferUriRequest extends CredentialOfferPayloadV1_0_15 {
22
22
  credentialDataSupplierInput?: CredentialDataSupplierInput;
23
23
  }
24
24
  type IRequiredContext = IAgentContext<never>;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { BearerTokenArg } from '@sphereon/ssi-types';
2
2
  import { IPluginMethodMap, IAgentContext, IAgentPlugin } from '@veramo/core';
3
- import { CredentialOfferPayloadV1_0_13, CredentialDataSupplierInput, CreateCredentialOfferURIResult, IssueStatusResponse } from '@sphereon/oid4vci-common';
3
+ import { CredentialOfferPayloadV1_0_15, CredentialDataSupplierInput, CreateCredentialOfferURIResult, IssueStatusResponse } from '@sphereon/oid4vci-common';
4
4
 
5
5
  interface IOID4VCIRestClient extends IPluginMethodMap {
6
6
  oid4vciClientCreateOfferUri(args: IOID4VCIClientCreateOfferUriRequestArgs, context: IRequiredContext): Promise<IOID4VCIClientCreateOfferUriResponse>;
@@ -18,7 +18,7 @@ interface IOID4VCIClientGetIssueStatusArgs {
18
18
  baseUrl?: string;
19
19
  }
20
20
  type IOID4VCIClientCreateOfferUriResponse = Omit<CreateCredentialOfferURIResult, 'session'>;
21
- interface IOID4VCIClientCreateOfferUriRequest extends CredentialOfferPayloadV1_0_13 {
21
+ interface IOID4VCIClientCreateOfferUriRequest extends CredentialOfferPayloadV1_0_15 {
22
22
  credentialDataSupplierInput?: CredentialDataSupplierInput;
23
23
  }
24
24
  type IRequiredContext = IAgentContext<never>;
package/dist/index.js CHANGED
@@ -28,11 +28,11 @@ var require_plugin_schema = __commonJS({
28
28
  },
29
29
  grants: {
30
30
  $ref: "#/components/schemas/Grant",
31
- description: "OPTIONAL. A JSON object indicating to the Wallet the Grant Types the Credential Issuer's AS is prepared to process for this credential offer. Every grant is represented by a key and an object. The key value is the Grant Type identifier, the object MAY contain parameters either determining the way the Wallet MUST use the particular grant and/or parameters the Wallet MUST send with the respective request(s). If grants is not present or empty, the Wallet MUST determine the Grant Types the Credential Issuer's AS supports using the respective metadata. When multiple grants are present, it's at the Wallet's discretion which one to use."
31
+ description: "OPTIONAL. Object indicating to the Wallet the Grant Types the Credential Issuer's Authorization Server is prepared to process for this Credential Offer. Every grant is represented by a name/value pair. The name is the Grant Type identifier; the value is an object that contains parameters either determining the way the Wallet MUST use the particular grant and/or parameters the Wallet MUST send with the respective request(s). If grants is not present or is empty, the Wallet MUST determine the Grant Types the Credential Issuer's Authorization Server supports using the respective metadata. When multiple grants are present, it is at the Wallet's discretion which one to use."
32
32
  },
33
33
  client_id: {
34
34
  type: "string",
35
- description: "Some implementations might include a client_id in the offer. For instance EBSI in a same-device flow. (Cross-device tucks it in the state JWT)"
35
+ description: "OPTIONAL. Some implementations might include a client_id in the offer. For instance EBSI in a same-device flow. (Cross-device tucks it in the state JWT)"
36
36
  },
37
37
  credentialDataSupplierInput: {
38
38
  $ref: "#/components/schemas/CredentialDataSupplierInput"
@@ -42,7 +42,10 @@ var require_plugin_schema = __commonJS({
42
42
  }
43
43
  },
44
44
  additionalProperties: false,
45
- required: ["credential_configuration_ids", "credential_issuer"]
45
+ required: [
46
+ "credential_configuration_ids",
47
+ "credential_issuer"
48
+ ]
46
49
  },
47
50
  Grant: {
48
51
  type: "object",
@@ -94,7 +97,9 @@ var require_plugin_schema = __commonJS({
94
97
  description: "OPTIONAL. Boolean value specifying whether the AS expects presentation of the End-User PIN along with the Token Request in a Pre-Authorized Code Flow. Default is false. This PIN is intended to bind the Pre-Authorized Code to a certain transaction to prevent replay of this code by an attacker that, for example, scanned the QR code while standing behind the legitimate End-User. It is RECOMMENDED to send a PIN via a separate channel. If the Wallet decides to use the Pre-Authorized Code Flow, a PIN value MUST be sent in the user_pin parameter with the respective Token Request."
95
98
  }
96
99
  },
97
- required: ["pre-authorized_code"],
100
+ required: [
101
+ "pre-authorized_code"
102
+ ],
98
103
  additionalProperties: false
99
104
  },
100
105
  TxCode: {
@@ -117,7 +122,10 @@ var require_plugin_schema = __commonJS({
117
122
  },
118
123
  InputCharSet: {
119
124
  type: "string",
120
- enum: ["numeric", "text"]
125
+ enum: [
126
+ "numeric",
127
+ "text"
128
+ ]
121
129
  },
122
130
  CredentialDataSupplierInput: {
123
131
  description: "Optional storage that can help the credential Data Supplier. For instance to store credential input data during offer creation, if no additional data can be supplied later on"
@@ -147,7 +155,10 @@ var require_plugin_schema = __commonJS({
147
155
  $ref: "#/components/schemas/TxCode"
148
156
  }
149
157
  },
150
- required: ["uri", "correlationId"],
158
+ required: [
159
+ "uri",
160
+ "correlationId"
161
+ ],
151
162
  additionalProperties: false
152
163
  },
153
164
  IOID4VCIClientGetIssueStatusArgs: {
@@ -160,7 +171,9 @@ var require_plugin_schema = __commonJS({
160
171
  type: "string"
161
172
  }
162
173
  },
163
- required: ["id"],
174
+ required: [
175
+ "id"
176
+ ],
164
177
  additionalProperties: false
165
178
  },
166
179
  IssueStatusResponse: {
@@ -191,7 +204,11 @@ var require_plugin_schema = __commonJS({
191
204
  }
192
205
  }
193
206
  },
194
- required: ["createdAt", "lastUpdatedAt", "status"],
207
+ required: [
208
+ "createdAt",
209
+ "lastUpdatedAt",
210
+ "status"
211
+ ],
195
212
  additionalProperties: false
196
213
  },
197
214
  IssueStatus: {
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../plugin.schema.json","../src/agent/OID4VCIRestClient.ts","../src/index.ts"],"sourcesContent":["{\n \"IOID4VCIRestClient\": {\n \"components\": {\n \"schemas\": {\n \"IOID4VCIClientCreateOfferUriRequestArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"credential_issuer\": {\n \"type\": \"string\",\n \"description\": \"REQUIRED. The URL of the Credential Issuer, as defined in Section 11.2.1, from which the Wallet is requested to obtain one or more Credentials. The Wallet uses it to obtain the Credential Issuer's Metadata following the steps defined in Section 11.2.2.\"\n },\n \"credential_configuration_ids\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"REQUIRED. Array of unique strings that each identify one of the keys in the name/value pairs stored in the credential_configurations_supported Credential Issuer metadata. The Wallet uses these string values to obtain the respective object that contains information about the Credential being offered as defined in Section 11.2.3. For example, these string values can be used to obtain scope values to be used in the Authorization Request.\"\n },\n \"grants\": {\n \"$ref\": \"#/components/schemas/Grant\",\n \"description\": \"OPTIONAL. A JSON object indicating to the Wallet the Grant Types the Credential Issuer's AS is prepared to process for this credential offer. Every grant is represented by a key and an object. The key value is the Grant Type identifier, the object MAY contain parameters either determining the way the Wallet MUST use the particular grant and/or parameters the Wallet MUST send with the respective request(s). If grants is not present or empty, the Wallet MUST determine the Grant Types the Credential Issuer's AS supports using the respective metadata. When multiple grants are present, it's at the Wallet's discretion which one to use.\"\n },\n \"client_id\": {\n \"type\": \"string\",\n \"description\": \"Some implementations might include a client_id in the offer. For instance EBSI in a same-device flow. (Cross-device tucks it in the state JWT)\"\n },\n \"credentialDataSupplierInput\": {\n \"$ref\": \"#/components/schemas/CredentialDataSupplierInput\"\n },\n \"agentBaseUrl\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false,\n \"required\": [\"credential_configuration_ids\", \"credential_issuer\"]\n },\n \"Grant\": {\n \"type\": \"object\",\n \"properties\": {\n \"authorization_code\": {\n \"$ref\": \"#/components/schemas/GrantAuthorizationCode\"\n },\n \"urn:ietf:params:oauth:grant-type:pre-authorized_code\": {\n \"$ref\": \"#/components/schemas/GrantUrnIetf\"\n }\n },\n \"additionalProperties\": false\n },\n \"GrantAuthorizationCode\": {\n \"type\": \"object\",\n \"properties\": {\n \"issuer_state\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL. String value created by the Credential Issuer and opaque to the Wallet that is used to bind the subsequent Authorization Request with the Credential Issuer to a context set up during previous steps.\"\n },\n \"authorization_server\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL string that the Wallet can use to identify the Authorization Server to use with this grant type when authorization_servers parameter in the Credential Issuer metadata has multiple entries. MUST NOT be used otherwise. The value of this parameter MUST match with one of the values in the authorization_servers array obtained from the Credential Issuer metadata\"\n }\n },\n \"additionalProperties\": false\n },\n \"GrantUrnIetf\": {\n \"type\": \"object\",\n \"properties\": {\n \"pre-authorized_code\": {\n \"type\": \"string\",\n \"description\": \"REQUIRED. The code representing the Credential Issuer's authorization for the Wallet to obtain Credentials of a certain type.\"\n },\n \"tx_code\": {\n \"$ref\": \"#/components/schemas/TxCode\",\n \"description\": \"OPTIONAL. Object specifying whether the Authorization Server expects presentation of a Transaction Code by the End-User along with the Token Request in a Pre-Authorized Code Flow. If the Authorization Server does not expect a Transaction Code, this object is absent; this is the default. The Transaction Code is intended to bind the Pre-Authorized Code to a certain transaction to prevent replay of this code by an attacker that, for example, scanned the QR code while standing behind the legitimate End-User. It is RECOMMENDED to send the Transaction Code via a separate channel. If the Wallet decides to use the Pre-Authorized Code Flow, the Transaction Code value MUST be sent in the tx_code parameter with the respective Token Request as defined in Section 6.1. If no length or description is given, this object may be empty, indicating that a Transaction Code is required.\"\n },\n \"interval\": {\n \"type\": \"number\",\n \"description\": \"OPTIONAL. The minimum amount of time in seconds that the Wallet SHOULD wait between polling requests to the token endpoint (in case the Authorization Server responds with error code authorization_pending - see Section 6.3). If no value is provided, Wallets MUST use 5 as the default.\"\n },\n \"authorization_server\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL string that the Wallet can use to identify the Authorization Server to use with this grant type when authorization_servers parameter in the Credential Issuer metadata has multiple entries. MUST NOT be used otherwise. The value of this parameter MUST match with one of the values in the authorization_servers array obtained from the Credential Issuer metadata\"\n },\n \"user_pin_required\": {\n \"type\": \"boolean\",\n \"description\": \"OPTIONAL. Boolean value specifying whether the AS expects presentation of the End-User PIN along with the Token Request in a Pre-Authorized Code Flow. Default is false. This PIN is intended to bind the Pre-Authorized Code to a certain transaction to prevent replay of this code by an attacker that, for example, scanned the QR code while standing behind the legitimate End-User. It is RECOMMENDED to send a PIN via a separate channel. If the Wallet decides to use the Pre-Authorized Code Flow, a PIN value MUST be sent in the user_pin parameter with the respective Token Request.\"\n }\n },\n \"required\": [\"pre-authorized_code\"],\n \"additionalProperties\": false\n },\n \"TxCode\": {\n \"type\": \"object\",\n \"properties\": {\n \"input_mode\": {\n \"$ref\": \"#/components/schemas/InputCharSet\",\n \"description\": \"OPTIONAL. String specifying the input character set. Possible values are numeric (only digits) and text (any characters). The default is numeric.\"\n },\n \"length\": {\n \"type\": \"number\",\n \"description\": \"OPTIONAL. Integer specifying the length of the Transaction Code. This helps the Wallet to render the input screen and improve the user experience.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL. String containing guidance for the Holder of the Wallet on how to obtain the Transaction Code, e.g., describing over which communication channel it is delivered. The Wallet is RECOMMENDED to display this description next to the Transaction Code input screen to improve the user experience. The length of the string MUST NOT exceed 300 characters. The description does not support internationalization, however the Issuer MAY detect the Holder's language by previous communication or an HTTP Accept-Language header within an HTTP GET request for a Credential Offer URI.\"\n }\n },\n \"additionalProperties\": false\n },\n \"InputCharSet\": {\n \"type\": \"string\",\n \"enum\": [\"numeric\", \"text\"]\n },\n \"CredentialDataSupplierInput\": {\n \"description\": \"Optional storage that can help the credential Data Supplier. For instance to store credential input data during offer creation, if no additional data can be supplied later on\"\n },\n \"IOID4VCIClientCreateOfferUriResponse\": {\n \"$ref\": \"#/components/schemas/Omit<CreateCredentialOfferURIResult,\\\"session\\\">\"\n },\n \"Omit<CreateCredentialOfferURIResult,\\\"session\\\">\": {\n \"$ref\": \"#/components/schemas/Pick<CreateCredentialOfferURIResult,Exclude<(\\\"uri\\\"|\\\"correlationId\\\"|\\\"qrCodeDataUri\\\"|\\\"session\\\"|\\\"userPin\\\"|\\\"txCode\\\"),\\\"session\\\">>\"\n },\n \"Pick<CreateCredentialOfferURIResult,Exclude<(\\\"uri\\\"|\\\"correlationId\\\"|\\\"qrCodeDataUri\\\"|\\\"session\\\"|\\\"userPin\\\"|\\\"txCode\\\"),\\\"session\\\">>\": {\n \"type\": \"object\",\n \"properties\": {\n \"uri\": {\n \"type\": \"string\"\n },\n \"correlationId\": {\n \"type\": \"string\"\n },\n \"qrCodeDataUri\": {\n \"type\": \"string\"\n },\n \"userPin\": {\n \"type\": \"string\"\n },\n \"txCode\": {\n \"$ref\": \"#/components/schemas/TxCode\"\n }\n },\n \"required\": [\"uri\", \"correlationId\"],\n \"additionalProperties\": false\n },\n \"IOID4VCIClientGetIssueStatusArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"baseUrl\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\"id\"],\n \"additionalProperties\": false\n },\n \"IssueStatusResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"createdAt\": {\n \"type\": \"number\"\n },\n \"lastUpdatedAt\": {\n \"type\": \"number\"\n },\n \"expiresAt\": {\n \"type\": \"number\"\n },\n \"status\": {\n \"$ref\": \"#/components/schemas/IssueStatus\"\n },\n \"error\": {\n \"type\": \"string\"\n },\n \"clientId\": {\n \"type\": \"string\"\n },\n \"statusLists\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/StatusListOpts\"\n }\n }\n },\n \"required\": [\"createdAt\", \"lastUpdatedAt\", \"status\"],\n \"additionalProperties\": false\n },\n \"IssueStatus\": {\n \"type\": \"string\",\n \"enum\": [\n \"OFFER_CREATED\",\n \"ACCESS_TOKEN_REQUESTED\",\n \"ACCESS_TOKEN_CREATED\",\n \"CREDENTIAL_REQUEST_RECEIVED\",\n \"CREDENTIAL_ISSUED\",\n \"NOTIFICATION_CREDENTIAL_ACCEPTED\",\n \"NOTIFICATION_CREDENTIAL_DELETED\",\n \"NOTIFICATION_CREDENTIAL_FAILURE\",\n \"ERROR\"\n ]\n },\n \"StatusListOpts\": {\n \"type\": \"object\",\n \"properties\": {\n \"statusListId\": {\n \"type\": \"string\"\n },\n \"statusListCorrelationId\": {\n \"type\": \"string\"\n },\n \"statusListIndex\": {\n \"type\": \"number\"\n },\n \"statusEntryCorrelationId\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false\n }\n },\n \"methods\": {\n \"oid4vciClientCreateOfferUri\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IOID4VCIClientCreateOfferUriRequestArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IOID4VCIClientCreateOfferUriResponse\"\n }\n },\n \"oid4vciClientGetIssueStatus\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IOID4VCIClientGetIssueStatusArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IssueStatusResponse\"\n }\n }\n }\n }\n }\n}\n","import { fetch } from 'cross-fetch'\nimport {\n IOID4VCIRestClient,\n IOID4VCIClientCreateOfferUriRequest,\n IOID4VCIClientCreateOfferUriRequestArgs,\n IOID4VCIClientCreateOfferUriResponse,\n IOID4VCIClientGetIssueStatusArgs,\n IRestClientAuthenticationOpts,\n} from '../types/IOID4VCIRestClient'\nimport { IssueStatusResponse } from '@sphereon/oid4vci-common'\nimport { IAgentPlugin } from '@veramo/core'\nimport { Loggers } from '@sphereon/ssi-types'\n\nconst logger = Loggers.DEFAULT.get('sphereon:ssi-sdk:oid4vci:issuer:rest-client')\n\n/**\n * {@inheritDoc IOID4VCIRestClient}\n */\nexport class OID4VCIRestClient implements IAgentPlugin {\n readonly methods: IOID4VCIRestClient = {\n oid4vciClientCreateOfferUri: this.oid4vciClientCreateOfferUri.bind(this),\n oid4vciClientGetIssueStatus: this.oid4vciClientGetIssueStatus.bind(this),\n }\n\n private readonly agentBaseUrl?: string\n private readonly authOpts?: IRestClientAuthenticationOpts\n\n constructor(args?: { baseUrl?: string; authentication?: IRestClientAuthenticationOpts }) {\n if (args?.baseUrl) {\n this.agentBaseUrl = args.baseUrl\n }\n this.authOpts = args?.authentication\n }\n\n private async createHeaders(existing?: Record<string, any>): Promise<HeadersInit> {\n const headers: HeadersInit = {\n ...existing,\n Accept: 'application/json',\n }\n if (this.authOpts?.enabled === true) {\n if (!this.authOpts.bearerToken) {\n throw Error(`Cannot have authentication enabled, whilst not enabling static bearer tokens at this point`)\n }\n headers.Authorization = `Bearer ${\n typeof this.authOpts.bearerToken === 'string' ? this.authOpts.bearerToken : await this.authOpts.bearerToken()\n }`\n }\n return headers\n }\n\n /** {@inheritDoc IOID4VCIRestClient.vciClientCreateOfferUri} */\n private async oid4vciClientCreateOfferUri(args: IOID4VCIClientCreateOfferUriRequestArgs): Promise<IOID4VCIClientCreateOfferUriResponse> {\n if (!args.credential_configuration_ids || !args.grants) {\n return Promise.reject(Error(\"Can't generate the credential offer url without credentials and grants params present.\"))\n }\n const baseUrl = this.assertedAgentBaseUrl(args.agentBaseUrl)\n const request: IOID4VCIClientCreateOfferUriRequest = {\n credential_configuration_ids: args.credential_configuration_ids,\n grants: args.grants,\n ...(args.credentialDataSupplierInput && { credentialDataSupplierInput: args.credentialDataSupplierInput }),\n }\n const url = OID4VCIRestClient.urlWithBase(`webapp/credential-offers`, baseUrl)\n logger.debug(`OID4VCIRestClient is going to send request: ${JSON.stringify(request)} to ${url}`)\n try {\n const origResponse = await fetch(url, {\n method: 'POST',\n headers: await this.createHeaders({ 'Content-Type': 'application/json' }),\n body: JSON.stringify(request),\n })\n if (!origResponse.ok) {\n return Promise.reject(Error(`request to ${url} returned ${origResponse.status}`))\n }\n return await origResponse.json()\n } catch (e) {\n logger.debug(`Error on posting to url ${url}: ${e}`)\n return Promise.reject(Error(`request to ${url} returned ${e}`))\n }\n }\n\n private async oid4vciClientGetIssueStatus(args: IOID4VCIClientGetIssueStatusArgs): Promise<IssueStatusResponse> {\n const baseUrl = this.assertedAgentBaseUrl(args.baseUrl)\n const url = OID4VCIRestClient.urlWithBase('/webapp/credential-offer-status', baseUrl)\n const statusResponse = await fetch(url, {\n method: 'POST',\n headers: await this.createHeaders({ 'Content-Type': 'application/json' }),\n body: JSON.stringify({\n id: args.id,\n }),\n })\n logger.debug(`issue status response: ${statusResponse}`)\n try {\n return await statusResponse.json()\n } catch (err) {\n throw Error(`Status has returned ${statusResponse.status}`)\n }\n }\n\n private assertedAgentBaseUrl(baseUrl?: string): string {\n if (baseUrl) {\n return baseUrl\n } else if (this.agentBaseUrl) {\n return this.agentBaseUrl\n }\n throw new Error('No base url has been provided')\n }\n\n private static urlWithBase(path: string, baseUrl: string): string {\n return `${baseUrl}${path.startsWith('/') ? path : `/${path}`}`\n }\n}\n","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { OID4VCIRestClient } from './agent/OID4VCIRestClient'\nexport type * from './types/IOID4VCIRestClient'\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA,MACE,oBAAsB;AAAA,QACpB,YAAc;AAAA,UACZ,SAAW;AAAA,YACT,yCAA2C;AAAA,cACzC,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,mBAAqB;AAAA,kBACnB,MAAQ;AAAA,kBACR,aAAe;AAAA,gBACjB;AAAA,gBACA,8BAAgC;AAAA,kBAC9B,MAAQ;AAAA,kBACR,OAAS;AAAA,oBACP,MAAQ;AAAA,kBACV;AAAA,kBACA,aAAe;AAAA,gBACjB;AAAA,gBACA,QAAU;AAAA,kBACR,MAAQ;AAAA,kBACR,aAAe;AAAA,gBACjB;AAAA,gBACA,WAAa;AAAA,kBACX,MAAQ;AAAA,kBACR,aAAe;AAAA,gBACjB;AAAA,gBACA,6BAA+B;AAAA,kBAC7B,MAAQ;AAAA,gBACV;AAAA,gBACA,cAAgB;AAAA,kBACd,MAAQ;AAAA,gBACV;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AI,CAACO,aAAaI,IAAI;AACpB,eAAOd,QAAQC,OAAOL,MAAM,cAAcS,GAAAA,aAAgBK,aAAaK,MAAM,EAAE,CAAA;MACjF;AACA,aAAO,MAAML,aAAaM,KAAI;IAChC,SAASC,GAAG;AACVzC,aAAO+B,MAAM,2BAA2BF,GAAAA,KAAQY,CAAAA,EAAG;AACnD,aAAOjB,QAAQC,OAAOL,MAAM,cAAcS,GAAAA,aAAgBY,CAAAA,EAAG,CAAA;IAC/D;EACF;EAEA,MAAcjC,4BAA4BG,MAAsE;AAC9G,UAAMC,UAAU,KAAKc,qBAAqBf,KAAKC,OAAO;AACtD,UAAMiB,MAAMzB,mBAAkB0B,YAAY,mCAAmClB,OAAAA;AAC7E,UAAM8B,iBAAiB,MAAMP,MAAMN,KAAK;MACtCO,QAAQ;MACRpB,SAAS,MAAM,KAAKF,cAAc;QAAE,gBAAgB;MAAmB,CAAA;MACvEuB,MAAML,KAAKC,UAAU;QACnBU,IAAIhC,KAAKgC;MACX,CAAA;IACF,CAAA;AACA3C,WAAO+B,MAAM,0BAA0BW,cAAAA,EAAgB;AACvD,QAAI;AACF,aAAO,MAAMA,eAAeF,KAAI;IAClC,SAASI,KAAK;AACZ,YAAMxB,MAAM,uBAAuBsB,eAAeH,MAAM,EAAE;IAC5D;EACF;EAEQb,qBAAqBd,SAA0B;AACrD,QAAIA,SAAS;AACX,aAAOA;IACT,WAAW,KAAKH,cAAc;AAC5B,aAAO,KAAKA;IACd;AACA,UAAM,IAAIW,MAAM,+BAAA;EAClB;EAEA,OAAeU,YAAYe,MAAcjC,SAAyB;AAChE,WAAO,GAAGA,OAAAA,GAAUiC,KAAKC,WAAW,GAAA,IAAOD,OAAO,IAAIA,IAAAA,EAAM;EAC9D;AACF;;;AC1GA,IAAME,SAASC;","names":["fetch","Loggers","logger","Loggers","DEFAULT","get","OID4VCIRestClient","methods","oid4vciClientCreateOfferUri","bind","oid4vciClientGetIssueStatus","agentBaseUrl","authOpts","args","baseUrl","authentication","createHeaders","existing","headers","Accept","enabled","bearerToken","Error","Authorization","credential_configuration_ids","grants","Promise","reject","assertedAgentBaseUrl","request","credentialDataSupplierInput","url","urlWithBase","debug","JSON","stringify","origResponse","fetch","method","body","ok","status","json","e","statusResponse","id","err","path","startsWith","schema","require"]}
1
+ {"version":3,"sources":["../plugin.schema.json","../src/agent/OID4VCIRestClient.ts","../src/index.ts"],"sourcesContent":["{\n \"IOID4VCIRestClient\": {\n \"components\": {\n \"schemas\": {\n \"IOID4VCIClientCreateOfferUriRequestArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"credential_issuer\": {\n \"type\": \"string\",\n \"description\": \"REQUIRED. The URL of the Credential Issuer, as defined in Section 11.2.1, from which the Wallet is requested to obtain one or more Credentials. The Wallet uses it to obtain the Credential Issuer's Metadata following the steps defined in Section 11.2.2.\"\n },\n \"credential_configuration_ids\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"REQUIRED. Array of unique strings that each identify one of the keys in the name/value pairs stored in the credential_configurations_supported Credential Issuer metadata. The Wallet uses these string values to obtain the respective object that contains information about the Credential being offered as defined in Section 11.2.3. For example, these string values can be used to obtain scope values to be used in the Authorization Request.\"\n },\n \"grants\": {\n \"$ref\": \"#/components/schemas/Grant\",\n \"description\": \"OPTIONAL. Object indicating to the Wallet the Grant Types the Credential Issuer's Authorization Server is prepared to process for this Credential Offer. Every grant is represented by a name/value pair. The name is the Grant Type identifier; the value is an object that contains parameters either determining the way the Wallet MUST use the particular grant and/or parameters the Wallet MUST send with the respective request(s). If grants is not present or is empty, the Wallet MUST determine the Grant Types the Credential Issuer's Authorization Server supports using the respective metadata. When multiple grants are present, it is at the Wallet's discretion which one to use.\"\n },\n \"client_id\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL. Some implementations might include a client_id in the offer. For instance EBSI in a same-device flow. (Cross-device tucks it in the state JWT)\"\n },\n \"credentialDataSupplierInput\": {\n \"$ref\": \"#/components/schemas/CredentialDataSupplierInput\"\n },\n \"agentBaseUrl\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false,\n \"required\": [\n \"credential_configuration_ids\",\n \"credential_issuer\"\n ]\n },\n \"Grant\": {\n \"type\": \"object\",\n \"properties\": {\n \"authorization_code\": {\n \"$ref\": \"#/components/schemas/GrantAuthorizationCode\"\n },\n \"urn:ietf:params:oauth:grant-type:pre-authorized_code\": {\n \"$ref\": \"#/components/schemas/GrantUrnIetf\"\n }\n },\n \"additionalProperties\": false\n },\n \"GrantAuthorizationCode\": {\n \"type\": \"object\",\n \"properties\": {\n \"issuer_state\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL. String value created by the Credential Issuer and opaque to the Wallet that is used to bind the subsequent Authorization Request with the Credential Issuer to a context set up during previous steps.\"\n },\n \"authorization_server\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL string that the Wallet can use to identify the Authorization Server to use with this grant type when authorization_servers parameter in the Credential Issuer metadata has multiple entries. MUST NOT be used otherwise. The value of this parameter MUST match with one of the values in the authorization_servers array obtained from the Credential Issuer metadata\"\n }\n },\n \"additionalProperties\": false\n },\n \"GrantUrnIetf\": {\n \"type\": \"object\",\n \"properties\": {\n \"pre-authorized_code\": {\n \"type\": \"string\",\n \"description\": \"REQUIRED. The code representing the Credential Issuer's authorization for the Wallet to obtain Credentials of a certain type.\"\n },\n \"tx_code\": {\n \"$ref\": \"#/components/schemas/TxCode\",\n \"description\": \"OPTIONAL. Object specifying whether the Authorization Server expects presentation of a Transaction Code by the End-User along with the Token Request in a Pre-Authorized Code Flow. If the Authorization Server does not expect a Transaction Code, this object is absent; this is the default. The Transaction Code is intended to bind the Pre-Authorized Code to a certain transaction to prevent replay of this code by an attacker that, for example, scanned the QR code while standing behind the legitimate End-User. It is RECOMMENDED to send the Transaction Code via a separate channel. If the Wallet decides to use the Pre-Authorized Code Flow, the Transaction Code value MUST be sent in the tx_code parameter with the respective Token Request as defined in Section 6.1. If no length or description is given, this object may be empty, indicating that a Transaction Code is required.\"\n },\n \"interval\": {\n \"type\": \"number\",\n \"description\": \"OPTIONAL. The minimum amount of time in seconds that the Wallet SHOULD wait between polling requests to the token endpoint (in case the Authorization Server responds with error code authorization_pending - see Section 6.3). If no value is provided, Wallets MUST use 5 as the default.\"\n },\n \"authorization_server\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL string that the Wallet can use to identify the Authorization Server to use with this grant type when authorization_servers parameter in the Credential Issuer metadata has multiple entries. MUST NOT be used otherwise. The value of this parameter MUST match with one of the values in the authorization_servers array obtained from the Credential Issuer metadata\"\n },\n \"user_pin_required\": {\n \"type\": \"boolean\",\n \"description\": \"OPTIONAL. Boolean value specifying whether the AS expects presentation of the End-User PIN along with the Token Request in a Pre-Authorized Code Flow. Default is false. This PIN is intended to bind the Pre-Authorized Code to a certain transaction to prevent replay of this code by an attacker that, for example, scanned the QR code while standing behind the legitimate End-User. It is RECOMMENDED to send a PIN via a separate channel. If the Wallet decides to use the Pre-Authorized Code Flow, a PIN value MUST be sent in the user_pin parameter with the respective Token Request.\"\n }\n },\n \"required\": [\n \"pre-authorized_code\"\n ],\n \"additionalProperties\": false\n },\n \"TxCode\": {\n \"type\": \"object\",\n \"properties\": {\n \"input_mode\": {\n \"$ref\": \"#/components/schemas/InputCharSet\",\n \"description\": \"OPTIONAL. String specifying the input character set. Possible values are numeric (only digits) and text (any characters). The default is numeric.\"\n },\n \"length\": {\n \"type\": \"number\",\n \"description\": \"OPTIONAL. Integer specifying the length of the Transaction Code. This helps the Wallet to render the input screen and improve the user experience.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"description\": \"OPTIONAL. String containing guidance for the Holder of the Wallet on how to obtain the Transaction Code, e.g., describing over which communication channel it is delivered. The Wallet is RECOMMENDED to display this description next to the Transaction Code input screen to improve the user experience. The length of the string MUST NOT exceed 300 characters. The description does not support internationalization, however the Issuer MAY detect the Holder's language by previous communication or an HTTP Accept-Language header within an HTTP GET request for a Credential Offer URI.\"\n }\n },\n \"additionalProperties\": false\n },\n \"InputCharSet\": {\n \"type\": \"string\",\n \"enum\": [\n \"numeric\",\n \"text\"\n ]\n },\n \"CredentialDataSupplierInput\": {\n \"description\": \"Optional storage that can help the credential Data Supplier. For instance to store credential input data during offer creation, if no additional data can be supplied later on\"\n },\n \"IOID4VCIClientCreateOfferUriResponse\": {\n \"$ref\": \"#/components/schemas/Omit<CreateCredentialOfferURIResult,\\\"session\\\">\"\n },\n \"Omit<CreateCredentialOfferURIResult,\\\"session\\\">\": {\n \"$ref\": \"#/components/schemas/Pick<CreateCredentialOfferURIResult,Exclude<(\\\"uri\\\"|\\\"correlationId\\\"|\\\"qrCodeDataUri\\\"|\\\"session\\\"|\\\"userPin\\\"|\\\"txCode\\\"),\\\"session\\\">>\"\n },\n \"Pick<CreateCredentialOfferURIResult,Exclude<(\\\"uri\\\"|\\\"correlationId\\\"|\\\"qrCodeDataUri\\\"|\\\"session\\\"|\\\"userPin\\\"|\\\"txCode\\\"),\\\"session\\\">>\": {\n \"type\": \"object\",\n \"properties\": {\n \"uri\": {\n \"type\": \"string\"\n },\n \"correlationId\": {\n \"type\": \"string\"\n },\n \"qrCodeDataUri\": {\n \"type\": \"string\"\n },\n \"userPin\": {\n \"type\": \"string\"\n },\n \"txCode\": {\n \"$ref\": \"#/components/schemas/TxCode\"\n }\n },\n \"required\": [\n \"uri\",\n \"correlationId\"\n ],\n \"additionalProperties\": false\n },\n \"IOID4VCIClientGetIssueStatusArgs\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"baseUrl\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\"\n ],\n \"additionalProperties\": false\n },\n \"IssueStatusResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"createdAt\": {\n \"type\": \"number\"\n },\n \"lastUpdatedAt\": {\n \"type\": \"number\"\n },\n \"expiresAt\": {\n \"type\": \"number\"\n },\n \"status\": {\n \"$ref\": \"#/components/schemas/IssueStatus\"\n },\n \"error\": {\n \"type\": \"string\"\n },\n \"clientId\": {\n \"type\": \"string\"\n },\n \"statusLists\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/StatusListOpts\"\n }\n }\n },\n \"required\": [\n \"createdAt\",\n \"lastUpdatedAt\",\n \"status\"\n ],\n \"additionalProperties\": false\n },\n \"IssueStatus\": {\n \"type\": \"string\",\n \"enum\": [\n \"OFFER_CREATED\",\n \"ACCESS_TOKEN_REQUESTED\",\n \"ACCESS_TOKEN_CREATED\",\n \"CREDENTIAL_REQUEST_RECEIVED\",\n \"CREDENTIAL_ISSUED\",\n \"NOTIFICATION_CREDENTIAL_ACCEPTED\",\n \"NOTIFICATION_CREDENTIAL_DELETED\",\n \"NOTIFICATION_CREDENTIAL_FAILURE\",\n \"ERROR\"\n ]\n },\n \"StatusListOpts\": {\n \"type\": \"object\",\n \"properties\": {\n \"statusListId\": {\n \"type\": \"string\"\n },\n \"statusListCorrelationId\": {\n \"type\": \"string\"\n },\n \"statusListIndex\": {\n \"type\": \"number\"\n },\n \"statusEntryCorrelationId\": {\n \"type\": \"string\"\n }\n },\n \"additionalProperties\": false\n }\n },\n \"methods\": {\n \"oid4vciClientCreateOfferUri\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IOID4VCIClientCreateOfferUriRequestArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IOID4VCIClientCreateOfferUriResponse\"\n }\n },\n \"oid4vciClientGetIssueStatus\": {\n \"description\": \"\",\n \"arguments\": {\n \"$ref\": \"#/components/schemas/IOID4VCIClientGetIssueStatusArgs\"\n },\n \"returnType\": {\n \"$ref\": \"#/components/schemas/IssueStatusResponse\"\n }\n }\n }\n }\n }\n}","import { fetch } from 'cross-fetch'\nimport {\n IOID4VCIRestClient,\n IOID4VCIClientCreateOfferUriRequest,\n IOID4VCIClientCreateOfferUriRequestArgs,\n IOID4VCIClientCreateOfferUriResponse,\n IOID4VCIClientGetIssueStatusArgs,\n IRestClientAuthenticationOpts,\n} from '../types/IOID4VCIRestClient'\nimport { IssueStatusResponse } from '@sphereon/oid4vci-common'\nimport { IAgentPlugin } from '@veramo/core'\nimport { Loggers } from '@sphereon/ssi-types'\n\nconst logger = Loggers.DEFAULT.get('sphereon:ssi-sdk:oid4vci:issuer:rest-client')\n\n/**\n * {@inheritDoc IOID4VCIRestClient}\n */\nexport class OID4VCIRestClient implements IAgentPlugin {\n readonly methods: IOID4VCIRestClient = {\n oid4vciClientCreateOfferUri: this.oid4vciClientCreateOfferUri.bind(this),\n oid4vciClientGetIssueStatus: this.oid4vciClientGetIssueStatus.bind(this),\n }\n\n private readonly agentBaseUrl?: string\n private readonly authOpts?: IRestClientAuthenticationOpts\n\n constructor(args?: { baseUrl?: string; authentication?: IRestClientAuthenticationOpts }) {\n if (args?.baseUrl) {\n this.agentBaseUrl = args.baseUrl\n }\n this.authOpts = args?.authentication\n }\n\n private async createHeaders(existing?: Record<string, any>): Promise<HeadersInit> {\n const headers: HeadersInit = {\n ...existing,\n Accept: 'application/json',\n }\n if (this.authOpts?.enabled === true) {\n if (!this.authOpts.bearerToken) {\n throw Error(`Cannot have authentication enabled, whilst not enabling static bearer tokens at this point`)\n }\n headers.Authorization = `Bearer ${\n typeof this.authOpts.bearerToken === 'string' ? this.authOpts.bearerToken : await this.authOpts.bearerToken()\n }`\n }\n return headers\n }\n\n /** {@inheritDoc IOID4VCIRestClient.vciClientCreateOfferUri} */\n private async oid4vciClientCreateOfferUri(args: IOID4VCIClientCreateOfferUriRequestArgs): Promise<IOID4VCIClientCreateOfferUriResponse> {\n if (!args.credential_configuration_ids || !args.grants) {\n return Promise.reject(Error(\"Can't generate the credential offer url without credentials and grants params present.\"))\n }\n const baseUrl = this.assertedAgentBaseUrl(args.agentBaseUrl)\n const request: IOID4VCIClientCreateOfferUriRequest = {\n credential_configuration_ids: args.credential_configuration_ids,\n grants: args.grants,\n ...(args.credentialDataSupplierInput && { credentialDataSupplierInput: args.credentialDataSupplierInput }),\n }\n const url = OID4VCIRestClient.urlWithBase(`webapp/credential-offers`, baseUrl)\n logger.debug(`OID4VCIRestClient is going to send request: ${JSON.stringify(request)} to ${url}`)\n try {\n const origResponse = await fetch(url, {\n method: 'POST',\n headers: await this.createHeaders({ 'Content-Type': 'application/json' }),\n body: JSON.stringify(request),\n })\n if (!origResponse.ok) {\n return Promise.reject(Error(`request to ${url} returned ${origResponse.status}`))\n }\n return await origResponse.json()\n } catch (e) {\n logger.debug(`Error on posting to url ${url}: ${e}`)\n return Promise.reject(Error(`request to ${url} returned ${e}`))\n }\n }\n\n private async oid4vciClientGetIssueStatus(args: IOID4VCIClientGetIssueStatusArgs): Promise<IssueStatusResponse> {\n const baseUrl = this.assertedAgentBaseUrl(args.baseUrl)\n const url = OID4VCIRestClient.urlWithBase('/webapp/credential-offer-status', baseUrl)\n const statusResponse = await fetch(url, {\n method: 'POST',\n headers: await this.createHeaders({ 'Content-Type': 'application/json' }),\n body: JSON.stringify({\n id: args.id,\n }),\n })\n logger.debug(`issue status response: ${statusResponse}`)\n try {\n return await statusResponse.json()\n } catch (err) {\n throw Error(`Status has returned ${statusResponse.status}`)\n }\n }\n\n private assertedAgentBaseUrl(baseUrl?: string): string {\n if (baseUrl) {\n return baseUrl\n } else if (this.agentBaseUrl) {\n return this.agentBaseUrl\n }\n throw new Error('No base url has been provided')\n }\n\n private static urlWithBase(path: string, baseUrl: string): string {\n return `${baseUrl}${path.startsWith('/') ? path : `/${path}`}`\n }\n}\n","/**\n * @public\n */\nconst schema = require('../plugin.schema.json')\nexport { schema }\nexport { OID4VCIRestClient } from './agent/OID4VCIRestClient'\nexport type * from './types/IOID4VCIRestClient'\n"],"mappings":";;;;;;;;AAAA;AAAA;AAAA;AAAA,MACE,oBAAsB;AAAA,QACpB,YAAc;AAAA,UACZ,SAAW;AAAA,YACT,yCAA2C;AAAA,cACzC,MAAQ;AAAA,cACR,YAAc;AAAA,gBACZ,mBAAqB;AAAA,kBACnB,MAAQ;AAAA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BAAuBsB,eAAeH,MAAM,EAAE;IAC5D;EACF;EAEQb,qBAAqBd,SAA0B;AACrD,QAAIA,SAAS;AACX,aAAOA;IACT,WAAW,KAAKH,cAAc;AAC5B,aAAO,KAAKA;IACd;AACA,UAAM,IAAIW,MAAM,+BAAA;EAClB;EAEA,OAAeU,YAAYe,MAAcjC,SAAyB;AAChE,WAAO,GAAGA,OAAAA,GAAUiC,KAAKC,WAAW,GAAA,IAAOD,OAAO,IAAIA,IAAAA,EAAM;EAC9D;AACF;;;AC1GA,IAAME,SAASC;","names":["fetch","Loggers","logger","Loggers","DEFAULT","get","OID4VCIRestClient","methods","oid4vciClientCreateOfferUri","bind","oid4vciClientGetIssueStatus","agentBaseUrl","authOpts","args","baseUrl","authentication","createHeaders","existing","headers","Accept","enabled","bearerToken","Error","Authorization","credential_configuration_ids","grants","Promise","reject","assertedAgentBaseUrl","request","credentialDataSupplierInput","url","urlWithBase","debug","JSON","stringify","origResponse","fetch","method","body","ok","status","json","e","statusResponse","id","err","path","startsWith","schema","require"]}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sphereon/ssi-sdk.oid4vci-issuer-rest-client",
3
3
  "description": "contains the client side to call REST endpoints of a Verifiable Credential Issuer",
4
- "version": "0.34.1-next.7+abc1dfeb",
4
+ "version": "0.34.1-next.85+019802c5",
5
5
  "source": "src/index.ts",
6
6
  "type": "module",
7
7
  "main": "./dist/index.cjs",
@@ -25,16 +25,16 @@
25
25
  },
26
26
  "scripts": {
27
27
  "build": "tsup --config ../../tsup.config.ts --tsconfig ../../tsconfig.tsup.json",
28
- "generate-plugin-schema": "ts-node ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
28
+ "generate-plugin-schema": "tsx ../../packages/dev/bin/sphereon.js dev generate-plugin-schema"
29
29
  },
30
30
  "dependencies": {
31
- "@sphereon/oid4vci-common": "0.19.1-next.2",
32
- "@sphereon/ssi-types": "0.34.1-next.7+abc1dfeb",
31
+ "@sphereon/oid4vci-common": "0.19.1-feature.SSISDK.45.86",
32
+ "@sphereon/ssi-types": "0.34.1-next.85+019802c5",
33
33
  "@veramo/core": "4.2.0",
34
- "cross-fetch": "^3.1.8"
34
+ "cross-fetch": "^4.1.0"
35
35
  },
36
36
  "devDependencies": {
37
- "@sphereon/ssi-sdk.dev": "0.34.1-next.7+abc1dfeb",
37
+ "@sphereon/ssi-sdk.dev": "0.34.1-next.85+019802c5",
38
38
  "@types/node": "^20.17.1",
39
39
  "@veramo/remote-client": "4.2.0",
40
40
  "@veramo/remote-server": "4.2.0",
@@ -63,5 +63,5 @@
63
63
  "Verifiable Credentials",
64
64
  "SSI"
65
65
  ],
66
- "gitHead": "abc1dfebd9a53c49235573ad0a337abb248bf2f3"
66
+ "gitHead": "019802c57e9c1f9e3df4ecbb1d6a17f49e8fdbeb"
67
67
  }
@@ -18,11 +18,11 @@
18
18
  },
19
19
  "grants": {
20
20
  "$ref": "#/components/schemas/Grant",
21
- "description": "OPTIONAL. A JSON object indicating to the Wallet the Grant Types the Credential Issuer's AS is prepared to process for this credential offer. Every grant is represented by a key and an object. The key value is the Grant Type identifier, the object MAY contain parameters either determining the way the Wallet MUST use the particular grant and/or parameters the Wallet MUST send with the respective request(s). If grants is not present or empty, the Wallet MUST determine the Grant Types the Credential Issuer's AS supports using the respective metadata. When multiple grants are present, it's at the Wallet's discretion which one to use."
21
+ "description": "OPTIONAL. Object indicating to the Wallet the Grant Types the Credential Issuer's Authorization Server is prepared to process for this Credential Offer. Every grant is represented by a name/value pair. The name is the Grant Type identifier; the value is an object that contains parameters either determining the way the Wallet MUST use the particular grant and/or parameters the Wallet MUST send with the respective request(s). If grants is not present or is empty, the Wallet MUST determine the Grant Types the Credential Issuer's Authorization Server supports using the respective metadata. When multiple grants are present, it is at the Wallet's discretion which one to use."
22
22
  },
23
23
  "client_id": {
24
24
  "type": "string",
25
- "description": "Some implementations might include a client_id in the offer. For instance EBSI in a same-device flow. (Cross-device tucks it in the state JWT)"
25
+ "description": "OPTIONAL. Some implementations might include a client_id in the offer. For instance EBSI in a same-device flow. (Cross-device tucks it in the state JWT)"
26
26
  },
27
27
  "credentialDataSupplierInput": {
28
28
  "$ref": "#/components/schemas/CredentialDataSupplierInput"
@@ -32,7 +32,10 @@
32
32
  }
33
33
  },
34
34
  "additionalProperties": false,
35
- "required": ["credential_configuration_ids", "credential_issuer"]
35
+ "required": [
36
+ "credential_configuration_ids",
37
+ "credential_issuer"
38
+ ]
36
39
  },
37
40
  "Grant": {
38
41
  "type": "object",
@@ -84,7 +87,9 @@
84
87
  "description": "OPTIONAL. Boolean value specifying whether the AS expects presentation of the End-User PIN along with the Token Request in a Pre-Authorized Code Flow. Default is false. This PIN is intended to bind the Pre-Authorized Code to a certain transaction to prevent replay of this code by an attacker that, for example, scanned the QR code while standing behind the legitimate End-User. It is RECOMMENDED to send a PIN via a separate channel. If the Wallet decides to use the Pre-Authorized Code Flow, a PIN value MUST be sent in the user_pin parameter with the respective Token Request."
85
88
  }
86
89
  },
87
- "required": ["pre-authorized_code"],
90
+ "required": [
91
+ "pre-authorized_code"
92
+ ],
88
93
  "additionalProperties": false
89
94
  },
90
95
  "TxCode": {
@@ -107,7 +112,10 @@
107
112
  },
108
113
  "InputCharSet": {
109
114
  "type": "string",
110
- "enum": ["numeric", "text"]
115
+ "enum": [
116
+ "numeric",
117
+ "text"
118
+ ]
111
119
  },
112
120
  "CredentialDataSupplierInput": {
113
121
  "description": "Optional storage that can help the credential Data Supplier. For instance to store credential input data during offer creation, if no additional data can be supplied later on"
@@ -137,7 +145,10 @@
137
145
  "$ref": "#/components/schemas/TxCode"
138
146
  }
139
147
  },
140
- "required": ["uri", "correlationId"],
148
+ "required": [
149
+ "uri",
150
+ "correlationId"
151
+ ],
141
152
  "additionalProperties": false
142
153
  },
143
154
  "IOID4VCIClientGetIssueStatusArgs": {
@@ -150,7 +161,9 @@
150
161
  "type": "string"
151
162
  }
152
163
  },
153
- "required": ["id"],
164
+ "required": [
165
+ "id"
166
+ ],
154
167
  "additionalProperties": false
155
168
  },
156
169
  "IssueStatusResponse": {
@@ -181,7 +194,11 @@
181
194
  }
182
195
  }
183
196
  },
184
- "required": ["createdAt", "lastUpdatedAt", "status"],
197
+ "required": [
198
+ "createdAt",
199
+ "lastUpdatedAt",
200
+ "status"
201
+ ],
185
202
  "additionalProperties": false
186
203
  },
187
204
  "IssueStatus": {
@@ -239,4 +256,4 @@
239
256
  }
240
257
  }
241
258
  }
242
- }
259
+ }
@@ -4,7 +4,7 @@ import type {
4
4
  IssueStatusResponse,
5
5
  CredentialDataSupplierInput,
6
6
  CreateCredentialOfferURIResult,
7
- CredentialOfferPayloadV1_0_13,
7
+ CredentialOfferPayloadV1_0_15,
8
8
  } from '@sphereon/oid4vci-common'
9
9
 
10
10
  export interface IOID4VCIRestClient extends IPluginMethodMap {
@@ -28,7 +28,7 @@ export interface IOID4VCIClientGetIssueStatusArgs {
28
28
 
29
29
  export type IOID4VCIClientCreateOfferUriResponse = Omit<CreateCredentialOfferURIResult, 'session'>
30
30
 
31
- export interface IOID4VCIClientCreateOfferUriRequest extends CredentialOfferPayloadV1_0_13 {
31
+ export interface IOID4VCIClientCreateOfferUriRequest extends CredentialOfferPayloadV1_0_15 {
32
32
  credentialDataSupplierInput?: CredentialDataSupplierInput
33
33
  }
34
34