@proof.com/proof-vc-common 0.4.5 → 0.5.1
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/LICENSE +201 -0
- package/README.md +171 -0
- package/dist/client.d.ts +10 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +19 -5
- package/dist/client.js.map +1 -1
- package/dist/constants.d.ts +2 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +5 -0
- package/dist/constants.js.map +1 -1
- package/dist/dcql.d.ts +10 -2
- package/dist/dcql.d.ts.map +1 -1
- package/dist/dcql.js +9 -7
- package/dist/dcql.js.map +1 -1
- package/dist/errors.d.ts +10 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +7 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/internal.d.ts +16 -1
- package/dist/internal.d.ts.map +1 -1
- package/dist/internal.js +53 -12
- package/dist/internal.js.map +1 -1
- package/dist/types.d.ts +3 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/warnings.d.ts +3 -0
- package/dist/warnings.d.ts.map +1 -0
- package/dist/warnings.js +16 -0
- package/dist/warnings.js.map +1 -0
- package/package.json +5 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright [yyyy] [name of copyright owner]
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
# Proof Digital Credentials
|
|
2
|
+
|
|
3
|
+
<img src="https://raw.githubusercontent.com/proof/proof-vc-common/main/docs/proof-logo.svg" alt="drawing" width="450"/>
|
|
4
|
+
|
|
5
|
+
_A digital passport. Verified once, usable everywhere._
|
|
6
|
+
|
|
7
|
+
Read our [documentation](https://dev.proof.com/docs/digital-credentials-overview) or [try it](https://try.proof.com)!
|
|
8
|
+
|
|
9
|
+
## Table of Contents
|
|
10
|
+
|
|
11
|
+
- [Packages](#packages)
|
|
12
|
+
- [Installation](#installation)
|
|
13
|
+
- [Getting Started](#getting-started)
|
|
14
|
+
- [Client Side](#client-side)
|
|
15
|
+
- [Response Modes](#response-modes)
|
|
16
|
+
- [Verifiable Credential Presentation](#verifiable-credential-presentation)
|
|
17
|
+
- [Credential Type](#credential-type)
|
|
18
|
+
- [Request](#request)
|
|
19
|
+
- [Scopes](#scopes)
|
|
20
|
+
- [Documentation](#documentation)
|
|
21
|
+
- [Contributing](#contributing)
|
|
22
|
+
|
|
23
|
+
## Packages
|
|
24
|
+
|
|
25
|
+
| Package | Runtime | Usage | Runtime deps |
|
|
26
|
+
| ------------------------------------------------------------------------------------------------------ | ------------------- | ----------------------------------------------------------------------------------------------------------------------------------- | ----------------- |
|
|
27
|
+
| **[`@proof.com/proof-vc-common`](https://github.com/proof/proof-vc-common/blob/main/packages/common)** | browser **or** Node | Request a Verifiable Presentation | **0** ✅ |
|
|
28
|
+
| **[`@proof.com/proof-vc-server`](https://github.com/proof/proof-vc-common/blob/main/packages/server)** | Node | `proof-vc-common` **plus** Presentation Verification, Secured Authorization Requests, Transaction Templates and Verifier Enrollment | sd-jwt, owf, jose |
|
|
29
|
+
|
|
30
|
+
## Installation
|
|
31
|
+
|
|
32
|
+
Browser / Node:
|
|
33
|
+
|
|
34
|
+
```
|
|
35
|
+
npm install @proof.com/proof-vc-common
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
Node:
|
|
39
|
+
|
|
40
|
+
```
|
|
41
|
+
npm install @proof.com/proof-vc-server
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Proof implements the [OpenID for Verifiable Presentations 1.0](https://openid.net/specs/openid-4-verifiable-presentations-1_0.html) specification.
|
|
45
|
+
[Setup an OAuth Application](https://dev.proof.com/docs/oauth-client-credentials) in your Proof account to get your `client_id`.
|
|
46
|
+
|
|
47
|
+
## Getting Started
|
|
48
|
+
|
|
49
|
+
### Client Side
|
|
50
|
+
|
|
51
|
+
You can request a Verifiable Presentation in the browser by using `createClient` and `authorizationUrl` to craft an Authorization Request URL.
|
|
52
|
+
Either `fragment` or `direct_post` [Response Mode](#response-modes) are supported (defaults to `fragment`).
|
|
53
|
+
|
|
54
|
+
- if using `fragment`, at the callback URI, use `parseAuthorizationResponse` to extract the `vp_token` from it and send it to your verification endpoint
|
|
55
|
+
- if using `direct_post`, the `vp_token` is sent directly to your verification endpoint
|
|
56
|
+
|
|
57
|
+
```javascript
|
|
58
|
+
import {
|
|
59
|
+
createClient,
|
|
60
|
+
parseAuthorizationResponse,
|
|
61
|
+
} from "@proof.com/proof-vc-common";
|
|
62
|
+
|
|
63
|
+
const proof = createClient({
|
|
64
|
+
environment: "sandbox",
|
|
65
|
+
clientId: "verifier-demo",
|
|
66
|
+
callbackUri: "https://example.com/callback",
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
button.onclick = () => {
|
|
70
|
+
window.location.href = proof.authorizationUrl({
|
|
71
|
+
nonce: "3e8e4918-e9fb-453a-a538-81152be15c1b",
|
|
72
|
+
scope: "urn:proof:params:scope:verifiable-credentials:basic",
|
|
73
|
+
});
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
// at https://example.com/callback
|
|
77
|
+
const response = parseAuthorizationResponse(); // reads window.location.hash
|
|
78
|
+
if (response?.type === "success") {
|
|
79
|
+
fetch("/verify_vp_token", {
|
|
80
|
+
method: "POST",
|
|
81
|
+
body: new URLSearchParams({ vp_token: response.vpToken }),
|
|
82
|
+
});
|
|
83
|
+
} else if (response?.type === "error") {
|
|
84
|
+
console.error(response.error, response.errorDescription);
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
`parseAuthorizationResponse` returns `{ type: "success", vpToken, state? }`, `{ type: "error", error, errorDescription?, errorUri?, state? }` when the authorization server answered with an [OAuth 2.0 error response](https://datatracker.ietf.org/doc/html/rfc6749#section-4.1.2.1), or `null` when neither is present.
|
|
89
|
+
|
|
90
|
+
You can also use `buildAuthorizationUrl` to provide all the Authorization Request parameters at once:
|
|
91
|
+
|
|
92
|
+
```javascript
|
|
93
|
+
import { buildAuthorizationUrl } from "@proof.com/proof-vc-common";
|
|
94
|
+
|
|
95
|
+
window.location.href = buildAuthorizationUrl({
|
|
96
|
+
environment: "sandbox",
|
|
97
|
+
clientId: "verifier-demo",
|
|
98
|
+
callbackUri: "https://example.com/callback",
|
|
99
|
+
nonce: "3e8e4918-e9fb-453a-a538-81152be15c1b",
|
|
100
|
+
scope: "urn:proof:params:scope:verifiable-credentials:basic",
|
|
101
|
+
});
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Response Modes
|
|
105
|
+
|
|
106
|
+
Proof supports `fragment` and `direct_post` response modes (default `fragment`).
|
|
107
|
+
|
|
108
|
+
#### fragment
|
|
109
|
+
|
|
110
|
+
Using `fragment` the `vp_token` is returned as a fragment of the `callbackUri` when the user is 302 redirected from Proof to your website. Use `parseAuthorizationResponse()` in the browser to read it.
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
GET https://example.com/verify_vp_token#vp_token=eyJwcm9vZl9pZF9...
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
#### direct_post
|
|
117
|
+
|
|
118
|
+
Using `direct_post` the `vp_token` and `state` (optional) are returned in the `application/x-www-form-urlencoded` body of a POST request to the `callbackUri` from Proof to your server. Pass the `vp_token` value as received to [`verifyVPToken`](https://github.com/proof/proof-vc-common#verify). See the [OID4VP specification](https://openid.net/specs/openid-4-verifiable-presentations-1_0.html#name-response-mode-direct_post) for more details.
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
POST https://example.com/verify_vp_token
|
|
122
|
+
Content-Type: application/x-www-form-urlencoded
|
|
123
|
+
|
|
124
|
+
vp_token=eyJwcm9vZl9pZF9...&state=6A2B4CD830
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
## Verifiable Credential Presentation
|
|
128
|
+
|
|
129
|
+
### Credential Type
|
|
130
|
+
|
|
131
|
+
Proof issues Verifiable Credentials according to the [SD-JWT-VC specification](https://www.ietf.org/archive/id/draft-ietf-oauth-sd-jwt-vc-16.html) and publishes its [OID4VCI Credential Issuer Metadata](https://openid.net/specs/openid-4-verifiable-credential-issuance-1_0.html#name-credential-issuer-metadata) at https://api.proof.com/.well-known/openid-credential-issuer.
|
|
132
|
+
|
|
133
|
+
`ProofCredentialV1`
|
|
134
|
+
|
|
135
|
+
| claim | accessor | type | description |
|
|
136
|
+
| -------------------- | -------------- | ------- | ------------------------------------------------------------------ |
|
|
137
|
+
| given_name | `givenName` | string | user's given name as it appears on the verified identity document |
|
|
138
|
+
| family_name | `familyName` | string | user's family name as it appears on the verified identity document |
|
|
139
|
+
| birth_date | `birthDate` | string | user's date of birth in ISO 8601 format (`YYYY-MM-DD`) |
|
|
140
|
+
| age_equal_or_over.18 | `isOver18` | boolean | boolean confirming the user is 18 or older |
|
|
141
|
+
| age_equal_or_over.21 | `isOver21` | boolean | boolean confirming the user is 21 or older |
|
|
142
|
+
| age_equal_or_over.65 | `isOver65` | boolean | boolean confirming the user is 65 or older |
|
|
143
|
+
| is_national.us | `isNationalUS` | boolean | boolean confirming US nationality (`nationality:us` scope) |
|
|
144
|
+
|
|
145
|
+
All attributes are selectively disclosable and will return `undefined` if the claim wasn't disclosed. `getClaims()` returns the disclosed claims as issued and `toJSON()` the accessors above. A credential with a `vct` unknown to this SDK is returned as a `DefaultProofCredential` with a one-time `ProofVCWarning`.
|
|
146
|
+
|
|
147
|
+
### Request
|
|
148
|
+
|
|
149
|
+
Request a Verifiable Credential Presentation with an [OAuth 2.0](https://datatracker.ietf.org/doc/html/rfc6749) Authorization Request. See [Client Side](#client-side) and [Server Side](https://github.com/proof/proof-vc-common#server-side) above for the two entry points. Exactly one of `scope` or `dcqlQuery` must be given.
|
|
150
|
+
|
|
151
|
+
#### Scopes
|
|
152
|
+
|
|
153
|
+
Proof supports the `scope` parameter of the [OID4VP specification](https://openid.net/specs/openid-4-verifiable-presentations-1_0.html#name-using-scope-parameter-to-re). Each scope maps to a pre-defined DCQL query and returns a specific [Credential Type](#credential-type).
|
|
154
|
+
|
|
155
|
+
Supported `scope` and their associated [Credential Type](#credential-type):
|
|
156
|
+
|
|
157
|
+
| scope | Credential Type | claims | Key Binding JWT |
|
|
158
|
+
| -------------------------------------------------------------- | ------------------- | --------------------------------------------------- | --------------- |
|
|
159
|
+
| `urn:proof:params:scope:verifiable-credentials:basic` | `ProofCredentialV1` | `given_name`, `family_name`, `age_equal_or_over.18` | yes |
|
|
160
|
+
| `urn:proof:params:scope:verifiable-credentials:nationality:us` | `ProofCredentialV1` | `age_equal_or_over.18`, `is_national.us` | yes |
|
|
161
|
+
|
|
162
|
+
A scope unknown to this SDK is accepted and emits a one-time `ProofVCWarning`.
|
|
163
|
+
|
|
164
|
+
## Documentation
|
|
165
|
+
|
|
166
|
+
_Digital Credentials_ guides https://dev.proof.com/docs/digital-credentials-overview \
|
|
167
|
+
_API Documentation_ https://dev.proof.com/reference/authorizeverifiablecredentialpresentation
|
|
168
|
+
|
|
169
|
+
## Contributing
|
|
170
|
+
|
|
171
|
+
[Contribution guidelines for this project](https://github.com/proof/proof-vc-common/blob/main/CONTRIBUTING.md)
|
package/dist/client.d.ts
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
import { type ClientConfig, type AuthorizationRequestParams } from "./internal.ts";
|
|
2
2
|
export type { ClientConfig, AuthorizationRequestParams } from "./internal.ts";
|
|
3
|
-
export type
|
|
3
|
+
export type AuthorizationSuccessResponse = {
|
|
4
|
+
type: "success";
|
|
4
5
|
vpToken: string;
|
|
5
6
|
state?: string;
|
|
6
7
|
};
|
|
8
|
+
export type AuthorizationErrorResponse = {
|
|
9
|
+
type: "error";
|
|
10
|
+
error: string;
|
|
11
|
+
errorDescription?: string;
|
|
12
|
+
errorUri?: string;
|
|
13
|
+
state?: string;
|
|
14
|
+
};
|
|
15
|
+
export type AuthorizationResponse = AuthorizationSuccessResponse | AuthorizationErrorResponse;
|
|
7
16
|
export interface VCClient {
|
|
8
17
|
authorizationUrl(params: AuthorizationRequestParams): string;
|
|
9
18
|
}
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,YAAY,EACjB,KAAK,0BAA0B,EAChC,MAAM,eAAe,CAAC;AAEvB,YAAY,EAAE,YAAY,EAAE,0BAA0B,EAAE,MAAM,eAAe,CAAC;AAE9E,MAAM,MAAM,4BAA4B,GAAG;IACzC,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAC/B,4BAA4B,GAAG,0BAA0B,CAAC;AAE5D,MAAM,WAAW,QAAQ;IACvB,gBAAgB,CAAC,MAAM,EAAE,0BAA0B,GAAG,MAAM,CAAC;CAC9D;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,GAAG,QAAQ,CAS3D;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,YAAY,GAAG,0BAA0B,GAC/C,MAAM,CAWR;AAED,wBAAgB,0BAA0B,CACxC,KAAK,CAAC,EAAE,MAAM,GACb,qBAAqB,GAAG,IAAI,CA8B9B"}
|
package/dist/client.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { buildAuthorizationSearchParams, authorizeUrlFromSearchParams, } from "./internal.js";
|
|
1
|
+
import { buildAuthorizationSearchParams, authorizeUrlFromSearchParams, assertBaseClientConfig, assertNonEmptyString, } from "./internal.js";
|
|
2
2
|
export function createClient(config) {
|
|
3
|
+
assertBaseClientConfig(config);
|
|
4
|
+
assertNonEmptyString(config.callbackUri, "callbackUri");
|
|
3
5
|
return {
|
|
4
6
|
authorizationUrl(params) {
|
|
5
7
|
const search = buildAuthorizationSearchParams(config, params);
|
|
@@ -29,11 +31,23 @@ export function parseAuthorizationResponse(input) {
|
|
|
29
31
|
: window.location.search;
|
|
30
32
|
}
|
|
31
33
|
const search = new URLSearchParams(raw.replace(/^[#?]/, ""));
|
|
34
|
+
const state = search.get("state");
|
|
32
35
|
const vpToken = search.get("vp_token");
|
|
33
|
-
if (vpToken
|
|
34
|
-
return null;
|
|
36
|
+
if (vpToken !== null) {
|
|
37
|
+
return { type: "success", vpToken, ...(state !== null && { state }) };
|
|
35
38
|
}
|
|
36
|
-
const
|
|
37
|
-
|
|
39
|
+
const error = search.get("error");
|
|
40
|
+
if (error !== null) {
|
|
41
|
+
const errorDescription = search.get("error_description");
|
|
42
|
+
const errorUri = search.get("error_uri");
|
|
43
|
+
return {
|
|
44
|
+
type: "error",
|
|
45
|
+
error,
|
|
46
|
+
...(errorDescription !== null && { errorDescription }),
|
|
47
|
+
...(errorUri !== null && { errorUri }),
|
|
48
|
+
...(state !== null && { state }),
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
return null;
|
|
38
52
|
}
|
|
39
53
|
//# sourceMappingURL=client.js.map
|
package/dist/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,EAC9B,4BAA4B,EAC5B,sBAAsB,EACtB,oBAAoB,GAGrB,MAAM,eAAe,CAAC;AAyBvB,MAAM,UAAU,YAAY,CAAC,MAAoB;IAC/C,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAC/B,oBAAoB,CAAC,MAAM,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;IACxD,OAAO;QACL,gBAAgB,CAAC,MAAkC;YACjD,MAAM,MAAM,GAAG,8BAA8B,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YAC9D,OAAO,4BAA4B,CAAC,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,CAAC;QAClE,CAAC;KACF,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,qBAAqB,CACnC,KAAgD;IAEhD,MAAM,EAAE,WAAW,EAAE,QAAQ,EAAE,WAAW,EAAE,YAAY,EAAE,GAAG,MAAM,EAAE,GAAG,KAAK,CAAC;IAC9E,MAAM,MAAM,GAAiB;QAC3B,WAAW;QACX,QAAQ;QACR,WAAW;QACX,GAAG,CAAC,YAAY,KAAK,SAAS,IAAI,EAAE,YAAY,EAAE,CAAC;KACpD,CAAC;IACF,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,gBAAgB,CAC1C,MAAoC,CACrC,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,0BAA0B,CACxC,KAAc;IAEd,IAAI,GAAG,GAAG,KAAK,CAAC;IAChB,IAAI,GAAG,KAAK,SAAS,EAAE,CAAC;QACtB,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YAClC,OAAO,IAAI,CAAC;QACd,C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{ CredentialID } from "./types.ts";
|
|
1
|
+
import type { CredentialID, KnownScope } from "./types.ts";
|
|
2
|
+
export declare const KNOWN_SCOPES: KnownScope[];
|
|
2
3
|
export declare const DEFAULT_CREDENTIAL_ID: CredentialID;
|
|
3
4
|
export declare const NATIONALITY_US_CREDENTIAL_ID: CredentialID;
|
|
4
5
|
export declare const PROOF_CREDENTIAL_V1_VCT = "https://credentials.notarize.com/ProofCredentialV1";
|
package/dist/constants.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAO3D,eAAO,MAAM,YAAY,EAAmC,UAAU,EAAE,CAAC;AAEzE,eAAO,MAAM,qBAAqB,EAAE,YAAiC,CAAC;AAEtE,eAAO,MAAM,4BAA4B,EAAE,YAChB,CAAC;AAE5B,eAAO,MAAM,uBAAuB,uDACkB,CAAC"}
|
package/dist/constants.js
CHANGED
|
@@ -1,3 +1,8 @@
|
|
|
1
|
+
const KNOWN_SCOPE_SET = {
|
|
2
|
+
"urn:proof:params:scope:verifiable-credentials:basic": true,
|
|
3
|
+
"urn:proof:params:scope:verifiable-credentials:nationality:us": true,
|
|
4
|
+
};
|
|
5
|
+
export const KNOWN_SCOPES = Object.keys(KNOWN_SCOPE_SET);
|
|
1
6
|
export const DEFAULT_CREDENTIAL_ID = "proof_id_default";
|
|
2
7
|
export const NATIONALITY_US_CREDENTIAL_ID = "proof_id_nationality_us";
|
|
3
8
|
export const PROOF_CREDENTIAL_V1_VCT = "https://credentials.notarize.com/ProofCredentialV1";
|
package/dist/constants.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,qBAAqB,GAAiB,kBAAkB,CAAC;AAEtE,MAAM,CAAC,MAAM,4BAA4B,GACvC,yBAAyB,CAAC;AAE5B,MAAM,CAAC,MAAM,uBAAuB,GAClC,oDAAoD,CAAC"}
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAEA,MAAM,eAAe,GAAG;IACtB,qDAAqD,EAAE,IAAI;IAC3D,8DAA8D,EAAE,IAAI;CAClC,CAAC;AAErC,MAAM,CAAC,MAAM,YAAY,GAAG,MAAM,CAAC,IAAI,CAAC,eAAe,CAAiB,CAAC;AAEzE,MAAM,CAAC,MAAM,qBAAqB,GAAiB,kBAAkB,CAAC;AAEtE,MAAM,CAAC,MAAM,4BAA4B,GACvC,yBAAyB,CAAC;AAE5B,MAAM,CAAC,MAAM,uBAAuB,GAClC,oDAAoD,CAAC"}
|
package/dist/dcql.d.ts
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
1
|
import type { Format } from "./types.ts";
|
|
2
2
|
export type DCQLCredentialQueryMeta = {
|
|
3
|
-
vct_values: string[];
|
|
3
|
+
vct_values: readonly string[];
|
|
4
|
+
};
|
|
5
|
+
export type DCQLClaimPathSegment = string | number | null;
|
|
6
|
+
export type DCQLClaimsQuery = {
|
|
7
|
+
id?: string;
|
|
8
|
+
path: readonly DCQLClaimPathSegment[];
|
|
9
|
+
values?: readonly (string | number | boolean)[];
|
|
4
10
|
};
|
|
5
11
|
export type DCQLCredentialQuery = {
|
|
6
12
|
id: string;
|
|
7
13
|
format: Format;
|
|
8
14
|
meta: DCQLCredentialQueryMeta;
|
|
15
|
+
claims?: readonly DCQLClaimsQuery[];
|
|
16
|
+
claim_sets?: readonly (readonly string[])[];
|
|
9
17
|
};
|
|
10
18
|
export type DCQLQuery = {
|
|
11
|
-
credentials: DCQLCredentialQuery[];
|
|
19
|
+
credentials: readonly DCQLCredentialQuery[];
|
|
12
20
|
};
|
|
13
21
|
export declare const DCQL_QUERY_BASIC: DCQLQuery;
|
|
14
22
|
//# sourceMappingURL=dcql.d.ts.map
|
package/dist/dcql.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dcql.d.ts","sourceRoot":"","sources":["../src/dcql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,MAAM,EAAE,CAAC;
|
|
1
|
+
{"version":3,"file":"dcql.d.ts","sourceRoot":"","sources":["../src/dcql.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAC;AAGzC,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG,MAAM,GAAG,IAAI,CAAC;AAE1D,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,SAAS,oBAAoB,EAAE,CAAC;IACtC,MAAM,CAAC,EAAE,SAAS,CAAC,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAAE,CAAC;CACjD,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,uBAAuB,CAAC;IAC9B,MAAM,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACpC,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAC;CAC7C,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG;IACtB,WAAW,EAAE,SAAS,mBAAmB,EAAE,CAAC;CAC7C,CAAC;AAEF,eAAO,MAAM,gBAAgB,EAAE,SAU7B,CAAC"}
|
package/dist/dcql.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import { DEFAULT_CREDENTIAL_ID, PROOF_CREDENTIAL_V1_VCT } from "./constants.js";
|
|
2
|
-
export const DCQL_QUERY_BASIC = {
|
|
3
|
-
credentials: [
|
|
4
|
-
{
|
|
2
|
+
export const DCQL_QUERY_BASIC = Object.freeze({
|
|
3
|
+
credentials: Object.freeze([
|
|
4
|
+
Object.freeze({
|
|
5
5
|
id: DEFAULT_CREDENTIAL_ID,
|
|
6
6
|
format: "dc+sd-jwt",
|
|
7
|
-
meta: {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
7
|
+
meta: Object.freeze({
|
|
8
|
+
vct_values: Object.freeze([PROOF_CREDENTIAL_V1_VCT]),
|
|
9
|
+
}),
|
|
10
|
+
}),
|
|
11
|
+
]),
|
|
12
|
+
});
|
|
11
13
|
//# sourceMappingURL=dcql.js.map
|
package/dist/dcql.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dcql.js","sourceRoot":"","sources":["../src/dcql.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"dcql.js","sourceRoot":"","sources":["../src/dcql.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,gBAAgB,CAAC;AA0BhF,MAAM,CAAC,MAAM,gBAAgB,GAAc,MAAM,CAAC,MAAM,CAAC;IACvD,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC;QACzB,MAAM,CAAC,MAAM,CAAC;YACZ,EAAE,EAAE,qBAAqB;YACzB,MAAM,EAAE,WAAoB;YAC5B,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC;gBAClB,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,uBAAuB,CAAC,CAAC;aACrD,CAAC;SACH,CAAC;KACH,CAAC;CACH,CAAC,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type ProofVCErrorCode = "invalid_config" | "invalid_input" | "authorization_server_error" | "verification_failed";
|
|
2
|
+
export declare class ProofVCError extends Error {
|
|
3
|
+
readonly code: ProofVCErrorCode;
|
|
4
|
+
readonly status?: number;
|
|
5
|
+
constructor(code: ProofVCErrorCode, message: string, options?: {
|
|
6
|
+
cause?: unknown;
|
|
7
|
+
status?: number;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB,gBAAgB,GAChB,eAAe,GACf,4BAA4B,GAC5B,qBAAqB,CAAC;AAE1B,qBAAa,YAAa,SAAQ,KAAK;IACrC,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;gBAGvB,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE;CASjD"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export class ProofVCError extends Error {
|
|
2
|
+
code;
|
|
3
|
+
status;
|
|
4
|
+
constructor(code, message, options) {
|
|
5
|
+
super(message, options);
|
|
6
|
+
this.name = "ProofVCError";
|
|
7
|
+
this.code = code;
|
|
8
|
+
if (options?.status !== undefined) {
|
|
9
|
+
this.status = options.status;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAMA,MAAM,OAAO,YAAa,SAAQ,KAAK;IAC5B,IAAI,CAAmB;IACvB,MAAM,CAAU;IAEzB,YACE,IAAsB,EACtB,OAAe,EACf,OAA8C;QAE9C,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAC3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,OAAO,EAAE,MAAM,KAAK,SAAS,EAAE,CAAC;YAClC,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;QAC/B,CAAC;IACH,CAAC;CACF"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
|
-
export type { Environment, ResponseMode, ResponseType, Scope, CredentialID, CredentialType, Format, } from "./types.ts";
|
|
2
|
-
export {
|
|
3
|
-
export
|
|
1
|
+
export type { Environment, ResponseMode, ResponseType, Scope, KnownScope, CredentialID, CredentialType, Format, } from "./types.ts";
|
|
2
|
+
export type { ProofVCErrorCode } from "./errors.ts";
|
|
3
|
+
export { ProofVCError } from "./errors.ts";
|
|
4
|
+
export { DEFAULT_CREDENTIAL_ID, NATIONALITY_US_CREDENTIAL_ID, PROOF_CREDENTIAL_V1_VCT, KNOWN_SCOPES, } from "./constants.ts";
|
|
5
|
+
export type { DCQLQuery, DCQLCredentialQuery, DCQLCredentialQueryMeta, DCQLClaimsQuery, DCQLClaimPathSegment, } from "./dcql.ts";
|
|
4
6
|
export { DCQL_QUERY_BASIC } from "./dcql.ts";
|
|
5
|
-
export type { ClientConfig, AuthorizationRequestParams, AuthorizationResponse, VCClient, } from "./client.ts";
|
|
7
|
+
export type { ClientConfig, AuthorizationRequestParams, AuthorizationResponse, AuthorizationSuccessResponse, AuthorizationErrorResponse, VCClient, } from "./client.ts";
|
|
6
8
|
export { createClient, buildAuthorizationUrl, parseAuthorizationResponse, } from "./client.ts";
|
|
9
|
+
export { agentsTrustListUrl } from "./internal.ts";
|
|
7
10
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,cAAc,EACd,MAAM,GACP,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,YAAY,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,KAAK,EACL,UAAU,EACV,YAAY,EACZ,cAAc,EACd,MAAM,GACP,MAAM,YAAY,CAAC;AAEpB,YAAY,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,YAAY,GACb,MAAM,gBAAgB,CAAC;AAExB,YAAY,EACV,SAAS,EACT,mBAAmB,EACnB,uBAAuB,EACvB,eAAe,EACf,oBAAoB,GACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,YAAY,EACV,YAAY,EACZ,0BAA0B,EAC1B,qBAAqB,EACrB,4BAA4B,EAC5B,0BAA0B,EAC1B,QAAQ,GACT,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { ProofVCError } from "./errors.js";
|
|
2
|
+
export { DEFAULT_CREDENTIAL_ID, NATIONALITY_US_CREDENTIAL_ID, PROOF_CREDENTIAL_V1_VCT, KNOWN_SCOPES, } from "./constants.js";
|
|
2
3
|
export { DCQL_QUERY_BASIC } from "./dcql.js";
|
|
3
4
|
export { createClient, buildAuthorizationUrl, parseAuthorizationResponse, } from "./client.js";
|
|
5
|
+
export { agentsTrustListUrl } from "./internal.js";
|
|
4
6
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EACL,qBAAqB,EACrB,4BAA4B,EAC5B,uBAAuB,EACvB,YAAY,GACb,MAAM,gBAAgB,CAAC;AASxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAU7C,OAAO,EACL,YAAY,EACZ,qBAAqB,EACrB,0BAA0B,GAC3B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAC"}
|
package/dist/internal.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { Environment, ResponseMode, ResponseType, Scope } from "./types.ts";
|
|
2
2
|
import type { DCQLQuery } from "./dcql.ts";
|
|
3
|
+
export { warnOnce } from "./warnings.ts";
|
|
3
4
|
export declare const OID4VP_URI = "/verifiable-credentials/v1/presentation";
|
|
4
5
|
export declare const RESPONSE_TYPE: ResponseType;
|
|
5
6
|
export type ClientConfig = {
|
|
@@ -20,12 +21,26 @@ export type AuthorizationRequestParams = BaseAuthorizationRequestParams & ({
|
|
|
20
21
|
dcqlQuery: DCQLQuery;
|
|
21
22
|
scope?: never;
|
|
22
23
|
});
|
|
24
|
+
export declare const BASE_URLS: {
|
|
25
|
+
localhost: string;
|
|
26
|
+
next: string;
|
|
27
|
+
staging: string;
|
|
28
|
+
sandbox: string;
|
|
29
|
+
production: string;
|
|
30
|
+
};
|
|
23
31
|
export declare function resolveBaseUrl(environment: Environment): string;
|
|
32
|
+
export declare function credentialIssuer(environment: Environment): string;
|
|
33
|
+
export declare function authorizationServerIssuer(environment: Environment): string;
|
|
34
|
+
export declare function agentsTrustListUrl(environment: Environment): string;
|
|
35
|
+
export declare function assertNonEmptyString(value: unknown, name: string): asserts value is string;
|
|
36
|
+
export declare function assertOneOf<T extends string>(value: unknown, allowed: Record<T, unknown>, name: string): asserts value is T;
|
|
37
|
+
export declare function assertBaseClientConfig(config: Omit<ClientConfig, "callbackUri"> & {
|
|
38
|
+
callbackUri?: string;
|
|
39
|
+
}): void;
|
|
24
40
|
export declare function assertScopeOrDcql(params: {
|
|
25
41
|
scope: Scope | undefined;
|
|
26
42
|
dcqlQuery: DCQLQuery | undefined;
|
|
27
43
|
}): void;
|
|
28
44
|
export declare function buildAuthorizationSearchParams(config: ClientConfig, params: AuthorizationRequestParams): URLSearchParams;
|
|
29
45
|
export declare function authorizeUrlFromSearchParams(environment: Environment, search: URLSearchParams): string;
|
|
30
|
-
export {};
|
|
31
46
|
//# sourceMappingURL=internal.d.ts.map
|
package/dist/internal.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,KAAK,EACN,MAAM,YAAY,CAAC;AACpB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"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wBAAgB,WAAW,CAAC,CAAC,SAAS,MAAM,EAC1C,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,MAAM,CAAC,CAAC,EAAE,OAAO,CAAC,EAC3B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,KAAK,IAAI,CAAC,CASpB;AAED,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,IAAI,CAAC,YAAY,EAAE,aAAa,CAAC,GAAG;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACnE,IAAI,CASN;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE;IACxC,KAAK,EAAE,KAAK,GAAG,SAAS,CAAC;IACzB,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;CAClC,GAAG,IAAI,CAgBP;AAED,wBAAgB,8BAA8B,CAC5C,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,0BAA0B,GACjC,eAAe,CAiBjB;AAED,wBAAgB,4BAA4B,CAC1C,WAAW,EAAE,WAAW,EACxB,MAAM,EAAE,eAAe,GACtB,MAAM,CAIR"}
|
package/dist/internal.js
CHANGED
|
@@ -1,27 +1,68 @@
|
|
|
1
|
+
import { ProofVCError } from "./errors.js";
|
|
2
|
+
import { KNOWN_SCOPES } from "./constants.js";
|
|
3
|
+
import { warnOnce } from "./warnings.js";
|
|
4
|
+
export { warnOnce } from "./warnings.js";
|
|
1
5
|
export const OID4VP_URI = "/verifiable-credentials/v1/presentation";
|
|
2
6
|
export const RESPONSE_TYPE = "vp_token";
|
|
3
7
|
const DEFAULT_RESPONSE_MODE = "fragment";
|
|
8
|
+
export const BASE_URLS = {
|
|
9
|
+
localhost: "https://api.local.dev-notarize.com",
|
|
10
|
+
next: "https://api.next.proof.com",
|
|
11
|
+
staging: "https://api.staging.proof.com",
|
|
12
|
+
sandbox: "https://api.fairfax.proof.com",
|
|
13
|
+
production: "https://api.proof.com",
|
|
14
|
+
};
|
|
15
|
+
const RESPONSE_MODES = {
|
|
16
|
+
fragment: true,
|
|
17
|
+
direct_post: true,
|
|
18
|
+
};
|
|
4
19
|
export function resolveBaseUrl(environment) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
20
|
+
return BASE_URLS[environment];
|
|
21
|
+
}
|
|
22
|
+
export function credentialIssuer(environment) {
|
|
23
|
+
return resolveBaseUrl(environment);
|
|
24
|
+
}
|
|
25
|
+
export function authorizationServerIssuer(environment) {
|
|
26
|
+
return new URL(OID4VP_URI, resolveBaseUrl(environment)).toString();
|
|
27
|
+
}
|
|
28
|
+
export function agentsTrustListUrl(environment) {
|
|
29
|
+
assertOneOf(environment, BASE_URLS, "environment");
|
|
30
|
+
return new URL("/.well-known/agents-trust-list", resolveBaseUrl(environment)).toString();
|
|
31
|
+
}
|
|
32
|
+
export function assertNonEmptyString(value, name) {
|
|
33
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
34
|
+
throw new ProofVCError("invalid_config", `\`${name}\` must be a non-empty string`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export function assertOneOf(value, allowed, name) {
|
|
38
|
+
if (typeof value !== "string" || !Object.hasOwn(allowed, value)) {
|
|
39
|
+
throw new ProofVCError("invalid_config", `\`${name}\` must be one of ${Object.keys(allowed)
|
|
40
|
+
.map((k) => `"${k}"`)
|
|
41
|
+
.join(", ")}`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export function assertBaseClientConfig(config) {
|
|
45
|
+
assertOneOf(config.environment, BASE_URLS, "environment");
|
|
46
|
+
assertNonEmptyString(config.clientId, "clientId");
|
|
47
|
+
if (config.responseMode !== undefined) {
|
|
48
|
+
assertOneOf(config.responseMode, RESPONSE_MODES, "responseMode");
|
|
49
|
+
}
|
|
50
|
+
if (config.callbackUri !== undefined) {
|
|
51
|
+
assertNonEmptyString(config.callbackUri, "callbackUri");
|
|
16
52
|
}
|
|
17
53
|
}
|
|
18
54
|
export function assertScopeOrDcql(params) {
|
|
19
55
|
if ((params.scope === undefined) === (params.dcqlQuery === undefined)) {
|
|
20
|
-
throw new
|
|
56
|
+
throw new ProofVCError("invalid_config", "authorization request requires exactly one of `scope` or `dcqlQuery`");
|
|
57
|
+
}
|
|
58
|
+
if (params.scope !== undefined &&
|
|
59
|
+
!KNOWN_SCOPES.includes(params.scope)) {
|
|
60
|
+
warnOnce("PROOF_VC_UNKNOWN_SCOPE", `scope "${params.scope}" is not known to this version of the Proof VC SDK; upgrade to a newer version`);
|
|
21
61
|
}
|
|
22
62
|
}
|
|
23
63
|
export function buildAuthorizationSearchParams(config, params) {
|
|
24
64
|
const { scope, dcqlQuery, nonce, state, loginHint } = params;
|
|
65
|
+
assertNonEmptyString(nonce, "nonce");
|
|
25
66
|
assertScopeOrDcql({ scope, dcqlQuery });
|
|
26
67
|
const responseMode = config.responseMode ?? DEFAULT_RESPONSE_MODE;
|
|
27
68
|
return new URLSearchParams({
|
package/dist/internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"internal.js","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAEzC,MAAM,CAAC,MAAM,UAAU,GAAG,yCAAyC,CAAC;AACpE,MAAM,CAAC,MAAM,aAAa,GAAiB,UAAU,CAAC;AACtD,MAAM,qBAAqB,GAAiB,UAAU,CAAC;AAqBvD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,SAAS,EAAE,oCAAoC;IAC/C,I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AAE,OAAO,CAAC,CAAC;IACrC,iBAAiB,CAAC,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC,CAAC;IACxC,MAAM,YAAY,GAAG,MAAM,CAAC,YAAY,IAAI,qBAAqB,CAAC;IAClE,OAAO,IAAI,eAAe,CAAC;QACzB,SAAS,EAAE,MAAM,CAAC,QAAQ;QAC1B,aAAa,EAAE,YAAY;QAC3B,aAAa,EAAE,aAAa;QAC5B,GAAG,CAAC,YAAY,KAAK,UAAU,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;QACxE,GAAG,CAAC,YAAY,KAAK,aAAa,IAAI,EAAE,YAAY,EAAE,MAAM,CAAC,WAAW,EAAE,CAAC;QAC3E,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;QACrC,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,CAAC;QACzE,KAAK;QACL,GAAG,CAAC,KAAK,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,CAAC;QACrC,GAAG,CAAC,SAAS,KAAK,SAAS,IAAI,EAAE,UAAU,EAAE,SAAS,EAAE,CAAC;KAC1D,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,4BAA4B,CAC1C,WAAwB,EACxB,MAAuB;IAEvB,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,UAAU,YAAY,EAAE,cAAc,CAAC,WAAW,CAAC,CAAC,CAAC;IAC5E,GAAG,CAAC,MAAM,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAC/B,OAAO,GAAG,CAAC,QAAQ,EAAE,CAAC;AACxB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export type Environment = "localhost" | "next" | "staging" | "sandbox" | "production";
|
|
2
2
|
export type ResponseMode = "fragment" | "direct_post";
|
|
3
3
|
export type ResponseType = "vp_token";
|
|
4
|
-
export type
|
|
4
|
+
export type KnownScope = "urn:proof:params:scope:verifiable-credentials:basic" | "urn:proof:params:scope:verifiable-credentials:nationality:us";
|
|
5
|
+
export type Scope = string;
|
|
5
6
|
export type CredentialID = "proof_id_default" | "proof_id_nationality_us";
|
|
6
|
-
export type CredentialType = "ProofCredentialV1";
|
|
7
|
+
export type CredentialType = "ProofCredentialV1" | "Default";
|
|
7
8
|
export type Format = "dc+sd-jwt";
|
|
8
9
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GACrB,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,YAAY,CAAC;AAC9D,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,aAAa,CAAC;AACtD,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC;AACtC,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GACrB,WAAW,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,YAAY,CAAC;AAC9D,MAAM,MAAM,YAAY,GAAG,UAAU,GAAG,aAAa,CAAC;AACtD,MAAM,MAAM,YAAY,GAAG,UAAU,CAAC;AACtC,MAAM,MAAM,UAAU,GAClB,qDAAqD,GACrD,8DAA8D,CAAC;AACnE,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC;AAC3B,MAAM,MAAM,YAAY,GAAG,kBAAkB,GAAG,yBAAyB,CAAC;AAC1E,MAAM,MAAM,cAAc,GAAG,mBAAmB,GAAG,SAAS,CAAC;AAC7D,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warnings.d.ts","sourceRoot":"","sources":["../src/warnings.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,mBAAmB,CAAC;AAW7C,wBAAgB,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAY5D"}
|
package/dist/warnings.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export const WARNING_TYPE = "ProofVCWarning";
|
|
2
|
+
const emitted = new Set();
|
|
3
|
+
export function warnOnce(code, message) {
|
|
4
|
+
const key = `${code}:${message}`;
|
|
5
|
+
if (emitted.has(key)) {
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
emitted.add(key);
|
|
9
|
+
const nodeProcess = globalThis.process;
|
|
10
|
+
if (typeof nodeProcess?.emitWarning === "function") {
|
|
11
|
+
nodeProcess.emitWarning(message, { type: WARNING_TYPE, code });
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
console.warn(`${WARNING_TYPE} [${code}]: ${message}`);
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=warnings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"warnings.js","sourceRoot":"","sources":["../src/warnings.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GAAG,gBAAgB,CAAC;AAS7C,MAAM,OAAO,GAAG,IAAI,GAAG,EAAU,CAAC;AAElC,MAAM,UAAU,QAAQ,CAAC,IAAY,EAAE,OAAe;IACpD,MAAM,GAAG,GAAG,GAAG,IAAI,IAAI,OAAO,EAAE,CAAC;IACjC,IAAI,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QACrB,OAAO;IACT,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IACjB,MAAM,WAAW,GAAI,UAA+C,CAAC,OAAO,CAAC;IAC7E,IAAI,OAAO,WAAW,EAAE,WAAW,KAAK,UAAU,EAAE,CAAC;QACnD,WAAW,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAC;QAC/D,OAAO;IACT,CAAC;IACD,OAAO,CAAC,IAAI,CAAC,GAAG,YAAY,KAAK,IAAI,MAAM,OAAO,EAAE,CAAC,CAAC;AACxD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proof.com/proof-vc-common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"description": "A digital passport, verified once, usable everywhere.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"VC",
|
|
7
7
|
"Verifiable Credentials",
|
|
8
8
|
"OID4VCI",
|
|
9
|
-
"
|
|
9
|
+
"OID4VP",
|
|
10
10
|
"SD-JWT-VC",
|
|
11
11
|
"Selective Disclosures",
|
|
12
12
|
"Proof",
|
|
@@ -34,6 +34,8 @@
|
|
|
34
34
|
"default": "./dist/internal.js"
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
|
+
"main": "./dist/index.js",
|
|
38
|
+
"types": "./dist/index.d.ts",
|
|
37
39
|
"files": [
|
|
38
40
|
"dist"
|
|
39
41
|
],
|
|
@@ -47,7 +49,7 @@
|
|
|
47
49
|
"typescript": "^6.0.3"
|
|
48
50
|
},
|
|
49
51
|
"engines": {
|
|
50
|
-
"node": ">=22.
|
|
52
|
+
"node": ">=22.12.0"
|
|
51
53
|
},
|
|
52
54
|
"publishConfig": {
|
|
53
55
|
"access": "public"
|