@powerhousedao/renown-package 0.0.2 → 0.0.4

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.
Files changed (39) hide show
  1. package/dist/document-models/renown-credential/gen/document-model.js +96 -10
  2. package/dist/document-models/renown-credential/gen/manager/actions.d.ts +14 -2
  3. package/dist/document-models/renown-credential/gen/manager/creators.d.ts +5 -2
  4. package/dist/document-models/renown-credential/gen/manager/creators.js +4 -1
  5. package/dist/document-models/renown-credential/gen/manager/error.d.ts +45 -1
  6. package/dist/document-models/renown-credential/gen/manager/error.js +53 -1
  7. package/dist/document-models/renown-credential/gen/manager/object.d.ts +5 -2
  8. package/dist/document-models/renown-credential/gen/manager/object.js +10 -1
  9. package/dist/document-models/renown-credential/gen/manager/operations.d.ts +4 -1
  10. package/dist/document-models/renown-credential/gen/object.d.ts +1 -1
  11. package/dist/document-models/renown-credential/gen/ph-factories.js +11 -5
  12. package/dist/document-models/renown-credential/gen/reducer.d.ts +1 -1
  13. package/dist/document-models/renown-credential/gen/reducer.js +12 -0
  14. package/dist/document-models/renown-credential/gen/schema/types.d.ts +43 -12
  15. package/dist/document-models/renown-credential/gen/schema/zod.d.ts +5 -1
  16. package/dist/document-models/renown-credential/gen/schema/zod.js +48 -10
  17. package/dist/document-models/renown-credential/gen/utils.d.ts +1 -1
  18. package/dist/document-models/renown-credential/gen/utils.js +11 -5
  19. package/dist/document-models/renown-credential/index.d.ts +3 -0
  20. package/dist/document-models/renown-credential/src/reducers/manager.js +69 -15
  21. package/dist/document-models/renown-user/gen/object.d.ts +1 -1
  22. package/dist/document-models/renown-user/gen/profile/object.d.ts +1 -1
  23. package/dist/document-models/renown-user/gen/reducer.d.ts +1 -1
  24. package/dist/document-models/renown-user/gen/utils.d.ts +1 -1
  25. package/dist/processors/index.d.ts +1 -0
  26. package/dist/processors/index.js +1 -0
  27. package/dist/processors/renown-credential/index.d.ts +9 -0
  28. package/dist/processors/renown-credential/index.js +129 -0
  29. package/dist/processors/renown-credential/migrations.d.ts +3 -0
  30. package/dist/processors/renown-credential/migrations.js +77 -0
  31. package/dist/processors/renown-credential/schema.d.ts +27 -0
  32. package/dist/processors/renown-credential/schema.js +1 -0
  33. package/dist/processors/renown-user/migrations.js +2 -2
  34. package/dist/style.css +18 -12
  35. package/dist/subgraphs/renown-credential/resolvers.js +36 -0
  36. package/dist/subgraphs/renown-credential/schema.js +62 -12
  37. package/dist/subgraphs/renown-read-model/resolvers.js +122 -3
  38. package/dist/subgraphs/renown-read-model/schema.js +61 -2
  39. package/package.json +33 -2
