@powerhousedao/renown-package 0.0.7 → 0.0.30

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.
@@ -26,13 +26,6 @@ export const documentModel = {
26
26
  name: "MissingContextError",
27
27
  template: "",
28
28
  },
29
- {
30
- code: "",
31
- description: "",
32
- id: "invalid-jwt-payload-error",
33
- name: "",
34
- template: "",
35
- },
36
29
  {
37
30
  code: "INVALID_JWT_PAYLOAD",
38
31
  description: "JWT payload does not contain valid W3C Verifiable Credential fields",
@@ -40,13 +33,6 @@ export const documentModel = {
40
33
  name: "InvalidJwtPayloadError",
41
34
  template: "",
42
35
  },
43
- {
44
- code: "",
45
- description: "",
46
- id: "jwt-verification-error",
47
- name: "",
48
- template: "",
49
- },
50
36
  {
51
37
  code: "JWT_VERIFICATION_FAILED",
52
38
  description: "Failed to verify the JWT signature or the JWT is malformed",
@@ -72,7 +58,7 @@ export const documentModel = {
72
58
  examples: [],
73
59
  id: "366dfd44-377f-42d7-949d-a8d82b6a909d",
74
60
  name: "INIT",
75
- reducer: '// Validate context\nconst context = action.input.context && action.input.context.length > 0 \n ? action.input.context \n : ["https://www.w3.org/2018/credentials/v1"];\n\nif (!context.includes("https://www.w3.org/2018/credentials/v1")) {\n throw new MissingContextError("Context must include https://www.w3.org/2018/credentials/v1");\n}\n\n// Validate type\nconst type = action.input.type && action.input.type.length > 0\n ? action.input.type\n : ["VerifiableCredential"];\n\nif (!type.includes("VerifiableCredential")) {\n throw new MissingTypeError("Type must include VerifiableCredential");\n}\n\n// Validate credentialSubject is valid JSON\ntry {\n JSON.parse(action.input.credentialSubject);\n} catch (e) {\n throw new InvalidClaimsError("Credential subject must be valid JSON");\n}\n\nstate.context = context;\nstate.id = action.input.id || null;\nstate.type = type;\nstate.issuer = action.input.issuer;\nstate.issuanceDate = action.input.issuanceDate;\nstate.credentialSubject = action.input.credentialSubject;\nstate.expirationDate = action.input.expirationDate || null;\nstate.credentialStatus = null;\nstate.jwt = null;\nstate.revoked = false;\nstate.revokedAt = null;\nstate.revocationReason = null;',
61
+ reducer: "// NOTE: JWT should be cryptographically verified using verifyCredential()\n// from did-jwt-vc BEFORE dispatching this action. This reducer only decodes\n// and extracts the credential fields from the JWT payload.\n\n// Decode the JWT to extract payload\nlet decoded;\ntry {\n decoded = decodeJWT(action.input.jwt);\n} catch (e) {\n const error = e as Error;\n throw new JwtVerificationError(`Failed to decode JWT: ${error.message}`);\n}\n\nconst payload = decoded.payload as JwtPayload;\n\n// Validate minimum required JWT fields\nif (!payload.iss) {\n throw new InvalidJwtPayloadError('JWT payload missing issuer (iss field)');\n}\n\n// Extract the verifiable credential from the payload (if present)\nconst vc = payload.vc as VerifiableCredentialPayload | undefined;\n\nif (!vc) {\n throw new InvalidJwtPayloadError('JWT payload does not contain a verifiable credential (vc field)');\n}\n\n// Store the complete VC payload for maximum flexibility\nstate.vcPayload = JSON.stringify(vc);\n\n// Extract common W3C VC fields if present (but don't fail if missing)\n// Context\nif (vc['@context']) {\n const context = Array.isArray(vc['@context']) ? vc['@context'] : [vc['@context']];\n state.context = context;\n} else {\n state.context = null;\n}\n\n// Type\nif (vc.type) {\n const type = Array.isArray(vc.type) ? vc.type : [vc.type];\n state.type = type;\n} else {\n state.type = null;\n}\n\n// Credential Subject - store as JSON string for flexibility\nif (vc.credentialSubject !== undefined) {\n const credentialSubjectStr = typeof vc.credentialSubject === 'string'\n ? vc.credentialSubject\n : JSON.stringify(vc.credentialSubject);\n state.credentialSubject = credentialSubjectStr;\n} else {\n state.credentialSubject = null;\n}\n\n// Issuer (from JWT payload)\nstate.issuer = payload.iss;\n\n// Issuance date (JWT uses 'iat' or 'nbf')\nif (payload.nbf || payload.iat) {\n const issuanceTimestamp = (payload.nbf || payload.iat)!;\n state.issuanceDate = new Date(issuanceTimestamp * 1000).toISOString();\n} else {\n state.issuanceDate = null;\n}\n\n// Expiration date (from JWT exp or VC expirationDate)\nif (payload.exp) {\n state.expirationDate = new Date(payload.exp * 1000).toISOString();\n} else if (vc.expirationDate) {\n state.expirationDate = vc.expirationDate;\n} else {\n state.expirationDate = null;\n}\n\n// Credential ID (JWT uses 'jti', VC uses 'id')\nstate.id = payload.jti || vc.id || null;\n\n// Credential Status (optional W3C VC field)\nstate.credentialStatus = vc.credentialStatus || null;\n\n// Store JWT token\nstate.jwt = action.input.jwt;\nstate.jwtVerified = true;\n\n// Initialize revocation tracking\nstate.revoked = false;\nstate.revokedAt = null;\nstate.revocationReason = null;",
76
62
  schema: "input InitInput {\n jwt: String!\n}",
77
63
  scope: "global",
78
64
  template: "",
@@ -158,8 +144,8 @@ export const documentModel = {
158
144
  state: {
159
145
  global: {
160
146
  examples: [],
161
- initialValue: '"{\\n \\"vcPayload\\": null,\\n \\"context\\": null,\\n \\"id\\": null,\\n \\"type\\": null,\\n \\"issuer\\": null,\\n \\"issuanceDate\\": null,\\n \\"credentialSubject\\": null,\\n \\"expirationDate\\": null,\\n \\"credentialStatus\\": null,\\n \\"jwt\\": null,\\n \\"jwtVerified\\": false,\\n \\"jwtVerificationError\\": null,\\n \\"jwtPayload\\": null,\\n \\"revoked\\": false,\\n \\"revokedAt\\": null,\\n \\"revocationReason\\": null\\n}"',
162
- schema: 'type CredentialStatus {\n id: String!\n type: String!\n statusPurpose: String!\n statusListIndex: String!\n statusListCredential: String!\n}\n\ntype RenownCredentialState {\n "Complete VC Payload - stores the full verifiable credential object for maximum flexibility"\n vcPayload: String\n \n "W3C VC Common Fields - extracted for convenience, may be null for non-standard VCs"\n context: [String!]\n id: String\n type: [String!]\n issuer: String\n issuanceDate: DateTime\n credentialSubject: String\n \n "W3C VC Optional Fields"\n expirationDate: DateTime\n credentialStatus: CredentialStatus\n \n "JWT Representation"\n jwt: String\n jwtVerified: Boolean\n jwtVerificationError: String\n jwtPayload: String\n \n "Revocation tracking"\n revoked: Boolean\n revokedAt: DateTime\n revocationReason: String\n}',
147
+ initialValue: '"{\\n \\"vcPayload\\": null,\\n \\"context\\": null,\\n \\"id\\": null,\\n \\"type\\": null,\\n \\"issuer\\": null,\\n \\"issuanceDate\\": null,\\n \\"credentialSubject\\": null,\\n \\"expirationDate\\": null,\\n \\"credentialStatus\\": null,\\n \\"jwt\\": null,\\n \\"jwtVerified\\": false,\\n \\"revoked\\": false,\\n \\"revokedAt\\": null,\\n \\"revocationReason\\": null\\n}"',
148
+ schema: 'type CredentialStatus {\n id: String!\n type: String!\n statusPurpose: String!\n statusListIndex: String!\n statusListCredential: String!\n}\n\ntype RenownCredentialState {\n "JWT token containing the Verifiable Credential"\n jwt: String\n jwtVerified: Boolean\n\n "Complete VC Payload - extracted from JWT for convenience and flexibility"\n vcPayload: String\n\n "W3C VC Common Fields - extracted for querying convenience, may be null for non-standard VCs"\n context: [String!]\n id: String\n type: [String!]\n issuer: String\n issuanceDate: DateTime\n credentialSubject: String\n\n "W3C VC Optional Fields"\n expirationDate: DateTime\n credentialStatus: CredentialStatus\n\n "Revocation tracking"\n revoked: Boolean\n revokedAt: DateTime\n revocationReason: String\n}',
163
149
  },
164
150
  local: {
165
151
  examples: [],
@@ -1,4 +1,4 @@
1
- export type ErrorCode = 'MissingContextError' | 'MissingTypeError' | 'InvalidClaimsError' | 'JwtVerificationError' | 'InvalidJwtPayloadError' | 'AlreadyRevokedError' | 'CredentialRevokedError' | 'InvalidStatusPurposeError';
1
+ export type ErrorCode = "MissingContextError" | "InvalidJwtPayloadError" | "JwtVerificationError" | "InvalidClaimsError" | "MissingTypeError" | "AlreadyRevokedError" | "CredentialRevokedError" | "InvalidStatusPurposeError";
2
2
  export interface ReducerError {
3
3
  errorCode: ErrorCode;
4
4
  }
@@ -6,19 +6,19 @@ export declare class MissingContextError extends Error implements ReducerError {
6
6
  errorCode: ErrorCode;
7
7
  constructor(message?: string);
8
8
  }
9
- export declare class MissingTypeError extends Error implements ReducerError {
9
+ export declare class InvalidJwtPayloadError extends Error implements ReducerError {
10
10
  errorCode: ErrorCode;
11
11
  constructor(message?: string);
12
12
  }
13
- export declare class InvalidClaimsError extends Error implements ReducerError {
13
+ export declare class JwtVerificationError extends Error implements ReducerError {
14
14
  errorCode: ErrorCode;
15
15
  constructor(message?: string);
16
16
  }
17
- export declare class JwtVerificationError extends Error implements ReducerError {
17
+ export declare class InvalidClaimsError extends Error implements ReducerError {
18
18
  errorCode: ErrorCode;
19
19
  constructor(message?: string);
20
20
  }
21
- export declare class InvalidJwtPayloadError extends Error implements ReducerError {
21
+ export declare class MissingTypeError extends Error implements ReducerError {
22
22
  errorCode: ErrorCode;
23
23
  constructor(message?: string);
24
24
  }
@@ -37,10 +37,10 @@ export declare class InvalidStatusPurposeError extends Error implements ReducerE
37
37
  export declare const errors: {
38
38
  Init: {
39
39
  MissingContextError: typeof MissingContextError;
40
- MissingTypeError: typeof MissingTypeError;
41
- InvalidClaimsError: typeof InvalidClaimsError;
42
- JwtVerificationError: typeof JwtVerificationError;
43
40
  InvalidJwtPayloadError: typeof InvalidJwtPayloadError;
41
+ JwtVerificationError: typeof JwtVerificationError;
42
+ InvalidClaimsError: typeof InvalidClaimsError;
43
+ MissingTypeError: typeof MissingTypeError;
44
44
  };
45
45
  Revoke: {
46
46
  AlreadyRevokedError: typeof AlreadyRevokedError;
@@ -1,58 +1,58 @@
1
1
  export class MissingContextError extends Error {
2
- errorCode = 'MissingContextError';
3
- constructor(message = 'MissingContextError') {
2
+ errorCode = "MissingContextError";
3
+ constructor(message = "MissingContextError") {
4
4
  super(message);
5
5
  }
6
6
  }
7
- export class MissingTypeError extends Error {
8
- errorCode = 'MissingTypeError';
9
- constructor(message = 'MissingTypeError') {
7
+ export class InvalidJwtPayloadError extends Error {
8
+ errorCode = "InvalidJwtPayloadError";
9
+ constructor(message = "InvalidJwtPayloadError") {
10
10
  super(message);
11
11
  }
12
12
  }
13
- export class InvalidClaimsError extends Error {
14
- errorCode = 'InvalidClaimsError';
15
- constructor(message = 'InvalidClaimsError') {
13
+ export class JwtVerificationError extends Error {
14
+ errorCode = "JwtVerificationError";
15
+ constructor(message = "JwtVerificationError") {
16
16
  super(message);
17
17
  }
18
18
  }
19
- export class JwtVerificationError extends Error {
20
- errorCode = 'JwtVerificationError';
21
- constructor(message = 'JwtVerificationError') {
19
+ export class InvalidClaimsError extends Error {
20
+ errorCode = "InvalidClaimsError";
21
+ constructor(message = "InvalidClaimsError") {
22
22
  super(message);
23
23
  }
24
24
  }
25
- export class InvalidJwtPayloadError extends Error {
26
- errorCode = 'InvalidJwtPayloadError';
27
- constructor(message = 'InvalidJwtPayloadError') {
25
+ export class MissingTypeError extends Error {
26
+ errorCode = "MissingTypeError";
27
+ constructor(message = "MissingTypeError") {
28
28
  super(message);
29
29
  }
30
30
  }
31
31
  export class AlreadyRevokedError extends Error {
32
- errorCode = 'AlreadyRevokedError';
33
- constructor(message = 'AlreadyRevokedError') {
32
+ errorCode = "AlreadyRevokedError";
33
+ constructor(message = "AlreadyRevokedError") {
34
34
  super(message);
35
35
  }
36
36
  }
37
37
  export class CredentialRevokedError extends Error {
38
- errorCode = 'CredentialRevokedError';
39
- constructor(message = 'CredentialRevokedError') {
38
+ errorCode = "CredentialRevokedError";
39
+ constructor(message = "CredentialRevokedError") {
40
40
  super(message);
41
41
  }
42
42
  }
43
43
  export class InvalidStatusPurposeError extends Error {
44
- errorCode = 'InvalidStatusPurposeError';
45
- constructor(message = 'InvalidStatusPurposeError') {
44
+ errorCode = "InvalidStatusPurposeError";
45
+ constructor(message = "InvalidStatusPurposeError") {
46
46
  super(message);
47
47
  }
48
48
  }
49
49
  export const errors = {
50
50
  Init: {
51
51
  MissingContextError,
52
- MissingTypeError,
53
- InvalidClaimsError,
54
- JwtVerificationError,
55
52
  InvalidJwtPayloadError,
53
+ JwtVerificationError,
54
+ InvalidClaimsError,
55
+ MissingTypeError,
56
56
  },
57
57
  Revoke: {
58
58
  AlreadyRevokedError,
@@ -16,8 +16,6 @@ export function defaultGlobalState() {
16
16
  credentialStatus: null,
17
17
  jwt: null,
18
18
  jwtVerified: false,
19
- jwtVerificationError: null,
20
- jwtPayload: null,
21
19
  revoked: false,
22
20
  revokedAt: null,
23
21
  revocationReason: null,
@@ -145,7 +145,7 @@ export type InitInput = {
145
145
  jwt: Scalars["String"]["input"];
146
146
  };
147
147
  export type RenownCredentialState = {
148
- /** W3C VC Common Fields - extracted for convenience, may be null for non-standard VCs */
148
+ /** W3C VC Common Fields - extracted for querying convenience, may be null for non-standard VCs */
149
149
  context: Maybe<Array<Scalars["String"]["output"]>>;
150
150
  credentialStatus: Maybe<CredentialStatus>;
151
151
  credentialSubject: Maybe<Scalars["String"]["output"]>;
@@ -154,17 +154,15 @@ export type RenownCredentialState = {
154
154
  id: Maybe<Scalars["String"]["output"]>;
155
155
  issuanceDate: Maybe<Scalars["DateTime"]["output"]>;
156
156
  issuer: Maybe<Scalars["String"]["output"]>;
157
- /** JWT Representation */
157
+ /** JWT token containing the Verifiable Credential */
158
158
  jwt: Maybe<Scalars["String"]["output"]>;
159
- jwtPayload: Maybe<Scalars["String"]["output"]>;
160
- jwtVerificationError: Maybe<Scalars["String"]["output"]>;
161
159
  jwtVerified: Maybe<Scalars["Boolean"]["output"]>;
162
160
  revocationReason: Maybe<Scalars["String"]["output"]>;
163
161
  /** Revocation tracking */
164
162
  revoked: Maybe<Scalars["Boolean"]["output"]>;
165
163
  revokedAt: Maybe<Scalars["DateTime"]["output"]>;
166
164
  type: Maybe<Array<Scalars["String"]["output"]>>;
167
- /** Complete VC Payload - stores the full verifiable credential object for maximum flexibility */
165
+ /** Complete VC Payload - extracted from JWT for convenience and flexibility */
168
166
  vcPayload: Maybe<Scalars["String"]["output"]>;
169
167
  };
170
168
  export type RevokeInput = {
@@ -29,8 +29,6 @@ export function RenownCredentialStateSchema() {
29
29
  issuanceDate: z.string().datetime().nullable(),
30
30
  issuer: z.string().nullable(),
31
31
  jwt: z.string().nullable(),
32
- jwtPayload: z.string().nullable(),
33
- jwtVerificationError: z.string().nullable(),
34
32
  jwtVerified: z.boolean().nullable(),
35
33
  revocationReason: z.string().nullable(),
36
34
  revoked: z.boolean().nullable(),
@@ -12,8 +12,6 @@ export const initialGlobalState = {
12
12
  credentialStatus: null,
13
13
  jwt: null,
14
14
  jwtVerified: false,
15
- jwtVerificationError: null,
16
- jwtPayload: null,
17
15
  revoked: false,
18
16
  revokedAt: null,
19
17
  revocationReason: null,
@@ -34,11 +32,9 @@ export const createDocument = (state) => {
34
32
  return document;
35
33
  };
36
34
  export const saveToFile = (document, path, name) => {
37
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
38
35
  return baseSaveToFile(document, path, "phrc", name);
39
36
  };
40
37
  export const saveToFileHandle = (document, input) => {
41
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
42
38
  return baseSaveToFileHandle(document, input);
43
39
  };
44
40
  export const loadFromFile = (path) => {
@@ -57,7 +57,7 @@ export const reducer = {
57
57
  state.issuer = payload.iss;
58
58
  // Issuance date (JWT uses 'iat' or 'nbf')
59
59
  if (payload.nbf || payload.iat) {
60
- const issuanceTimestamp = payload.nbf || payload.iat;
60
+ const issuanceTimestamp = (payload.nbf || payload.iat);
61
61
  state.issuanceDate = new Date(issuanceTimestamp * 1000).toISOString();
62
62
  }
63
63
  else {
@@ -77,11 +77,9 @@ export const reducer = {
77
77
  state.id = payload.jti || vc.id || null;
78
78
  // Credential Status (optional W3C VC field)
79
79
  state.credentialStatus = vc.credentialStatus || null;
80
- // Store JWT metadata
80
+ // Store JWT token
81
81
  state.jwt = action.input.jwt;
82
82
  state.jwtVerified = true;
83
- state.jwtVerificationError = null;
84
- state.jwtPayload = JSON.stringify(payload);
85
83
  // Initialize revocation tracking
86
84
  state.revoked = false;
87
85
  state.revokedAt = null;
@@ -99,17 +97,6 @@ export const reducer = {
99
97
  throw new InvalidClaimsError("Credential subject must be valid JSON");
100
98
  }
101
99
  state.credentialSubject = action.input.credentialSubject;
102
- // Update vcPayload if it exists
103
- if (state.vcPayload) {
104
- try {
105
- const vc = JSON.parse(state.vcPayload);
106
- vc.credentialSubject = JSON.parse(action.input.credentialSubject);
107
- state.vcPayload = JSON.stringify(vc);
108
- }
109
- catch (e) {
110
- // If vcPayload can't be updated, just continue
111
- }
112
- }
113
100
  // Clear JWT as credential content has changed
114
101
  state.jwt = null;
115
102
  },
@@ -21,11 +21,9 @@ export const createDocument = (state) => {
21
21
  return document;
22
22
  };
23
23
  export const saveToFile = (document, path, name) => {
24
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
25
24
  return baseSaveToFile(document, path, "phru", name);
26
25
  };
27
26
  export const saveToFileHandle = (document, input) => {
28
- // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
29
27
  return baseSaveToFileHandle(document, input);
30
28
  };
31
29
  export const loadFromFile = (path) => {
@@ -15,7 +15,7 @@ export function Editor(props) {
15
15
  const [isSettingJwt, setIsSettingJwt] = useState(false);
16
16
  const [isSettingStatus, setIsSettingStatus] = useState(false);
17
17
  const { state: { global }, } = typedDocument;
18
- const { vcPayload, context, id: credentialId, type, issuer, issuanceDate, credentialSubject, expirationDate, credentialStatus, jwt, jwtPayload, revoked, revokedAt, revocationReason, } = global;
18
+ const { vcPayload, context, id: credentialId, type, issuer, issuanceDate, credentialSubject, expirationDate, credentialStatus, jwt, revoked, revokedAt, revocationReason, } = global;
19
19
  const isInitialized = issuer && issuanceDate;
20
20
  // Initialize credential from JWT
21
21
  const handleInit = useCallback((values) => {
@@ -82,7 +82,7 @@ export function Editor(props) {
82
82
  e.preventDefault();
83
83
  const formData = new FormData(e.target);
84
84
  handleSetJwt(formData.get("jwt"));
85
- }, children: _jsxs("div", { className: "space-y-4", children: [_jsx(TextareaField, { name: "jwt", label: "JWT Token", defaultValue: jwt || "", required: true, rows: 6, description: "Signed JWT representation of the credential" }), _jsxs("div", { className: "flex justify-end space-x-3", children: [_jsx(Button, { color: "light", onClick: () => setIsSettingJwt(false), children: "Cancel" }), _jsx(Button, { type: "submit", children: "Set JWT" })] })] }) })) : jwt ? (_jsxs(_Fragment, { children: [_jsx("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: _jsx("p", { className: "text-xs font-mono text-gray-900 break-all", children: jwt }) }), jwtPayload && (_jsxs("div", { className: "mt-4", children: [_jsx("label", { className: "block text-xs font-semibold text-gray-500 uppercase tracking-wider mb-2", children: "Decoded JWT Payload" }), _jsx("pre", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200 overflow-auto text-xs max-h-64", children: JSON.stringify(JSON.parse(jwtPayload), null, 2) })] }))] })) : (_jsx("p", { className: "text-gray-500 italic", children: "No JWT set" })) })] }), _jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsx("div", { className: "px-6 py-5 bg-gray-50", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-2xl font-bold text-gray-900", children: "Credential Status (StatusList2021)" }), !credentialStatus && !isSettingStatus && (_jsx(Button, { color: "light", onClick: () => setIsSettingStatus(true), children: "Set Status" }))] }) }), _jsx("div", { className: "p-6", children: isSettingStatus ? (_jsx(Form, { onSubmit: (e) => {
85
+ }, children: _jsxs("div", { className: "space-y-4", children: [_jsx(TextareaField, { name: "jwt", label: "JWT Token", defaultValue: jwt || "", required: true, rows: 6, description: "Signed JWT representation of the credential" }), _jsxs("div", { className: "flex justify-end space-x-3", children: [_jsx(Button, { color: "light", onClick: () => setIsSettingJwt(false), children: "Cancel" }), _jsx(Button, { type: "submit", children: "Set JWT" })] })] }) })) : jwt ? (_jsx(_Fragment, { children: _jsx("div", { className: "bg-gray-50 p-4 rounded-lg border border-gray-200", children: _jsx("p", { className: "text-xs font-mono text-gray-900 break-all", children: jwt }) }) })) : (_jsx("p", { className: "text-gray-500 italic", children: "No JWT set" })) })] }), _jsxs("div", { className: "bg-white rounded-xl shadow-md border border-gray-200 overflow-hidden", children: [_jsx("div", { className: "px-6 py-5 bg-gray-50", children: _jsxs("div", { className: "flex items-center justify-between", children: [_jsx("h2", { className: "text-2xl font-bold text-gray-900", children: "Credential Status (StatusList2021)" }), !credentialStatus && !isSettingStatus && (_jsx(Button, { color: "light", onClick: () => setIsSettingStatus(true), children: "Set Status" }))] }) }), _jsx("div", { className: "p-6", children: isSettingStatus ? (_jsx(Form, { onSubmit: (e) => {
86
86
  e.preventDefault();
87
87
  const formData = new FormData(e.target);
88
88
  handleSetStatus({
@@ -36,6 +36,8 @@ export class RenownCredentialProcessor extends RelationalDbProcessor {
36
36
  .insertInto("renown_credential")
37
37
  .values({
38
38
  document_id: documentId,
39
+ jwt: state.jwt || null,
40
+ jwt_verified: state.jwtVerified || false,
39
41
  vc_payload: state.vcPayload || null,
40
42
  context: state.context ? JSON.stringify(state.context) : null,
41
43
  credential_id: state.id || null,
@@ -53,9 +55,6 @@ export class RenownCredentialProcessor extends RelationalDbProcessor {
53
55
  credential_status_purpose: state.credentialStatus?.statusPurpose || null,
54
56
  credential_status_list_index: state.credentialStatus?.statusListIndex || null,
55
57
  credential_status_list_credential: state.credentialStatus?.statusListCredential || null,
56
- jwt: state.jwt || null,
57
- jwt_payload: state.jwtPayload || null,
58
- jwt_verified: state.jwtVerified || false,
59
58
  revoked: state.revoked || false,
60
59
  revoked_at: state.revokedAt ? new Date(state.revokedAt) : null,
61
60
  revocation_reason: state.revocationReason || null,
@@ -77,7 +76,6 @@ export class RenownCredentialProcessor extends RelationalDbProcessor {
77
76
  credential_subject: state.credentialSubject || null,
78
77
  vc_payload: state.vcPayload || null, // Sync vcPayload with updated credentialSubject
79
78
  jwt: null, // Clear JWT when content changes
80
- jwt_payload: null, // Also clear JWT payload
81
79
  jwt_verified: false, // Mark as unverified since content changed
82
80
  updated_at: new Date(),
83
81
  })
@@ -4,7 +4,9 @@ export async function up(db) {
4
4
  await db.schema
5
5
  .createTable("renown_credential")
6
6
  .addColumn("document_id", "varchar(255)")
7
- .addColumn("vc_payload", "text") // Complete VC JSON object
7
+ .addColumn("jwt", "text") // JWT token containing the VC
8
+ .addColumn("jwt_verified", "boolean", (col) => col.notNull().defaultTo(false))
9
+ .addColumn("vc_payload", "text") // Complete VC JSON object extracted from JWT
8
10
  .addColumn("context", "text") // JSON array - extracted for convenience
9
11
  .addColumn("credential_id", "varchar(255)")
10
12
  .addColumn("type", "text") // JSON array - extracted for convenience
@@ -17,9 +19,6 @@ export async function up(db) {
17
19
  .addColumn("credential_status_purpose", "varchar(255)")
18
20
  .addColumn("credential_status_list_index", "varchar(255)")
19
21
  .addColumn("credential_status_list_credential", "text")
20
- .addColumn("jwt", "text")
21
- .addColumn("jwt_payload", "text") // Complete JWT payload JSON object
22
- .addColumn("jwt_verified", "boolean", (col) => col.notNull().defaultTo(false))
23
22
  .addColumn("revoked", "boolean", (col) => col.notNull().defaultTo(false))
24
23
  .addColumn("revoked_at", "timestamp")
25
24
  .addColumn("revocation_reason", "text")
@@ -3,6 +3,8 @@ export type Generated<T> = T extends ColumnType<infer S, infer I, infer U> ? Col
3
3
  export type Timestamp = ColumnType<Date, Date | string, Date | string>;
4
4
  export interface RenownCredential {
5
5
  document_id: string;
6
+ jwt: string | null;
7
+ jwt_verified: boolean;
6
8
  vc_payload: string | null;
7
9
  context: string | null;
8
10
  credential_id: string | null;
@@ -16,9 +18,6 @@ export interface RenownCredential {
16
18
  credential_status_purpose: string | null;
17
19
  credential_status_list_index: string | null;
18
20
  credential_status_list_credential: string | null;
19
- jwt: string | null;
20
- jwt_payload: string | null;
21
- jwt_verified: boolean;
22
21
  revoked: boolean;
23
22
  revoked_at: Timestamp | null;
24
23
  revocation_reason: string | null;
package/dist/style.css CHANGED
@@ -314,9 +314,6 @@
314
314
  .mt-2 {
315
315
  margin-top: calc(var(--spacing) * 2);
316
316
  }
317
- .mt-4 {
318
- margin-top: calc(var(--spacing) * 4);
319
- }
320
317
  .mt-6 {
321
318
  margin-top: calc(var(--spacing) * 6);
322
319
  }
@@ -365,9 +362,6 @@
365
362
  .h-24 {
366
363
  height: calc(var(--spacing) * 24);
367
364
  }
368
- .max-h-64 {
369
- max-height: calc(var(--spacing) * 64);
370
- }
371
365
  .max-h-96 {
372
366
  max-height: calc(var(--spacing) * 96);
373
367
  }
@@ -12,10 +12,14 @@ export const schema = gql `
12
12
  }
13
13
 
14
14
  type RenownCredentialState {
15
- "Complete VC Payload - stores the full verifiable credential object for maximum flexibility"
15
+ "JWT token containing the Verifiable Credential"
16
+ jwt: String
17
+ jwtVerified: Boolean
18
+
19
+ "Complete VC Payload - extracted from JWT for convenience and flexibility"
16
20
  vcPayload: String
17
21
 
18
- "W3C VC Common Fields - extracted for convenience, may be null for non-standard VCs"
22
+ "W3C VC Common Fields - extracted for querying convenience, may be null for non-standard VCs"
19
23
  context: [String!]
20
24
  id: String
21
25
  type: [String!]
@@ -27,12 +31,6 @@ export const schema = gql `
27
31
  expirationDate: DateTime
28
32
  credentialStatus: CredentialStatus
29
33
 
30
- "JWT Representation"
31
- jwt: String
32
- jwtVerified: Boolean
33
- jwtVerificationError: String
34
- jwtPayload: String
35
-
36
34
  "Revocation tracking"
37
35
  revoked: Boolean
38
36
  revokedAt: DateTime
@@ -10,6 +10,8 @@ const mapToUser = (user) => ({
10
10
  });
11
11
  const mapToCredential = (credential) => ({
12
12
  documentId: credential.document_id,
13
+ jwt: credential.jwt,
14
+ jwtVerified: credential.jwt_verified,
13
15
  vcPayload: credential.vc_payload,
14
16
  credentialId: credential.credential_id,
15
17
  context: credential.context ? JSON.parse(credential.context) : null,
@@ -31,9 +33,6 @@ const mapToCredential = (credential) => ({
31
33
  statusListCredential: credential.credential_status_list_credential,
32
34
  }
33
35
  : null,
34
- jwt: credential.jwt,
35
- jwtPayload: credential.jwt_payload,
36
- jwtVerified: credential.jwt_verified,
37
36
  revoked: credential.revoked,
38
37
  revokedAt: credential.revoked_at,
39
38
  revocationReason: credential.revocation_reason,
@@ -28,6 +28,8 @@ export const schema = gql `
28
28
 
29
29
  type ReadRenownCredential {
30
30
  documentId: String!
31
+ jwt: String
32
+ jwtVerified: Boolean!
31
33
  vcPayload: String
32
34
  credentialId: String
33
35
  context: [String!]
@@ -37,9 +39,6 @@ export const schema = gql `
37
39
  credentialSubject: String
38
40
  expirationDate: DateTime
39
41
  credentialStatus: ReadCredentialStatus
40
- jwt: String
41
- jwtPayload: String
42
- jwtVerified: Boolean!
43
42
  revoked: Boolean!
44
43
  revokedAt: DateTime
45
44
  revocationReason: String
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@powerhousedao/renown-package",
3
3
  "description": "",
4
- "version": "0.0.7",
4
+ "version": "0.0.30",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [
@@ -62,14 +62,14 @@
62
62
  "./style.css": "./dist/style.css"
63
63
  },
64
64
  "dependencies": {
65
- "@powerhousedao/builder-tools": "staging",
66
- "@powerhousedao/common": "staging",
67
- "@powerhousedao/design-system": "staging",
65
+ "@powerhousedao/builder-tools": "5.0.0-staging.30",
66
+ "@powerhousedao/common": "5.0.0-staging.30",
67
+ "@powerhousedao/design-system": "5.0.0-staging.30",
68
68
  "@powerhousedao/document-engineering": "^1.37.0",
69
- "@powerhousedao/vetra": "staging",
69
+ "@powerhousedao/vetra": "5.0.0-staging.30",
70
70
  "did-jwt": "^8.0.18",
71
71
  "did-jwt-vc": "^4.0.16",
72
- "document-model": "staging",
72
+ "document-model": "5.0.0-staging.30",
73
73
  "graphql": "^16.10.0",
74
74
  "graphql-tag": "^2.12.6",
75
75
  "kysely": "^0.28.7",
@@ -81,13 +81,13 @@
81
81
  "@electric-sql/pglite": "^0.2.12",
82
82
  "@eslint/js": "^9.22.0",
83
83
  "@powerhousedao/analytics-engine-core": "^0.5.0",
84
- "@powerhousedao/codegen": "staging",
85
- "@powerhousedao/ph-cli": "staging",
86
- "@powerhousedao/reactor-api": "staging",
87
- "@powerhousedao/reactor-browser": "staging",
88
- "@powerhousedao/reactor-local": "staging",
89
- "@powerhousedao/scalars": "staging",
90
- "@powerhousedao/switchboard": "staging",
84
+ "@powerhousedao/codegen": "5.0.0-staging.30",
85
+ "@powerhousedao/ph-cli": "5.0.0-staging.30",
86
+ "@powerhousedao/reactor-api": "5.0.0-staging.30",
87
+ "@powerhousedao/reactor-browser": "5.0.0-staging.30",
88
+ "@powerhousedao/reactor-local": "5.0.0-staging.30",
89
+ "@powerhousedao/scalars": "1.33.1-staging.5",
90
+ "@powerhousedao/switchboard": "5.0.0-staging.30",
91
91
  "@semantic-release/changelog": "^6.0.3",
92
92
  "@semantic-release/git": "^10.0.1",
93
93
  "@tailwindcss/cli": "^4.0.15",
@@ -95,7 +95,7 @@
95
95
  "@types/node": "^22.13.11",
96
96
  "@types/react": "^18.3.19",
97
97
  "@vitejs/plugin-react": "^4.3.4",
98
- "document-drive": "staging",
98
+ "document-drive": "5.0.0-staging.30",
99
99
  "eslint": "^9.22.0",
100
100
  "eslint-plugin-react": "^7.37.4",
101
101
  "eslint-plugin-react-hooks": "^5.2.0",