Skip to content

Commit 1a030d5

Browse files
authored
Update sd-jwt-payload dependency (#1296)
1 parent 22f042a commit 1a030d5

File tree

9 files changed

+115
-160
lines changed

9 files changed

+115
-160
lines changed

bindings/wasm/docs/api-reference.md

+71-80
Original file line numberDiff line numberDiff line change
@@ -189,9 +189,10 @@ working with storage backed DID documents.</p>
189189
<dl>
190190
<dt><a href="#StateMetadataEncoding">StateMetadataEncoding</a></dt>
191191
<dd></dd>
192-
<dt><a href="#StatusPurpose">StatusPurpose</a></dt>
193-
<dd><p>Purpose of a <a href="#StatusList2021">StatusList2021</a>.</p>
194-
</dd>
192+
<dt><a href="#MethodRelationship">MethodRelationship</a></dt>
193+
<dd></dd>
194+
<dt><a href="#CredentialStatus">CredentialStatus</a></dt>
195+
<dd></dd>
195196
<dt><a href="#SubjectHolderRelationship">SubjectHolderRelationship</a></dt>
196197
<dd><p>Declares how credential subjects must relate to the presentation holder.</p>
197198
<p>See also the <a href="https://www.w3.org/TR/vc-data-model/#subject-holder-relationships">Subject-Holder Relationship</a> section of the specification.</p>
@@ -215,6 +216,9 @@ This variant is the default.</p>
215216
<dt><a href="#FirstError">FirstError</a></dt>
216217
<dd><p>Return after the first error occurs.</p>
217218
</dd>
219+
<dt><a href="#StatusPurpose">StatusPurpose</a></dt>
220+
<dd><p>Purpose of a <a href="#StatusList2021">StatusList2021</a>.</p>
221+
</dd>
218222
<dt><a href="#StatusCheck">StatusCheck</a></dt>
219223
<dd><p>Controls validation behaviour when checking whether or not a credential has been revoked by its
220224
<a href="https://www.w3.org/TR/vc-data-model/#status"><code>credentialStatus</code></a>.</p>
@@ -232,15 +236,17 @@ This variant is the default.</p>
232236
<dt><a href="#SkipAll">SkipAll</a></dt>
233237
<dd><p>Skip all status checks.</p>
234238
</dd>
235-
<dt><a href="#CredentialStatus">CredentialStatus</a></dt>
236-
<dd></dd>
237-
<dt><a href="#MethodRelationship">MethodRelationship</a></dt>
238-
<dd></dd>
239239
</dl>
240240

241241
## Functions
242242

243243
<dl>
244+
<dt><a href="#encodeB64">encodeB64(data)</a> ⇒ <code>string</code></dt>
245+
<dd><p>Encode the given bytes in url-safe base64.</p>
246+
</dd>
247+
<dt><a href="#decodeB64">decodeB64(data)</a> ⇒ <code>Uint8Array</code></dt>
248+
<dd><p>Decode the given url-safe base64-encoded slice into its raw bytes.</p>
249+
</dd>
244250
<dt><a href="#verifyEd25519">verifyEd25519(alg, signingInput, decodedSignature, publicKey)</a></dt>
245251
<dd><p>Verify a JWS signature secured with the <code>EdDSA</code> algorithm and curve <code>Ed25519</code>.</p>
246252
<p>This function is useful when one is composing a <code>IJwsVerifier</code> that delegates
@@ -249,12 +255,6 @@ This variant is the default.</p>
249255
<p>This function does not check whether <code>alg = EdDSA</code> in the protected header. Callers are expected to assert this
250256
prior to calling the function.</p>
251257
</dd>
252-
<dt><a href="#encodeB64">encodeB64(data)</a> ⇒ <code>string</code></dt>
253-
<dd><p>Encode the given bytes in url-safe base64.</p>
254-
</dd>
255-
<dt><a href="#decodeB64">decodeB64(data)</a> ⇒ <code>Uint8Array</code></dt>
256-
<dd><p>Decode the given url-safe base64-encoded slice into its raw bytes.</p>
257-
</dd>
258258
<dt><a href="#start">start()</a></dt>
259259
<dd><p>Initializes the console error panic hook for better error messages</p>
260260
</dd>
@@ -5233,7 +5233,6 @@ Note: digests are created using the sha-256 algorithm.
52335233
* [SdObjectEncoder](#SdObjectEncoder)
52345234
* [new SdObjectEncoder(object)](#new_SdObjectEncoder_new)
52355235
* [.conceal(path, [salt])](#SdObjectEncoder+conceal)[<code>Disclosure</code>](#Disclosure)
5236-
* [.concealArrayEntry(path, element_index, [salt])](#SdObjectEncoder+concealArrayEntry)[<code>Disclosure</code>](#Disclosure)
52375236
* [.addSdAlgProperty()](#SdObjectEncoder+addSdAlgProperty)
52385237
* [.encodeToString()](#SdObjectEncoder+encodeToString) ⇒ <code>string</code>
52395238
* [.toString()](#SdObjectEncoder+toString) ⇒ <code>string</code>
@@ -5257,43 +5256,35 @@ Creates a new `SdObjectEncoder` with `sha-256` hash function.
52575256
Substitutes a value with the digest of its disclosure.
52585257
If no salt is provided, the disclosure will be created with a random salt value.
52595258

5260-
The value of the key specified in `path` will be concealed. E.g. for path
5261-
`["claim", "subclaim"]` the value of `claim.subclaim` will be concealed.
5259+
`path` indicates the pointer to the value that will be concealed using the syntax of
5260+
[JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901).
52625261

5263-
## Error
5264-
`InvalidPath` if path is invalid or the path slice is empty.
5265-
`DataTypeMismatch` if existing SD format is invalid.
5262+
For the following object:
52665263

5267-
## Note
5268-
Use `concealArrayEntry` for values in arrays.
5264+
```
5265+
{
5266+
"id": "did:value",
5267+
"claim1": {
5268+
"abc": true
5269+
},
5270+
"claim2": ["val_1", "val_2"]
5271+
}
5272+
```
52695273

5270-
**Kind**: instance method of [<code>SdObjectEncoder</code>](#SdObjectEncoder)
5274+
Path "/id" conceals `"id": "did:value"`
5275+
Path "/claim1/abc" conceals `"abc": true`
5276+
Path "/claim2/0" conceals `val_1`
5277+
```
52715278
5272-
| Param | Type |
5273-
| --- | --- |
5274-
| path | <code>Array.&lt;string&gt;</code> |
5275-
| [salt] | <code>string</code> \| <code>undefined</code> |
5276-
5277-
<a name="SdObjectEncoder+concealArrayEntry"></a>
5278-
5279-
### sdObjectEncoder.concealArrayEntry(path, element_index, [salt]) ⇒ [<code>Disclosure</code>](#Disclosure)
5280-
Substitutes a value within an array with the digest of its disclosure.
5281-
If no salt is provided, the disclosure will be created with random salt value.
5282-
5283-
`path` is used to specify the array in the object, while `element_index` specifies
5284-
the index of the element to be concealed (index start at 0).
5285-
5286-
## Error
5287-
`InvalidPath` if path is invalid or the path slice is empty.
5288-
`DataTypeMismatch` if existing SD format is invalid.
5289-
`IndexOutofBounds` if `element_index` is out of bounds.
5279+
## Errors
5280+
* `InvalidPath` if pointer is invalid.
5281+
* `DataTypeMismatch` if existing SD format is invalid.
52905282
52915283
**Kind**: instance method of [<code>SdObjectEncoder</code>](#SdObjectEncoder)
52925284
52935285
| Param | Type |
52945286
| --- | --- |
5295-
| path | <code>Array.&lt;string&gt;</code> |
5296-
| element_index | <code>number</code> |
5287+
| path | <code>string</code> |
52975288
| [salt] | <code>string</code> \| <code>undefined</code> |
52985289
52995290
<a name="SdObjectEncoder+addSdAlgProperty"></a>
@@ -5337,7 +5328,7 @@ If path is an empty slice, decoys will be added to the top level.
53375328
53385329
| Param | Type |
53395330
| --- | --- |
5340-
| path | <code>Array.&lt;string&gt;</code> |
5331+
| path | <code>string</code> |
53415332
| number_of_decoys | <code>number</code> |
53425333
53435334
<a name="Service"></a>
@@ -5506,7 +5497,7 @@ A parsed [StatusList2021Credential](https://www.w3.org/TR/2023/WD-vc-status-list
55065497
* [new StatusList2021Credential(credential)](#new_StatusList2021Credential_new)
55075498
* _instance_
55085499
* [.id()](#StatusList2021Credential+id) ⇒ <code>string</code>
5509-
* [.setCredentialStatus(credential, index, value)](#StatusList2021Credential+setCredentialStatus)[<code>StatusList2021Entry</code>](#StatusList2021Entry)
5500+
* [.setCredentialStatus(credential, index, revoked_or_suspended)](#StatusList2021Credential+setCredentialStatus) ⇒ [<code>StatusList2021Entry</code>](#StatusList2021Entry)
55105501
* [.purpose()](#StatusList2021Credential+purpose) ⇒ [<code>StatusPurpose</code>](#StatusPurpose)
55115502
* [.entry(index)](#StatusList2021Credential+entry) ⇒ [<code>CredentialStatus</code>](#CredentialStatus)
55125503
* [.clone()](#StatusList2021Credential+clone) ⇒ [<code>StatusList2021Credential</code>](#StatusList2021Credential)
@@ -5530,7 +5521,7 @@ Creates a new [StatusList2021Credential](#StatusList2021Credential).
55305521
**Kind**: instance method of [<code>StatusList2021Credential</code>](#StatusList2021Credential)
55315522
<a name="StatusList2021Credential+setCredentialStatus"></a>
55325523
5533-
### statusList2021Credential.setCredentialStatus(credential, index, value) ⇒ [<code>StatusList2021Entry</code>](#StatusList2021Entry)
5524+
### statusList2021Credential.setCredentialStatus(credential, index, revoked_or_suspended) ⇒ [<code>StatusList2021Entry</code>](#StatusList2021Entry)
55345525
Sets the given credential's status using the `index`-th entry of this status list.
55355526
Returns the created `credentialStatus`.
55365527
@@ -5540,7 +5531,7 @@ Returns the created `credentialStatus`.
55405531
| --- | --- |
55415532
| credential | [<code>Credential</code>](#Credential) |
55425533
| index | <code>number</code> |
5543-
| value | <code>boolean</code> |
5534+
| revoked_or_suspended | <code>boolean</code> |
55445535
55455536
<a name="StatusList2021Credential+purpose"></a>
55465537
@@ -5700,7 +5691,7 @@ Attempts to build a valid [StatusList2021Credential](#StatusList2021Credential)
57005691
* [.id()](#StatusList2021Entry+id) ⇒ <code>string</code>
57015692
* [.purpose()](#StatusList2021Entry+purpose) ⇒ [<code>StatusPurpose</code>](#StatusPurpose)
57025693
* [.index()](#StatusList2021Entry+index) ⇒ <code>number</code>
5703-
* [.status_list_credential()](#StatusList2021Entry+status_list_credential) ⇒ <code>string</code>
5694+
* [.statusListCredential()](#StatusList2021Entry+statusListCredential) ⇒ <code>string</code>
57045695
* [.toStatus()](#StatusList2021Entry+toStatus) ⇒ <code>Status</code>
57055696
* [.clone()](#StatusList2021Entry+clone) ⇒ [<code>StatusList2021Entry</code>](#StatusList2021Entry)
57065697
* [.toJSON()](#StatusList2021Entry+toJSON) ⇒ <code>any</code>
@@ -5738,9 +5729,9 @@ Returns the purpose of this entry.
57385729
Returns the index of this entry.
57395730
57405731
**Kind**: instance method of [<code>StatusList2021Entry</code>](#StatusList2021Entry)
5741-
<a name="StatusList2021Entry+status_list_credential"></a>
5732+
<a name="StatusList2021Entry+statusListCredential"></a>
57425733
5743-
### statusList2021Entry.status\_list\_credential() ⇒ <code>string</code>
5734+
### statusList2021Entry.statusListCredential() ⇒ <code>string</code>
57445735
Returns the referenced [StatusList2021Credential](#StatusList2021Credential)'s url.
57455736
57465737
**Kind**: instance method of [<code>StatusList2021Entry</code>](#StatusList2021Entry)
@@ -6117,11 +6108,13 @@ Deserializes an instance from a JSON object.
61176108
61186109
## StateMetadataEncoding
61196110
**Kind**: global variable
6120-
<a name="StatusPurpose"></a>
6111+
<a name="MethodRelationship"></a>
61216112
6122-
## StatusPurpose
6123-
Purpose of a [StatusList2021](#StatusList2021).
6113+
## MethodRelationship
6114+
**Kind**: global variable
6115+
<a name="CredentialStatus"></a>
61246116
6117+
## CredentialStatus
61256118
**Kind**: global variable
61266119
<a name="SubjectHolderRelationship"></a>
61276120
@@ -6167,6 +6160,12 @@ Return all errors that occur during validation.
61676160
## FirstError
61686161
Return after the first error occurs.
61696162
6163+
**Kind**: global variable
6164+
<a name="StatusPurpose"></a>
6165+
6166+
## StatusPurpose
6167+
Purpose of a [StatusList2021](#StatusList2021).
6168+
61706169
**Kind**: global variable
61716170
<a name="StatusCheck"></a>
61726171
@@ -6199,14 +6198,28 @@ Validate the status if supported, skip any unsupported
61996198
Skip all status checks.
62006199
62016200
**Kind**: global variable
6202-
<a name="CredentialStatus"></a>
6201+
<a name="encodeB64"></a>
62036202
6204-
## CredentialStatus
6205-
**Kind**: global variable
6206-
<a name="MethodRelationship"></a>
6203+
## encodeB64(data) ⇒ <code>string</code>
6204+
Encode the given bytes in url-safe base64.
6205+
6206+
**Kind**: global function
6207+
6208+
| Param | Type |
6209+
| --- | --- |
6210+
| data | <code>Uint8Array</code> |
6211+
6212+
<a name="decodeB64"></a>
6213+
6214+
## decodeB64(data) ⇒ <code>Uint8Array</code>
6215+
Decode the given url-safe base64-encoded slice into its raw bytes.
6216+
6217+
**Kind**: global function
6218+
6219+
| Param | Type |
6220+
| --- | --- |
6221+
| data | <code>Uint8Array</code> |
62076222
6208-
## MethodRelationship
6209-
**Kind**: global variable
62106223
<a name="verifyEd25519"></a>
62116224
62126225
## verifyEd25519(alg, signingInput, decodedSignature, publicKey)
@@ -6229,28 +6242,6 @@ prior to calling the function.
62296242
| decodedSignature | <code>Uint8Array</code> |
62306243
| publicKey | [<code>Jwk</code>](#Jwk) |
62316244
6232-
<a name="encodeB64"></a>
6233-
6234-
## encodeB64(data) ⇒ <code>string</code>
6235-
Encode the given bytes in url-safe base64.
6236-
6237-
**Kind**: global function
6238-
6239-
| Param | Type |
6240-
| --- | --- |
6241-
| data | <code>Uint8Array</code> |
6242-
6243-
<a name="decodeB64"></a>
6244-
6245-
## decodeB64(data) ⇒ <code>Uint8Array</code>
6246-
Decode the given url-safe base64-encoded slice into its raw bytes.
6247-
6248-
**Kind**: global function
6249-
6250-
| Param | Type |
6251-
| --- | --- |
6252-
| data | <code>Uint8Array</code> |
6253-
62546245
<a name="start"></a>
62556246
62566247
## start()

bindings/wasm/examples/src/1_advanced/6_sd_jwt.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -99,16 +99,16 @@ export async function sdJwt() {
9999
// Make "locality", "postal_code", "street_address" and the first entry of "nationalities"
100100
// selectively disclosable while keeping other properties in plain text.
101101
let disclosures = [
102-
encoder.conceal(["vc", "credentialSubject", "address", "locality"]),
103-
encoder.conceal(["vc", "credentialSubject", "address", "postal_code"]),
104-
encoder.conceal(["vc", "credentialSubject", "address", "street_address"]),
105-
encoder.concealArrayEntry(["vc", "credentialSubject", "nationalities"], 1),
102+
encoder.conceal("/vc/credentialSubject/address/locality"),
103+
encoder.conceal("/vc/credentialSubject/address/postal_code"),
104+
encoder.conceal("/vc/credentialSubject/address/street_address"),
105+
encoder.conceal("/vc/credentialSubject/nationalities/1"),
106106
];
107107

108108
// Add decoys in the credential top level, nationalities array and address object.
109-
encoder.addDecoys(["vc", "credentialSubject", "nationalities"], 3);
110-
encoder.addDecoys(["vc"], 4);
111-
encoder.addDecoys(["vc", "credentialSubject", "address"], 2);
109+
encoder.addDecoys("/vc/credentialSubject/nationalities", 3);
110+
encoder.addDecoys("/vc", 4);
111+
encoder.addDecoys("/vc/credentialSubject/address", 2);
112112

113113
// Add the `_sd_alg` property.
114114
encoder.addSdAlgProperty();

0 commit comments

Comments
 (0)