@@ -17,35 +17,121 @@ export const documentModel = {
17
17
  name: "manager",
18
18
  operations: [
19
19
  {
20
- description: "",
21
- errors: [],
20
+ description: "Initialize a W3C Verifiable Credential with required fields",
21
+ errors: [
22
+ {
23
+ code: "MISSING_CONTEXT",
24
+ description: "The @context field is required for W3C VC compliance",
25
+ id: "missing-context-error",
26
+ name: "MissingContextError",
27
+ template: "",
28
+ },
29
+ {
30
+ code: "MISSING_TYPE",
31
+ description: "The type field is required and must include VerifiableCredential",
32
+ id: "missing-type-error",
33
+ name: "MissingTypeError",
34
+ template: "",
35
+ },
36
+ {
37
+ code: "INVALID_CLAIMS",
38
+ description: "The subject claims must be valid JSON",
39
+ id: "invalid-claims-error",
40
+ name: "InvalidClaimsError",
41
+ template: "",
42
+ },
43
+ ],
22
44
  examples: [],
23
45
  id: "366dfd44-377f-42d7-949d-a8d82b6a909d",
24
46
  name: "INIT",
25
- reducer: "",
26
- schema: 'input InitInput {\n "Add your inputs here"\n jwt: String!\n issuer: String\n subject: String\n audience: String\n payload: String\n}',
47
+ 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;',
48
+ schema: "input InitInput {\n context: [String!]\n id: String\n type: [String!]\n issuer: String!\n issuanceDate: DateTime!\n credentialSubject: String!\n expirationDate: DateTime\n}",
27
49
  scope: "global",
28
50
  template: "",
29
51
  },
30
52
  {
31
- description: "",
32
- errors: [],
53
+ description: "Marks the credential as revoked",
54
+ errors: [
55
+ {
56
+ code: "ALREADY_REVOKED",
57
+ description: "The credential is already revoked",
58
+ id: "already-revoked-error",
59
+ name: "AlreadyRevokedError",
60
+ template: "",
61
+ },
62
+ ],
33
63
  examples: [],
34
64
  id: "8d8ed639-f7c4-43a5-8644-85729bd5b7dc",
35
65
  name: "REVOKE",
36
- reducer: "",
37
- schema: "input RevokeInput {\n jwt: String\n}",
66
+ reducer: 'if (state.revoked) {\n throw new AlreadyRevokedError("Credential is already revoked");\n}\n\nstate.revoked = true;\nstate.revokedAt = action.input.revokedAt;\nstate.revocationReason = action.input.reason || null;',
67
+ schema: "input RevokeInput {\n revokedAt: DateTime!\n reason: String\n}",
38
68
  scope: "global",
39
69
  template: "",
40
70
  },
71
+ {
72
+ description: "Updates the credential subject claims",
73
+ errors: [
74
+ {
75
+ code: "INVALID_CLAIMS",
76
+ description: "The subject claims must be valid JSON",
77
+ id: "invalid-claims-error-2",
78
+ name: "InvalidClaimsError",
79
+ template: "",
80
+ },
81
+ {
82
+ code: "CREDENTIAL_REVOKED",
83
+ description: "Cannot update a revoked credential",
84
+ id: "credential-revoked-error",
85
+ name: "CredentialRevokedError",
86
+ template: "",
87
+ },
88
+ ],
89
+ examples: [],
90
+ id: "update-credential-subject-op",
91
+ name: "UPDATE_CREDENTIAL_SUBJECT",
92
+ reducer: 'if (state.revoked) {\n throw new CredentialRevokedError("Cannot update a revoked credential");\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.credentialSubject = action.input.credentialSubject;\n\n// Clear JWT as credential content has changed\nstate.jwt = null;',
93
+ schema: "input UpdateCredentialSubjectInput {\n credentialSubject: String!\n}",
94
+ scope: "global",
95
+ template: "Updates the credential subject claims",
96
+ },
97
+ {
98
+ description: "Sets the signed JWT representation of the credential",
99
+ errors: [],
100
+ examples: [],
101
+ id: "set-jwt-op",
102
+ name: "SET_JWT",
103
+ reducer: "state.jwt = action.input.jwt;",
104
+ schema: "input SetJwtInput {\n jwt: String!\n}",
105
+ scope: "global",
106
+ template: "Sets the signed JWT representation of the credential",
107
+ },
108
+ {
109
+ description: "Sets the credential status for revocation support (StatusList2021)",
110
+ errors: [
111
+ {
112
+ code: "INVALID_STATUS_PURPOSE",
113
+ description: "Status purpose must be either 'revocation' or 'suspension'",
114
+ id: "invalid-status-purpose-error",
115
+ name: "InvalidStatusPurposeError",
116
+ template: "",
117
+ },
118
+ ],
119
+ examples: [],
120
+ id: "set-credential-status-op",
121
+ name: "SET_CREDENTIAL_STATUS",
122
+ reducer: '// Validate statusPurpose\nif (action.input.statusPurpose !== "revocation" && action.input.statusPurpose !== "suspension") {\n throw new InvalidStatusPurposeError("Status purpose must be \'revocation\' or \'suspension\'");\n}\n\nstate.credentialStatus = {\n id: action.input.statusId,\n type: action.input.statusType,\n statusPurpose: action.input.statusPurpose,\n statusListIndex: action.input.statusListIndex,\n statusListCredential: action.input.statusListCredential\n};',
123
+ schema: "input SetCredentialStatusInput {\n statusId: String!\n statusType: String!\n statusPurpose: String!\n statusListIndex: String!\n statusListCredential: String!\n}",
124
+ scope: "global",
125
+ template: "Sets the credential status for revocation support (StatusList2021)",
126
+ },
41
127
  ],
42
128
  },
