@hyperledger/anoncreds-shared 0.1.0-dev.8 → 0.1.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.
- package/build/Anoncreds.d.ts +20 -14
- package/build/AnoncredsObject.d.ts +2 -1
- package/build/AnoncredsObject.js +1 -1
- package/build/AnoncredsObject.js.map +1 -1
- package/build/api/Credential.d.ts +19 -19
- package/build/api/Credential.js +77 -23
- package/build/api/Credential.js.map +1 -1
- package/build/api/CredentialDefinition.d.ts +4 -3
- package/build/api/CredentialDefinition.js +26 -13
- package/build/api/CredentialDefinition.js.map +1 -1
- package/build/api/CredentialDefinitionPrivate.d.ts +2 -1
- package/build/api/CredentialDefinitionPrivate.js +2 -2
- package/build/api/CredentialDefinitionPrivate.js.map +1 -1
- package/build/api/CredentialOffer.d.ts +4 -3
- package/build/api/CredentialOffer.js +21 -7
- package/build/api/CredentialOffer.js.map +1 -1
- package/build/api/CredentialRequest.d.ts +9 -8
- package/build/api/CredentialRequest.js +29 -11
- package/build/api/CredentialRequest.js.map +1 -1
- package/build/api/CredentialRequestMetadata.d.ts +2 -1
- package/build/api/CredentialRequestMetadata.js +2 -2
- package/build/api/CredentialRequestMetadata.js.map +1 -1
- package/build/api/CredentialRevocationConfig.d.ts +1 -0
- package/build/api/CredentialRevocationConfig.js +4 -0
- package/build/api/CredentialRevocationConfig.js.map +1 -1
- package/build/api/CredentialRevocationState.d.ts +7 -7
- package/build/api/CredentialRevocationState.js +29 -11
- package/build/api/CredentialRevocationState.js.map +1 -1
- package/build/api/KeyCorrectnessProof.d.ts +2 -1
- package/build/api/KeyCorrectnessProof.js +2 -2
- package/build/api/KeyCorrectnessProof.js.map +1 -1
- package/build/api/LinkSecret.d.ts +3 -0
- package/build/api/LinkSecret.js +11 -0
- package/build/api/LinkSecret.js.map +1 -0
- package/build/api/Presentation.d.ts +26 -20
- package/build/api/Presentation.js +79 -34
- package/build/api/Presentation.js.map +1 -1
- package/build/api/PresentationRequest.d.ts +2 -1
- package/build/api/PresentationRequest.js +2 -2
- package/build/api/PresentationRequest.js.map +1 -1
- package/build/api/RevocationRegistry.d.ts +2 -1
- package/build/api/RevocationRegistry.js +2 -2
- package/build/api/RevocationRegistry.js.map +1 -1
- package/build/api/RevocationRegistryDefinition.d.ts +4 -3
- package/build/api/RevocationRegistryDefinition.js +18 -5
- package/build/api/RevocationRegistryDefinition.js.map +1 -1
- package/build/api/RevocationRegistryDefinitionPrivate.d.ts +2 -1
- package/build/api/RevocationRegistryDefinitionPrivate.js +2 -2
- package/build/api/RevocationRegistryDefinitionPrivate.js.map +1 -1
- package/build/api/RevocationStatusList.d.ts +6 -3
- package/build/api/RevocationStatusList.js +28 -5
- package/build/api/RevocationStatusList.js.map +1 -1
- package/build/api/Schema.d.ts +2 -1
- package/build/api/Schema.js +2 -2
- package/build/api/Schema.js.map +1 -1
- package/build/api/index.d.ts +1 -2
- package/build/api/index.js +1 -2
- package/build/api/index.js.map +1 -1
- package/build/api/utils.d.ts +1 -0
- package/build/api/utils.js +6 -0
- package/build/api/utils.js.map +1 -0
- package/build/error.d.ts +4 -0
- package/build/error.js +11 -1
- package/build/error.js.map +1 -1
- package/build/types.d.ts +1 -0
- package/package.json +2 -2
- package/build/api/MasterSecret.d.ts +0 -5
- package/build/api/MasterSecret.js +0 -15
- package/build/api/MasterSecret.js.map +0 -1
- package/build/api/RevocationRegistryDelta.d.ts +0 -4
- package/build/api/RevocationRegistryDelta.js +0 -12
- package/build/api/RevocationRegistryDelta.js.map +0 -1
package/build/Anoncreds.d.ts
CHANGED
|
@@ -10,6 +10,11 @@ export declare type NativeCredentialProve = {
|
|
|
10
10
|
isPredicate: boolean;
|
|
11
11
|
reveal: boolean;
|
|
12
12
|
};
|
|
13
|
+
export declare type NativeNonRevokedIntervalOverride = {
|
|
14
|
+
revocationRegistryDefinitionId: string;
|
|
15
|
+
requestedFromTimestamp: number;
|
|
16
|
+
overrideRevocationStatusListTimestamp: number;
|
|
17
|
+
};
|
|
13
18
|
export declare type NativeRevocationEntry = {
|
|
14
19
|
revocationRegistryDefinitionEntryIndex: number;
|
|
15
20
|
entry: ObjectHandle;
|
|
@@ -24,6 +29,7 @@ export declare type NativeCredentialRevocationConfig = {
|
|
|
24
29
|
export interface Anoncreds {
|
|
25
30
|
version(): string;
|
|
26
31
|
getCurrentError(): string;
|
|
32
|
+
setDefaultLogger(): void;
|
|
27
33
|
generateNonce(): string;
|
|
28
34
|
createSchema(options: {
|
|
29
35
|
name: string;
|
|
@@ -41,7 +47,7 @@ export interface Anoncreds {
|
|
|
41
47
|
}): {
|
|
42
48
|
credentialDefinition: ObjectHandle;
|
|
43
49
|
credentialDefinitionPrivate: ObjectHandle;
|
|
44
|
-
|
|
50
|
+
keyCorrectnessProof: ObjectHandle;
|
|
45
51
|
};
|
|
46
52
|
createCredential(options: {
|
|
47
53
|
credentialDefinition: ObjectHandle;
|
|
@@ -60,32 +66,33 @@ export interface Anoncreds {
|
|
|
60
66
|
processCredential(options: {
|
|
61
67
|
credential: ObjectHandle;
|
|
62
68
|
credentialRequestMetadata: ObjectHandle;
|
|
63
|
-
|
|
69
|
+
linkSecret: string;
|
|
64
70
|
credentialDefinition: ObjectHandle;
|
|
65
71
|
revocationRegistryDefinition?: ObjectHandle;
|
|
66
72
|
}): ObjectHandle;
|
|
67
73
|
createCredentialOffer(options: {
|
|
68
74
|
schemaId: string;
|
|
69
75
|
credentialDefinitionId: string;
|
|
70
|
-
|
|
76
|
+
keyCorrectnessProof: ObjectHandle;
|
|
71
77
|
}): ObjectHandle;
|
|
72
78
|
createCredentialRequest(options: {
|
|
79
|
+
entropy?: string;
|
|
73
80
|
proverDid?: string;
|
|
74
81
|
credentialDefinition: ObjectHandle;
|
|
75
|
-
|
|
76
|
-
|
|
82
|
+
linkSecret: string;
|
|
83
|
+
linkSecretId: string;
|
|
77
84
|
credentialOffer: ObjectHandle;
|
|
78
85
|
}): {
|
|
79
86
|
credentialRequest: ObjectHandle;
|
|
80
87
|
credentialRequestMetadata: ObjectHandle;
|
|
81
88
|
};
|
|
82
|
-
|
|
89
|
+
createLinkSecret(): string;
|
|
83
90
|
createPresentation(options: {
|
|
84
91
|
presentationRequest: ObjectHandle;
|
|
85
92
|
credentials: NativeCredentialEntry[];
|
|
86
93
|
credentialsProve: NativeCredentialProve[];
|
|
87
94
|
selfAttest: Record<string, string>;
|
|
88
|
-
|
|
95
|
+
linkSecret: string;
|
|
89
96
|
schemas: Record<string, ObjectHandle>;
|
|
90
97
|
credentialDefinitions: Record<string, ObjectHandle>;
|
|
91
98
|
}): ObjectHandle;
|
|
@@ -99,6 +106,7 @@ export interface Anoncreds {
|
|
|
99
106
|
revocationRegistryDefinitions?: ObjectHandle[];
|
|
100
107
|
revocationRegistryDefinitionIds?: string[];
|
|
101
108
|
revocationStatusLists?: ObjectHandle[];
|
|
109
|
+
nonRevokedIntervalOverrides?: NativeNonRevokedIntervalOverride[];
|
|
102
110
|
}): boolean;
|
|
103
111
|
createRevocationRegistryDefinition(options: {
|
|
104
112
|
credentialDefinition: ObjectHandle;
|
|
@@ -117,12 +125,13 @@ export interface Anoncreds {
|
|
|
117
125
|
revocationStatusList: ObjectHandle;
|
|
118
126
|
revocationRegistryIndex: number;
|
|
119
127
|
tailsPath: string;
|
|
120
|
-
|
|
128
|
+
oldRevocationState?: ObjectHandle;
|
|
121
129
|
oldRevocationStatusList?: ObjectHandle;
|
|
122
130
|
}): ObjectHandle;
|
|
123
131
|
createRevocationStatusList(options: {
|
|
124
132
|
revocationRegistryDefinitionId: string;
|
|
125
133
|
revocationRegistryDefinition: ObjectHandle;
|
|
134
|
+
issuerId: string;
|
|
126
135
|
timestamp?: number;
|
|
127
136
|
issuanceByDefault: boolean;
|
|
128
137
|
}): ObjectHandle;
|
|
@@ -154,6 +163,9 @@ export interface Anoncreds {
|
|
|
154
163
|
revocationRegistryFromJson(options: {
|
|
155
164
|
json: string;
|
|
156
165
|
}): ObjectHandle;
|
|
166
|
+
revocationStatusListFromJson(options: {
|
|
167
|
+
json: string;
|
|
168
|
+
}): ObjectHandle;
|
|
157
169
|
presentationFromJson(options: {
|
|
158
170
|
json: string;
|
|
159
171
|
}): ObjectHandle;
|
|
@@ -163,9 +175,6 @@ export interface Anoncreds {
|
|
|
163
175
|
schemaFromJson(options: {
|
|
164
176
|
json: string;
|
|
165
177
|
}): ObjectHandle;
|
|
166
|
-
masterSecretFromJson(options: {
|
|
167
|
-
json: string;
|
|
168
|
-
}): ObjectHandle;
|
|
169
178
|
credentialRequestFromJson(options: {
|
|
170
179
|
json: string;
|
|
171
180
|
}): ObjectHandle;
|
|
@@ -178,9 +187,6 @@ export interface Anoncreds {
|
|
|
178
187
|
revocationRegistryDefinitionPrivateFromJson(options: {
|
|
179
188
|
json: string;
|
|
180
189
|
}): ObjectHandle;
|
|
181
|
-
revocationRegistryDeltaFromJson(options: {
|
|
182
|
-
json: string;
|
|
183
|
-
}): ObjectHandle;
|
|
184
190
|
revocationStateFromJson(options: {
|
|
185
191
|
json: string;
|
|
186
192
|
}): ObjectHandle;
|
package/build/AnoncredsObject.js
CHANGED
|
@@ -8,7 +8,7 @@ class AnoncredsObject {
|
|
|
8
8
|
this.handle = new ObjectHandle_1.ObjectHandle(handle);
|
|
9
9
|
}
|
|
10
10
|
toJson() {
|
|
11
|
-
return register_1.anoncreds.getJson({ objectHandle: this.handle });
|
|
11
|
+
return JSON.parse(register_1.anoncreds.getJson({ objectHandle: this.handle }));
|
|
12
12
|
}
|
|
13
13
|
}
|
|
14
14
|
exports.AnoncredsObject = AnoncredsObject;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnoncredsObject.js","sourceRoot":"","sources":["../src/AnoncredsObject.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"AnoncredsObject.js","sourceRoot":"","sources":["../src/AnoncredsObject.ts"],"names":[],"mappings":";;;AAEA,iDAA6C;AAC7C,yCAAsC;AAEtC,MAAa,eAAe;IAG1B,YAAmB,MAAc;QAC/B,IAAI,CAAC,MAAM,GAAG,IAAI,2BAAY,CAAC,MAAM,CAAC,CAAA;IACxC,CAAC;IAEM,MAAM;QACX,OAAO,IAAI,CAAC,KAAK,CAAC,oBAAS,CAAC,OAAO,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,MAAM,EAAE,CAAC,CAAe,CAAA;IACnF,CAAC;CACF;AAVD,0CAUC"}
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CredentialDefinitionPrivate } from './CredentialDefinitionPrivate';
|
|
3
|
-
import type { CredentialOffer } from './CredentialOffer';
|
|
4
|
-
import type { CredentialRequest } from './CredentialRequest';
|
|
5
|
-
import type { CredentialRequestMetadata } from './CredentialRequestMetadata';
|
|
1
|
+
import type { JsonObject } from '../types';
|
|
6
2
|
import type { CredentialRevocationConfig } from './CredentialRevocationConfig';
|
|
7
|
-
import type { MasterSecret } from './MasterSecret';
|
|
8
|
-
import type { RevocationRegistryDefinition } from './RevocationRegistryDefinition';
|
|
9
|
-
import type { RevocationStatusList } from './RevocationStatusList';
|
|
10
3
|
import { AnoncredsObject } from '../AnoncredsObject';
|
|
4
|
+
import { CredentialDefinition } from './CredentialDefinition';
|
|
5
|
+
import { CredentialDefinitionPrivate } from './CredentialDefinitionPrivate';
|
|
6
|
+
import { CredentialOffer } from './CredentialOffer';
|
|
7
|
+
import { CredentialRequest } from './CredentialRequest';
|
|
8
|
+
import { CredentialRequestMetadata } from './CredentialRequestMetadata';
|
|
9
|
+
import { RevocationRegistryDefinition } from './RevocationRegistryDefinition';
|
|
10
|
+
import { RevocationStatusList } from './RevocationStatusList';
|
|
11
11
|
export declare type CreateCredentialOptions = {
|
|
12
|
-
credentialDefinition: CredentialDefinition;
|
|
13
|
-
credentialDefinitionPrivate: CredentialDefinitionPrivate;
|
|
14
|
-
credentialOffer: CredentialOffer;
|
|
15
|
-
credentialRequest: CredentialRequest;
|
|
12
|
+
credentialDefinition: CredentialDefinition | JsonObject;
|
|
13
|
+
credentialDefinitionPrivate: CredentialDefinitionPrivate | JsonObject;
|
|
14
|
+
credentialOffer: CredentialOffer | JsonObject;
|
|
15
|
+
credentialRequest: CredentialRequest | JsonObject;
|
|
16
16
|
attributeRawValues: Record<string, string>;
|
|
17
17
|
attributeEncodedValues?: Record<string, string>;
|
|
18
18
|
revocationRegistryId?: string;
|
|
19
19
|
revocationConfiguration?: CredentialRevocationConfig;
|
|
20
|
-
revocationStatusList?: RevocationStatusList;
|
|
20
|
+
revocationStatusList?: RevocationStatusList | JsonObject;
|
|
21
21
|
};
|
|
22
22
|
export declare type ProcessCredentialOptions = {
|
|
23
|
-
credentialRequestMetadata: CredentialRequestMetadata;
|
|
24
|
-
|
|
25
|
-
credentialDefinition: CredentialDefinition;
|
|
26
|
-
revocationRegistryDefinition?: RevocationRegistryDefinition;
|
|
23
|
+
credentialRequestMetadata: CredentialRequestMetadata | JsonObject;
|
|
24
|
+
linkSecret: string;
|
|
25
|
+
credentialDefinition: CredentialDefinition | JsonObject;
|
|
26
|
+
revocationRegistryDefinition?: RevocationRegistryDefinition | JsonObject;
|
|
27
27
|
};
|
|
28
28
|
export declare class Credential extends AnoncredsObject {
|
|
29
29
|
static create(options: CreateCredentialOptions): Credential;
|
|
30
|
-
static
|
|
31
|
-
process(options: ProcessCredentialOptions):
|
|
30
|
+
static fromJson(json: JsonObject): Credential;
|
|
31
|
+
process(options: ProcessCredentialOptions): this;
|
|
32
32
|
get schemaId(): string;
|
|
33
33
|
get credentialDefinitionId(): string;
|
|
34
34
|
get revocationRegistryId(): string;
|
package/build/api/Credential.js
CHANGED
|
@@ -3,35 +3,89 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.Credential = void 0;
|
|
4
4
|
const AnoncredsObject_1 = require("../AnoncredsObject");
|
|
5
5
|
const register_1 = require("../register");
|
|
6
|
+
const CredentialDefinition_1 = require("./CredentialDefinition");
|
|
7
|
+
const CredentialDefinitionPrivate_1 = require("./CredentialDefinitionPrivate");
|
|
8
|
+
const CredentialOffer_1 = require("./CredentialOffer");
|
|
9
|
+
const CredentialRequest_1 = require("./CredentialRequest");
|
|
10
|
+
const CredentialRequestMetadata_1 = require("./CredentialRequestMetadata");
|
|
11
|
+
const RevocationRegistryDefinition_1 = require("./RevocationRegistryDefinition");
|
|
12
|
+
const RevocationStatusList_1 = require("./RevocationStatusList");
|
|
13
|
+
const utils_1 = require("./utils");
|
|
6
14
|
class Credential extends AnoncredsObject_1.AnoncredsObject {
|
|
7
15
|
static create(options) {
|
|
8
|
-
var _a
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
var _a;
|
|
17
|
+
let credential;
|
|
18
|
+
// Objects created within this method must be freed up
|
|
19
|
+
const objectHandles = [];
|
|
20
|
+
try {
|
|
21
|
+
const credentialDefinition = options.credentialDefinition instanceof CredentialDefinition_1.CredentialDefinition
|
|
22
|
+
? options.credentialDefinition.handle
|
|
23
|
+
: (0, utils_1.pushToArray)(CredentialDefinition_1.CredentialDefinition.fromJson(options.credentialDefinition).handle, objectHandles);
|
|
24
|
+
const credentialDefinitionPrivate = options.credentialDefinitionPrivate instanceof CredentialDefinitionPrivate_1.CredentialDefinitionPrivate
|
|
25
|
+
? options.credentialDefinitionPrivate.handle
|
|
26
|
+
: (0, utils_1.pushToArray)(CredentialDefinitionPrivate_1.CredentialDefinitionPrivate.fromJson(options.credentialDefinitionPrivate).handle, objectHandles);
|
|
27
|
+
const credentialOffer = options.credentialOffer instanceof CredentialOffer_1.CredentialOffer
|
|
28
|
+
? options.credentialOffer.handle
|
|
29
|
+
: (0, utils_1.pushToArray)(CredentialOffer_1.CredentialOffer.fromJson(options.credentialOffer).handle, objectHandles);
|
|
30
|
+
const credentialRequest = options.credentialRequest instanceof CredentialRequest_1.CredentialRequest
|
|
31
|
+
? options.credentialRequest.handle
|
|
32
|
+
: (0, utils_1.pushToArray)(CredentialRequest_1.CredentialRequest.fromJson(options.credentialRequest).handle, objectHandles);
|
|
33
|
+
const revocationStatusList = options.revocationStatusList instanceof RevocationStatusList_1.RevocationStatusList
|
|
34
|
+
? options.revocationStatusList.handle
|
|
35
|
+
: options.revocationStatusList !== undefined
|
|
36
|
+
? (0, utils_1.pushToArray)(RevocationStatusList_1.RevocationStatusList.fromJson(options.revocationStatusList).handle, objectHandles)
|
|
37
|
+
: undefined;
|
|
38
|
+
credential = register_1.anoncreds.createCredential({
|
|
39
|
+
credentialDefinition,
|
|
40
|
+
credentialDefinitionPrivate,
|
|
41
|
+
credentialOffer,
|
|
42
|
+
credentialRequest,
|
|
43
|
+
attributeRawValues: options.attributeRawValues,
|
|
44
|
+
attributeEncodedValues: options.attributeEncodedValues,
|
|
45
|
+
revocationRegistryId: options.revocationRegistryId,
|
|
46
|
+
revocationConfiguration: (_a = options.revocationConfiguration) === null || _a === void 0 ? void 0 : _a.native,
|
|
47
|
+
revocationStatusList,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
finally {
|
|
51
|
+
objectHandles.forEach((handle) => handle.clear());
|
|
52
|
+
}
|
|
20
53
|
return new Credential(credential.handle);
|
|
21
54
|
}
|
|
22
|
-
static
|
|
23
|
-
return new Credential(register_1.anoncreds.credentialFromJson({ json }).handle);
|
|
55
|
+
static fromJson(json) {
|
|
56
|
+
return new Credential(register_1.anoncreds.credentialFromJson({ json: JSON.stringify(json) }).handle);
|
|
24
57
|
}
|
|
25
58
|
process(options) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
59
|
+
let credential;
|
|
60
|
+
// Objects created within this method must be freed up
|
|
61
|
+
const objectHandles = [];
|
|
62
|
+
try {
|
|
63
|
+
const credentialDefinition = options.credentialDefinition instanceof CredentialDefinition_1.CredentialDefinition
|
|
64
|
+
? options.credentialDefinition.handle
|
|
65
|
+
: (0, utils_1.pushToArray)(CredentialDefinition_1.CredentialDefinition.fromJson(options.credentialDefinition).handle, objectHandles);
|
|
66
|
+
const credentialRequestMetadata = options.credentialRequestMetadata instanceof CredentialRequestMetadata_1.CredentialRequestMetadata
|
|
67
|
+
? options.credentialRequestMetadata.handle
|
|
68
|
+
: (0, utils_1.pushToArray)(CredentialRequestMetadata_1.CredentialRequestMetadata.fromJson(options.credentialRequestMetadata).handle, objectHandles);
|
|
69
|
+
const revocationRegistryDefinition = options.revocationRegistryDefinition instanceof RevocationRegistryDefinition_1.RevocationRegistryDefinition
|
|
70
|
+
? options.revocationRegistryDefinition.handle
|
|
71
|
+
: options.revocationRegistryDefinition !== undefined
|
|
72
|
+
? (0, utils_1.pushToArray)(RevocationRegistryDefinition_1.RevocationRegistryDefinition.fromJson(options.revocationRegistryDefinition).handle, objectHandles)
|
|
73
|
+
: undefined;
|
|
74
|
+
credential = register_1.anoncreds.processCredential({
|
|
75
|
+
credential: this.handle,
|
|
76
|
+
credentialDefinition,
|
|
77
|
+
credentialRequestMetadata,
|
|
78
|
+
linkSecret: options.linkSecret,
|
|
79
|
+
revocationRegistryDefinition,
|
|
80
|
+
});
|
|
81
|
+
// We can discard previous handle and store the new one
|
|
82
|
+
this.handle.clear();
|
|
83
|
+
this.handle = credential;
|
|
84
|
+
}
|
|
85
|
+
finally {
|
|
86
|
+
objectHandles.forEach((handle) => handle.clear());
|
|
87
|
+
}
|
|
88
|
+
return this;
|
|
35
89
|
}
|
|
36
90
|
get schemaId() {
|
|
37
91
|
return register_1.anoncreds.credentialGetAttribute({ objectHandle: this.handle, name: 'schema_id' });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Credential.js","sourceRoot":"","sources":["../../src/api/Credential.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"Credential.js","sourceRoot":"","sources":["../../src/api/Credential.ts"],"names":[],"mappings":";;;A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BAAS,CAAC,sBAAsB,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,CAAC,CAAA;IAC3F,CAAC;IAED,IAAW,sBAAsB;QAC/B,OAAO,oBAAS,CAAC,sBAAsB,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,aAAa,EAAE,CAAC,CAAA;IAC7F,CAAC;IAED,IAAW,oBAAoB;QAC7B,OAAO,oBAAS,CAAC,sBAAsB,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC,CAAA;IAC5F,CAAC;IAED,IAAW,uBAAuB;QAChC,MAAM,KAAK,GAAG,oBAAS,CAAC,sBAAsB,CAAC,EAAE,YAAY,EAAE,IAAI,CAAC,MAAM,EAAE,IAAI,EAAE,eAAe,EAAE,CAAC,CAAA;QACpG,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAA;IAC1C,CAAC;CACF;AAhHD,gCAgHC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { JsonObject } from '../types';
|
|
2
2
|
import { AnoncredsObject } from '../AnoncredsObject';
|
|
3
3
|
import { CredentialDefinitionPrivate } from './CredentialDefinitionPrivate';
|
|
4
4
|
import { KeyCorrectnessProof } from './KeyCorrectnessProof';
|
|
5
|
+
import { Schema } from './Schema';
|
|
5
6
|
export declare type CreateCredentialDefinitionOptions = {
|
|
6
7
|
schemaId: string;
|
|
7
|
-
schema: Schema;
|
|
8
|
+
schema: Schema | JsonObject;
|
|
8
9
|
signatureType: string;
|
|
9
10
|
tag: string;
|
|
10
11
|
issuerId: string;
|
|
@@ -16,5 +17,5 @@ export declare class CredentialDefinition extends AnoncredsObject {
|
|
|
16
17
|
credentialDefinitionPrivate: CredentialDefinitionPrivate;
|
|
17
18
|
keyCorrectnessProof: KeyCorrectnessProof;
|
|
18
19
|
};
|
|
19
|
-
static
|
|
20
|
+
static fromJson(json: JsonObject): CredentialDefinition;
|
|
20
21
|
}
|
|
@@ -5,25 +5,38 @@ const AnoncredsObject_1 = require("../AnoncredsObject");
|
|
|
5
5
|
const register_1 = require("../register");
|
|
6
6
|
const CredentialDefinitionPrivate_1 = require("./CredentialDefinitionPrivate");
|
|
7
7
|
const KeyCorrectnessProof_1 = require("./KeyCorrectnessProof");
|
|
8
|
+
const Schema_1 = require("./Schema");
|
|
9
|
+
const utils_1 = require("./utils");
|
|
8
10
|
class CredentialDefinition extends AnoncredsObject_1.AnoncredsObject {
|
|
9
11
|
static create(options) {
|
|
10
12
|
var _a;
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
let createReturnObj;
|
|
14
|
+
// Objects created within this method must be freed up
|
|
15
|
+
const objectHandles = [];
|
|
16
|
+
try {
|
|
17
|
+
const schema = options.schema instanceof Schema_1.Schema
|
|
18
|
+
? options.schema.handle
|
|
19
|
+
: (0, utils_1.pushToArray)(Schema_1.Schema.fromJson(options.schema).handle, objectHandles);
|
|
20
|
+
createReturnObj = register_1.anoncreds.createCredentialDefinition({
|
|
21
|
+
schemaId: options.schemaId,
|
|
22
|
+
schema,
|
|
23
|
+
signatureType: options.signatureType,
|
|
24
|
+
tag: options.tag,
|
|
25
|
+
issuerId: options.issuerId,
|
|
26
|
+
supportRevocation: (_a = options.supportRevocation) !== null && _a !== void 0 ? _a : false,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
finally {
|
|
30
|
+
objectHandles.forEach((handle) => handle.clear());
|
|
31
|
+
}
|
|
19
32
|
return {
|
|
20
|
-
credentialDefinition: new CredentialDefinition(credentialDefinition.handle),
|
|
21
|
-
credentialDefinitionPrivate: new CredentialDefinitionPrivate_1.CredentialDefinitionPrivate(credentialDefinitionPrivate.handle),
|
|
22
|
-
keyCorrectnessProof: new KeyCorrectnessProof_1.KeyCorrectnessProof(
|
|
33
|
+
credentialDefinition: new CredentialDefinition(createReturnObj.credentialDefinition.handle),
|
|
34
|
+
credentialDefinitionPrivate: new CredentialDefinitionPrivate_1.CredentialDefinitionPrivate(createReturnObj.credentialDefinitionPrivate.handle),
|
|
35
|
+
keyCorrectnessProof: new KeyCorrectnessProof_1.KeyCorrectnessProof(createReturnObj.keyCorrectnessProof.handle),
|
|
23
36
|
};
|
|
24
37
|
}
|
|
25
|
-
static
|
|
26
|
-
return new CredentialDefinition(register_1.anoncreds.credentialDefinitionFromJson({ json }).handle);
|
|
38
|
+
static fromJson(json) {
|
|
39
|
+
return new CredentialDefinition(register_1.anoncreds.credentialDefinitionFromJson({ json: JSON.stringify(json) }).handle);
|
|
27
40
|
}
|
|
28
41
|
}
|
|
29
42
|
exports.CredentialDefinition = CredentialDefinition;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialDefinition.js","sourceRoot":"","sources":["../../src/api/CredentialDefinition.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CredentialDefinition.js","sourceRoot":"","sources":["../../src/api/CredentialDefinition.ts"],"names":[],"mappings":";;;AAGA,wDAAoD;AACpD,0CAAuC;AAEvC,+EAA2E;AAC3E,+DAA2D;AAC3D,qCAAiC;AACjC,mCAAqC;AAWrC,MAAa,oBAAqB,SAAQ,iCAAe;IAChD,MAAM,CAAC,MAAM,CAAC,OAA0C;;QAC7D,IAAI,eAIH,CAAA;QAED,sDAAsD;QACtD,MAAM,aAAa,GAAmB,EAAE,CAAA;QACxC,IAAI;YACF,MAAM,MAAM,GACV,OAAO,CAAC,MAAM,YAAY,eAAM;gBAC9B,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM;gBACvB,CAAC,CAAC,IAAA,mBAAW,EAAC,eAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;YACxE,eAAe,GAAG,oBAAS,CAAC,0BAA0B,CAAC;gBACrD,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,MAAM;gBACN,aAAa,EAAE,OAAO,CAAC,aAAa;gBACpC,GAAG,EAAE,OAAO,CAAC,GAAG;gBAChB,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,iBAAiB,EAAE,MAAA,OAAO,CAAC,iBAAiB,mCAAI,KAAK;aACtD,CAAC,CAAA;SACH;gBAAS;YACR,aAAa,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;SAClD;QACD,OAAO;YACL,oBAAoB,EAAE,IAAI,oBAAoB,CAAC,eAAe,CAAC,oBAAoB,CAAC,MAAM,CAAC;YAC3F,2BAA2B,EAAE,IAAI,yDAA2B,CAAC,eAAe,CAAC,2BAA2B,CAAC,MAAM,CAAC;YAChH,mBAAmB,EAAE,IAAI,yCAAmB,CAAC,eAAe,CAAC,mBAAmB,CAAC,MAAM,CAAC;SACzF,CAAA;IACH,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,IAAgB;QACrC,OAAO,IAAI,oBAAoB,CAAC,oBAAS,CAAC,4BAA4B,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;IAChH,CAAC;CACF;AApCD,oDAoCC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { JsonObject } from '../types';
|
|
1
2
|
import { AnoncredsObject } from '../AnoncredsObject';
|
|
2
3
|
export declare class CredentialDefinitionPrivate extends AnoncredsObject {
|
|
3
|
-
static
|
|
4
|
+
static fromJson(json: JsonObject): CredentialDefinitionPrivate;
|
|
4
5
|
}
|
|
@@ -4,8 +4,8 @@ exports.CredentialDefinitionPrivate = void 0;
|
|
|
4
4
|
const AnoncredsObject_1 = require("../AnoncredsObject");
|
|
5
5
|
const register_1 = require("../register");
|
|
6
6
|
class CredentialDefinitionPrivate extends AnoncredsObject_1.AnoncredsObject {
|
|
7
|
-
static
|
|
8
|
-
return new CredentialDefinitionPrivate(register_1.anoncreds.credentialDefinitionPrivateFromJson({ json }).handle);
|
|
7
|
+
static fromJson(json) {
|
|
8
|
+
return new CredentialDefinitionPrivate(register_1.anoncreds.credentialDefinitionPrivateFromJson({ json: JSON.stringify(json) }).handle);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.CredentialDefinitionPrivate = CredentialDefinitionPrivate;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialDefinitionPrivate.js","sourceRoot":"","sources":["../../src/api/CredentialDefinitionPrivate.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CredentialDefinitionPrivate.js","sourceRoot":"","sources":["../../src/api/CredentialDefinitionPrivate.ts"],"names":[],"mappings":";;;AAEA,wDAAoD;AACpD,0CAAuC;AAEvC,MAAa,2BAA4B,SAAQ,iCAAe;IACvD,MAAM,CAAC,QAAQ,CAAC,IAAgB;QACrC,OAAO,IAAI,2BAA2B,CACpC,oBAAS,CAAC,mCAAmC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CACrF,CAAA;IACH,CAAC;CACF;AAND,kEAMC"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { JsonObject } from '../types';
|
|
2
2
|
import { AnoncredsObject } from '../AnoncredsObject';
|
|
3
|
+
import { KeyCorrectnessProof } from './KeyCorrectnessProof';
|
|
3
4
|
export declare type CreateCredentialOfferOptions = {
|
|
4
5
|
schemaId: string;
|
|
5
6
|
credentialDefinitionId: string;
|
|
6
|
-
keyCorrectnessProof: KeyCorrectnessProof;
|
|
7
|
+
keyCorrectnessProof: KeyCorrectnessProof | JsonObject;
|
|
7
8
|
};
|
|
8
9
|
export declare class CredentialOffer extends AnoncredsObject {
|
|
9
10
|
static create(options: CreateCredentialOfferOptions): CredentialOffer;
|
|
10
|
-
static
|
|
11
|
+
static fromJson(json: JsonObject): CredentialOffer;
|
|
11
12
|
}
|
|
@@ -3,16 +3,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CredentialOffer = void 0;
|
|
4
4
|
const AnoncredsObject_1 = require("../AnoncredsObject");
|
|
5
5
|
const register_1 = require("../register");
|
|
6
|
+
const KeyCorrectnessProof_1 = require("./KeyCorrectnessProof");
|
|
7
|
+
const utils_1 = require("./utils");
|
|
6
8
|
class CredentialOffer extends AnoncredsObject_1.AnoncredsObject {
|
|
7
9
|
static create(options) {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
let credentialOfferHandle;
|
|
11
|
+
// Objects created within this method must be freed up
|
|
12
|
+
const objectHandles = [];
|
|
13
|
+
try {
|
|
14
|
+
const keyCorrectnessProof = options.keyCorrectnessProof instanceof KeyCorrectnessProof_1.KeyCorrectnessProof
|
|
15
|
+
? options.keyCorrectnessProof.handle
|
|
16
|
+
: (0, utils_1.pushToArray)(KeyCorrectnessProof_1.KeyCorrectnessProof.fromJson(options.keyCorrectnessProof).handle, objectHandles);
|
|
17
|
+
credentialOfferHandle = register_1.anoncreds.createCredentialOffer({
|
|
18
|
+
schemaId: options.schemaId,
|
|
19
|
+
credentialDefinitionId: options.credentialDefinitionId,
|
|
20
|
+
keyCorrectnessProof,
|
|
21
|
+
}).handle;
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
objectHandles.forEach((handle) => handle.clear());
|
|
25
|
+
}
|
|
26
|
+
return new CredentialOffer(credentialOfferHandle);
|
|
13
27
|
}
|
|
14
|
-
static
|
|
15
|
-
return new CredentialOffer(register_1.anoncreds.credentialOfferFromJson({ json }).handle);
|
|
28
|
+
static fromJson(json) {
|
|
29
|
+
return new CredentialOffer(register_1.anoncreds.credentialOfferFromJson({ json: JSON.stringify(json) }).handle);
|
|
16
30
|
}
|
|
17
31
|
}
|
|
18
32
|
exports.CredentialOffer = CredentialOffer;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialOffer.js","sourceRoot":"","sources":["../../src/api/CredentialOffer.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CredentialOffer.js","sourceRoot":"","sources":["../../src/api/CredentialOffer.ts"],"names":[],"mappings":";;;AAGA,wDAAoD;AACpD,0CAAuC;AAEvC,+DAA2D;AAC3D,mCAAqC;AAQrC,MAAa,eAAgB,SAAQ,iCAAe;IAC3C,MAAM,CAAC,MAAM,CAAC,OAAqC;QACxD,IAAI,qBAAqB,CAAA;QACzB,sDAAsD;QACtD,MAAM,aAAa,GAAmB,EAAE,CAAA;QACxC,IAAI;YACF,MAAM,mBAAmB,GACvB,OAAO,CAAC,mBAAmB,YAAY,yCAAmB;gBACxD,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,MAAM;gBACpC,CAAC,CAAC,IAAA,mBAAW,EAAC,yCAAmB,CAAC,QAAQ,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;YAElG,qBAAqB,GAAG,oBAAS,CAAC,qBAAqB,CAAC;gBACtD,QAAQ,EAAE,OAAO,CAAC,QAAQ;gBAC1B,sBAAsB,EAAE,OAAO,CAAC,sBAAsB;gBACtD,mBAAmB;aACpB,CAAC,CAAC,MAAM,CAAA;SACV;gBAAS;YACR,aAAa,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;SAClD;QACD,OAAO,IAAI,eAAe,CAAC,qBAAqB,CAAC,CAAA;IACnD,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,IAAgB;QACrC,OAAO,IAAI,eAAe,CAAC,oBAAS,CAAC,uBAAuB,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;IACtG,CAAC;CACF;AAzBD,0CAyBC"}
|
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { CredentialOffer } from './CredentialOffer';
|
|
3
|
-
import type { MasterSecret } from './MasterSecret';
|
|
1
|
+
import type { JsonObject } from '../types';
|
|
4
2
|
import { AnoncredsObject } from '../AnoncredsObject';
|
|
3
|
+
import { CredentialDefinition } from './CredentialDefinition';
|
|
4
|
+
import { CredentialOffer } from './CredentialOffer';
|
|
5
5
|
import { CredentialRequestMetadata } from './CredentialRequestMetadata';
|
|
6
6
|
export declare type CreateCredentialRequestOptions = {
|
|
7
|
+
entropy?: string;
|
|
7
8
|
proverDid?: string;
|
|
8
|
-
credentialDefinition: CredentialDefinition;
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
credentialOffer: CredentialOffer;
|
|
9
|
+
credentialDefinition: CredentialDefinition | JsonObject;
|
|
10
|
+
linkSecret: string;
|
|
11
|
+
linkSecretId: string;
|
|
12
|
+
credentialOffer: CredentialOffer | JsonObject;
|
|
12
13
|
};
|
|
13
14
|
export declare class CredentialRequest extends AnoncredsObject {
|
|
14
15
|
static create(options: CreateCredentialRequestOptions): {
|
|
15
16
|
credentialRequest: CredentialRequest;
|
|
16
17
|
credentialRequestMetadata: CredentialRequestMetadata;
|
|
17
18
|
};
|
|
18
|
-
static
|
|
19
|
+
static fromJson(json: JsonObject): CredentialRequest;
|
|
19
20
|
}
|
|
@@ -3,23 +3,41 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.CredentialRequest = void 0;
|
|
4
4
|
const AnoncredsObject_1 = require("../AnoncredsObject");
|
|
5
5
|
const register_1 = require("../register");
|
|
6
|
+
const CredentialDefinition_1 = require("./CredentialDefinition");
|
|
7
|
+
const CredentialOffer_1 = require("./CredentialOffer");
|
|
6
8
|
const CredentialRequestMetadata_1 = require("./CredentialRequestMetadata");
|
|
9
|
+
const utils_1 = require("./utils");
|
|
7
10
|
class CredentialRequest extends AnoncredsObject_1.AnoncredsObject {
|
|
8
11
|
static create(options) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
let createReturnObj;
|
|
13
|
+
// Objects created within this method must be freed up
|
|
14
|
+
const objectHandles = [];
|
|
15
|
+
try {
|
|
16
|
+
const credentialDefinition = options.credentialDefinition instanceof CredentialDefinition_1.CredentialDefinition
|
|
17
|
+
? options.credentialDefinition.handle
|
|
18
|
+
: (0, utils_1.pushToArray)(CredentialDefinition_1.CredentialDefinition.fromJson(options.credentialDefinition).handle, objectHandles);
|
|
19
|
+
const credentialOffer = options.credentialOffer instanceof CredentialOffer_1.CredentialOffer
|
|
20
|
+
? options.credentialOffer.handle
|
|
21
|
+
: (0, utils_1.pushToArray)(CredentialOffer_1.CredentialOffer.fromJson(options.credentialOffer).handle, objectHandles);
|
|
22
|
+
createReturnObj = register_1.anoncreds.createCredentialRequest({
|
|
23
|
+
entropy: options.entropy,
|
|
24
|
+
proverDid: options.proverDid,
|
|
25
|
+
credentialDefinition,
|
|
26
|
+
linkSecret: options.linkSecret,
|
|
27
|
+
linkSecretId: options.linkSecretId,
|
|
28
|
+
credentialOffer,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
finally {
|
|
32
|
+
objectHandles.forEach((handle) => handle.clear());
|
|
33
|
+
}
|
|
16
34
|
return {
|
|
17
|
-
credentialRequest: new CredentialRequest(credentialRequest.handle),
|
|
18
|
-
credentialRequestMetadata: new CredentialRequestMetadata_1.CredentialRequestMetadata(credentialRequestMetadata.handle),
|
|
35
|
+
credentialRequest: new CredentialRequest(createReturnObj.credentialRequest.handle),
|
|
36
|
+
credentialRequestMetadata: new CredentialRequestMetadata_1.CredentialRequestMetadata(createReturnObj.credentialRequestMetadata.handle),
|
|
19
37
|
};
|
|
20
38
|
}
|
|
21
|
-
static
|
|
22
|
-
return new CredentialRequest(register_1.anoncreds.credentialRequestFromJson({ json }).handle);
|
|
39
|
+
static fromJson(json) {
|
|
40
|
+
return new CredentialRequest(register_1.anoncreds.credentialRequestFromJson({ json: JSON.stringify(json) }).handle);
|
|
23
41
|
}
|
|
24
42
|
}
|
|
25
43
|
exports.CredentialRequest = CredentialRequest;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialRequest.js","sourceRoot":"","sources":["../../src/api/CredentialRequest.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CredentialRequest.js","sourceRoot":"","sources":["../../src/api/CredentialRequest.ts"],"names":[],"mappings":";;;AAGA,wDAAoD;AACpD,0CAAuC;AAEvC,iEAA6D;AAC7D,uDAAmD;AACnD,2EAAuE;AACvE,mCAAqC;AAWrC,MAAa,iBAAkB,SAAQ,iCAAe;IAC7C,MAAM,CAAC,MAAM,CAAC,OAAuC;QAC1D,IAAI,eAGH,CAAA;QACD,sDAAsD;QACtD,MAAM,aAAa,GAAmB,EAAE,CAAA;QACxC,IAAI;YACF,MAAM,oBAAoB,GACxB,OAAO,CAAC,oBAAoB,YAAY,2CAAoB;gBAC1D,CAAC,CAAC,OAAO,CAAC,oBAAoB,CAAC,MAAM;gBACrC,CAAC,CAAC,IAAA,mBAAW,EAAC,2CAAoB,CAAC,QAAQ,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;YAEpG,MAAM,eAAe,GACnB,OAAO,CAAC,eAAe,YAAY,iCAAe;gBAChD,CAAC,CAAC,OAAO,CAAC,eAAe,CAAC,MAAM;gBAChC,CAAC,CAAC,IAAA,mBAAW,EAAC,iCAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,eAAe,CAAC,CAAC,MAAM,EAAE,aAAa,CAAC,CAAA;YAE1F,eAAe,GAAG,oBAAS,CAAC,uBAAuB,CAAC;gBAClD,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,oBAAoB;gBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;gBAC9B,YAAY,EAAE,OAAO,CAAC,YAAY;gBAClC,eAAe;aAChB,CAAC,CAAA;SACH;gBAAS;YACR,aAAa,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC,CAAA;SAClD;QACD,OAAO;YACL,iBAAiB,EAAE,IAAI,iBAAiB,CAAC,eAAe,CAAC,iBAAiB,CAAC,MAAM,CAAC;YAClF,yBAAyB,EAAE,IAAI,qDAAyB,CAAC,eAAe,CAAC,yBAAyB,CAAC,MAAM,CAAC;SAC3G,CAAA;IACH,CAAC;IAEM,MAAM,CAAC,QAAQ,CAAC,IAAgB;QACrC,OAAO,IAAI,iBAAiB,CAAC,oBAAS,CAAC,yBAAyB,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,CAAA;IAC1G,CAAC;CACF;AAvCD,8CAuCC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { JsonObject } from '../types';
|
|
1
2
|
import { AnoncredsObject } from '../AnoncredsObject';
|
|
2
3
|
export declare class CredentialRequestMetadata extends AnoncredsObject {
|
|
3
|
-
static
|
|
4
|
+
static fromJson(json: JsonObject): CredentialRequestMetadata;
|
|
4
5
|
}
|
|
@@ -4,8 +4,8 @@ exports.CredentialRequestMetadata = void 0;
|
|
|
4
4
|
const AnoncredsObject_1 = require("../AnoncredsObject");
|
|
5
5
|
const register_1 = require("../register");
|
|
6
6
|
class CredentialRequestMetadata extends AnoncredsObject_1.AnoncredsObject {
|
|
7
|
-
static
|
|
8
|
-
return new CredentialRequestMetadata(register_1.anoncreds.credentialRequestMetadataFromJson({ json }).handle);
|
|
7
|
+
static fromJson(json) {
|
|
8
|
+
return new CredentialRequestMetadata(register_1.anoncreds.credentialRequestMetadataFromJson({ json: JSON.stringify(json) }).handle);
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
11
|
exports.CredentialRequestMetadata = CredentialRequestMetadata;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CredentialRequestMetadata.js","sourceRoot":"","sources":["../../src/api/CredentialRequestMetadata.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"CredentialRequestMetadata.js","sourceRoot":"","sources":["../../src/api/CredentialRequestMetadata.ts"],"names":[],"mappings":";;;AAEA,wDAAoD;AACpD,0CAAuC;AAEvC,MAAa,yBAA0B,SAAQ,iCAAe;IACrD,MAAM,CAAC,QAAQ,CAAC,IAAgB;QACrC,OAAO,IAAI,yBAAyB,CAClC,oBAAS,CAAC,iCAAiC,CAAC,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC,MAAM,CACnF,CAAA;IACH,CAAC;CACF;AAND,8DAMC"}
|