Skip to content

Commit

Permalink
feat: added DynamicRegistrationClientMetadata type and extended exist…
Browse files Browse the repository at this point in the history
…ing metadata for issuer and rp
  • Loading branch information
Brummos committed Oct 16, 2024
1 parent f4f0362 commit 97b8779
Show file tree
Hide file tree
Showing 9 changed files with 418 additions and 146 deletions.
1 change: 1 addition & 0 deletions packages/common/lib/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export const VCI_LOG_COMMON = VCI_LOGGERS.get('sphereon:oid4vci:common');

export * from './jwt';
export * from './dpop';
export * from './oauth';

export { v4 as uuidv4 } from 'uuid';
export { defaultHasher } from './hasher';
4 changes: 4 additions & 0 deletions packages/common/lib/jwt/Jwk.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,7 @@ export interface JWK extends BaseJWK {

[propName: string]: unknown;
}

export type JWKS = {
keys: JWK[]
}
20 changes: 20 additions & 0 deletions packages/common/lib/oauth/DynamicClientRegistration.types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { JWKS } from '../jwt'

// https://www.rfc-editor.org/rfc/rfc7591.html#section-2
export interface DynamicRegistrationClientMetadata {
redirect_uris?: string[]
token_endpoint_auth_method?: string
grant_types?: string
response_types?: string
client_name?: string
client_uri?: string
logo_uri?: string
scope?: string
contacts?: string[]
tos_uri?: string
policy_uri?: string
jwks_uri?: string
jwks?: JWKS
software_id?: string
software_version?: string
}
1 change: 1 addition & 0 deletions packages/common/lib/oauth/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './DynamicClientRegistration.types';
5 changes: 2 additions & 3 deletions packages/oid4vci-common/lib/types/ServerMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
import { SigningAlgo } from '@sphereon/oid4vc-common';
import { DynamicRegistrationClientMetadata, SigningAlgo } from '@sphereon/oid4vc-common';

export interface AuthorizationServerMetadata {
export interface AuthorizationServerMetadata extends DynamicRegistrationClientMetadata {
issuer: string;
authorization_endpoint?: string;
token_endpoint?: string;
token_endpoint_auth_methods_supported?: string[];
token_endpoint_auth_signing_alg_values_supported?: string[];

jwks_uri?: string;
registration_endpoint?: string;
scopes_supported?: string[];
response_types_supported: string[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ export const createDiscoveryMetadataPayload = (opts: DiscoveryMetadataOpts): Dis
client_id: opts.client_id,
redirect_uris: opts.redirectUris,
client_name: opts.clientName,
client_uri: opts.clientUri,
scope: opts.scope,
contacts: opts.contacts,
tos_uri: opts.tosUri,
policy_uri: opts.policyUri,
jwks: opts.jwks,
software_id: opts.softwareId,
software_version: opts.softwareVersion,
token_endpoint_auth_method: opts.tokenEndpointAuthMethod,
application_type: opts.applicationType,
response_types: opts.responseTypes,
Expand Down
261 changes: 165 additions & 96 deletions packages/siop-oid4vp/lib/schemas/AuthorizationResponseOpts.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -450,6 +450,33 @@ export const AuthorizationResponseOptsSchemaObj = {
"clientName": {
"type": "string"
},
"clientUri": {
"type": "string"
},
"scope": {
"type": "string"
},
"contacts": {
"type": "array",
"items": {
"type": "string"
}
},
"tosUri": {
"type": "string"
},
"policyUri": {
"type": "string"
},
"jwks": {
"$ref": "#/definitions/JWKS"
},
"softwareId": {
"type": "string"
},
"softwareVersion": {
"type": "string"
},
"tokenEndpointAuthMethod": {
"type": "string"
},
Expand Down Expand Up @@ -858,6 +885,33 @@ export const AuthorizationResponseOptsSchemaObj = {
"clientName": {
"type": "string"
},
"clientUri": {
"type": "string"
},
"scope": {
"type": "string"
},
"contacts": {
"type": "array",
"items": {
"type": "string"
}
},
"tosUri": {
"type": "string"
},
"policyUri": {
"type": "string"
},
"jwks": {
"$ref": "#/definitions/JWKS"
},
"softwareId": {
"type": "string"
},
"softwareVersion": {
"type": "string"
},
"tokenEndpointAuthMethod": {
"type": "string"
},
Expand Down Expand Up @@ -1395,6 +1449,117 @@ export const AuthorizationResponseOptsSchemaObj = {
"distributed"
]
},
"JWKS": {
"type": "object",
"properties": {
"keys": {
"type": "array",
"items": {
"$ref": "#/definitions/JWK"
}
}
},
"required": [
"keys"
],
"additionalProperties": false
},
"JWK": {
"type": "object",
"properties": {
"kty": {
"type": "string"
},
"crv": {
"type": "string"
},
"x": {
"type": "string"
},
"y": {
"type": "string"
},
"e": {
"type": "string"
},
"n": {
"type": "string"
},
"alg": {
"type": "string"
},
"d": {
"type": "string"
},
"dp": {
"type": "string"
},
"dq": {
"type": "string"
},
"ext": {
"type": "boolean"
},
"k": {
"type": "string"
},
"key_ops": {
"type": "array",
"items": {
"type": "string"
}
},
"kid": {
"type": "string"
},
"oth": {
"type": "array",
"items": {
"type": "object",
"properties": {
"d": {
"type": "string"
},
"r": {
"type": "string"
},
"t": {
"type": "string"
}
},
"additionalProperties": false
}
},
"p": {
"type": "string"
},
"q": {
"type": "string"
},
"qi": {
"type": "string"
},
"use": {
"type": "string"
},
"x5c": {
"type": "array",
"items": {
"type": "string"
}
},
"x5t": {
"type": "string"
},
"x5t#S256": {
"type": "string"
},
"x5u": {
"type": "string"
}
},
"additionalProperties": {}
},
"Format": {
"type": "object",
"properties": {
Expand Down Expand Up @@ -1677,102 +1842,6 @@ export const AuthorizationResponseOptsSchemaObj = {
],
"additionalProperties": false
},
"JWK": {
"type": "object",
"properties": {
"kty": {
"type": "string"
},
"crv": {
"type": "string"
},
"x": {
"type": "string"
},
"y": {
"type": "string"
},
"e": {
"type": "string"
},
"n": {
"type": "string"
},
"alg": {
"type": "string"
},
"d": {
"type": "string"
},
"dp": {
"type": "string"
},
"dq": {
"type": "string"
},
"ext": {
"type": "boolean"
},
"k": {
"type": "string"
},
"key_ops": {
"type": "array",
"items": {
"type": "string"
}
},
"kid": {
"type": "string"
},
"oth": {
"type": "array",
"items": {
"type": "object",
"properties": {
"d": {
"type": "string"
},
"r": {
"type": "string"
},
"t": {
"type": "string"
}
},
"additionalProperties": false
}
},
"p": {
"type": "string"
},
"q": {
"type": "string"
},
"qi": {
"type": "string"
},
"use": {
"type": "string"
},
"x5c": {
"type": "array",
"items": {
"type": "string"
}
},
"x5t": {
"type": "string"
},
"x5t#S256": {
"type": "string"
},
"x5u": {
"type": "string"
}
},
"additionalProperties": {}
},
"JwtIssuerCustom": {
"type": "object",
"properties": {
Expand Down
Loading

0 comments on commit 97b8779

Please sign in to comment.