43
129
  ],
44
130
  state: {
45
131
  global: {
46
132
  examples: [],
47
- initialValue: '"{\\n \\"jwt\\": null,\\n \\"revoked\\": null,\\n \\"issuer\\": null,\\n \\"subject\\": null,\\n \\"audience\\": null,\\n \\"payload\\": null\\n}"',
48
- schema: 'type RenownCredentialState {\n "Add your global state fields here"\n jwt: String\n revoked: Boolean\n issuer: String\n subject: String\n audience: String\n payload: String\n}',
133
+ initialValue: '"{\\n \\"context\\": [\\"https://www.w3.org/2018/credentials/v1\\"],\\n \\"id\\": null,\\n \\"type\\": [\\"VerifiableCredential\\"],\\n \\"issuer\\": \\"\\",\\n \\"issuanceDate\\": \\"\\",\\n \\"credentialSubject\\": \\"{}\\",\\n \\"expirationDate\\": null,\\n \\"credentialStatus\\": null,\\n \\"jwt\\": null,\\n \\"revoked\\": false,\\n \\"revokedAt\\": null,\\n \\"revocationReason\\": null\\n}"',
134
+ schema: 'type CredentialStatus {\n id: String!\n type: String!\n statusPurpose: String!\n statusListIndex: String!\n statusListCredential: String!\n}\n\ntype RenownCredentialState {\n "W3C VC Required Fields"\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 \n "Revocation tracking"\n revoked: Boolean\n revokedAt: DateTime\n revocationReason: String\n}',
49
135
  },
50
136
  local: {
51
137
  examples: [],
@@ -1,5 +1,5 @@
1
1
  import { type Action } from "document-model";
2
- import type { InitInput, RevokeInput } from "../types.js";
2
+ import type { InitInput, RevokeInput, UpdateCredentialSubjectInput, SetJwtInput, SetCredentialStatusInput } from "../types.js";
3
3
  export type InitAction = Action & {
4
4
  type: "INIT";
5
5
  input: InitInput;
@@ -8,4 +8,16 @@ export type RevokeAction = Action & {
8
8
  type: "REVOKE";
9
9
  input: RevokeInput;
10
10
  };
11
- export type RenownCredentialManagerAction = InitAction | RevokeAction;
11
+ export type UpdateCredentialSubjectAction = Action & {
12
+ type: "UPDATE_CREDENTIAL_SUBJECT";
13
+ input: UpdateCredentialSubjectInput;
14
+ };
15
+ export type SetJwtAction = Action & {
16
+ type: "SET_JWT";
17
+ input: SetJwtInput;
18
+ };
19
+ export type SetCredentialStatusAction = Action & {
20
+ type: "SET_CREDENTIAL_STATUS";
21
+ input: SetCredentialStatusInput;
22
+ };
23
+ export type RenownCredentialManagerAction = InitAction | RevokeAction | UpdateCredentialSubjectAction | SetJwtAction | SetCredentialStatusAction;
@@ -1,4 +1,7 @@
1
- import { type InitInput, type RevokeInput } from "../types.js";
2
- import { type InitAction, type RevokeAction } from "./actions.js";
1
+ import { type InitInput, type RevokeInput, type UpdateCredentialSubjectInput, type SetJwtInput, type SetCredentialStatusInput } from "../types.js";
2
+ import { type InitAction, type RevokeAction, type UpdateCredentialSubjectAction, type SetJwtAction, type SetCredentialStatusAction } from "./actions.js";
3
3
  export declare const init: (input: InitInput) => InitAction;
4
4
  export declare const revoke: (input: RevokeInput) => RevokeAction;
5
+ export declare const updateCredentialSubject: (input: UpdateCredentialSubjectInput) => UpdateCredentialSubjectAction;
6
+ export declare const setJwt: (input: SetJwtInput) => SetJwtAction;
7
+ export declare const setCredentialStatus: (input: SetCredentialStatusInput) => SetCredentialStatusAction;
@@ -1,4 +1,7 @@
1
1
  import { createAction } from "document-model";
2
- import { z } from "../types.js";
2
+ import { z, } from "../types.js";
3
3
  export const init = (input) => createAction("INIT", { ...input }, undefined, z.InitInputSchema, "global");
4
4
  export const revoke = (input) => createAction("REVOKE", { ...input }, undefined, z.RevokeInputSchema, "global");
5
+ export const updateCredentialSubject = (input) => createAction("UPDATE_CREDENTIAL_SUBJECT", { ...input }, undefined, z.UpdateCredentialSubjectInputSchema, "global");
6
+ export const setJwt = (input) => createAction("SET_JWT", { ...input }, undefined, z.SetJwtInputSchema, "global");
7
+ export const setCredentialStatus = (input) => createAction("SET_CREDENTIAL_STATUS", { ...input }, undefined, z.SetCredentialStatusInputSchema, "global");
@@ -1 +1,45 @@
1
- export declare const errors: {};
1
+ export type ErrorCode = "MissingContextError" | "MissingTypeError" | "InvalidClaimsError" | "AlreadyRevokedError" | "CredentialRevokedError" | "InvalidStatusPurposeError";
2
+ export interface ReducerError {
3
+ errorCode: ErrorCode;
4
+ }
5
+ export declare class MissingContextError extends Error implements ReducerError {
6
+ errorCode: ErrorCode;
7
+ constructor(message?: string);
8
+ }
9
+ export declare class MissingTypeError extends Error implements ReducerError {
10
+ errorCode: ErrorCode;
11
+ constructor(message?: string);
12
+ }
13
+ export declare class InvalidClaimsError extends Error implements ReducerError {
14
+ errorCode: ErrorCode;
15
+ constructor(message?: string);
16
+ }
17
+ export declare class AlreadyRevokedError extends Error implements ReducerError {
18
+ errorCode: ErrorCode;
19
+ constructor(message?: string);
20
+ }
21
+ export declare class CredentialRevokedError extends Error implements ReducerError {
22
+ errorCode: ErrorCode;
23
+ constructor(message?: string);
24
+ }
25
+ export declare class InvalidStatusPurposeError extends Error implements ReducerError {
26
+ errorCode: ErrorCode;
27
+ constructor(message?: string);
28
+ }
29
+ export declare const errors: {
30
+ Init: {
31
+ MissingContextError: typeof MissingContextError;
32
+ MissingTypeError: typeof MissingTypeError;
33
+ InvalidClaimsError: typeof InvalidClaimsError;
34
+ };
35
+ Revoke: {
36
+ AlreadyRevokedError: typeof AlreadyRevokedError;
37
+ };
38
+ UpdateCredentialSubject: {
39
+ InvalidClaimsError: typeof InvalidClaimsError;
40
+ CredentialRevokedError: typeof CredentialRevokedError;
41
+ };
42
+ SetCredentialStatus: {
43
+ InvalidStatusPurposeError: typeof InvalidStatusPurposeError;
44
+ };
45
+ };
@@ -1 +1,53 @@
1
- export const errors = {};
1
+ export class MissingContextError extends Error {
2
+ errorCode = "MissingContextError";
3
+ constructor(message = "MissingContextError") {
4
+ super(message);
5
+ }
6
+ }
7
+ export class MissingTypeError extends Error {
8
+ errorCode = "MissingTypeError";
9
+ constructor(message = "MissingTypeError") {
10
+ super(message);
11
+ }
12
+ }
13
+ export class InvalidClaimsError extends Error {
14
+ errorCode = "InvalidClaimsError";
15
+ constructor(message = "InvalidClaimsError") {
16
+ super(message);
17
+ }
18
+ }
19
+ export class AlreadyRevokedError extends Error {
20
+ errorCode = "AlreadyRevokedError";
21
+ constructor(message = "AlreadyRevokedError") {
22
+ super(message);
23
+ }
24
+ }
25
+ export class CredentialRevokedError extends Error {
26
+ errorCode = "CredentialRevokedError";
27
+ constructor(message = "CredentialRevokedError") {
28
+ super(message);
29
+ }
30
+ }
31
+ export class InvalidStatusPurposeError extends Error {
32
+ errorCode = "InvalidStatusPurposeError";
33
+ constructor(message = "InvalidStatusPurposeError") {
34
+ super(message);
35
+ }
36
+ }
37
+ export const errors = {
38
+ Init: {
39
+ MissingContextError,
40
+ MissingTypeError,
41
+ InvalidClaimsError,
42
+ },
43
+ Revoke: {
44
+ AlreadyRevokedError,
45
+ },
46
+ UpdateCredentialSubject: {
47
+ InvalidClaimsError,
48
+ CredentialRevokedError,
49
+ },
50
+ SetCredentialStatus: {
51
+ InvalidStatusPurposeError,
52
+ },
53
+ };
@@ -1,7 +1,10 @@
1
1
  import { BaseDocumentClass } from "document-model";
2
- import { RenownCredentialPHState } from "../ph-factories.js";
3
- import { type InitInput, type RevokeInput } from "../types.js";
2
+ import { type RenownCredentialPHState } from "../ph-factories.js";
3
+ import { type InitInput, type RevokeInput, type UpdateCredentialSubjectInput, type SetJwtInput, type SetCredentialStatusInput } from "../types.js";
4
4
  export default class RenownCredential_Manager extends BaseDocumentClass<RenownCredentialPHState> {
5
5
  init(input: InitInput): this;
6
6
  revoke(input: RevokeInput): this;
7
+ updateCredentialSubject(input: UpdateCredentialSubjectInput): this;
8
+ setJwt(input: SetJwtInput): this;
9
+ setCredentialStatus(input: SetCredentialStatusInput): this;
7
10
  }
@@ -1,5 +1,5 @@
1
1
  import { BaseDocumentClass } from "document-model";
2
- import { init, revoke } from "./creators.js";
2
+ import { init, revoke, updateCredentialSubject, setJwt, setCredentialStatus, } from "./creators.js";
3
3
  export default class RenownCredential_Manager extends BaseDocumentClass {
4
4
  init(input) {
5
5
  return this.dispatch(init(input));
@@ -7,4 +7,13 @@ export default class RenownCredential_Manager extends BaseDocumentClass {
7
7
  revoke(input) {
8
8
  return this.dispatch(revoke(input));
9
9
  }
10
+ updateCredentialSubject(input) {
11
+ return this.dispatch(updateCredentialSubject(input));
12
+ }
13
+ setJwt(input) {
14
+ return this.dispatch(setJwt(input));
15
+ }
16
+ setCredentialStatus(input) {
17
+ return this.dispatch(setCredentialStatus(input));
18
+ }
10
19
  }
@@ -1,7 +1,10 @@
1
1
  import { type SignalDispatch } from "document-model";
2
- import { type InitAction, type RevokeAction } from "./actions.js";
2
+ import { type InitAction, type RevokeAction, type UpdateCredentialSubjectAction, type SetJwtAction, type SetCredentialStatusAction } from "./actions.js";
3
3
  import { type RenownCredentialState } from "../types.js";
4
4
  export interface RenownCredentialManagerOperations {
5
5
  initOperation: (state: RenownCredentialState, action: InitAction, dispatch?: SignalDispatch) => void;
6
6
  revokeOperation: (state: RenownCredentialState, action: RevokeAction, dispatch?: SignalDispatch) => void;
7
+ updateCredentialSubjectOperation: (state: RenownCredentialState, action: UpdateCredentialSubjectAction, dispatch?: SignalDispatch) => void;
8
+ setJwtOperation: (state: RenownCredentialState, action: SetJwtAction, dispatch?: SignalDispatch) => void;
9
+ setCredentialStatusOperation: (state: RenownCredentialState, action: SetCredentialStatusAction, dispatch?: SignalDispatch) => void;
7
10
  }
@@ -1,5 +1,5 @@
1
1
  import { BaseDocumentClass, type SignalDispatch } from "document-model";
2
- import { RenownCredentialPHState } from "./ph-factories.js";
2
+ import { type RenownCredentialPHState } from "./ph-factories.js";
3
3
  import RenownCredential_Manager from "./manager/object.js";
4
4
  export * from "./manager/object.js";
5
5
  interface RenownCredential extends RenownCredential_Manager {
@@ -5,12 +5,18 @@ import { createBaseState, defaultBaseState, } from "document-model";
5
5
  import { createDocument } from "./utils.js";
6
6
  export function defaultGlobalState() {
7
7
  return {
8
+ context: ["https://www.w3.org/2018/credentials/v1"],
9
+ id: null,
10
+ type: ["VerifiableCredential"],
11
+ issuer: "",
12
+ issuanceDate: "",
13
+ credentialSubject: "{}",
14
+ expirationDate: null,
15
+ credentialStatus: null,
8
16
  jwt: null,
9
- revoked: null,
10
- issuer: null,
11
- subject: null,
12
- audience: null,
13
- payload: null,
17
+ revoked: false,
18
+ revokedAt: null,
19
+ revocationReason: null,
14
20
  };
15
21
  }
16
22
  export function defaultLocalState() {
@@ -1,4 +1,4 @@
1
1
  import { type StateReducer } from "document-model";
2
- import { RenownCredentialPHState } from "./ph-factories.js";
2
+ import { type RenownCredentialPHState } from "./ph-factories.js";
3
3
  export declare const stateReducer: StateReducer<RenownCredentialPHState>;
4
4
  export declare const reducer: import("document-model").Reducer<RenownCredentialPHState>;
@@ -17,6 +17,18 @@ export const stateReducer = (state, action, dispatch) => {
17
17
  z.RevokeInputSchema().parse(action.input);
18
18
  ManagerReducer.revokeOperation(state[action.scope], action, dispatch);
19
19
  break;
20
+ case "UPDATE_CREDENTIAL_SUBJECT":
21
+ z.UpdateCredentialSubjectInputSchema().parse(action.input);
22
+ ManagerReducer.updateCredentialSubjectOperation(state[action.scope], action, dispatch);
23
+ break;
24
+ case "SET_JWT":
25
+ z.SetJwtInputSchema().parse(action.input);
26
+ ManagerReducer.setJwtOperation(state[action.scope], action, dispatch);
27
+ break;
28
+ case "SET_CREDENTIAL_STATUS":
29
+ z.SetCredentialStatusInputSchema().parse(action.input);
30
+ ManagerReducer.setCredentialStatusOperation(state[action.scope], action, dispatch);
31
+ break;
20
32
  default:
21
33
  return state;
22
34
  }
@@ -134,23 +134,54 @@ export type Scalars = {
134
134
  output: File;
135
135
  };
136
136
  };
137
+ export type CredentialStatus = {
138
+ id: Scalars["String"]["output"];
139
+ statusListCredential: Scalars["String"]["output"];
140
+ statusListIndex: Scalars["String"]["output"];
141
+ statusPurpose: Scalars["String"]["output"];
142
+ type: Scalars["String"]["output"];
143
+ };
137
144
  export type InitInput = {
138
- audience?: InputMaybe<Scalars["String"]["input"]>;
139
- issuer?: InputMaybe<Scalars["String"]["input"]>;
140
- /** Add your inputs here */
141
- jwt: Scalars["String"]["input"];
142
- payload?: InputMaybe<Scalars["String"]["input"]>;
143
- subject?: InputMaybe<Scalars["String"]["input"]>;
145
+ context?: InputMaybe<Array<Scalars["String"]["input"]>>;
146
+ credentialSubject: Scalars["String"]["input"];
147
+ expirationDate?: InputMaybe<Scalars["DateTime"]["input"]>;
148
+ id?: InputMaybe<Scalars["String"]["input"]>;
149
+ issuanceDate: Scalars["DateTime"]["input"];
150
+ issuer: Scalars["String"]["input"];
151
+ type?: InputMaybe<Array<Scalars["String"]["input"]>>;
144
152
  };
145
153
  export type RenownCredentialState = {
146
- audience: Maybe<Scalars["String"]["output"]>;
147
- issuer: Maybe<Scalars["String"]["output"]>;
148
- /** Add your global state fields here */
154
+ /** W3C VC Required Fields */
155
+ context: Array<Scalars["String"]["output"]>;
156
+ credentialStatus: Maybe<CredentialStatus>;
157
+ credentialSubject: Scalars["String"]["output"];
158
+ /** W3C VC Optional Fields */
159
+ expirationDate: Maybe<Scalars["DateTime"]["output"]>;
160
+ id: Maybe<Scalars["String"]["output"]>;
161
+ issuanceDate: Scalars["DateTime"]["output"];
162
+ issuer: Scalars["String"]["output"];
163
+ /** JWT Representation */
149
164
  jwt: Maybe<Scalars["String"]["output"]>;
150
- payload: Maybe<Scalars["String"]["output"]>;
165
+ revocationReason: Maybe<Scalars["String"]["output"]>;
166
+ /** Revocation tracking */
151
167
  revoked: Maybe<Scalars["Boolean"]["output"]>;
152
- subject: Maybe<Scalars["String"]["output"]>;
168
+ revokedAt: Maybe<Scalars["DateTime"]["output"]>;
169
+ type: Array<Scalars["String"]["output"]>;
153
170
  };
154
171
  export type RevokeInput = {
155
- jwt?: InputMaybe<Scalars["String"]["input"]>;
172
+ reason?: InputMaybe<Scalars["String"]["input"]>;
173
+ revokedAt: Scalars["DateTime"]["input"];
174
+ };
175
+ export type SetCredentialStatusInput = {
176
+ statusId: Scalars["String"]["input"];
177
+ statusListCredential: Scalars["String"]["input"];
178
+ statusListIndex: Scalars["String"]["input"];
179
+ statusPurpose: Scalars["String"]["input"];
180
+ statusType: Scalars["String"]["input"];
181
+ };
182
+ export type SetJwtInput = {
183
+ jwt: Scalars["String"]["input"];
184
+ };
185
+ export type UpdateCredentialSubjectInput = {
186
+ credentialSubject: Scalars["String"]["input"];
156
187
  };
@@ -1,12 +1,16 @@
1
1
  import { z } from "zod";
2
- import type { InitInput, RenownCredentialState, RevokeInput } from "./types.js";
2
+ import type { CredentialStatus, InitInput, RenownCredentialState, RevokeInput, SetCredentialStatusInput, SetJwtInput, UpdateCredentialSubjectInput } from "./types.js";
3
3
  type Properties<T> = Required<{
4
4
  [K in keyof T]: z.ZodType<T[K], any, T[K]>;
5
5
  }>;
6
6
  type definedNonNullAny = {};
7
7
  export declare const isDefinedNonNullAny: (v: any) => v is definedNonNullAny;
8
8
  export declare const definedNonNullAnySchema: z.ZodEffects<z.ZodAny, definedNonNullAny, any>;
9
+ export declare function CredentialStatusSchema(): z.ZodObject<Properties<CredentialStatus>>;
9
10
  export declare function InitInputSchema(): z.ZodObject<Properties<InitInput>>;
10
11
  export declare function RenownCredentialStateSchema(): z.ZodObject<Properties<RenownCredentialState>>;
11
12
  export declare function RevokeInputSchema(): z.ZodObject<Properties<RevokeInput>>;
13
+ export declare function SetCredentialStatusInputSchema(): z.ZodObject<Properties<SetCredentialStatusInput>>;
14
+ export declare function SetJwtInputSchema(): z.ZodObject<Properties<SetJwtInput>>;
15
+ export declare function UpdateCredentialSubjectInputSchema(): z.ZodObject<Properties<UpdateCredentialSubjectInput>>;
12
16
  export {};
@@ -3,28 +3,66 @@ export const isDefinedNonNullAny = (v) => v !== undefined && v !== null;
3
3
  export const definedNonNullAnySchema = z
4
4
  .any()
5
5
  .refine((v) => isDefinedNonNullAny(v));
6
+ export function CredentialStatusSchema() {
7
+ return z.object({
8
+ __typename: z.literal("CredentialStatus").optional(),
9
+ id: z.string(),
10
+ statusListCredential: z.string(),
11
+ statusListIndex: z.string(),
12
+ statusPurpose: z.string(),
13
+ type: z.string(),
14
+ });
15
+ }
6
16
  export function InitInputSchema() {
7
17
  return z.object({
8
- audience: z.string().nullish(),
9
- issuer: z.string().nullish(),
10
- jwt: z.string(),
11
- payload: z.string().nullish(),
12
- subject: z.string().nullish(),
18
+ context: z.array(z.string()).nullish(),
19
+ credentialSubject: z.string(),
20
+ expirationDate: z.string().datetime().nullish(),
21
+ id: z.string().nullish(),
22
+ issuanceDate: z.string().datetime(),
23
+ issuer: z.string(),
24
+ type: z.array(z.string()).nullish(),
13
25
  });
14
26
  }
15
27
  export function RenownCredentialStateSchema() {
16
28
  return z.object({
17
29
  __typename: z.literal("RenownCredentialState").optional(),
18
- audience: z.string().nullable(),
19
- issuer: z.string().nullable(),
30
+ context: z.array(z.string()),
31
+ credentialStatus: CredentialStatusSchema().nullable(),
32
+ credentialSubject: z.string(),
33
+ expirationDate: z.string().datetime().nullable(),
34
+ id: z.string().nullable(),
35
+ issuanceDate: z.string().datetime(),
36
+ issuer: z.string(),
20
37
  jwt: z.string().nullable(),
21
- payload: z.string().nullable(),
38
+ revocationReason: z.string().nullable(),
22
39
  revoked: z.boolean().nullable(),
23
- subject: z.string().nullable(),
40
+ revokedAt: z.string().datetime().nullable(),
41
+ type: z.array(z.string()),
24
42
  });
25
43
  }
26
44
  export function RevokeInputSchema() {
27
45
  return z.object({
28
- jwt: z.string().nullish(),
46
+ reason: z.string().nullish(),
47
+ revokedAt: z.string().datetime(),
48
+ });
49
+ }
50
+ export function SetCredentialStatusInputSchema() {
51
+ return z.object({
52
+ statusId: z.string(),
53
+ statusListCredential: z.string(),
54
+ statusListIndex: z.string(),
55
+ statusPurpose: z.string(),
56
+ statusType: z.string(),
57
+ });
58
+ }
59
+ export function SetJwtInputSchema() {
60
+ return z.object({
61
+ jwt: z.string(),
62
+ });
63
+ }
64
+ export function UpdateCredentialSubjectInputSchema() {
65
+ return z.object({
66
+ credentialSubject: z.string(),
29
67
  });
30
68
  }
@@ -1,6 +1,6 @@
1
1
  import { type CreateDocument, type CreateState, type LoadFromFile, type LoadFromInput } from "document-model";
2
2
  import { type RenownCredentialState, type RenownCredentialLocalState } from "./types.js";
3
- import { RenownCredentialPHState } from "./ph-factories.js";
3
+ import { type RenownCredentialPHState } from "./ph-factories.js";
4
4
  export declare const initialGlobalState: RenownCredentialState;
5
5
  export declare const initialLocalState: RenownCredentialLocalState;
6
6
  export declare const createState: CreateState<RenownCredentialPHState>;
@@ -1,12 +1,18 @@
1
1
  import { baseCreateDocument, baseSaveToFile, baseSaveToFileHandle, baseLoadFromFile, baseLoadFromInput, defaultBaseState, generateId, } from "document-model";
2
2
  import { reducer } from "./reducer.js";
3
3
  export const initialGlobalState = {
4
+ context: ["https://www.w3.org/2018/credentials/v1"],
5
+ id: null,
6
+ type: ["VerifiableCredential"],
7
+ issuer: "",
8
+ issuanceDate: "",
9
+ credentialSubject: "{}",
10
+ expirationDate: null,
11
+ credentialStatus: null,
4
12
  jwt: null,
5
- revoked: null,
6
- issuer: null,
7
- subject: null,
8
- audience: null,
9
- payload: null,
13
+ revoked: false,
14
+ revokedAt: null,
15
+ revocationReason: null,
10
16
  };
11
17
  export const initialLocalState = {};
12
18
  export const createState = (state) => {
@@ -18,6 +18,9 @@ declare const utils: {
18
18
  declare const actions: {
19
19
  init: (input: import("./index.js").InitInput) => import("./gen/actions.js").InitAction;
20
20
  revoke: (input: import("./index.js").RevokeInput) => import("./gen/actions.js").RevokeAction;
21
+ updateCredentialSubject: (input: import("./index.js").UpdateCredentialSubjectInput) => import("./gen/actions.js").UpdateCredentialSubjectAction;
22
+ setJwt: (input: import("./index.js").SetJwtInput) => import("./gen/actions.js").SetJwtAction;
23
+ setCredentialStatus: (input: import("./index.js").SetCredentialStatusInput) => import("./gen/actions.js").SetCredentialStatusAction;
21
24
  };
22
25
  export declare const module: DocumentModelModule<RenownCredentialPHState>;
23
26
  export { reducer, actions, utils, documentModel };