From 5df183daba17e7cde24454abc103d292eefd4b7a Mon Sep 17 00:00:00 2001 From: Devin Turner <5410284+l1h3r@users.noreply.github.com> Date: Wed, 2 Jun 2021 10:03:41 -0700 Subject: [PATCH] Use u32 for message delays (#281) * Use u32 for message delays * Update docs * Update version --- bindings/wasm/docs/api-reference.md | 137 ++++------------------------ bindings/wasm/package.json | 2 +- bindings/wasm/src/message/timing.rs | 4 +- bindings/wasm/src/wasm_document.rs | 2 +- identity-comm/src/message/timing.rs | 6 +- 5 files changed, 23 insertions(+), 128 deletions(-) diff --git a/bindings/wasm/docs/api-reference.md b/bindings/wasm/docs/api-reference.md index db76e3c6d1..b601e2ae72 100644 --- a/bindings/wasm/docs/api-reference.md +++ b/bindings/wasm/docs/api-reference.md @@ -75,6 +75,9 @@ ## Functions
+
start()
+

Initializes the console error panic hook for better error messages

+
publish(document, params)any

Publishes a DID Document to the Tangle, params looks like { node: "http://localhost:14265", network: "main" }

@@ -87,9 +90,6 @@
checkPresentation(data, params)any

Validates a presentation with the DID Document from the Tangle, params looks like { node: "http://localhost:14265", network: "main" }

-
start()
-

Initializes the console error panic hook for better error messages

-
@@ -99,115 +99,10 @@ * [AuthenticationRequest](#AuthenticationRequest) * _instance_ - * [.context](#AuthenticationRequest+context) ⇒ string - * [.context](#AuthenticationRequest+context) - * [.thread](#AuthenticationRequest+thread) ⇒ string - * [.thread](#AuthenticationRequest+thread) - * [.callbackURL](#AuthenticationRequest+callbackURL) ⇒ string - * [.callbackURL](#AuthenticationRequest+callbackURL) - * [.challenge](#AuthenticationRequest+challenge) ⇒ string - * [.challenge](#AuthenticationRequest+challenge) - * [.responseRequested](#AuthenticationRequest+responseRequested) ⇒ boolean \| undefined - * [.responseRequested](#AuthenticationRequest+responseRequested) - * [.id](#AuthenticationRequest+id) ⇒ [DID](#DID) \| undefined - * [.id](#AuthenticationRequest+id) - * [.timing](#AuthenticationRequest+timing) ⇒ [Timing](#Timing) \| undefined - * [.timing](#AuthenticationRequest+timing) * [.toJSON()](#AuthenticationRequest+toJSON) ⇒ any * _static_ * [.fromJSON(value)](#AuthenticationRequest.fromJSON) ⇒ [AuthenticationRequest](#AuthenticationRequest) - - -### authenticationRequest.context ⇒ string -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - - -### authenticationRequest.context -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - -| Param | Type | -| --- | --- | -| value | string | - - - -### authenticationRequest.thread ⇒ string -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - - -### authenticationRequest.thread -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - -| Param | Type | -| --- | --- | -| value | string | - - - -### authenticationRequest.callbackURL ⇒ string -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - - -### authenticationRequest.callbackURL -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - -| Param | Type | -| --- | --- | -| value | string | - - - -### authenticationRequest.challenge ⇒ string -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - - -### authenticationRequest.challenge -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - -| Param | Type | -| --- | --- | -| value | string | - - - -### authenticationRequest.responseRequested ⇒ boolean \| undefined -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - - -### authenticationRequest.responseRequested -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - -| Param | Type | -| --- | --- | -| value | boolean | - - - -### authenticationRequest.id ⇒ [DID](#DID) \| undefined -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - - -### authenticationRequest.id -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - -| Param | Type | -| --- | --- | -| value | string | - - - -### authenticationRequest.timing ⇒ [Timing](#Timing) \| undefined -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - - -### authenticationRequest.timing -**Kind**: instance property of [AuthenticationRequest](#AuthenticationRequest) - -| Param | Type | -| --- | --- | -| value | [Timing](#Timing) | - ### authenticationRequest.toJSON() ⇒ any @@ -531,7 +426,7 @@ Parses a `DID` from the input string. * [.merge(diff)](#Document+merge) * [.toJSON()](#Document+toJSON) ⇒ any * _static_ - * [.fromKeyPair(key)](#Document.fromKeyPair) ⇒ [Document](#Document) + * [.fromKeyPair(key, network)](#Document.fromKeyPair) ⇒ [Document](#Document) * [.fromAuthentication(method)](#Document.fromAuthentication) ⇒ [Document](#Document) * [.fromJSON(json)](#Document.fromJSON) ⇒ [Document](#Document) @@ -724,10 +619,10 @@ Serializes a `Document` object as a JSON object. **Kind**: instance method of [Document](#Document) -### Document.fromKeyPair(key) ⇒ [Document](#Document) +### Document.fromKeyPair(key, network) ⇒ [Document](#Document) Creates a new DID Document from the given KeyPair and optional network. -If unspecified, the network defaults to the mainnet. +If unspecified, network defaults to the mainnet. **Kind**: static method of [Document](#Document) @@ -1189,7 +1084,7 @@ Serializes a `Service` object as a JSON object. ### Service.fromJSON(value) ⇒ [Service](#Service) -Deserializes a `Method` object from a JSON object. +Deserializes a `Service` object from a JSON object. **Kind**: static method of [Service](#Service) @@ -1214,7 +1109,7 @@ Deserializes a `Method` object from a JSON object. * [.expiresTime](#Timing+expiresTime) * [.waitUntilTime](#Timing+waitUntilTime) ⇒ string \| undefined * [.waitUntilTime](#Timing+waitUntilTime) - * [.delayMilli](#Timing+delayMilli) ⇒ BigInt \| undefined + * [.delayMilli](#Timing+delayMilli) ⇒ number \| undefined * [.delayMilli](#Timing+delayMilli) * [.toJSON()](#Timing+toJSON) ⇒ any * _static_ @@ -1287,7 +1182,7 @@ Deserializes a `Method` object from a JSON object. -### timing.delayMilli ⇒ BigInt \| undefined +### timing.delayMilli ⇒ number \| undefined **Kind**: instance property of [Timing](#Timing) @@ -1296,7 +1191,7 @@ Deserializes a `Method` object from a JSON object. | Param | Type | | --- | --- | -| value | BigInt | +| value | number | @@ -1555,6 +1450,12 @@ Deserializes a `VerificationMethod` object from a JSON object. ## KeyType **Kind**: global variable + + +## start() +Initializes the console error panic hook for better error messages + +**Kind**: global function ## publish(document, params) ⇒ any @@ -1603,9 +1504,3 @@ Validates a presentation with the DID Document from the Tangle, params looks lik | data | string | | params | any | - - -## start() -Initializes the console error panic hook for better error messages - -**Kind**: global function diff --git a/bindings/wasm/package.json b/bindings/wasm/package.json index 503ed752b2..65abec64f9 100644 --- a/bindings/wasm/package.json +++ b/bindings/wasm/package.json @@ -1,6 +1,6 @@ { "name": "@iota/identity-wasm", - "version": "0.3.1", + "version": "0.3.2", "description": "WASM bindings for IOTA Identity - A Self Sovereign Identity Framework implementing the DID and VC standards from W3C. To be used in Javascript/Typescript", "repository": { "type": "git", diff --git a/bindings/wasm/src/message/timing.rs b/bindings/wasm/src/message/timing.rs index b0a6a3035e..5f50ab84b4 100644 --- a/bindings/wasm/src/message/timing.rs +++ b/bindings/wasm/src/message/timing.rs @@ -64,12 +64,12 @@ impl Timing { } #[wasm_bindgen(getter = delayMilli)] - pub fn delay_milli(&self) -> Option { + pub fn delay_milli(&self) -> Option { self.0.delay_milli() } #[wasm_bindgen(setter = delayMilli)] - pub fn set_delay_milli(&mut self, value: u64) { + pub fn set_delay_milli(&mut self, value: u32) { self.0.set_delay_milli(value); } diff --git a/bindings/wasm/src/wasm_document.rs b/bindings/wasm/src/wasm_document.rs index 0902706904..a8accc42f9 100644 --- a/bindings/wasm/src/wasm_document.rs +++ b/bindings/wasm/src/wasm_document.rs @@ -87,7 +87,7 @@ impl WasmDocument { pub fn from_keypair(key: &KeyPair, network: Option) -> Result { let doc = match network { Some(net) => IotaDocument::from_keypair_with_network(&key.0, &net), - None => IotaDocument::from_keypair(&key.0) + None => IotaDocument::from_keypair(&key.0), }; doc.map_err(err).map(Self) } diff --git a/identity-comm/src/message/timing.rs b/identity-comm/src/message/timing.rs index ac58e2113a..951074057f 100644 --- a/identity-comm/src/message/timing.rs +++ b/identity-comm/src/message/timing.rs @@ -19,7 +19,7 @@ pub struct Timing { #[serde(skip_serializing_if = "Option::is_none")] wait_until_time: Option, #[serde(skip_serializing_if = "Option::is_none")] - delay_milli: Option, + delay_milli: Option, } impl Timing { @@ -111,12 +111,12 @@ impl Timing { } /// Returns the value of the `delay_milli` field. - pub fn delay_milli(&self) -> Option { + pub fn delay_milli(&self) -> Option { self.delay_milli } /// Sets the value of the `delay_milli` field. - pub fn set_delay_milli>>(&mut self, value: T) { + pub fn set_delay_milli>>(&mut self, value: T) { self.delay_milli = value.into(); } }