@bifold/verifier 1.0.0

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 (83) hide show
  1. package/README.md +1 -0
  2. package/build/commonjs/README.md +4 -0
  3. package/build/commonjs/constants.js +9 -0
  4. package/build/commonjs/constants.js.map +1 -0
  5. package/build/commonjs/hooks/proofs.js +22 -0
  6. package/build/commonjs/hooks/proofs.js.map +1 -0
  7. package/build/commonjs/index.js +120 -0
  8. package/build/commonjs/index.js.map +1 -0
  9. package/build/commonjs/request-templates.js +59 -0
  10. package/build/commonjs/request-templates.js.map +1 -0
  11. package/build/commonjs/types/agent.js +9 -0
  12. package/build/commonjs/types/agent.js.map +1 -0
  13. package/build/commonjs/types/metadata.js +11 -0
  14. package/build/commonjs/types/metadata.js.map +1 -0
  15. package/build/commonjs/types/proof-reqeust-template.js +12 -0
  16. package/build/commonjs/types/proof-reqeust-template.js.map +1 -0
  17. package/build/commonjs/types/proof.js +26 -0
  18. package/build/commonjs/types/proof.js.map +1 -0
  19. package/build/commonjs/utils/proof-request.js +163 -0
  20. package/build/commonjs/utils/proof-request.js.map +1 -0
  21. package/build/commonjs/utils/proof.js +184 -0
  22. package/build/commonjs/utils/proof.js.map +1 -0
  23. package/build/module/README.md +4 -0
  24. package/build/module/constants.js +3 -0
  25. package/build/module/constants.js.map +1 -0
  26. package/build/module/hooks/proofs.js +15 -0
  27. package/build/module/hooks/proofs.js.map +1 -0
  28. package/build/module/index.js +7 -0
  29. package/build/module/index.js.map +1 -0
  30. package/build/module/request-templates.js +52 -0
  31. package/build/module/request-templates.js.map +1 -0
  32. package/build/module/types/agent.js +5 -0
  33. package/build/module/types/agent.js.map +1 -0
  34. package/build/module/types/metadata.js +5 -0
  35. package/build/module/types/metadata.js.map +1 -0
  36. package/build/module/types/proof-reqeust-template.js +8 -0
  37. package/build/module/types/proof-reqeust-template.js.map +1 -0
  38. package/build/module/types/proof.js +18 -0
  39. package/build/module/types/proof.js.map +1 -0
  40. package/build/module/utils/proof-request.js +151 -0
  41. package/build/module/utils/proof-request.js.map +1 -0
  42. package/build/module/utils/proof.js +171 -0
  43. package/build/module/utils/proof.js.map +1 -0
  44. package/build/typescript/__tests__/verifier/proof-request.test.d.ts +2 -0
  45. package/build/typescript/__tests__/verifier/proof-request.test.d.ts.map +1 -0
  46. package/build/typescript/__tests__/verifier/proof.test.d.ts +2 -0
  47. package/build/typescript/__tests__/verifier/proof.test.d.ts.map +1 -0
  48. package/build/typescript/constants.d.ts +3 -0
  49. package/build/typescript/constants.d.ts.map +1 -0
  50. package/build/typescript/hooks/proofs.d.ts +3 -0
  51. package/build/typescript/hooks/proofs.d.ts.map +1 -0
  52. package/build/typescript/index.d.ts +11 -0
  53. package/build/typescript/index.d.ts.map +1 -0
  54. package/build/typescript/request-templates.d.ts +3 -0
  55. package/build/typescript/request-templates.d.ts.map +1 -0
  56. package/build/typescript/types/agent.d.ts +12 -0
  57. package/build/typescript/types/agent.d.ts.map +1 -0
  58. package/build/typescript/types/metadata.d.ts +9 -0
  59. package/build/typescript/types/metadata.d.ts.map +1 -0
  60. package/build/typescript/types/proof-reqeust-template.d.ts +48 -0
  61. package/build/typescript/types/proof-reqeust-template.d.ts.map +1 -0
  62. package/build/typescript/types/proof.d.ts +51 -0
  63. package/build/typescript/types/proof.d.ts.map +1 -0
  64. package/build/typescript/utils/proof-request.d.ts +30 -0
  65. package/build/typescript/utils/proof-request.d.ts.map +1 -0
  66. package/build/typescript/utils/proof.d.ts +18 -0
  67. package/build/typescript/utils/proof.d.ts.map +1 -0
  68. package/package.json +59 -0
  69. package/src/README.md +4 -0
  70. package/src/__tests__/verifier/__snapshots__/proof-request.test.ts.snap +72 -0
  71. package/src/__tests__/verifier/__snapshots__/proof.test.ts.snap +135 -0
  72. package/src/__tests__/verifier/proof-request.test.ts +34 -0
  73. package/src/__tests__/verifier/proof.test.ts +99 -0
  74. package/src/constants.ts +2 -0
  75. package/src/hooks/proofs.ts +20 -0
  76. package/src/index.ts +45 -0
  77. package/src/request-templates.ts +62 -0
  78. package/src/types/agent.ts +53 -0
  79. package/src/types/metadata.ts +9 -0
  80. package/src/types/proof-reqeust-template.ts +59 -0
  81. package/src/types/proof.ts +68 -0
  82. package/src/utils/proof-request.ts +177 -0
  83. package/src/utils/proof.ts +173 -0
