@sphereon/oid4vci-common
Advanced tools
Comparing version 0.4.1-next.285 to 0.4.1-next.306
@@ -11,6 +11,11 @@ "use strict"; | ||
}; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.determineGrantTypes = exports.getCredentialOfferPayload = exports.determineFlowType = exports.toUniformCredentialOfferPayload = exports.resolveCredentialOfferURI = exports.assertedUniformCredentialOffer = exports.isPreAuthCode = exports.toUniformCredentialOfferRequest = exports.isCredentialOfferVersion = exports.determineSpecVersionFromOffer = exports.getIssuerFromCredentialOfferPayload = exports.getScheme = exports.determineSpecVersionFromScheme = exports.determineSpecVersionFromURI = void 0; | ||
const debug_1 = __importDefault(require("debug")); | ||
const types_1 = require("../types"); | ||
const HttpUtils_1 = require("./HttpUtils"); | ||
const debug = (0, debug_1.default)('sphereon:oid4vci:offer'); | ||
function determineSpecVersionFromURI(uri) { | ||
@@ -79,7 +84,7 @@ let version = types_1.OpenId4VCIVersion.VER_UNKNOWN; | ||
if (version.valueOf() < min.valueOf()) { | ||
console.log(`Credential offer version (${version.valueOf()}) is lower than minimum required version (${min.valueOf()})`); | ||
debug(`Credential offer version (${version.valueOf()}) is lower than minimum required version (${min.valueOf()})`); | ||
return false; | ||
} | ||
else if (max && version.valueOf() > max.valueOf()) { | ||
console.log(`Credential offer version (${version.valueOf()}) is higher than maximum required version (${max.valueOf()})`); | ||
debug(`Credential offer version (${version.valueOf()}) is higher than maximum required version (${max.valueOf()})`); | ||
return false; | ||
@@ -86,0 +91,0 @@ } |
@@ -59,3 +59,3 @@ "use strict"; | ||
}; | ||
console.log(`START fetching url: ${url}`); | ||
debug(`START fetching url: ${url}`); | ||
if (body) { | ||
@@ -70,3 +70,3 @@ debug(`Body:\r\n${JSON.stringify(body)}`); | ||
const responseBody = isJSONResponse && responseText.includes('{') ? JSON.parse(responseText) : responseText; | ||
console.log(`${success ? 'success' : 'error'} status: ${origResponse.status}, body:\r\n${JSON.stringify(responseBody)}`); | ||
debug(`${success ? 'success' : 'error'} status: ${origResponse.status}, body:\r\n${JSON.stringify(responseBody)}`); | ||
if (!success && (opts === null || opts === void 0 ? void 0 : opts.exceptionOnHttpErrorStatus)) { | ||
@@ -73,0 +73,0 @@ const error = JSON.stringify(responseBody); |
@@ -1,2 +0,2 @@ | ||
import { CredentialIssuerMetadata, CredentialOfferFormat, CredentialSupported, CredentialSupportedTypeV1_0_08, CredentialSupportedV1_0_08, IssuerMetadataV1_0_08, OpenId4VCIVersion } from '../types'; | ||
import { CredentialIssuerMetadata, CredentialOfferFormat, CredentialSupported, CredentialSupportedTypeV1_0_08, CredentialSupportedV1_0_08, IssuerMetadataV1_0_08, MetadataDisplay, OpenId4VCIVersion } from '../types'; | ||
export declare function getSupportedCredentials(opts?: { | ||
@@ -10,2 +10,5 @@ issuerMetadata?: CredentialIssuerMetadata | IssuerMetadataV1_0_08; | ||
export declare function credentialSupportedV8ToV11(key: string, supportedV8: CredentialSupportedV1_0_08): CredentialSupported[]; | ||
export declare function getIssuerDisplays(metadata: CredentialIssuerMetadata | IssuerMetadataV1_0_08, opts?: { | ||
prefLocales: string[]; | ||
}): MetadataDisplay[]; | ||
//# sourceMappingURL=IssuerMetadataUtils.d.ts.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.credentialSupportedV8ToV11 = exports.credentialsSupportedV8ToV11 = exports.getSupportedCredentials = void 0; | ||
exports.getIssuerDisplays = exports.credentialSupportedV8ToV11 = exports.credentialsSupportedV8ToV11 = exports.getSupportedCredentials = void 0; | ||
const types_1 = require("../types"); | ||
@@ -89,2 +89,8 @@ function getSupportedCredentials(opts) { | ||
exports.credentialSupportedV8ToV11 = credentialSupportedV8ToV11; | ||
function getIssuerDisplays(metadata, opts) { | ||
var _a, _b; | ||
const matchedDisplays = (_b = (_a = metadata.display) === null || _a === void 0 ? void 0 : _a.filter((item) => !(opts === null || opts === void 0 ? void 0 : opts.prefLocales) || opts.prefLocales.length === 0 || (item.locale && opts.prefLocales.includes(item.locale)) || !item.locale)) !== null && _b !== void 0 ? _b : []; | ||
return matchedDisplays.sort((item) => { var _a; return (item.locale ? (_a = opts === null || opts === void 0 ? void 0 : opts.prefLocales.indexOf(item.locale)) !== null && _a !== void 0 ? _a : 1 : Number.MAX_VALUE); }); | ||
} | ||
exports.getIssuerDisplays = getIssuerDisplays; | ||
//# sourceMappingURL=IssuerMetadataUtils.js.map |
@@ -92,5 +92,5 @@ import { W3CVerifiableCredential } from '@sphereon/ssi-types'; | ||
} | ||
export interface ProofOfPossessionCallbacks { | ||
export interface ProofOfPossessionCallbacks<DIDDoc> { | ||
signCallback: JWTSignerCallback; | ||
verifyCallback?: JWTVerifyCallback; | ||
verifyCallback?: JWTVerifyCallback<DIDDoc>; | ||
} | ||
@@ -128,3 +128,3 @@ export declare enum Alg { | ||
iss?: string; | ||
aud?: string; | ||
aud?: string | string[]; | ||
iat?: number; | ||
@@ -137,6 +137,15 @@ nonce?: string; | ||
export type JWTSignerCallback = (jwt: Jwt, kid?: string) => Promise<string>; | ||
export type JWTVerifyCallback = (args: { | ||
export type JWTVerifyCallback<DIDDoc> = (args: { | ||
jwt: string; | ||
kid?: string; | ||
}) => Promise<Jwt>; | ||
}) => Promise<JwtVerifyResult<DIDDoc>>; | ||
export interface JwtVerifyResult<DIDDoc> { | ||
jwt: Jwt; | ||
kid?: string; | ||
alg: string; | ||
did?: string; | ||
didDocument?: DIDDoc; | ||
x5c?: string; | ||
jwk?: BaseJWK; | ||
} | ||
//# sourceMappingURL=CredentialIssuance.types.d.ts.map |
import { ICredentialContextType, IVerifiableCredential, W3CVerifiableCredential } from '@sphereon/ssi-types'; | ||
import { ProofOfPossession } from './CredentialIssuance.types'; | ||
import { Oauth2ASWithOID4VCIMetadata } from './OpenID4VCIServerMetadata'; | ||
import { CredentialOfferSession } from './StateManager.types'; | ||
import { IssuerMetadataV1_0_08 } from './v1_0_08.types'; | ||
@@ -9,3 +10,3 @@ import { CredentialRequestV1_0_11 } from './v1_0_11.types'; | ||
*/ | ||
export interface CredentialLogo { | ||
export interface ImageInfo { | ||
url?: string; | ||
@@ -22,3 +23,3 @@ alt_text?: string; | ||
export interface LogoAndColor { | ||
logo?: CredentialLogo; | ||
logo?: ImageInfo; | ||
description?: string; | ||
@@ -30,2 +31,3 @@ background_color?: string; | ||
name: string; | ||
background_image?: ImageInfo; | ||
}; | ||
@@ -74,2 +76,13 @@ export type MetadataDisplay = NameAndLocale & LogoAndColor & { | ||
} | ||
/** | ||
* 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 | ||
*/ | ||
export type CredentialDataSupplierInput = any; | ||
export type CreateCredentialOfferURIResult = { | ||
uri: string; | ||
session: CredentialOfferSession; | ||
userPin?: string; | ||
userPinLength?: number; | ||
userPinRequired: boolean; | ||
}; | ||
export interface IssuerCredentialDefinition { | ||
@@ -76,0 +89,0 @@ '@context': ICredentialContextType[]; |
@@ -9,2 +9,4 @@ export declare const BAD_PARAMS = "Wrong parameters provided"; | ||
export declare const KID_JWK_X5C_ERROR = "Only one must be present: kid, jwk or x5c"; | ||
export declare const KID_DID_NO_DID_ERROR = "A DID value needs to be returned when kid is present"; | ||
export declare const DID_NO_DIDDOC_ERROR = "A DID Document needs to be resolved when a DID is encountered"; | ||
export declare const AUD_ERROR = "aud must be the URL of the credential issuer"; | ||
@@ -11,0 +13,0 @@ export declare const IAT_ERROR = "iat must be the time at which the proof was issued"; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ACCESS_TOKEN_ISSUER_REQUIRED_ERROR = exports.PIN_NOT_MATCHING_ERROR = exports.NONCE_STATE_MANAGER_REQUIRED_ERROR = exports.STATE_MANAGER_REQUIRED_ERROR = exports.JWT_SIGNER_CALLBACK_REQUIRED_ERROR = exports.EXPIRED_PRE_AUTHORIZED_CODE = exports.INVALID_PRE_AUTHORIZED_CODE = exports.PIN_NOT_MATCH_ERROR = exports.PIN_VALIDATION_ERROR = exports.USER_PIN_NOT_REQUIRED_ERROR = exports.USER_PIN_REQUIRED_ERROR = exports.PRE_AUTHORIZED_CODE_REQUIRED_ERROR = exports.UNSUPPORTED_GRANT_TYPE_ERROR = exports.CREDENTIAL_MISSING_ERROR = exports.STATE_MISSING_ERROR = exports.GRANTS_MUST_NOT_BE_UNDEFINED = exports.ISS_MUST_BE_CLIENT_ID = exports.ISS_PRESENT_IN_PRE_AUTHORIZED_CODE_CONTEXT = exports.NO_ISS_IN_AUTHORIZATION_CODE_CONTEXT = exports.UNKNOWN_CLIENT_ERROR = exports.ISSUER_CONFIG_ERROR = exports.JWT_VERIFY_CONFIG_ERROR = exports.NONCE_ERROR = exports.IAT_ERROR = exports.AUD_ERROR = exports.KID_JWK_X5C_ERROR = exports.ALG_ERROR = exports.TYP_ERROR = exports.NO_JWT_PROVIDED = exports.PROOF_CANT_BE_CONSTRUCTED = exports.JWS_NOT_VALID = exports.URL_NOT_VALID = exports.BAD_PARAMS = void 0; | ||
exports.ACCESS_TOKEN_ISSUER_REQUIRED_ERROR = exports.PIN_NOT_MATCHING_ERROR = exports.NONCE_STATE_MANAGER_REQUIRED_ERROR = exports.STATE_MANAGER_REQUIRED_ERROR = exports.JWT_SIGNER_CALLBACK_REQUIRED_ERROR = exports.EXPIRED_PRE_AUTHORIZED_CODE = exports.INVALID_PRE_AUTHORIZED_CODE = exports.PIN_NOT_MATCH_ERROR = exports.PIN_VALIDATION_ERROR = exports.USER_PIN_NOT_REQUIRED_ERROR = exports.USER_PIN_REQUIRED_ERROR = exports.PRE_AUTHORIZED_CODE_REQUIRED_ERROR = exports.UNSUPPORTED_GRANT_TYPE_ERROR = exports.CREDENTIAL_MISSING_ERROR = exports.STATE_MISSING_ERROR = exports.GRANTS_MUST_NOT_BE_UNDEFINED = exports.ISS_MUST_BE_CLIENT_ID = exports.ISS_PRESENT_IN_PRE_AUTHORIZED_CODE_CONTEXT = exports.NO_ISS_IN_AUTHORIZATION_CODE_CONTEXT = exports.UNKNOWN_CLIENT_ERROR = exports.ISSUER_CONFIG_ERROR = exports.JWT_VERIFY_CONFIG_ERROR = exports.NONCE_ERROR = exports.IAT_ERROR = exports.AUD_ERROR = exports.DID_NO_DIDDOC_ERROR = exports.KID_DID_NO_DID_ERROR = exports.KID_JWK_X5C_ERROR = exports.ALG_ERROR = exports.TYP_ERROR = exports.NO_JWT_PROVIDED = exports.PROOF_CANT_BE_CONSTRUCTED = exports.JWS_NOT_VALID = exports.URL_NOT_VALID = exports.BAD_PARAMS = void 0; | ||
const CredentialIssuance_types_1 = require("./CredentialIssuance.types"); | ||
@@ -13,2 +13,4 @@ exports.BAD_PARAMS = 'Wrong parameters provided'; | ||
exports.KID_JWK_X5C_ERROR = 'Only one must be present: kid, jwk or x5c'; | ||
exports.KID_DID_NO_DID_ERROR = 'A DID value needs to be returned when kid is present'; | ||
exports.DID_NO_DIDDOC_ERROR = 'A DID Document needs to be resolved when a DID is encountered'; | ||
exports.AUD_ERROR = 'aud must be the URL of the credential issuer'; | ||
@@ -15,0 +17,0 @@ exports.IAT_ERROR = 'iat must be the time at which the proof was issued'; |
import { AssertedUniformCredentialOffer } from './CredentialIssuance.types'; | ||
import { CredentialDataSupplierInput } from './Generic.types'; | ||
export interface StateType { | ||
@@ -8,6 +9,19 @@ createdAt: number; | ||
credentialOffer: AssertedUniformCredentialOffer; | ||
credentialDataSupplierInput?: CredentialDataSupplierInput; | ||
userPin?: string; | ||
status: IssueStatus; | ||
error?: string; | ||
lastUpdatedAt: number; | ||
issuerState?: string; | ||
preAuthorizedCode?: string; | ||
} | ||
export declare enum IssueStatus { | ||
OFFER_CREATED = "OFFER_CREATED", | ||
OFFER_URI_RETRIEVED = "OFFER_URI_RETRIEVED", | ||
ACCESS_TOKEN_REQUESTED = "ACCESS_TOKEN_CREATED", | ||
ACCESS_TOKEN_CREATED = "ACCESS_TOKEN_CREATED", | ||
CREDENTIAL_REQUEST_RECEIVED = "CREDENTIAL_REQUEST_RECEIVED", | ||
CREDENTIAL_ISSUED = "CREDENTIAL_ISSUED", | ||
ERROR = "ERROR" | ||
} | ||
export interface CNonceState extends StateType { | ||
@@ -23,2 +37,9 @@ cNonce: string; | ||
} | ||
export interface IssueStatusResponse { | ||
createdAt: number; | ||
lastUpdatedAt: number; | ||
status: IssueStatus; | ||
error?: string; | ||
clientId?: string; | ||
} | ||
export interface IStateManager<T extends StateType> { | ||
@@ -25,0 +46,0 @@ set(id: string, stateValue: T): Promise<void>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.IssueStatus = void 0; | ||
var IssueStatus; | ||
(function (IssueStatus) { | ||
IssueStatus["OFFER_CREATED"] = "OFFER_CREATED"; | ||
IssueStatus["OFFER_URI_RETRIEVED"] = "OFFER_URI_RETRIEVED"; | ||
IssueStatus["ACCESS_TOKEN_REQUESTED"] = "ACCESS_TOKEN_CREATED"; | ||
IssueStatus["ACCESS_TOKEN_CREATED"] = "ACCESS_TOKEN_CREATED"; | ||
IssueStatus["CREDENTIAL_REQUEST_RECEIVED"] = "CREDENTIAL_REQUEST_RECEIVED"; | ||
IssueStatus["CREDENTIAL_ISSUED"] = "CREDENTIAL_ISSUED"; | ||
IssueStatus["ERROR"] = "ERROR"; | ||
})(IssueStatus = exports.IssueStatus || (exports.IssueStatus = {})); | ||
//# sourceMappingURL=StateManager.types.js.map |
import { AuthorizationDetailsJwtVcJson, CommonAuthorizationRequest } from './Authorization.types'; | ||
import { CommonCredentialRequest, CredentialOfferFormat, CredentialRequestJwtVcJson, CredentialRequestJwtVcJsonLdAndLdpVc, Grant, IssuerCredentialDefinition } from './Generic.types'; | ||
import { CommonCredentialRequest, CredentialDataSupplierInput, CredentialOfferFormat, CredentialRequestJwtVcJson, CredentialRequestJwtVcJsonLdAndLdpVc, Grant, IssuerCredentialDefinition } from './Generic.types'; | ||
export interface CredentialOfferV1_0_11 { | ||
@@ -7,2 +7,8 @@ credential_offer?: CredentialOfferPayloadV1_0_11; | ||
} | ||
export interface CredentialOfferRESTRequest extends CredentialOfferV1_0_11 { | ||
baseUri?: string; | ||
scheme?: string; | ||
pinLength?: number; | ||
credentialDataSupplierInput?: CredentialDataSupplierInput; | ||
} | ||
export interface CommonCredentialOfferPayloadV1_0_11 { | ||
@@ -9,0 +15,0 @@ /** |
@@ -0,1 +1,3 @@ | ||
import Debug from 'debug'; | ||
import { | ||
@@ -21,2 +23,4 @@ AssertedUniformCredentialOffer, | ||
const debug = Debug('sphereon:oid4vci:offer'); | ||
export function determineSpecVersionFromURI(uri: string): OpenId4VCIVersion { | ||
@@ -85,6 +89,6 @@ let version: OpenId4VCIVersion = OpenId4VCIVersion.VER_UNKNOWN; | ||
if (version.valueOf() < min.valueOf()) { | ||
console.log(`Credential offer version (${version.valueOf()}) is lower than minimum required version (${min.valueOf()})`); | ||
debug(`Credential offer version (${version.valueOf()}) is lower than minimum required version (${min.valueOf()})`); | ||
return false; | ||
} else if (max && version.valueOf() > max.valueOf()) { | ||
console.log(`Credential offer version (${version.valueOf()}) is higher than maximum required version (${max.valueOf()})`); | ||
debug(`Credential offer version (${version.valueOf()}) is higher than maximum required version (${max.valueOf()})`); | ||
return false; | ||
@@ -91,0 +95,0 @@ } |
@@ -70,3 +70,3 @@ import { fetch } from 'cross-fetch'; | ||
console.log(`START fetching url: ${url}`); | ||
debug(`START fetching url: ${url}`); | ||
if (body) { | ||
@@ -82,3 +82,3 @@ debug(`Body:\r\n${JSON.stringify(body)}`); | ||
console.log(`${success ? 'success' : 'error'} status: ${origResponse.status}, body:\r\n${JSON.stringify(responseBody)}`); | ||
debug(`${success ? 'success' : 'error'} status: ${origResponse.status}, body:\r\n${JSON.stringify(responseBody)}`); | ||
if (!success && opts?.exceptionOnHttpErrorStatus) { | ||
@@ -85,0 +85,0 @@ const error = JSON.stringify(responseBody); |
@@ -8,2 +8,3 @@ import { | ||
IssuerMetadataV1_0_08, | ||
MetadataDisplay, | ||
OpenId4VCIVersion, | ||
@@ -103,1 +104,9 @@ } from '../types'; | ||
} | ||
export function getIssuerDisplays(metadata: CredentialIssuerMetadata | IssuerMetadataV1_0_08, opts?: { prefLocales: string[] }): MetadataDisplay[] { | ||
const matchedDisplays = | ||
metadata.display?.filter( | ||
(item) => !opts?.prefLocales || opts.prefLocales.length === 0 || (item.locale && opts.prefLocales.includes(item.locale)) || !item.locale | ||
) ?? []; | ||
return matchedDisplays.sort((item) => (item.locale ? opts?.prefLocales.indexOf(item.locale) ?? 1 : Number.MAX_VALUE)); | ||
} |
@@ -111,5 +111,5 @@ import { W3CVerifiableCredential } from '@sphereon/ssi-types'; | ||
export interface ProofOfPossessionCallbacks { | ||
export interface ProofOfPossessionCallbacks<DIDDoc> { | ||
signCallback: JWTSignerCallback; | ||
verifyCallback?: JWTVerifyCallback; | ||
verifyCallback?: JWTVerifyCallback<DIDDoc>; | ||
} | ||
@@ -159,3 +159,3 @@ | ||
iss?: string; // REQUIRED (string). The value of this claim MUST be the client_id of the client making the credential request. | ||
aud?: string; // REQUIRED (string). The value of this claim MUST be the issuer URL of credential issuer. | ||
aud?: string | string[]; // REQUIRED (string). The value of this claim MUST be the issuer URL of credential issuer. | ||
iat?: number; // REQUIRED (number). The value of this claim MUST be the time at which the proof was issued using the syntax defined in [RFC7519]. | ||
@@ -169,2 +169,11 @@ nonce?: string; // REQUIRED (string). The value type of this claim MUST be a string, where the value is a c_nonce provided by the credential issuer. //TODO: Marked as required not present in NGI flow | ||
export type JWTSignerCallback = (jwt: Jwt, kid?: string) => Promise<string>; | ||
export type JWTVerifyCallback = (args: { jwt: string; kid?: string }) => Promise<Jwt>; | ||
export type JWTVerifyCallback<DIDDoc> = (args: { jwt: string; kid?: string }) => Promise<JwtVerifyResult<DIDDoc>>; | ||
export interface JwtVerifyResult<DIDDoc> { | ||
jwt: Jwt; | ||
kid?: string; | ||
alg: string; | ||
did?: string; | ||
didDocument?: DIDDoc; | ||
x5c?: string; | ||
jwk?: BaseJWK; | ||
} |
@@ -5,2 +5,3 @@ import { ICredentialContextType, IVerifiableCredential, W3CVerifiableCredential } from '@sphereon/ssi-types'; | ||
import { Oauth2ASWithOID4VCIMetadata } from './OpenID4VCIServerMetadata'; | ||
import { CredentialOfferSession } from './StateManager.types'; | ||
import { IssuerMetadataV1_0_08 } from './v1_0_08.types'; | ||
@@ -12,3 +13,3 @@ import { CredentialRequestV1_0_11 } from './v1_0_11.types'; | ||
*/ | ||
export interface CredentialLogo { | ||
export interface ImageInfo { | ||
url?: string; | ||
@@ -29,3 +30,3 @@ alt_text?: string; | ||
export interface LogoAndColor { | ||
logo?: CredentialLogo; // OPTIONAL. A JSON object with information about the logo of the Credential with a following non-exhaustive list of parameters that MAY be included: | ||
logo?: ImageInfo; // OPTIONAL. A JSON object with information about the logo of the Credential with a following non-exhaustive list of parameters that MAY be included: | ||
description?: string; // OPTIONAL. String value of a description of the Credential. | ||
@@ -39,2 +40,3 @@ background_color?: string; //OPTIONAL. String value of a background color of the Credential represented as numerical color values defined in CSS Color Module Level 37 [CSS-Color]. | ||
name: string; // REQUIRED. String value of a display name for the Credential. | ||
background_image?: ImageInfo; //OPTIONAL, NON-SPEC compliant!. URL of a background image useful for card views of credentials. Expected to an image that fills the full card-view of a wallet | ||
}; | ||
@@ -60,8 +62,2 @@ | ||
credential_endpoint: string; // REQUIRED. URL of the Credential Issuer's Credential Endpoint. This URL MUST use the https scheme and MAY contain port, path and query parameter components. | ||
/*batch_credential_endpoint?: string; // OPTIONAL. URL of the Credential Issuer's Batch Credential Endpoint. This URL MUST use the https scheme and MAY contain port, path and query parameter components. If omitted, the Credential Issuer does not support the Batch Credential Endpoint. | ||
credentials_supported: CredentialSupported[]; // REQUIRED. A JSON array containing a list of JSON objects, each of them representing metadata about a separate credential type that the Credential Issuer can issue. The JSON objects in the array MUST conform to the structure of the Section 10.2.3.1. | ||
credential_issuer: string; // REQUIRED. The Credential Issuer's identifier. | ||
authorization_server?: string; // OPTIONAL. Identifier of the OAuth 2.0 Authorization Server (as defined in [RFC8414]) the Credential Issuer relies on for authorization. If this element is omitted, the entity providing the Credential Issuer is also acting as the AS, i.e. the Credential Issuer's identifier is used as the OAuth 2.0 Issuer value to obtain the Authorization Server metadata as per [RFC8414]. | ||
token_endpoint?: string; | ||
display?: MetadataDisplay[]; // An array of objects, where each object contains display properties of a Credential Issuer for a certain language. Below is a non-exhaustive list of valid parameters that MAY be included:*/ | ||
} | ||
@@ -102,2 +98,15 @@ | ||
/** | ||
* 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 | ||
*/ | ||
export type CredentialDataSupplierInput = any; | ||
export type CreateCredentialOfferURIResult = { | ||
uri: string; | ||
session: CredentialOfferSession; | ||
userPin?: string; | ||
userPinLength?: number; | ||
userPinRequired: boolean; | ||
}; | ||
export interface IssuerCredentialDefinition { | ||
@@ -109,39 +118,2 @@ '@context': ICredentialContextType[]; | ||
/* | ||
export interface CredentialOfferCredentialDefinition { | ||
'@context': ICredentialContextType[]; | ||
types: string[]; | ||
credentialSubject?: IssuerCredentialSubject; | ||
order?: string[]; // An array of claims.display.name values that lists them in the order they should be displayed by the Wallet. | ||
} | ||
*/ | ||
// export type GrantType = GrantTypes; | ||
/* | ||
export interface CommonAccessTokenRequest { | ||
client_id?: string; | ||
code?: string; | ||
code_verifier?: string; | ||
grant_type: GrantType; | ||
'pre-authorized_code'?: string; | ||
redirect_uri?: string; | ||
scope?: string; | ||
user_pin?: string; | ||
} | ||
*/ | ||
/* | ||
export interface CommonAccessTokenResponse { | ||
access_token: string; | ||
scope?: string; | ||
token_type?: string; | ||
expires_in?: number; // in seconds | ||
c_nonce?: string; | ||
c_nonce_expires_in?: number; // in seconds | ||
authorization_pending?: boolean; | ||
interval?: number; // in seconds | ||
} | ||
*/ | ||
export interface ErrorResponse extends Response { | ||
@@ -188,2 +160,3 @@ error: string; | ||
} | ||
// export type CredentialSubjectDisplay = NameAndLocale[]; | ||
@@ -190,0 +163,0 @@ |
@@ -11,2 +11,4 @@ import { Alg } from './CredentialIssuance.types'; | ||
export const KID_JWK_X5C_ERROR = 'Only one must be present: kid, jwk or x5c'; | ||
export const KID_DID_NO_DID_ERROR = 'A DID value needs to be returned when kid is present'; | ||
export const DID_NO_DIDDOC_ERROR = 'A DID Document needs to be resolved when a DID is encountered'; | ||
export const AUD_ERROR = 'aud must be the URL of the credential issuer'; | ||
@@ -13,0 +15,0 @@ export const IAT_ERROR = 'iat must be the time at which the proof was issued'; |
import { AssertedUniformCredentialOffer } from './CredentialIssuance.types'; | ||
import { CredentialDataSupplierInput } from './Generic.types'; | ||
@@ -10,3 +11,7 @@ export interface StateType { | ||
credentialOffer: AssertedUniformCredentialOffer; | ||
credentialDataSupplierInput?: CredentialDataSupplierInput; // 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 | ||
userPin?: string; | ||
status: IssueStatus; | ||
error?: string; | ||
lastUpdatedAt: number; | ||
issuerState?: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value | ||
@@ -16,2 +21,12 @@ preAuthorizedCode?: string; //todo: Probably good to hash it here, since it would come in from the client and we could match the hash and thus use the client value | ||
export enum IssueStatus { | ||
OFFER_CREATED = 'OFFER_CREATED', | ||
OFFER_URI_RETRIEVED = 'OFFER_URI_RETRIEVED', // This state is optional. as an offer uri is optional | ||
ACCESS_TOKEN_REQUESTED = 'ACCESS_TOKEN_CREATED', // Optional state, given the token endpoint could also be on a separate AS | ||
ACCESS_TOKEN_CREATED = 'ACCESS_TOKEN_CREATED', // Optional state, given the token endpoint could also be on a separate AS | ||
CREDENTIAL_REQUEST_RECEIVED = 'CREDENTIAL_REQUEST_RECEIVED', // Credential request received. Next state would either be error or issued | ||
CREDENTIAL_ISSUED = 'CREDENTIAL_ISSUED', | ||
ERROR = 'ERROR', | ||
} | ||
export interface CNonceState extends StateType { | ||
@@ -29,2 +44,10 @@ cNonce: string; | ||
export interface IssueStatusResponse { | ||
createdAt: number; | ||
lastUpdatedAt: number; | ||
status: IssueStatus; | ||
error?: string; | ||
clientId?: string; | ||
} | ||
export interface IStateManager<T extends StateType> { | ||
@@ -31,0 +54,0 @@ set(id: string, stateValue: T): Promise<void>; |
import { AuthorizationDetailsJwtVcJson, CommonAuthorizationRequest } from './Authorization.types'; | ||
import { | ||
CommonCredentialRequest, | ||
CredentialDataSupplierInput, | ||
CredentialOfferFormat, | ||
@@ -16,2 +17,9 @@ CredentialRequestJwtVcJson, | ||
export interface CredentialOfferRESTRequest extends CredentialOfferV1_0_11 { | ||
baseUri?: string; | ||
scheme?: string; | ||
pinLength?: number; | ||
credentialDataSupplierInput?: CredentialDataSupplierInput; | ||
} | ||
export interface CommonCredentialOfferPayloadV1_0_11 { | ||
@@ -18,0 +26,0 @@ /** |
{ | ||
"name": "@sphereon/oid4vci-common", | ||
"version": "0.4.1-next.285+47fec82", | ||
"version": "0.4.1-next.306+21ce927", | ||
"description": "OpenID 4 Verifiable Credential Issuance Common Types", | ||
@@ -12,3 +12,3 @@ "source": "lib/index.ts", | ||
"dependencies": { | ||
"@sphereon/ssi-types": "^0.9.0", | ||
"@sphereon/ssi-types": "^0.11.0", | ||
"cross-fetch": "^3.1.6", | ||
@@ -49,3 +49,3 @@ "jwt-decode": "^3.1.2" | ||
}, | ||
"gitHead": "47fec82924b0d4a32f25737d7ba7379903fdb4f0" | ||
"gitHead": "21ce927a20bf749310732819de7a22a1226b28a4" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
238203
3536
74
311
+ Added@sphereon/ssi-types@0.11.0(transitive)
- Removed@sphereon/ssi-types@0.9.0(transitive)
Updated@sphereon/ssi-types@^0.11.0