@docknetwork/wallet-sdk-core 1.5.6 → 1.5.9
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/lib/biometric-provider.d.ts +46 -19
- package/lib/biometric-provider.d.ts.map +1 -1
- package/lib/biometric-provider.js +71 -41
- package/lib/biometric-provider.js.map +1 -1
- package/lib/cloud-wallet.d.ts +102 -3
- package/lib/cloud-wallet.d.ts.map +1 -1
- package/lib/cloud-wallet.js +211 -17
- package/lib/cloud-wallet.js.map +1 -1
- package/lib/credential-provider.d.ts +10 -0
- package/lib/credential-provider.d.ts.map +1 -1
- package/lib/credential-provider.js +21 -1
- package/lib/credential-provider.js.map +1 -1
- package/lib/credentials/oidvc.js +1 -1
- package/lib/credentials/oidvc.js.map +1 -1
- package/package.json +5 -4
- package/src/biometric-provider.ts +139 -57
- package/src/cloud-wallet.ts +312 -16
- package/src/credential-provider.ts +31 -0
- package/src/credentials/oidvc.test.ts +75 -15
- package/src/credentials/oidvc.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
|
@@ -3,18 +3,16 @@ import {
|
|
|
3
3
|
getAuthURL,
|
|
4
4
|
decodeRequestJWT,
|
|
5
5
|
getPresentationSubmision,
|
|
6
|
-
} from './oidvc';
|
|
6
|
+
} from './oidvc';
|
|
7
7
|
import {credentialServiceRPC} from '@docknetwork/wallet-sdk-wasm/src/services/credential';
|
|
8
8
|
import {MetadataClient} from '@sphereon/oid4vci-client';
|
|
9
9
|
import jwtDecode from 'jwt-decode';
|
|
10
10
|
import axios from 'axios';
|
|
11
|
-
import {pexService} from '@docknetwork/wallet-sdk-wasm/src/services/pex';
|
|
12
11
|
|
|
13
12
|
jest.mock('@docknetwork/wallet-sdk-wasm/src/services/credential');
|
|
14
13
|
jest.mock('@sphereon/oid4vci-client');
|
|
15
14
|
jest.mock('jwt-decode');
|
|
16
15
|
jest.mock('axios');
|
|
17
|
-
jest.mock('@docknetwork/wallet-sdk-wasm/src/services/pex');
|
|
18
16
|
|
|
19
17
|
describe('acquireOpenIDCredentialFromURI', () => {
|
|
20
18
|
const didProvider: any = {
|
|
@@ -99,14 +97,71 @@ describe('decodeRequestJWT', () => {
|
|
|
99
97
|
|
|
100
98
|
describe('getPresentationSubmision', () => {
|
|
101
99
|
it('should get presentation submission', async () => {
|
|
102
|
-
const credentials = [
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
100
|
+
const credentials = [
|
|
101
|
+
{
|
|
102
|
+
'@context': [
|
|
103
|
+
'https://www.w3.org/2018/credentials/v1',
|
|
104
|
+
'https://ld.truvera.io/credentials/extensions-v1',
|
|
105
|
+
{
|
|
106
|
+
BasicCredential: 'dk:BasicCredential',
|
|
107
|
+
dk: 'https://ld.truvera.io/credentials#',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
id: 'https://creds-testnet.truvera.io/8afcb0925ad0d31c6afcc7fdec040f3b6c8260c20cdc6da5042307a9fa0dd7a6',
|
|
111
|
+
type: ['VerifiableCredential', 'BasicCredential'],
|
|
112
|
+
credentialSubject: {
|
|
113
|
+
id: 'did:key:z6MkkS7LbdxSqP8WM5GfsXiNwZC6Ve33aj83eEyzsFGphepp',
|
|
114
|
+
name: 'Test Credential',
|
|
115
|
+
},
|
|
116
|
+
issuanceDate: '2025-02-22T19:14:04.108Z',
|
|
117
|
+
issuer: {
|
|
118
|
+
name: 'Quotient Credit Union',
|
|
119
|
+
description: 'Quotient Credit Union is the credit union.',
|
|
120
|
+
logo: 'https://img.dock.io/06d78272268c606a172d5fd1cd559b46',
|
|
121
|
+
id: 'did:cheqd:testnet:5ad9c962-74e7-4857-891e-95e4a3b035d0',
|
|
122
|
+
},
|
|
123
|
+
name: 'Test Credential',
|
|
124
|
+
proof: {
|
|
125
|
+
type: 'Ed25519Signature2018',
|
|
126
|
+
created: '2025-05-29T18:48:19Z',
|
|
127
|
+
verificationMethod:
|
|
128
|
+
'did:cheqd:testnet:5ad9c962-74e7-4857-891e-95e4a3b035d0#keys-1',
|
|
129
|
+
proofPurpose: 'assertionMethod',
|
|
130
|
+
jws: 'eyJhbGciOiJFZERTQSIsImI2NCI6ZmFsc2UsImNyaXQiOlsiYjY0Il19..c5vxz6GKOuWykNKuNVqZ4giOplR3V8YVsJ5Ej4i5Dk3urVFd2ODsAkcu5Th7qWJrD5L3zEJzGEvlUbtRFCS1BQ',
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
const presentationDefinition = {
|
|
135
|
+
id: '94d240d2-b70f-412e-8331-1b610407cce6',
|
|
136
|
+
name: 'Verificação de maioridade',
|
|
137
|
+
purpose: 'Verificação de maioridade',
|
|
138
|
+
input_descriptors: [
|
|
139
|
+
{
|
|
140
|
+
id: 'OpenFinanceCredentialV2',
|
|
141
|
+
name: 'Verificação de maioridade',
|
|
142
|
+
purpose: 'Verificação de maioridade',
|
|
143
|
+
constraints: {
|
|
144
|
+
fields: [
|
|
145
|
+
{
|
|
146
|
+
path: ['$.credentialSubject.name'],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
path: ['$.type', '$.vc.type'],
|
|
150
|
+
filter: {
|
|
151
|
+
type: 'array',
|
|
152
|
+
contains: {
|
|
153
|
+
const: 'BasicCredential',
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
],
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
};
|
|
106
162
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
});
|
|
163
|
+
const holderDID =
|
|
164
|
+
'did:key:z6MkkS7LbdxSqP8WM5GfsXiNwZC6Ve33aj83eEyzsFGphepp';
|
|
110
165
|
|
|
111
166
|
const result = await getPresentationSubmision({
|
|
112
167
|
credentials,
|
|
@@ -114,11 +169,16 @@ describe('getPresentationSubmision', () => {
|
|
|
114
169
|
holderDID,
|
|
115
170
|
});
|
|
116
171
|
|
|
117
|
-
expect(
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
172
|
+
expect(result).toStrictEqual({
|
|
173
|
+
id: expect.any(String),
|
|
174
|
+
definition_id: '94d240d2-b70f-412e-8331-1b610407cce6',
|
|
175
|
+
descriptor_map: [
|
|
176
|
+
{
|
|
177
|
+
id: 'OpenFinanceCredentialV2',
|
|
178
|
+
format: 'ldp_vc',
|
|
179
|
+
path: '$.verifiableCredential[0]',
|
|
180
|
+
},
|
|
181
|
+
],
|
|
121
182
|
});
|
|
122
|
-
expect(result).toEqual(presentationSubmission);
|
|
123
183
|
});
|
|
124
184
|
});
|
package/src/credentials/oidvc.ts
CHANGED