@@ -0,0 +1,171 @@
1
+ import { ProofState } from '@credo-ts/core';
2
+ import { ProofMetadata } from '../types/metadata';
3
+ import { CredentialSharedProofData, ParsedAnonCredsProof } from '../types/proof';
4
+
5
+ /*
6
+ * Extract identifiers from indy proof
7
+ * */
8
+ export const getProofIdentifiers = (proof, proofIndex) => {
9
+ const identifiers = proof.identifiers[proofIndex];
10
+ if (!identifiers) {
11
+ throw new Error('Invalid indy proof data');
12
+ }
13
+ return identifiers;
14
+ };
15
+
16
+ /*
17
+ * Process anoncreds proof and return
18
+ * - shared attributes
19
+ * - shared attribute groups
20
+ * - resolved predicates
21
+ * - missing attributes
22
+ * - missing attribute groups
23
+ * - unresolved predicates
24
+ * */
25
+ export const parseAnonCredsProof = (request, proof) => {
26
+ const result = new ParsedAnonCredsProof();
27
+ for (const [referent, requested_attribute] of Object.entries(request.requested_attributes)) {
28
+ if (requested_attribute.name) {
29
+ const shared = proof.requested_proof.revealed_attrs[referent];
30
+ if (shared) {
31
+ const identifiers = getProofIdentifiers(proof, shared.sub_proof_index);
32
+ result.sharedAttributes.push({
33
+ name: requested_attribute.name,
34
+ value: shared.raw,
35
+ identifiers
36
+ });
37
+ } else {
38
+ result.unresolvedAttributes.push({
39
+ name: requested_attribute.name
40
+ });
41
+ }
42
+ }
43
+ if (requested_attribute.names) {
44
+ var _proof$requested_proo;
45
+ const shared = (_proof$requested_proo = proof.requested_proof.revealed_attr_groups) === null || _proof$requested_proo === void 0 ? void 0 : _proof$requested_proo[referent];
46
+ if (shared) {
47
+ const attributes = Object.entries(shared.values).map(([name, value]) => ({
48
+ name,
49
+ value: value.raw
50
+ }));
51
+ const identifiers = getProofIdentifiers(proof, shared.sub_proof_index);
52
+ result.sharedAttributeGroups.push({
53
+ attributes,
54
+ identifiers
55
+ });
56
+ } else {
57
+ result.unresolvedAttributeGroups.push(requested_attribute.names.map(name => ({
58
+ name
59
+ })));
60
+ }
61
+ }
62
+ }
63
+ for (const [referent, requestedPredicate] of Object.entries(request.requested_predicates)) {
64
+ const shared = proof.requested_proof.predicates[referent];
65
+ if (shared) {
66
+ const identifiers = getProofIdentifiers(proof, shared.sub_proof_index);
67
+ result.resolvedPredicates.push({
68
+ name: requestedPredicate.name,
69
+ predicateType: requestedPredicate.p_type,
70
+ predicateValue: requestedPredicate.p_value,
71
+ identifiers
72
+ });
73
+ } else {
74
+ result.unresolvedPredicates.push({
75
+ name: requestedPredicate.name,
76
+ predicateType: requestedPredicate.p_type,
77
+ predicateValue: requestedPredicate.p_value
78
+ });
79
+ }
80
+ }
81
+ return result;
82
+ };
83
+
84
+ /*
85
+ * Group parsed indy proof data ( returned from `parseIndyProof`) by credential definition id
86
+ * */
87
+ export const groupSharedProofDataByCredential = data => {
88
+ const result = new Map();
89
+ for (const item of data.sharedAttributes) {
90
+ var _result$get;
91
+ if (!result.has(item.identifiers.cred_def_id)) {
92
+ result.set(item.identifiers.cred_def_id, {
93
+ data: new CredentialSharedProofData(),
94
+ identifiers: item.identifiers
95
+ });
96
+ }
97
+ (_result$get = result.get(item.identifiers.cred_def_id)) === null || _result$get === void 0 || _result$get.data.sharedAttributes.push(item);
98
+ }
99
+ for (const item of data.sharedAttributeGroups) {
100
+ var _result$get2;
101
+ if (!result.has(item.identifiers.cred_def_id)) {
102
+ result.set(item.identifiers.cred_def_id, {
103
+ data: new CredentialSharedProofData(),
104
+ identifiers: item.identifiers
105
+ });
106
+ }
107
+ (_result$get2 = result.get(item.identifiers.cred_def_id)) === null || _result$get2 === void 0 || _result$get2.data.sharedAttributeGroups.push(item);
108
+ }
109
+ for (const item of data.resolvedPredicates) {
110
+ var _result$get3;
111
+ if (!result.has(item.identifiers.cred_def_id)) {
112
+ result.set(item.identifiers.cred_def_id, {
113
+ data: new CredentialSharedProofData(),
114
+ identifiers: item.identifiers
115
+ });
116
+ }
117
+ (_result$get3 = result.get(item.identifiers.cred_def_id)) === null || _result$get3 === void 0 || _result$get3.data.resolvedPredicates.push(item);
118
+ }
119
+ return result;
120
+ };
121
+
122
+ /*
123
+ * Retrieve proof details from Credo record
124
+ * */
125
+ export const getProofData = async (agent, recordId) => {
126
+ var _data$request, _data$presentation, _data$request2, _data$presentation2;
127
+ const data = await agent.proofs.getFormatData(recordId);
128
+ if ((_data$request = data.request) !== null && _data$request !== void 0 && _data$request.anoncreds && (_data$presentation = data.presentation) !== null && _data$presentation !== void 0 && _data$presentation.anoncreds) {
129
+ return parseAnonCredsProof(data.request.anoncreds, data.presentation.anoncreds);
130
+ } else if ((_data$request2 = data.request) !== null && _data$request2 !== void 0 && _data$request2.indy && (_data$presentation2 = data.presentation) !== null && _data$presentation2 !== void 0 && _data$presentation2.indy) {
131
+ return parseAnonCredsProof(data.request.indy, data.presentation.indy);
132
+ }
133
+ return undefined;
134
+ };
135
+
136
+ /*
137
+ * Check if a presentation received
138
+ * */
139
+ export const isPresentationReceived = record => {
140
+ return record.state === ProofState.PresentationReceived || record.state === ProofState.Done;
141
+ };
142
+
143
+ /*
144
+ * Check if a presentation failed
145
+ * */
146
+ export const isPresentationFailed = record => {
147
+ return record.state === ProofState.Abandoned;
148
+ };
149
+
150
+ /*
151
+ * Mark Proof record as viewed
152
+ * */
153
+ export const markProofAsViewed = async (agent, record) => {
154
+ record.metadata.set(ProofMetadata.customMetadata, {
155
+ ...record.metadata.data.customMetadata,
156
+ details_seen: true
157
+ });
158
+ return agent.proofs.update(record);
159
+ };
160
+
161
+ /*
162
+ * Add template reference to Proof Exchange record
163
+ * */
164
+ export const linkProofWithTemplate = async (agent, record, templateId) => {
165
+ record.metadata.set(ProofMetadata.customMetadata, {
166
+ ...record.metadata.data.customMetadata,
167
+ proof_request_template_id: templateId
168
+ });
169
+ return agent.proofs.update(record);
170
+ };
171
+ //# sourceMappingURL=proof.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["ProofState","ProofMetadata","CredentialSharedProofData","ParsedAnonCredsProof","getProofIdentifiers","proof","proofIndex","identifiers","Error","parseAnonCredsProof","request","result","referent","requested_attribute","Object","entries","requested_attributes","name","shared","requested_proof","revealed_attrs","sub_proof_index","sharedAttributes","push","value","raw","unresolvedAttributes","names","_proof$requested_proo","revealed_attr_groups","attributes","values","map","sharedAttributeGroups","unresolvedAttributeGroups","requestedPredicate","requested_predicates","predicates","resolvedPredicates","predicateType","p_type","predicateValue","p_value","unresolvedPredicates","groupSharedProofDataByCredential","data","Map","item","_result$get","has","cred_def_id","set","get","_result$get2","_result$get3","getProofData","agent","recordId","_data$request","_data$presentation","_data$request2","_data$presentation2","proofs","getFormatData","anoncreds","presentation","indy","undefined","isPresentationReceived","record","state","PresentationReceived","Done","isPresentationFailed","Abandoned","markProofAsViewed","metadata","customMetadata","details_seen","update","linkProofWithTemplate","templateId","proof_request_template_id"],"sourceRoot":"../../../src","sources":["utils/proof.ts"],"mappings":"AACA,SAAqCA,UAAU,QAAQ,gBAAgB;AAGvE,SAASC,aAAa,QAAQ,mBAAmB;AACjD,SACEC,yBAAyB,EAGzBC,oBAAoB,QACf,gBAAgB;;AAEvB;AACA;AACA;AACA,OAAO,MAAMC,mBAAmB,GAAGA,CAACC,KAAqB,EAAEC,UAAkB,KAAK;EAChF,MAAMC,WAAW,GAAGF,KAAK,CAACE,WAAW,CAACD,UAAU,CAAC;EACjD,IAAI,CAACC,WAAW,EAAE;IAChB,MAAM,IAAIC,KAAK,CAAC,yBAAyB,CAAC;EAC5C;EACA,OAAOD,WAAW;AACpB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAME,mBAAmB,GAAGA,CAACC,OAA8B,EAAEL,KAAqB,KAA2B;EAClH,MAAMM,MAAM,GAAG,IAAIR,oBAAoB,CAAC,CAA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,KAAKtE,UAAU,CAACwE,IAAI;AAC7F,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,oBAAoB,GAAIJ,MAA2B,IAAK;EACnE,OAAOA,MAAM,CAACC,KAAK,KAAKtE,UAAU,CAAC0E,SAAS;AAC9C,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAG,MAAAA,CAAOnB,KAAY,EAAEa,MAA2B,KAAK;EACpFA,MAAM,CAACO,QAAQ,CAACzB,GAAG,CAAClD,aAAa,CAAC4E,cAAc,EAAE;IAAE,GAAGR,MAAM,CAACO,QAAQ,CAAC/B,IAAI,CAACgC,cAAc;IAAEC,YAAY,EAAE;EAAK,CAAC,CAAC;EACjH,OAAOtB,KAAK,CAACM,MAAM,CAACiB,MAAM,CAACV,MAAM,CAAC;AACpC,CAAC;;AAED;AACA;AACA;AACA,OAAO,MAAMW,qBAAqB,GAAG,MAAAA,CAAOxB,KAAY,EAAEa,MAA2B,EAAEY,UAAkB,KAAK;EAC5GZ,MAAM,CAACO,QAAQ,CAACzB,GAAG,CAAClD,aAAa,CAAC4E,cAAc,EAAE;IAChD,GAAGR,MAAM,CAACO,QAAQ,CAAC/B,IAAI,CAACgC,cAAc;IACtCK,yBAAyB,EAAED;EAC7B,CAAC,CAAC;EACF,OAAOzB,KAAK,CAACM,MAAM,CAACiB,MAAM,CAACV,MAAM,CAAC;AACpC,CAAC","ignoreList":[]}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=proof-request.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proof-request.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/verifier/proof-request.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=proof.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proof.test.d.ts","sourceRoot":"","sources":["../../../../src/__tests__/verifier/proof.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,3 @@
1
+ export declare const protocolVersion = "v2";
2
+ export declare const domain = "didcomm://invite";
3
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,OAAO,CAAA;AACnC,eAAO,MAAM,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { ProofExchangeRecord } from '@credo-ts/core';
2
+ export declare const useProofsByTemplateId: (templateId: string) => ProofExchangeRecord[];
3
+ //# sourceMappingURL=proofs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proofs.d.ts","sourceRoot":"","sources":["../../../src/hooks/proofs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAMpD,eAAO,MAAM,qBAAqB,eAAgB,MAAM,KAAG,mBAAmB,EAa7E,CAAA"}
@@ -0,0 +1,11 @@
1
+ export { ProofRequestType } from './types/proof-reqeust-template';
2
+ export type { ProofRequestTemplate, DifProofRequestTemplatePayload, DifProofRequestTemplatePayloadData, AnonCredsProofRequestTemplatePayload, AnonCredsProofRequestTemplatePayloadData, AnonCredsRequestedAttribute, AnonCredsRequestedPredicate, } from './types/proof-reqeust-template';
3
+ export type { GroupedSharedProofData, GroupedSharedProofDataItem, CredentialSharedProofData, ParsedAnonCredsProof, UnresolvedPredicate, ResolvedPredicate, SharedAttributesGroup, SharedGroupedAttribute, SharedAttribute, MissingAttribute, } from './types/proof';
4
+ export type { ProofCustomMetadata } from './types/metadata';
5
+ export { ProofMetadata } from './types/metadata';
6
+ export { useProofsByTemplateId } from './hooks/proofs';
7
+ export { getProofIdentifiers, parseAnonCredsProof, groupSharedProofDataByCredential, getProofData, isPresentationReceived, isPresentationFailed, markProofAsViewed, linkProofWithTemplate, } from './utils/proof';
8
+ export type { CreateProofRequestInvitationResult, SendProofRequestResult } from './utils/proof-request';
9
+ export { findProofRequestMessage, buildProofRequestDataForTemplate, createConnectionlessProofRequestInvitation, sendProofRequest, hasPredicates, isParameterizable, } from './utils/proof-request';
10
+ export { getProofRequestTemplates } from './request-templates';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAA;AACjE,YAAY,EACV,oBAAoB,EACpB,8BAA8B,EAC9B,kCAAkC,EAClC,oCAAoC,EACpC,wCAAwC,EACxC,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,gCAAgC,CAAA;AACvC,YAAY,EACV,sBAAsB,EACtB,0BAA0B,EAC1B,yBAAyB,EACzB,oBAAoB,EACpB,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,sBAAsB,EACtB,eAAe,EACf,gBAAgB,GACjB,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAA;AAC3D,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,EACL,mBAAmB,EACnB,mBAAmB,EACnB,gCAAgC,EAChC,YAAY,EACZ,sBAAsB,EACtB,oBAAoB,EACpB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,eAAe,CAAA;AACtB,YAAY,EAAE,kCAAkC,EAAE,sBAAsB,EAAE,MAAM,uBAAuB,CAAA;AACvG,OAAO,EACL,uBAAuB,EACvB,gCAAgC,EAChC,0CAA0C,EAC1C,gBAAgB,EAChB,aAAa,EACb,iBAAiB,GAClB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,EAAE,wBAAwB,EAAE,MAAM,qBAAqB,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { ProofRequestTemplate } from './types/proof-reqeust-template';
2
+ export declare const getProofRequestTemplates: (useDevRestrictions: boolean) => ProofRequestTemplate[];
3
+ //# sourceMappingURL=request-templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-templates.d.ts","sourceRoot":"","sources":["../../src/request-templates.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAoB,MAAM,gCAAgC,CAAA;AAEvF,eAAO,MAAM,wBAAwB,uBAAwB,OAAO,2BA2DnE,CAAA"}
@@ -0,0 +1,12 @@
1
+ import { AnonCredsCredentialFormatService, AnonCredsModule, AnonCredsProofFormatService, DataIntegrityCredentialFormatService, LegacyIndyCredentialFormatService, LegacyIndyProofFormatService, V1CredentialProtocol, V1ProofProtocol } from '@credo-ts/anoncreds';
2
+ import { Agent, ConnectionsModule, CredentialsModule, DifPresentationExchangeProofFormatService, MediationRecipientModule, ProofsModule, V2CredentialProtocol, V2ProofProtocol } from '@credo-ts/core';
3
+ declare function getAgentModules(): {
4
+ anoncreds: AnonCredsModule;
5
+ connections: ConnectionsModule;
6
+ credentials: CredentialsModule<(V1CredentialProtocol | V2CredentialProtocol<(LegacyIndyCredentialFormatService | AnonCredsCredentialFormatService | DataIntegrityCredentialFormatService)[]>)[]>;
7
+ proofs: ProofsModule<(V1ProofProtocol | V2ProofProtocol<(LegacyIndyProofFormatService | AnonCredsProofFormatService | DifPresentationExchangeProofFormatService)[]>)[]>;
8
+ mediationRecipient: MediationRecipientModule;
9
+ };
10
+ export type BifoldAgent = Agent<ReturnType<typeof getAgentModules>>;
11
+ export {};
12
+ //# sourceMappingURL=agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent.d.ts","sourceRoot":"","sources":["../../../src/types/agent.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gCAAgC,EAChC,eAAe,EACf,2BAA2B,EAC3B,oCAAoC,EACpC,iCAAiC,EACjC,4BAA4B,EAC5B,oBAAoB,EACpB,eAAe,EAChB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EACL,KAAK,EACL,iBAAiB,EACjB,iBAAiB,EACjB,yCAAyC,EACzC,wBAAwB,EACxB,YAAY,EACZ,oBAAoB,EACpB,eAAe,EAChB,MAAM,gBAAgB,CAAA;AAEvB,iBAAS,eAAe,IACI;IAGxB,SAAS,EAAE,eAAe,CAAA;IAE1B,WAAW,EAAE,iBAAiB,CAAA;IAC9B,WAAW,EAAE,iBAAiB,CAC5B,CACI,oBAAoB,GACpB,oBAAoB,CAClB,CACI,iCAAiC,GACjC,gCAAgC,GAChC,oCAAoC,CACvC,EAAE,CACJ,CACJ,EAAE,CACJ,CAAA;IACD,MAAM,EAAE,YAAY,CAClB,CACI,eAAe,GACf,eAAe,CACb,CAAC,4BAA4B,GAAG,2BAA2B,GAAG,yCAAyC,CAAC,EAAE,CAC3G,CACJ,EAAE,CACJ,CAAA;IACD,kBAAkB,EAAE,wBAAwB,CAAA;CAC7C,CACF;AAED,MAAM,MAAM,WAAW,GAAG,KAAK,CAAC,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,CAAA"}
@@ -0,0 +1,9 @@
1
+ export declare enum ProofMetadata {
2
+ customMetadata = "customMetadata"
3
+ }
4
+ export interface ProofCustomMetadata {
5
+ details_seen?: boolean;
6
+ proof_request_template_id?: string;
7
+ delete_conn_after_seen?: boolean;
8
+ }
9
+ //# sourceMappingURL=metadata.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"metadata.d.ts","sourceRoot":"","sources":["../../../src/types/metadata.ts"],"names":[],"mappings":"AAAA,oBAAY,aAAa;IACvB,cAAc,mBAAmB;CAClC;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,CAAC,EAAE,OAAO,CAAA;IACtB,yBAAyB,CAAC,EAAE,MAAM,CAAA;IAClC,sBAAsB,CAAC,EAAE,OAAO,CAAA;CACjC"}
@@ -0,0 +1,48 @@
1
+ import { AnonCredsNonRevokedInterval, AnonCredsPredicateType, AnonCredsProofRequestRestriction } from '@credo-ts/anoncreds';
2
+ export interface AnonCredsRequestedPredicate {
3
+ label?: string;
4
+ name: string;
5
+ predicateType: AnonCredsPredicateType;
6
+ predicateValue: number;
7
+ restrictions?: AnonCredsProofRequestRestriction[];
8
+ devRestrictions?: AnonCredsProofRequestRestriction[];
9
+ nonRevoked?: AnonCredsNonRevokedInterval;
10
+ parameterizable?: boolean;
11
+ }
12
+ export interface AnonCredsRequestedAttribute {
13
+ label?: string;
14
+ name?: string;
15
+ names?: Array<string>;
16
+ restrictions?: AnonCredsProofRequestRestriction[];
17
+ devRestrictions?: AnonCredsProofRequestRestriction[];
18
+ revealed?: boolean;
19
+ nonRevoked?: AnonCredsNonRevokedInterval;
20
+ }
21
+ export interface AnonCredsProofRequestTemplatePayloadData {
22
+ schema: string;
23
+ requestedAttributes?: Array<AnonCredsRequestedAttribute>;
24
+ requestedPredicates?: Array<AnonCredsRequestedPredicate>;
25
+ }
26
+ export declare enum ProofRequestType {
27
+ AnonCreds = "anoncreds",
28
+ DIF = "dif"
29
+ }
30
+ export interface AnonCredsProofRequestTemplatePayload {
31
+ type: ProofRequestType.AnonCreds;
32
+ data: Array<AnonCredsProofRequestTemplatePayloadData>;
33
+ }
34
+ export interface DifProofRequestTemplatePayloadData {
35
+ }
36
+ export interface DifProofRequestTemplatePayload {
37
+ type: ProofRequestType.DIF;
38
+ data: Array<DifProofRequestTemplatePayloadData>;
39
+ }
40
+ export interface ProofRequestTemplate {
41
+ id: string;
42
+ name: string;
43
+ description: string;
44
+ version: string;
45
+ devOnly?: boolean;
46
+ payload: AnonCredsProofRequestTemplatePayload | DifProofRequestTemplatePayload;
47
+ }
48
+ //# sourceMappingURL=proof-reqeust-template.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proof-reqeust-template.d.ts","sourceRoot":"","sources":["../../../src/types/proof-reqeust-template.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,sBAAsB,EACtB,gCAAgC,EACjC,MAAM,qBAAqB,CAAA;AAE5B,MAAM,WAAW,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E,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,OAAO,EAAE,oCAAoC,GAAG,8BAA8B,CAAA;CAC/E"}
@@ -0,0 +1,51 @@
1
+ import { AnonCredsProof } from '@credo-ts/anoncreds';
2
+ type AnonCredsProofIdentifier = AnonCredsProof['identifiers'][number];
3
+ export interface MissingAttribute {
4
+ name: string;
5
+ }
6
+ export interface SharedAttribute {
7
+ name: string;
8
+ value: string;
9
+ identifiers: AnonCredsProofIdentifier;
10
+ }
11
+ export interface SharedGroupedAttribute {
12
+ name: string;
13
+ value: string;
14
+ }
15
+ export interface SharedAttributesGroup {
16
+ attributes: Array<SharedGroupedAttribute>;
17
+ identifiers: AnonCredsProofIdentifier;
18
+ }
19
+ export interface ResolvedPredicate {
20
+ name: string;
21
+ predicateType: string;
22
+ predicateValue: number;
23
+ identifiers: AnonCredsProofIdentifier;
24
+ }
25
+ export interface UnresolvedPredicate {
26
+ name: string;
27
+ predicateType: string;
28
+ predicateValue: number;
29
+ }
30
+ export declare class ParsedAnonCredsProof {
31
+ sharedAttributes: Array<SharedAttribute>;
32
+ sharedAttributeGroups: Array<SharedAttributesGroup>;
33
+ resolvedPredicates: Array<ResolvedPredicate>;
34
+ unresolvedAttributes: Array<MissingAttribute>;
35
+ unresolvedAttributeGroups: Array<Array<MissingAttribute>>;
36
+ unresolvedPredicates: Array<UnresolvedPredicate>;
37
+ constructor();
38
+ }
39
+ export declare class CredentialSharedProofData {
40
+ sharedAttributes: Array<SharedAttribute>;
41
+ sharedAttributeGroups: Array<SharedAttributesGroup>;
42
+ resolvedPredicates: Array<ResolvedPredicate>;
43
+ constructor();
44
+ }
45
+ export type GroupedSharedProofDataItem = {
46
+ data: CredentialSharedProofData;
47
+ identifiers: AnonCredsProofIdentifier;
48
+ };
49
+ export type GroupedSharedProofData = Map<string, GroupedSharedProofDataItem>;
50
+ export {};
51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AAK,CAAC,mBAAmB,CAAC,CAAA;;CAUxD;AAED,qBAAa,yBAAyB;IAC7B,gBAAgB,EAAE,KAAK,CAAC,eAAe,CAAC,CAAA;IACxC,qBAAqB,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACnD,kBAAkB,EAAE,KAAK,CAAC,iBAAiB,CAAC,CAAA;;CAOpD;AAED,MAAM,MAAM,0BAA0B,GAAG;IAAE,IAAI,EAAE,yBAAyB,CAAC;IAAC,WAAW,EAAE,wBAAwB,CAAA;CAAE,CAAA;AACnH,MAAM,MAAM,sBAAsB,GAAG,GAAG,CAAC,MAAM,EAAE,0BAA0B,CAAC,CAAA"}
@@ -0,0 +1,30 @@
1
+ import { AnonCredsRequestedAttribute, AnonCredsRequestedPredicate, LegacyIndyProofRequest } from '@credo-ts/anoncreds';
2
+ import { Agent, AgentMessage, ProofExchangeRecord } from '@credo-ts/core';
3
+ import { BifoldAgent } from '../types/agent';
4
+ import { ProofRequestTemplate } from '../types/proof-reqeust-template';
5
+ export declare const findProofRequestMessage: (agent: Agent, id: string) => Promise<LegacyIndyProofRequest | undefined>;
6
+ export declare const buildProofRequestDataForTemplate: (template: ProofRequestTemplate, customValues?: Record<string, Record<string, number>>) => {
7
+ anoncreds: {
8
+ name: string;
9
+ version: string;
10
+ nonce: string;
11
+ requested_attributes: Record<string, AnonCredsRequestedAttribute>;
12
+ requested_predicates: Record<string, AnonCredsRequestedPredicate>;
13
+ };
14
+ } | {
15
+ anoncreds?: undefined;
16
+ } | undefined;
17
+ export interface CreateProofRequestInvitationResult {
18
+ request: AgentMessage;
19
+ proofRecord: ProofExchangeRecord;
20
+ invitation: AgentMessage;
21
+ invitationUrl: string;
22
+ }
23
+ export declare const createConnectionlessProofRequestInvitation: (agent: BifoldAgent, template: ProofRequestTemplate, customPredicateValues?: Record<string, Record<string, number>>) => Promise<CreateProofRequestInvitationResult | undefined>;
24
+ export interface SendProofRequestResult {
25
+ proofRecord: ProofExchangeRecord;
26
+ }
27
+ export declare const sendProofRequest: (agent: BifoldAgent, template: ProofRequestTemplate, connectionId: string, customPredicateValues?: Record<string, Record<string, number>>) => Promise<SendProofRequestResult | undefined>;
28
+ export declare const hasPredicates: (record: ProofRequestTemplate) => boolean;
29
+ export declare const isParameterizable: (record: ProofRequestTemplate) => boolean;
30
+ //# sourceMappingURL=proof-request.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proof-request.d.ts","sourceRoot":"","sources":["../../../src/utils/proof-request.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,EAC3B,sBAAsB,EAEvB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,KAAK,EAAE,YAAY,EAAmB,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAE1F,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,oBAAoB,EAAoB,MAAM,iCAAiC,CAAA;AAQxF,eAAO,MAAM,uBAAuB,UAC3B,KAAK,MACR,MAAM,KACT,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAO5C,CAAA;AAQD,eAAO,MAAM,gCAAgC,aACjC,oBAAoB,iBACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;;;;;;;;;;aAiDtD,CAAA;AAED,MAAM,WAAW,kCAAkC;IACjD,OAAO,EAAE,YAAY,CAAA;IACrB,WAAW,EAAE,mBAAmB,CAAA;IAChC,UAAU,EAAE,YAAY,CAAA;IACxB,aAAa,EAAE,MAAM,CAAA;CACtB;AAKD,eAAO,MAAM,0CAA0C,UAC9C,WAAW,YACR,oBAAoB,0BACN,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAC7D,OAAO,CAAC,kCAAkC,GAAG,SAAS,CAqBxD,CAAA;AAED,MAAM,WAAW,sBAAsB;IACrC,WAAW,EAAE,mBAAmB,CAAA;CACjC;AAKD,eAAO,MAAM,gBAAgB,UACpB,WAAW,YACR,oBAAoB,gBAChB,MAAM,0BACI,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,KAC7D,OAAO,CAAC,sBAAsB,GAAG,SAAS,CAa5C,CAAA;AAKD,eAAO,MAAM,aAAa,WAAY,oBAAoB,KAAG,OAQ5D,CAAA;AAKD,eAAO,MAAM,iBAAiB,WAAY,oBAAoB,KAAG,OAQhE,CAAA"}
@@ -0,0 +1,18 @@
1
+ import { AnonCredsProof, AnonCredsProofRequest } from '@credo-ts/anoncreds';
2
+ import { Agent, ProofExchangeRecord } from '@credo-ts/core';
3
+ import { BifoldAgent } from '../types/agent';
4
+ import { GroupedSharedProofData, ParsedAnonCredsProof } from '../types/proof';
5
+ export declare const getProofIdentifiers: (proof: AnonCredsProof, proofIndex: number) => {
6
+ schema_id: string;
7
+ cred_def_id: string;
8
+ rev_reg_id?: string;
9
+ timestamp?: number;
10
+ };
11
+ export declare const parseAnonCredsProof: (request: AnonCredsProofRequest, proof: AnonCredsProof) => ParsedAnonCredsProof;
12
+ export declare const groupSharedProofDataByCredential: (data: ParsedAnonCredsProof) => GroupedSharedProofData;
13
+ export declare const getProofData: (agent: BifoldAgent, recordId: string) => Promise<ParsedAnonCredsProof | undefined>;
14
+ export declare const isPresentationReceived: (record: ProofExchangeRecord) => boolean;
15
+ export declare const isPresentationFailed: (record: ProofExchangeRecord) => boolean;
16
+ export declare const markProofAsViewed: (agent: Agent, record: ProofExchangeRecord) => Promise<void>;
17
+ export declare const linkProofWithTemplate: (agent: Agent, record: ProofExchangeRecord, templateId: string) => Promise<void>;
18
+ //# sourceMappingURL=proof.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"proof.d.ts","sourceRoot":"","sources":["../../../src/utils/proof.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAA;AAC3E,OAAO,EAAE,KAAK,EAAE,mBAAmB,EAAc,MAAM,gBAAgB,CAAA;AAEvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAE5C,OAAO,EAEL,sBAAsB,EAEtB,oBAAoB,EACrB,MAAM,gBAAgB,CAAA;AAKvB,eAAO,MAAM,mBAAmB,UAAW,cAAc,cAAc,MAAM;;;;;CAM5E,CAAA;AAWD,eAAO,MAAM,mBAAmB,YAAa,qBAAqB,SAAS,cAAc,KAAG,oBA0D3F,CAAA;AAKD,eAAO,MAAM,gCAAgC,SAAU,oBAAoB,KAAG,sBA8B7E,CAAA;AAKD,eAAO,MAAM,YAAY,UAAiB,WAAW,YAAY,MAAM,KAAG,OAAO,CAAC,oBAAoB,GAAG,SAAS,CASjH,CAAA;AAKD,eAAO,MAAM,sBAAsB,WAAY,mBAAmB,YAEjE,CAAA;AAKD,eAAO,MAAM,oBAAoB,WAAY,mBAAmB,YAE/D,CAAA;AAKD,eAAO,MAAM,iBAAiB,UAAiB,KAAK,UAAU,mBAAmB,kBAGhF,CAAA;AAKD,eAAO,MAAM,qBAAqB,UAAiB,KAAK,UAAU,mBAAmB,cAAc,MAAM,kBAMxG,CAAA"}
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@bifold/verifier",
3
+ "version": "1.0.0",
4
+ "main": "build/commonjs/index.js",
5
+ "types": "build/typescript/index.d.ts",
6
+ "module": "build/module/index.js",
7
+ "source": "src/index.ts",
8
+ "react-native": "src/index.ts",
9
+ "files": [
10
+ "src",
11
+ "build"
12
+ ],
13
+ "repository": {
14
+ "type": "git",
15
+ "url": "git+https://github.com/openwallet-foundation/bifold-wallet.git",
16
+ "directory": "packages/verifier"
17
+ },
18
+ "homepage": "https://github.com/openwallet-foundation/bifold-wallet",
19
+ "scripts": {
20
+ "build": "echo 'building verifier 🏗️' && yarn run clean && yarn run bob build && echo 'verifier built ✅'",
21
+ "clean": "rimraf ./build",
22
+ "test": "TZ=GMT jest",
23
+ "test:watch": "TZ=GMT jest --watch",
24
+ "coverage": "TZ=GMT jest --coverage"
25
+ },
26
+ "devDependencies": {
27
+ "@babel/core": "^7.20.0",
28
+ "@credo-ts/anoncreds": "0.5.13",
29
+ "@credo-ts/core": "0.5.13",
30
+ "@credo-ts/react-hooks": "^0.6.0",
31
+ "@hyperledger/anoncreds-shared": "0.2.4",
32
+ "@react-native/babel-preset": "0.73.21",
33
+ "@types/jest": "^29.5.5",
34
+ "@types/react": "^18.2.6",
35
+ "babel-jest": "^27.5.1",
36
+ "eslint": "^8.48.0",
37
+ "jest": "^29.6.4",
38
+ "react": "^18.2.0",
39
+ "react-native-builder-bob": "^0.21.3",
40
+ "rimraf": "^5.0.0",
41
+ "typescript": "^5.0.4"
42
+ },
43
+ "peerDependencies": {
44
+ "@credo-ts/anoncreds": "0.5.13",
45
+ "@credo-ts/core": "0.5.13",
46
+ "@credo-ts/react-hooks": "^0.6.0",
47
+ "@hyperledger/anoncreds-shared": "0.2.4",
48
+ "react": "^18.2.0"
49
+ },
50
+ "react-native-builder-bob": {
51
+ "source": "src",
52
+ "output": "build",
53
+ "targets": [
54
+ "commonjs",
55
+ "module",
56
+ "typescript"
57
+ ]
58
+ }
59
+ }
package/src/README.md ADDED
@@ -0,0 +1,4 @@
1
+ ## Verifier Module
2
+
3
+ This folder contains set of helpers, type definitions, and constants allowing to add verifier capability into Aries Mobile Agent React Native.
4
+ The folder is created to encourage the upcoming split of the project into sub packages.
@@ -0,0 +1,72 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Helpers Build anoncreds proof request from template containing two requested attributes 1`] = `
4
+ Object {
5
+ "anoncreds": Object {
6
+ "name": "Student full name",
7
+ "nonce": "1677766511505",
8
+ "requested_attributes": Object {
9
+ "referent_0": Object {
10
+ "name": "student_first_name",
11
+ "names": undefined,
12
+ "non_revoked": undefined,
13
+ "restrictions": Array [
14
+ Object {
15
+ "cred_def_id": "XUxBrVSALWHLeycAUhrNr9:3:CL:26293:student_card",
16
+ },
17
+ ],
18
+ },
19
+ "referent_1": Object {
20
+ "name": "student_last_name",
21
+ "names": undefined,
22
+ "non_revoked": undefined,
23
+ "restrictions": Array [
24
+ Object {
25
+ "cred_def_id": "XUxBrVSALWHLeycAUhrNr9:3:CL:26293:student_card",
26
+ },
27
+ ],
28
+ },
29
+ },
30
+ "requested_predicates": Object {},
31
+ "version": "0.0.1",
32
+ },
33
+ }
34
+ `;
35
+
36
+ exports[`Helpers Build anoncreds proof request from template containing two requested attributes and predicate 1`] = `
37
+ Object {
38
+ "anoncreds": Object {
39
+ "name": "Student full name and expiration date",
40
+ "nonce": "1677766511505",
41
+ "requested_attributes": Object {
42
+ "referent_0": Object {
43
+ "name": undefined,
44
+ "names": Array [
45
+ "student_first_name",
46
+ "student_last_name",
47
+ ],
48
+ "non_revoked": undefined,
49
+ "restrictions": Array [
50
+ Object {
51
+ "cred_def_id": "XUxBrVSALWHLeycAUhrNr9:3:CL:26293:student_card",
52
+ },
53
+ ],
54
+ },
55
+ },
56
+ "requested_predicates": Object {
57
+ "referent_1": Object {
58
+ "name": "expiry_date",
59
+ "non_revoked": undefined,
60
+ "p_type": ">=",
61
+ "p_value": 20240101,
62
+ "restrictions": Array [
63
+ Object {
64
+ "cred_def_id": "XUxBrVSALWHLeycAUhrNr9:3:CL:26293:student_card",
65
+ },
66
+ ],
67
+ },
68
+ },
69
+ "version": "0.0.1",
70
+ },
71
+ }
72
+ `;