Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump to 0.3.8 for @iota/identity-wasm@dev, add set_message_id #373

Merged
merged 3 commits into from
Aug 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions bindings/wasm/docs/api-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -715,6 +715,7 @@ Parses a `DID` from the input string.
* [.updated](#Document+updated)
* [.proof](#Document+proof) ⇒ <code>any</code>
* [.messageId](#Document+messageId) ⇒ <code>string</code>
* [.messageId](#Document+messageId)
* [.previousMessageId](#Document+previousMessageId) ⇒ <code>string</code>
* [.previousMessageId](#Document+previousMessageId)
* [.authentication()](#Document+authentication) ⇒ [<code>VerificationMethod</code>](#VerificationMethod)
Expand Down Expand Up @@ -801,7 +802,20 @@ Returns the DID Document `proof` object.
<a name="Document+messageId"></a>

### document.messageId ⇒ <code>string</code>
Get the message_id of the DID Document.

**Kind**: instance property of [<code>Document</code>](#Document)
<a name="Document+messageId"></a>

### document.messageId
Set the message_id of the DID Document.

**Kind**: instance property of [<code>Document</code>](#Document)

| Param | Type |
| --- | --- |
| message_id | <code>string</code> |

<a name="Document+previousMessageId"></a>

### document.previousMessageId ⇒ <code>string</code>
Expand Down
1 change: 1 addition & 0 deletions bindings/wasm/examples/browser/create_did.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ export async function createIdentity(clientConfig, log = true) {

// Publish the Identity to the IOTA Network, this may take a few seconds to complete Proof-of-Work.
const receipt = await client.publishDocument(doc.toJSON());
doc.messageId = receipt.messageId;

const explorerUrl = getExplorerUrl(doc, receipt.messageId);

Expand Down
1 change: 1 addition & 0 deletions bindings/wasm/examples/node/create_did.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ async function createIdentity(clientConfig) {

// Publish the Identity to the IOTA Network, this may take a few seconds to complete Proof-of-Work.
const receipt = await client.publishDocument(doc.toJSON());
doc.messageId = receipt.messageId;

// Log the results.
logExplorerUrl("Identity Creation:", clientConfig.network.toString(), receipt.messageId);
Expand Down
2 changes: 1 addition & 1 deletion bindings/wasm/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion bindings/wasm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@iota/identity-wasm",
"version": "0.3.7",
"version": "0.3.8",
"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",
Expand Down
11 changes: 9 additions & 2 deletions bindings/wasm/src/did/wasm_document.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,11 +151,20 @@ impl WasmDocument {
WasmVerificationMethod(self.0.authentication().clone())
}

/// Get the message_id of the DID Document.
#[wasm_bindgen(getter = messageId)]
pub fn message_id(&self) -> String {
self.0.message_id().to_string()
}

/// Set the message_id of the DID Document.
#[wasm_bindgen(setter = messageId)]
pub fn set_message_id(&mut self, message_id: &str) -> Result<()> {
let message_id: MessageId = MessageId::from_str(message_id).wasm_result()?;
self.0.set_message_id(message_id);
Ok(())
}

#[wasm_bindgen(getter = previousMessageId)]
pub fn previous_message_id(&self) -> String {
self.0.previous_message_id().to_string()
Expand All @@ -164,9 +173,7 @@ impl WasmDocument {
#[wasm_bindgen(setter = previousMessageId)]
pub fn set_previous_message_id(&mut self, value: &str) -> Result<()> {
let message: MessageId = MessageId::from_str(value).wasm_result()?;

self.0.set_previous_message_id(message);

Ok(())
}

Expand Down