diff --git a/docs/ssi/did-ops.md b/docs/ssi/did-ops.md index c19fc95..a23e30d 100644 --- a/docs/ssi/did-ops.md +++ b/docs/ssi/did-ops.md @@ -19,8 +19,8 @@ Usage: hid-noded tx ssi create-did [did-doc-string] [verification-method-id] [flags] Params: - - did-doc-string : Did Doc String received from hs-ssi-sdk - - verification-method-id : Verification Method ID + - did-doc-string : Did Document String + - verification-method-id : Id of verification Method Key Flags: - ver-key : Private Key of the Signer @@ -33,9 +33,9 @@ Usage: hid-noded tx ssi update-did [did-doc-string] [version-id] [verification-method-id] [flags] Params: - - did-doc-string : Did Doc String received from hs-ssi-sdk - - version-id : Version ID of the DID Document to be updated. It is expected that version ID should of the latest DID Document - - verification-method-id : Verification Method ID + - did-doc-string : Did Document string + - version-id : Version ID of the DID Document to be deactivated. It is expected that version Id should match latest DID Document's version Id + - verification-method-id : Id of verification Method Key Flags: - --ver-key : Private Key of the Signer @@ -45,12 +45,12 @@ Flags: ``` Usage: - hid-noded tx ssi deactivate-did [did-doc-string] [version-id] [verification-method-id] [flags] + hid-noded tx ssi deactivate-did [did-id] [version-id] [verification-method-id] [flags] Params: - - did-doc-string : Did Doc String received from hs-ssi-sdk - - version-id : Version ID of the DID Document to be updated. It is expected that version ID should of the latest DID Document - - verification-method-id : Verification Method ID + - did-id : Id of the Did Document to deactivate + - version-id : Version ID of the DID Document to be deactivated. It is expected that version Id should match latest DID Document's version Id + - verification-method-id : Id of verification Method Key Flags: - --ver-key : Private Key of the Signer @@ -58,7 +58,7 @@ Flags: ## Usage -The usage of CLI is explained through scenarios: +The usage of CLI is explained through following scenarios: ### Register DID @@ -134,27 +134,7 @@ Here, the `${VERSION_ID}` should have the version id of the latest DID of User 2 User 2 (`did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52`) is trying to deactivate it’s DID ```sh -hid-noded tx ssi deactivate-did '{ -"context": [ -"https://www.w3.org/ns/did/v1", -"https://w3id.org/security/v1", -"https://schema.org" -], -"id": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52", -"controller": ["did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52"], -"alsoKnownAs": ["did:hs:1f49341a-de30993e6c52"], -"verificationMethod": [ -{ -"id": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52#z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4", -"type": "Ed25519VerificationKey2020", -"controller": "did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52", -"publicKeyMultibase": "z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4" -} -], -"authentication": [ -"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52#z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4" -] -}' "${VERSION_ID}" did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52#z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4 --ver-key --keyring-backend test --from alice --chain-id hidnode --yes +hid-noded tx ssi deactivate-did 'did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52' "${VERSION_ID}" did:hs:0f49341a-20ef-43d1-bc93-de30993e6c52#z8BXg2zjwBRTrjPs7uCnkFBKrL9bPD14HxEJMENxm3CJ4 --ver-key --keyring-backend test --from alice --chain-id hidnode --yes ``` ### Resolving DID diff --git a/proto/ssi/v1/tx.proto b/proto/ssi/v1/tx.proto index 3183b78..dabb6b1 100644 --- a/proto/ssi/v1/tx.proto +++ b/proto/ssi/v1/tx.proto @@ -52,7 +52,7 @@ message MsgCreateSchemaResponse { message MsgDeactivateDID { string creator = 1; - Did didDocString = 2; + string didId = 2; string version_id = 3; repeated SignInfo signatures = 4; } diff --git a/tests/wallet/did.js b/tests/wallet/did.js deleted file mode 100644 index c298061..0000000 --- a/tests/wallet/did.js +++ /dev/null @@ -1,869 +0,0 @@ -/* eslint-disable */ -const { Writer, Reader } = require("protobufjs/minimal"); -const protobufPackage = "hypersignprotocol.hidnode.ssi"; -const baseDid = { - context: "", - id: "", - controller: "", - alsoKnownAs: "", - authentication: "", - assertionMethod: "", - keyAgreement: "", - capabilityInvocation: "", - capabilityDelegation: "", -}; -const Did = { - encode(message, writer = Writer.create()) { - for (const v of message.context) { - writer.uint32(10).string(v); - } - if (message.id !== "") { - writer.uint32(18).string(message.id); - } - for (const v of message.controller) { - writer.uint32(26).string(v); - } - for (const v of message.alsoKnownAs) { - writer.uint32(34).string(v); - } - for (const v of message.verificationMethod) { - VerificationMethod.encode(v, writer.uint32(42).fork()).ldelim(); - } - for (const v of message.authentication) { - writer.uint32(50).string(v); - } - for (const v of message.assertionMethod) { - writer.uint32(58).string(v); - } - for (const v of message.keyAgreement) { - writer.uint32(66).string(v); - } - for (const v of message.capabilityInvocation) { - writer.uint32(74).string(v); - } - for (const v of message.capabilityDelegation) { - writer.uint32(82).string(v); - } - for (const v of message.service) { - Service.encode(v, writer.uint32(90).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof Uint8Array ? new Reader(input) : input; - let end = length === undefined ? reader.len : reader.pos + length; - const message = { ...baseDid }; - message.context = []; - message.controller = []; - message.alsoKnownAs = []; - message.verificationMethod = []; - message.authentication = []; - message.assertionMethod = []; - message.keyAgreement = []; - message.capabilityInvocation = []; - message.capabilityDelegation = []; - message.service = []; - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.context.push(reader.string()); - break; - case 2: - message.id = reader.string(); - break; - case 3: - message.controller.push(reader.string()); - break; - case 4: - message.alsoKnownAs.push(reader.string()); - break; - case 5: - message.verificationMethod.push(VerificationMethod.decode(reader, reader.uint32())); - break; - case 6: - message.authentication.push(reader.string()); - break; - case 7: - message.assertionMethod.push(reader.string()); - break; - case 8: - message.keyAgreement.push(reader.string()); - break; - case 9: - message.capabilityInvocation.push(reader.string()); - break; - case 10: - message.capabilityDelegation.push(reader.string()); - break; - case 11: - message.service.push(Service.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object) { - const message = { ...baseDid }; - message.context = []; - message.controller = []; - message.alsoKnownAs = []; - message.verificationMethod = []; - message.authentication = []; - message.assertionMethod = []; - message.keyAgreement = []; - message.capabilityInvocation = []; - message.capabilityDelegation = []; - message.service = []; - if (object.context !== undefined && object.context !== null) { - for (const e of object.context) { - message.context.push(String(e)); - } - } - if (object.id !== undefined && object.id !== null) { - message.id = String(object.id); - } - else { - message.id = ""; - } - if (object.controller !== undefined && object.controller !== null) { - for (const e of object.controller) { - message.controller.push(String(e)); - } - } - if (object.alsoKnownAs !== undefined && object.alsoKnownAs !== null) { - for (const e of object.alsoKnownAs) { - message.alsoKnownAs.push(String(e)); - } - } - if (object.verificationMethod !== undefined && - object.verificationMethod !== null) { - for (const e of object.verificationMethod) { - message.verificationMethod.push(VerificationMethod.fromJSON(e)); - } - } - if (object.authentication !== undefined && object.authentication !== null) { - for (const e of object.authentication) { - message.authentication.push(String(e)); - } - } - if (object.assertionMethod !== undefined && - object.assertionMethod !== null) { - for (const e of object.assertionMethod) { - message.assertionMethod.push(String(e)); - } - } - if (object.keyAgreement !== undefined && object.keyAgreement !== null) { - for (const e of object.keyAgreement) { - message.keyAgreement.push(String(e)); - } - } - if (object.capabilityInvocation !== undefined && - object.capabilityInvocation !== null) { - for (const e of object.capabilityInvocation) { - message.capabilityInvocation.push(String(e)); - } - } - if (object.capabilityDelegation !== undefined && - object.capabilityDelegation !== null) { - for (const e of object.capabilityDelegation) { - message.capabilityDelegation.push(String(e)); - } - } - if (object.service !== undefined && object.service !== null) { - for (const e of object.service) { - message.service.push(Service.fromJSON(e)); - } - } - return message; - }, - toJSON(message) { - const obj = {}; - if (message.context) { - obj.context = message.context.map((e) => e); - } - else { - obj.context = []; - } - message.id !== undefined && (obj.id = message.id); - if (message.controller) { - obj.controller = message.controller.map((e) => e); - } - else { - obj.controller = []; - } - if (message.alsoKnownAs) { - obj.alsoKnownAs = message.alsoKnownAs.map((e) => e); - } - else { - obj.alsoKnownAs = []; - } - if (message.verificationMethod) { - obj.verificationMethod = message.verificationMethod.map((e) => e ? VerificationMethod.toJSON(e) : undefined); - } - else { - obj.verificationMethod = []; - } - if (message.authentication) { - obj.authentication = message.authentication.map((e) => e); - } - else { - obj.authentication = []; - } - if (message.assertionMethod) { - obj.assertionMethod = message.assertionMethod.map((e) => e); - } - else { - obj.assertionMethod = []; - } - if (message.keyAgreement) { - obj.keyAgreement = message.keyAgreement.map((e) => e); - } - else { - obj.keyAgreement = []; - } - if (message.capabilityInvocation) { - obj.capabilityInvocation = message.capabilityInvocation.map((e) => e); - } - else { - obj.capabilityInvocation = []; - } - if (message.capabilityDelegation) { - obj.capabilityDelegation = message.capabilityDelegation.map((e) => e); - } - else { - obj.capabilityDelegation = []; - } - if (message.service) { - obj.service = message.service.map((e) => e ? Service.toJSON(e) : undefined); - } - else { - obj.service = []; - } - return obj; - }, - fromPartial(object) { - const message = { ...baseDid }; - message.context = []; - message.controller = []; - message.alsoKnownAs = []; - message.verificationMethod = []; - message.authentication = []; - message.assertionMethod = []; - message.keyAgreement = []; - message.capabilityInvocation = []; - message.capabilityDelegation = []; - message.service = []; - if (object.context !== undefined && object.context !== null) { - for (const e of object.context) { - message.context.push(e); - } - } - if (object.id !== undefined && object.id !== null) { - message.id = object.id; - } - else { - message.id = ""; - } - if (object.controller !== undefined && object.controller !== null) { - for (const e of object.controller) { - message.controller.push(e); - } - } - if (object.alsoKnownAs !== undefined && object.alsoKnownAs !== null) { - for (const e of object.alsoKnownAs) { - message.alsoKnownAs.push(e); - } - } - if (object.verificationMethod !== undefined && - object.verificationMethod !== null) { - for (const e of object.verificationMethod) { - message.verificationMethod.push(VerificationMethod.fromPartial(e)); - } - } - if (object.authentication !== undefined && object.authentication !== null) { - for (const e of object.authentication) { - message.authentication.push(e); - } - } - if (object.assertionMethod !== undefined && - object.assertionMethod !== null) { - for (const e of object.assertionMethod) { - message.assertionMethod.push(e); - } - } - if (object.keyAgreement !== undefined && object.keyAgreement !== null) { - for (const e of object.keyAgreement) { - message.keyAgreement.push(e); - } - } - if (object.capabilityInvocation !== undefined && - object.capabilityInvocation !== null) { - for (const e of object.capabilityInvocation) { - message.capabilityInvocation.push(e); - } - } - if (object.capabilityDelegation !== undefined && - object.capabilityDelegation !== null) { - for (const e of object.capabilityDelegation) { - message.capabilityDelegation.push(e); - } - } - if (object.service !== undefined && object.service !== null) { - for (const e of object.service) { - message.service.push(Service.fromPartial(e)); - } - } - return message; - }, -}; -const baseMetadata = { - created: "", - updated: "", - deactivated: false, - versionId: "", -}; -const Metadata = { - encode(message, writer = Writer.create()) { - if (message.created !== "") { - writer.uint32(10).string(message.created); - } - if (message.updated !== "") { - writer.uint32(18).string(message.updated); - } - if (message.deactivated === true) { - writer.uint32(24).bool(message.deactivated); - } - if (message.versionId !== "") { - writer.uint32(34).string(message.versionId); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof Uint8Array ? new Reader(input) : input; - let end = length === undefined ? reader.len : reader.pos + length; - const message = { ...baseMetadata }; - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.created = reader.string(); - break; - case 2: - message.updated = reader.string(); - break; - case 3: - message.deactivated = reader.bool(); - break; - case 4: - message.versionId = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object) { - const message = { ...baseMetadata }; - if (object.created !== undefined && object.created !== null) { - message.created = String(object.created); - } - else { - message.created = ""; - } - if (object.updated !== undefined && object.updated !== null) { - message.updated = String(object.updated); - } - else { - message.updated = ""; - } - if (object.deactivated !== undefined && object.deactivated !== null) { - message.deactivated = Boolean(object.deactivated); - } - else { - message.deactivated = false; - } - if (object.versionId !== undefined && object.versionId !== null) { - message.versionId = String(object.versionId); - } - else { - message.versionId = ""; - } - return message; - }, - toJSON(message) { - const obj = {}; - message.created !== undefined && (obj.created = message.created); - message.updated !== undefined && (obj.updated = message.updated); - message.deactivated !== undefined && - (obj.deactivated = message.deactivated); - message.versionId !== undefined && (obj.versionId = message.versionId); - return obj; - }, - fromPartial(object) { - const message = { ...baseMetadata }; - if (object.created !== undefined && object.created !== null) { - message.created = object.created; - } - else { - message.created = ""; - } - if (object.updated !== undefined && object.updated !== null) { - message.updated = object.updated; - } - else { - message.updated = ""; - } - if (object.deactivated !== undefined && object.deactivated !== null) { - message.deactivated = object.deactivated; - } - else { - message.deactivated = false; - } - if (object.versionId !== undefined && object.versionId !== null) { - message.versionId = object.versionId; - } - else { - message.versionId = ""; - } - return message; - }, -}; -const baseDidResolveMeta = { retrieved: "", error: "" }; -const DidResolveMeta = { - encode(message, writer = Writer.create()) { - if (message.retrieved !== "") { - writer.uint32(18).string(message.retrieved); - } - if (message.error !== "") { - writer.uint32(26).string(message.error); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof Uint8Array ? new Reader(input) : input; - let end = length === undefined ? reader.len : reader.pos + length; - const message = { ...baseDidResolveMeta }; - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 2: - message.retrieved = reader.string(); - break; - case 3: - message.error = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object) { - const message = { ...baseDidResolveMeta }; - if (object.retrieved !== undefined && object.retrieved !== null) { - message.retrieved = String(object.retrieved); - } - else { - message.retrieved = ""; - } - if (object.error !== undefined && object.error !== null) { - message.error = String(object.error); - } - else { - message.error = ""; - } - return message; - }, - toJSON(message) { - const obj = {}; - message.retrieved !== undefined && (obj.retrieved = message.retrieved); - message.error !== undefined && (obj.error = message.error); - return obj; - }, - fromPartial(object) { - const message = { ...baseDidResolveMeta }; - if (object.retrieved !== undefined && object.retrieved !== null) { - message.retrieved = object.retrieved; - } - else { - message.retrieved = ""; - } - if (object.error !== undefined && object.error !== null) { - message.error = object.error; - } - else { - message.error = ""; - } - return message; - }, -}; -const baseVerificationMethod = { - id: "", - type: "", - controller: "", - publicKeyMultibase: "", -}; -const VerificationMethod = { - encode(message, writer = Writer.create()) { - if (message.id !== "") { - writer.uint32(10).string(message.id); - } - if (message.type !== "") { - writer.uint32(18).string(message.type); - } - if (message.controller !== "") { - writer.uint32(26).string(message.controller); - } - if (message.publicKeyMultibase !== "") { - writer.uint32(34).string(message.publicKeyMultibase); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof Uint8Array ? new Reader(input) : input; - let end = length === undefined ? reader.len : reader.pos + length; - const message = { ...baseVerificationMethod }; - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - message.controller = reader.string(); - break; - case 4: - message.publicKeyMultibase = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object) { - const message = { ...baseVerificationMethod }; - if (object.id !== undefined && object.id !== null) { - message.id = String(object.id); - } - else { - message.id = ""; - } - if (object.type !== undefined && object.type !== null) { - message.type = String(object.type); - } - else { - message.type = ""; - } - if (object.controller !== undefined && object.controller !== null) { - message.controller = String(object.controller); - } - else { - message.controller = ""; - } - if (object.publicKeyMultibase !== undefined && - object.publicKeyMultibase !== null) { - message.publicKeyMultibase = String(object.publicKeyMultibase); - } - else { - message.publicKeyMultibase = ""; - } - return message; - }, - toJSON(message) { - const obj = {}; - message.id !== undefined && (obj.id = message.id); - message.type !== undefined && (obj.type = message.type); - message.controller !== undefined && (obj.controller = message.controller); - message.publicKeyMultibase !== undefined && - (obj.publicKeyMultibase = message.publicKeyMultibase); - return obj; - }, - fromPartial(object) { - const message = { ...baseVerificationMethod }; - if (object.id !== undefined && object.id !== null) { - message.id = object.id; - } - else { - message.id = ""; - } - if (object.type !== undefined && object.type !== null) { - message.type = object.type; - } - else { - message.type = ""; - } - if (object.controller !== undefined && object.controller !== null) { - message.controller = object.controller; - } - else { - message.controller = ""; - } - if (object.publicKeyMultibase !== undefined && - object.publicKeyMultibase !== null) { - message.publicKeyMultibase = object.publicKeyMultibase; - } - else { - message.publicKeyMultibase = ""; - } - return message; - }, -}; -const baseService = { id: "", type: "", serviceEndpoint: "" }; -const Service = { - encode(message, writer = Writer.create()) { - if (message.id !== "") { - writer.uint32(10).string(message.id); - } - if (message.type !== "") { - writer.uint32(18).string(message.type); - } - if (message.serviceEndpoint !== "") { - writer.uint32(26).string(message.serviceEndpoint); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof Uint8Array ? new Reader(input) : input; - let end = length === undefined ? reader.len : reader.pos + length; - const message = { ...baseService }; - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = reader.string(); - break; - case 2: - message.type = reader.string(); - break; - case 3: - message.serviceEndpoint = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object) { - const message = { ...baseService }; - if (object.id !== undefined && object.id !== null) { - message.id = String(object.id); - } - else { - message.id = ""; - } - if (object.type !== undefined && object.type !== null) { - message.type = String(object.type); - } - else { - message.type = ""; - } - if (object.serviceEndpoint !== undefined && - object.serviceEndpoint !== null) { - message.serviceEndpoint = String(object.serviceEndpoint); - } - else { - message.serviceEndpoint = ""; - } - return message; - }, - toJSON(message) { - const obj = {}; - message.id !== undefined && (obj.id = message.id); - message.type !== undefined && (obj.type = message.type); - message.serviceEndpoint !== undefined && - (obj.serviceEndpoint = message.serviceEndpoint); - return obj; - }, - fromPartial(object) { - const message = { ...baseService }; - if (object.id !== undefined && object.id !== null) { - message.id = object.id; - } - else { - message.id = ""; - } - if (object.type !== undefined && object.type !== null) { - message.type = object.type; - } - else { - message.type = ""; - } - if (object.serviceEndpoint !== undefined && - object.serviceEndpoint !== null) { - message.serviceEndpoint = object.serviceEndpoint; - } - else { - message.serviceEndpoint = ""; - } - return message; - }, -}; -const baseSignInfo = { verificationMethodId: "", signature: "" }; -const SignInfo = { - encode(message, writer = Writer.create()) { - if (message.verificationMethodId !== "") { - writer.uint32(10).string(message.verificationMethodId); - } - if (message.signature !== "") { - writer.uint32(18).string(message.signature); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof Uint8Array ? new Reader(input) : input; - let end = length === undefined ? reader.len : reader.pos + length; - const message = { ...baseSignInfo }; - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.verificationMethodId = reader.string(); - break; - case 2: - message.signature = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object) { - const message = { ...baseSignInfo }; - if (object.verificationMethodId !== undefined && - object.verificationMethodId !== null) { - message.verificationMethodId = String(object.verificationMethodId); - } - else { - message.verificationMethodId = ""; - } - if (object.signature !== undefined && object.signature !== null) { - message.signature = String(object.signature); - } - else { - message.signature = ""; - } - return message; - }, - toJSON(message) { - const obj = {}; - message.verificationMethodId !== undefined && - (obj.verificationMethodId = message.verificationMethodId); - message.signature !== undefined && (obj.signature = message.signature); - return obj; - }, - fromPartial(object) { - const message = { ...baseSignInfo }; - if (object.verificationMethodId !== undefined && - object.verificationMethodId !== null) { - message.verificationMethodId = object.verificationMethodId; - } - else { - message.verificationMethodId = ""; - } - if (object.signature !== undefined && object.signature !== null) { - message.signature = object.signature; - } - else { - message.signature = ""; - } - return message; - }, -}; -const baseDidDocument = {}; -const DidDocument = { - encode(message, writer = Writer.create()) { - if (message.did !== undefined) { - Did.encode(message.did, writer.uint32(10).fork()).ldelim(); - } - if (message.metadata !== undefined) { - Metadata.encode(message.metadata, writer.uint32(18).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof Uint8Array ? new Reader(input) : input; - let end = length === undefined ? reader.len : reader.pos + length; - const message = { ...baseDidDocument }; - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.did = Did.decode(reader, reader.uint32()); - break; - case 2: - message.metadata = Metadata.decode(reader, reader.uint32()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object) { - const message = { ...baseDidDocument }; - if (object.did !== undefined && object.did !== null) { - message.did = Did.fromJSON(object.did); - } - else { - message.did = undefined; - } - if (object.metadata !== undefined && object.metadata !== null) { - message.metadata = Metadata.fromJSON(object.metadata); - } - else { - message.metadata = undefined; - } - return message; - }, - toJSON(message) { - const obj = {}; - message.did !== undefined && - (obj.did = message.did ? Did.toJSON(message.did) : undefined); - message.metadata !== undefined && - (obj.metadata = message.metadata - ? Metadata.toJSON(message.metadata) - : undefined); - return obj; - }, - fromPartial(object) { - const message = { ...baseDidDocument }; - if (object.did !== undefined && object.did !== null) { - message.did = Did.fromPartial(object.did); - } - else { - message.did = undefined; - } - if (object.metadata !== undefined && object.metadata !== null) { - message.metadata = Metadata.fromPartial(object.metadata); - } - else { - message.metadata = undefined; - } - return message; - }, -}; - -module.exports = { - Service, - SignInfo, - DidDocument, - protobufPackage, - Did -} \ No newline at end of file diff --git a/tests/wallet/package-lock.json b/tests/wallet/package-lock.json deleted file mode 100644 index 45c1a51..0000000 --- a/tests/wallet/package-lock.json +++ /dev/null @@ -1,1275 +0,0 @@ -{ - "name": "wallet", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "wallet", - "version": "1.0.0", - "license": "ISC", - "dependencies": { - "@cosmjs/launchpad": "^0.27.0", - "@cosmjs/proto-signing": "^0.27.0", - "@cosmjs/stargate": "^0.27.0" - } - }, - "node_modules/@confio/ics23": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@confio/ics23/-/ics23-0.6.5.tgz", - "integrity": "sha512-1GdPMsaP/l8JSF4P4HWFLBhdcxHcJT8lS0nknBYNSZ1XrJOsJKUy6EkOwd9Pa1qJkXzY2gyNv7MdHR+AIwSTAg==", - "dependencies": { - "js-sha512": "^0.8.0", - "protobufjs": "^6.8.8", - "ripemd160": "^2.0.2", - "sha.js": "^2.4.11" - } - }, - "node_modules/@cosmjs/amino": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.27.0.tgz", - "integrity": "sha512-ybyzRkGrRija1bjGjGP7sAp2ulPA2/S2wMY2pehB7b6ZR8dpwveCjz/IqFWC5KBxz6KZf5MuaONOY+t1kkjsfw==", - "dependencies": { - "@cosmjs/crypto": "0.27.0", - "@cosmjs/encoding": "0.27.0", - "@cosmjs/math": "0.27.0", - "@cosmjs/utils": "0.27.0" - } - }, - "node_modules/@cosmjs/crypto": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.27.0.tgz", - "integrity": "sha512-JTPHINCYZ+mnsxrfv8ZBHsFWgB7EGooa5SD0lQFhkCVX/FC3sqxuFNv6TZU5bVVU71DUSqXTMXF5m9kAMzPUkw==", - "dependencies": { - "@cosmjs/encoding": "0.27.0", - "@cosmjs/math": "0.27.0", - "@cosmjs/utils": "0.27.0", - "bip39": "^3.0.2", - "bn.js": "^5.2.0", - "elliptic": "^6.5.3", - "js-sha3": "^0.8.0", - "libsodium-wrappers": "^0.7.6", - "ripemd160": "^2.0.2", - "sha.js": "^2.4.11" - } - }, - "node_modules/@cosmjs/encoding": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.27.0.tgz", - "integrity": "sha512-cCT8X/NUAGXOe14F/k2GE6N9btjrOqALBilUPIn5CL4OEGxvRTPD59nWSACu0iafCGz10Tw3LPcouuYPtZmkbg==", - "dependencies": { - "base64-js": "^1.3.0", - "bech32": "^1.1.4", - "readonly-date": "^1.0.0" - } - }, - "node_modules/@cosmjs/json-rpc": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/json-rpc/-/json-rpc-0.27.0.tgz", - "integrity": "sha512-Q6na5KPYDD90QhlPZTInquwBycDjvhZvWwpV1TppDd2Em8S1FfN3ePiV2YCf4XzXREU5YPFSHzh5MHK/WhQY3w==", - "dependencies": { - "@cosmjs/stream": "0.27.0", - "xstream": "^11.14.0" - } - }, - "node_modules/@cosmjs/launchpad": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/launchpad/-/launchpad-0.27.0.tgz", - "integrity": "sha512-V8pK3jNvLw/2jf0DK0uD0fN0qUgh+v04NxSNIdRxyn2sdZ8CkD1L+FeKM5mGEn9vreSHOD4Z9pRy2s2roD/tEw==", - "dependencies": { - "@cosmjs/amino": "0.27.0", - "@cosmjs/crypto": "0.27.0", - "@cosmjs/encoding": "0.27.0", - "@cosmjs/math": "0.27.0", - "@cosmjs/utils": "0.27.0", - "axios": "^0.21.2", - "fast-deep-equal": "^3.1.3" - } - }, - "node_modules/@cosmjs/math": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.27.0.tgz", - "integrity": "sha512-+WsrdXojqpUL6l2LKOWYgiAJIDD0faONNtnjb1kpS1btSzZe1Ns+RdygG6QZLLvZuxMfkEzE54ZXDKPD5MhVPA==", - "dependencies": { - "bn.js": "^5.2.0" - } - }, - "node_modules/@cosmjs/proto-signing": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/proto-signing/-/proto-signing-0.27.0.tgz", - "integrity": "sha512-ODqnmY/ElmcEYu6HbDmeGce4KacgzSVGQzvGodZidC1RR9EYociuweBPNwSHqBPolC6PQPI/QGc83m/mbih2xw==", - "dependencies": { - "@cosmjs/amino": "0.27.0", - "@cosmjs/crypto": "0.27.0", - "@cosmjs/math": "0.27.0", - "cosmjs-types": "^0.4.0", - "long": "^4.0.0", - "protobufjs": "~6.10.2" - } - }, - "node_modules/@cosmjs/socket": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/socket/-/socket-0.27.0.tgz", - "integrity": "sha512-lOd0s6gLyjdjcs8xnYuS2IXRqBLUrI76Bek5wsia+m5CyUvHjRbbd7+nZiznbtVjApBlIwHGkiklLg3/byxkAA==", - "dependencies": { - "@cosmjs/stream": "0.27.0", - "isomorphic-ws": "^4.0.1", - "ws": "^7", - "xstream": "^11.14.0" - } - }, - "node_modules/@cosmjs/stargate": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/stargate/-/stargate-0.27.0.tgz", - "integrity": "sha512-Fiqk8rIpB4emzC/P7/+ZPPJV9aG6KJhVuOF4D8c1j1Bv8fVs1XqC6NgsY6elTLXl38pgXt7REn6VYzAdZwrHXQ==", - "dependencies": { - "@confio/ics23": "^0.6.3", - "@cosmjs/amino": "0.27.0", - "@cosmjs/encoding": "0.27.0", - "@cosmjs/math": "0.27.0", - "@cosmjs/proto-signing": "0.27.0", - "@cosmjs/stream": "0.27.0", - "@cosmjs/tendermint-rpc": "0.27.0", - "@cosmjs/utils": "0.27.0", - "cosmjs-types": "^0.4.0", - "long": "^4.0.0", - "protobufjs": "~6.10.2", - "xstream": "^11.14.0" - } - }, - "node_modules/@cosmjs/stream": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/stream/-/stream-0.27.0.tgz", - "integrity": "sha512-D9mXHqS6y7xrThhUg5SCvMjiVQ8ph9f7gAuWlrXhqVJ5FqrP6OyTGRbVyGGM91d5Jj7N7oidQ+hOfc34vKFgeg==", - "dependencies": { - "xstream": "^11.14.0" - } - }, - "node_modules/@cosmjs/tendermint-rpc": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.27.0.tgz", - "integrity": "sha512-WFcJ2/UF76fBBVzPRiHJoC/GCKvgt0mb7+ewgpwKBeEcYwfj5qb1QreGBbHn/UZx9QSsF9jhI5k7SmNdglC3cA==", - "dependencies": { - "@cosmjs/crypto": "0.27.0", - "@cosmjs/encoding": "0.27.0", - "@cosmjs/json-rpc": "0.27.0", - "@cosmjs/math": "0.27.0", - "@cosmjs/socket": "0.27.0", - "@cosmjs/stream": "0.27.0", - "axios": "^0.21.2", - "readonly-date": "^1.0.0", - "xstream": "^11.14.0" - } - }, - "node_modules/@cosmjs/utils": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.27.0.tgz", - "integrity": "sha512-UC1eWY9isDQm6POy6GaTmYtbPVY5dkywdjW8Qzj+JNMhbhMM0KHuI4pHwjv5TPXSO/Ba2z10MTnD9nUlZtDwtA==" - }, - "node_modules/@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" - }, - "node_modules/@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" - }, - "node_modules/@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" - }, - "node_modules/@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" - }, - "node_modules/@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", - "dependencies": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "node_modules/@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" - }, - "node_modules/@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" - }, - "node_modules/@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" - }, - "node_modules/@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" - }, - "node_modules/@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" - }, - "node_modules/@types/long": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", - "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" - }, - "node_modules/@types/node": { - "version": "11.11.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.6.tgz", - "integrity": "sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==" - }, - "node_modules/axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "dependencies": { - "follow-redirects": "^1.14.0" - } - }, - "node_modules/base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/bech32": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" - }, - "node_modules/bip39": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.4.tgz", - "integrity": "sha512-YZKQlb752TrUWqHWj7XAwCSjYEgGAk+/Aas3V7NyjQeZYsztO8JnQUaCWhcnL4T+jL8nvB8typ2jRPzTlgugNw==", - "dependencies": { - "@types/node": "11.11.6", - "create-hash": "^1.1.0", - "pbkdf2": "^3.0.9", - "randombytes": "^2.0.1" - } - }, - "node_modules/bn.js": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", - "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" - }, - "node_modules/brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "node_modules/cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "node_modules/cosmjs-types": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.4.1.tgz", - "integrity": "sha512-I7E/cHkIgoJzMNQdFF0YVqPlaTqrqKHrskuSTIqlEyxfB5Lf3WKCajSXVK2yHOfOFfSux/RxEdpMzw/eO4DIog==", - "dependencies": { - "long": "^4.0.0", - "protobufjs": "~6.11.2" - } - }, - "node_modules/cosmjs-types/node_modules/@types/node": { - "version": "17.0.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.10.tgz", - "integrity": "sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog==" - }, - "node_modules/cosmjs-types/node_modules/protobufjs": { - "version": "6.11.2", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.2.tgz", - "integrity": "sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw==", - "hasInstallScript": true, - "dependencies": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.1", - "@types/node": ">=13.7.0", - "long": "^4.0.0" - }, - "bin": { - "pbjs": "bin/pbjs", - "pbts": "bin/pbts" - } - }, - "node_modules/create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "dependencies": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "node_modules/create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "dependencies": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "node_modules/define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "dependencies": { - "object-keys": "^1.0.12" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "dependencies": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/elliptic/node_modules/bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - }, - "node_modules/fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "node_modules/follow-redirects": { - "version": "1.14.7", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz", - "integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==", - "funding": [ - { - "type": "individual", - "url": "https://github.com/sponsors/RubenVerborgh" - } - ], - "engines": { - "node": ">=4.0" - }, - "peerDependenciesMeta": { - "debug": { - "optional": true - } - } - }, - "node_modules/globalthis": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.2.tgz", - "integrity": "sha512-ZQnSFO1la8P7auIOQECnm0sSuoMeaSq0EEdXMBFF2QJO4uNcwbyhSgG3MruWNbFTqCLmxVwGOl7LZ9kASvHdeQ==", - "dependencies": { - "define-properties": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/hash-base": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", - "dependencies": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "dependencies": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "node_modules/hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "dependencies": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "node_modules/inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "node_modules/isomorphic-ws": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", - "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", - "peerDependencies": { - "ws": "*" - } - }, - "node_modules/js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" - }, - "node_modules/js-sha512": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha512/-/js-sha512-0.8.0.tgz", - "integrity": "sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==" - }, - "node_modules/libsodium": { - "version": "0.7.9", - "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.9.tgz", - "integrity": "sha512-gfeADtR4D/CM0oRUviKBViMGXZDgnFdMKMzHsvBdqLBHd9ySi6EtYnmuhHVDDYgYpAO8eU8hEY+F8vIUAPh08A==" - }, - "node_modules/libsodium-wrappers": { - "version": "0.7.9", - "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz", - "integrity": "sha512-9HaAeBGk1nKTRFRHkt7nzxqCvnkWTjn1pdjKgcUnZxj0FyOP4CnhgFhMdrFfgNsukijBGyBLpP2m2uKT1vuWhQ==", - "dependencies": { - "libsodium": "^0.7.0" - } - }, - "node_modules/long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "node_modules/md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "node_modules/minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "node_modules/minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, - "node_modules/object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==", - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/pbkdf2": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", - "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", - "dependencies": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - }, - "engines": { - "node": ">=0.12" - } - }, - "node_modules/protobufjs": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.2.tgz", - "integrity": "sha512-27yj+04uF6ya9l+qfpH187aqEzfCF4+Uit0I9ZBQVqK09hk/SQzKa2MUqUpXaVa7LOFRg1TSSr3lVxGOk6c0SQ==", - "hasInstallScript": true, - "dependencies": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.1", - "@types/node": "^13.7.0", - "long": "^4.0.0" - }, - "bin": { - "pbjs": "bin/pbjs", - "pbts": "bin/pbts" - } - }, - "node_modules/protobufjs/node_modules/@types/node": { - "version": "13.13.52", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.52.tgz", - "integrity": "sha512-s3nugnZumCC//n4moGGe6tkNMyYEdaDBitVjwPxXmR5lnMG5dHePinH2EdxkG3Rh1ghFHHixAG4NJhpJW1rthQ==" - }, - "node_modules/randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "dependencies": { - "safe-buffer": "^5.1.0" - } - }, - "node_modules/readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "dependencies": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - }, - "engines": { - "node": ">= 6" - } - }, - "node_modules/readonly-date": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/readonly-date/-/readonly-date-1.0.0.tgz", - "integrity": "sha512-tMKIV7hlk0h4mO3JTmmVuIlJVXjKk3Sep9Bf5OH0O+758ruuVkUy2J9SttDLm91IEX/WHlXPSpxMGjPj4beMIQ==" - }, - "node_modules/ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "dependencies": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ] - }, - "node_modules/sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "dependencies": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - }, - "bin": { - "sha.js": "bin.js" - } - }, - "node_modules/string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "dependencies": { - "safe-buffer": "~5.2.0" - } - }, - "node_modules/symbol-observable": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-2.0.3.tgz", - "integrity": "sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA==", - "engines": { - "node": ">=0.10" - } - }, - "node_modules/util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "node_modules/ws": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.6.tgz", - "integrity": "sha512-6GLgCqo2cy2A2rjCNFlxQS6ZljG/coZfZXclldI8FB/1G3CCI36Zd8xy2HrFVACi8tfk5XrgLQEk+P0Tnz9UcA==", - "engines": { - "node": ">=8.3.0" - }, - "peerDependencies": { - "bufferutil": "^4.0.1", - "utf-8-validate": "^5.0.2" - }, - "peerDependenciesMeta": { - "bufferutil": { - "optional": true - }, - "utf-8-validate": { - "optional": true - } - } - }, - "node_modules/xstream": { - "version": "11.14.0", - "resolved": "https://registry.npmjs.org/xstream/-/xstream-11.14.0.tgz", - "integrity": "sha512-1bLb+kKKtKPbgTK6i/BaoAn03g47PpFstlbe1BA+y3pNS/LfvcaghS5BFf9+EE1J+KwSQsEpfJvFN5GqFtiNmw==", - "dependencies": { - "globalthis": "^1.0.1", - "symbol-observable": "^2.0.3" - } - } - }, - "dependencies": { - "@confio/ics23": { - "version": "0.6.5", - "resolved": "https://registry.npmjs.org/@confio/ics23/-/ics23-0.6.5.tgz", - "integrity": "sha512-1GdPMsaP/l8JSF4P4HWFLBhdcxHcJT8lS0nknBYNSZ1XrJOsJKUy6EkOwd9Pa1qJkXzY2gyNv7MdHR+AIwSTAg==", - "requires": { - "js-sha512": "^0.8.0", - "protobufjs": "^6.8.8", - "ripemd160": "^2.0.2", - "sha.js": "^2.4.11" - } - }, - "@cosmjs/amino": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/amino/-/amino-0.27.0.tgz", - "integrity": "sha512-ybyzRkGrRija1bjGjGP7sAp2ulPA2/S2wMY2pehB7b6ZR8dpwveCjz/IqFWC5KBxz6KZf5MuaONOY+t1kkjsfw==", - "requires": { - "@cosmjs/crypto": "0.27.0", - "@cosmjs/encoding": "0.27.0", - "@cosmjs/math": "0.27.0", - "@cosmjs/utils": "0.27.0" - } - }, - "@cosmjs/crypto": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/crypto/-/crypto-0.27.0.tgz", - "integrity": "sha512-JTPHINCYZ+mnsxrfv8ZBHsFWgB7EGooa5SD0lQFhkCVX/FC3sqxuFNv6TZU5bVVU71DUSqXTMXF5m9kAMzPUkw==", - "requires": { - "@cosmjs/encoding": "0.27.0", - "@cosmjs/math": "0.27.0", - "@cosmjs/utils": "0.27.0", - "bip39": "^3.0.2", - "bn.js": "^5.2.0", - "elliptic": "^6.5.3", - "js-sha3": "^0.8.0", - "libsodium-wrappers": "^0.7.6", - "ripemd160": "^2.0.2", - "sha.js": "^2.4.11" - } - }, - "@cosmjs/encoding": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/encoding/-/encoding-0.27.0.tgz", - "integrity": "sha512-cCT8X/NUAGXOe14F/k2GE6N9btjrOqALBilUPIn5CL4OEGxvRTPD59nWSACu0iafCGz10Tw3LPcouuYPtZmkbg==", - "requires": { - "base64-js": "^1.3.0", - "bech32": "^1.1.4", - "readonly-date": "^1.0.0" - } - }, - "@cosmjs/json-rpc": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/json-rpc/-/json-rpc-0.27.0.tgz", - "integrity": "sha512-Q6na5KPYDD90QhlPZTInquwBycDjvhZvWwpV1TppDd2Em8S1FfN3ePiV2YCf4XzXREU5YPFSHzh5MHK/WhQY3w==", - "requires": { - "@cosmjs/stream": "0.27.0", - "xstream": "^11.14.0" - } - }, - "@cosmjs/launchpad": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/launchpad/-/launchpad-0.27.0.tgz", - "integrity": "sha512-V8pK3jNvLw/2jf0DK0uD0fN0qUgh+v04NxSNIdRxyn2sdZ8CkD1L+FeKM5mGEn9vreSHOD4Z9pRy2s2roD/tEw==", - "requires": { - "@cosmjs/amino": "0.27.0", - "@cosmjs/crypto": "0.27.0", - "@cosmjs/encoding": "0.27.0", - "@cosmjs/math": "0.27.0", - "@cosmjs/utils": "0.27.0", - "axios": "^0.21.2", - "fast-deep-equal": "^3.1.3" - } - }, - "@cosmjs/math": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/math/-/math-0.27.0.tgz", - "integrity": "sha512-+WsrdXojqpUL6l2LKOWYgiAJIDD0faONNtnjb1kpS1btSzZe1Ns+RdygG6QZLLvZuxMfkEzE54ZXDKPD5MhVPA==", - "requires": { - "bn.js": "^5.2.0" - } - }, - "@cosmjs/proto-signing": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/proto-signing/-/proto-signing-0.27.0.tgz", - "integrity": "sha512-ODqnmY/ElmcEYu6HbDmeGce4KacgzSVGQzvGodZidC1RR9EYociuweBPNwSHqBPolC6PQPI/QGc83m/mbih2xw==", - "requires": { - "@cosmjs/amino": "0.27.0", - "@cosmjs/crypto": "0.27.0", - "@cosmjs/math": "0.27.0", - "cosmjs-types": "^0.4.0", - "long": "^4.0.0", - "protobufjs": "~6.10.2" - } - }, - "@cosmjs/socket": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/socket/-/socket-0.27.0.tgz", - "integrity": "sha512-lOd0s6gLyjdjcs8xnYuS2IXRqBLUrI76Bek5wsia+m5CyUvHjRbbd7+nZiznbtVjApBlIwHGkiklLg3/byxkAA==", - "requires": { - "@cosmjs/stream": "0.27.0", - "isomorphic-ws": "^4.0.1", - "ws": "^7", - "xstream": "^11.14.0" - } - }, - "@cosmjs/stargate": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/stargate/-/stargate-0.27.0.tgz", - "integrity": "sha512-Fiqk8rIpB4emzC/P7/+ZPPJV9aG6KJhVuOF4D8c1j1Bv8fVs1XqC6NgsY6elTLXl38pgXt7REn6VYzAdZwrHXQ==", - "requires": { - "@confio/ics23": "^0.6.3", - "@cosmjs/amino": "0.27.0", - "@cosmjs/encoding": "0.27.0", - "@cosmjs/math": "0.27.0", - "@cosmjs/proto-signing": "0.27.0", - "@cosmjs/stream": "0.27.0", - "@cosmjs/tendermint-rpc": "0.27.0", - "@cosmjs/utils": "0.27.0", - "cosmjs-types": "^0.4.0", - "long": "^4.0.0", - "protobufjs": "~6.10.2", - "xstream": "^11.14.0" - } - }, - "@cosmjs/stream": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/stream/-/stream-0.27.0.tgz", - "integrity": "sha512-D9mXHqS6y7xrThhUg5SCvMjiVQ8ph9f7gAuWlrXhqVJ5FqrP6OyTGRbVyGGM91d5Jj7N7oidQ+hOfc34vKFgeg==", - "requires": { - "xstream": "^11.14.0" - } - }, - "@cosmjs/tendermint-rpc": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/tendermint-rpc/-/tendermint-rpc-0.27.0.tgz", - "integrity": "sha512-WFcJ2/UF76fBBVzPRiHJoC/GCKvgt0mb7+ewgpwKBeEcYwfj5qb1QreGBbHn/UZx9QSsF9jhI5k7SmNdglC3cA==", - "requires": { - "@cosmjs/crypto": "0.27.0", - "@cosmjs/encoding": "0.27.0", - "@cosmjs/json-rpc": "0.27.0", - "@cosmjs/math": "0.27.0", - "@cosmjs/socket": "0.27.0", - "@cosmjs/stream": "0.27.0", - "axios": "^0.21.2", - "readonly-date": "^1.0.0", - "xstream": "^11.14.0" - } - }, - "@cosmjs/utils": { - "version": "0.27.0", - "resolved": "https://registry.npmjs.org/@cosmjs/utils/-/utils-0.27.0.tgz", - "integrity": "sha512-UC1eWY9isDQm6POy6GaTmYtbPVY5dkywdjW8Qzj+JNMhbhMM0KHuI4pHwjv5TPXSO/Ba2z10MTnD9nUlZtDwtA==" - }, - "@protobufjs/aspromise": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", - "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78=" - }, - "@protobufjs/base64": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", - "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" - }, - "@protobufjs/codegen": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", - "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" - }, - "@protobufjs/eventemitter": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", - "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A=" - }, - "@protobufjs/fetch": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", - "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=", - "requires": { - "@protobufjs/aspromise": "^1.1.1", - "@protobufjs/inquire": "^1.1.0" - } - }, - "@protobufjs/float": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", - "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E=" - }, - "@protobufjs/inquire": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", - "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik=" - }, - "@protobufjs/path": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", - "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0=" - }, - "@protobufjs/pool": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", - "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q=" - }, - "@protobufjs/utf8": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", - "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA=" - }, - "@types/long": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz", - "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w==" - }, - "@types/node": { - "version": "11.11.6", - "resolved": "https://registry.npmjs.org/@types/node/-/node-11.11.6.tgz", - "integrity": "sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ==" - }, - "axios": { - "version": "0.21.4", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.4.tgz", - "integrity": "sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==", - "requires": { - "follow-redirects": "^1.14.0" - } - }, - "base64-js": { - "version": "1.5.1", - "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", - "integrity": "sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA==" - }, - "bech32": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", - "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" - }, - "bip39": { - "version": "3.0.4", - "resolved": "https://registry.npmjs.org/bip39/-/bip39-3.0.4.tgz", - "integrity": "sha512-YZKQlb752TrUWqHWj7XAwCSjYEgGAk+/Aas3V7NyjQeZYsztO8JnQUaCWhcnL4T+jL8nvB8typ2jRPzTlgugNw==", - "requires": { - "@types/node": "11.11.6", - "create-hash": "^1.1.0", - "pbkdf2": "^3.0.9", - "randombytes": "^2.0.1" - } - }, - "bn.js": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.0.tgz", - "integrity": "sha512-D7iWRBvnZE8ecXiLj/9wbxH7Tk79fAh8IHaTNq1RWRixsS02W+5qS+iE9yq6RYl0asXx5tw0bLhmT5pIfbSquw==" - }, - "brorand": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", - "integrity": "sha1-EsJe/kCkXjwyPrhnWgoM5XsiNx8=" - }, - "cipher-base": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/cipher-base/-/cipher-base-1.0.4.tgz", - "integrity": "sha512-Kkht5ye6ZGmwv40uUDZztayT2ThLQGfnj/T71N/XzeZeo3nf8foyW7zGTsPYkEya3m5f3cAypH+qe7YOrM1U2Q==", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "cosmjs-types": { - "version": "0.4.1", - "resolved": "https://registry.npmjs.org/cosmjs-types/-/cosmjs-types-0.4.1.tgz", - "integrity": "sha512-I7E/cHkIgoJzMNQdFF0YVqPlaTqrqKHrskuSTIqlEyxfB5Lf3WKCajSXVK2yHOfOFfSux/RxEdpMzw/eO4DIog==", - "requires": { - "long": "^4.0.0", - "protobufjs": "~6.11.2" - }, - "dependencies": { - "@types/node": { - "version": "17.0.10", - "resolved": "https://registry.npmjs.org/@types/node/-/node-17.0.10.tgz", - "integrity": "sha512-S/3xB4KzyFxYGCppyDt68yzBU9ysL88lSdIah4D6cptdcltc4NCPCAMc0+PCpg/lLIyC7IPvj2Z52OJWeIUkog==" - }, - "protobufjs": { - "version": "6.11.2", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.2.tgz", - "integrity": "sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw==", - "requires": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.1", - "@types/node": ">=13.7.0", - "long": "^4.0.0" - } - } - } - }, - "create-hash": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/create-hash/-/create-hash-1.2.0.tgz", - "integrity": "sha512-z00bCGNHDG8mHAkP7CtT1qVu+bFQUPjYq/4Iv3C3kWjTFV10zIjfSoeqXo9Asws8gwSHDGj/hl2u4OGIjapeCg==", - "requires": { - "cipher-base": "^1.0.1", - "inherits": "^2.0.1", - "md5.js": "^1.3.4", - "ripemd160": "^2.0.1", - "sha.js": "^2.4.0" - } - }, - "create-hmac": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/create-hmac/-/create-hmac-1.1.7.tgz", - "integrity": "sha512-MJG9liiZ+ogc4TzUwuvbER1JRdgvUFSB5+VR/g5h82fGaIRWMWddtKBHi7/sVhfjQZ6SehlyhvQYrcYkaUIpLg==", - "requires": { - "cipher-base": "^1.0.3", - "create-hash": "^1.1.0", - "inherits": "^2.0.1", - "ripemd160": "^2.0.0", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "define-properties": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.3.tgz", - "integrity": "sha512-3MqfYKj2lLzdMSf8ZIZE/V+Zuy+BgD6f164e8K2w7dgnpKArBDerGYpM46IYYcjnkdPNMjPk9A6VFB8+3SKlXQ==", - "requires": { - "object-keys": "^1.0.12" - } - }, - "elliptic": { - "version": "6.5.4", - "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", - "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", - "requires": { - "bn.js": "^4.11.9", - "brorand": "^1.1.0", - "hash.js": "^1.0.0", - "hmac-drbg": "^1.0.1", - "inherits": "^2.0.4", - "minimalistic-assert": "^1.0.1", - "minimalistic-crypto-utils": "^1.0.1" - }, - "dependencies": { - "bn.js": { - "version": "4.12.0", - "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", - "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" - } - } - }, - "fast-deep-equal": { - "version": "3.1.3", - "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" - }, - "follow-redirects": { - "version": "1.14.7", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz", - "integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==" - }, - "globalthis": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/globalthis/-/globalthis-1.0.2.tgz", - "integrity": "sha512-ZQnSFO1la8P7auIOQECnm0sSuoMeaSq0EEdXMBFF2QJO4uNcwbyhSgG3MruWNbFTqCLmxVwGOl7LZ9kASvHdeQ==", - "requires": { - "define-properties": "^1.1.3" - } - }, - "hash-base": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/hash-base/-/hash-base-3.1.0.tgz", - "integrity": "sha512-1nmYp/rhMDiE7AYkDw+lLwlAzz0AntGIe51F3RfFfEqyQ3feY2eI/NcwC6umIQVOASPMsWJLJScWKSSvzL9IVA==", - "requires": { - "inherits": "^2.0.4", - "readable-stream": "^3.6.0", - "safe-buffer": "^5.2.0" - } - }, - "hash.js": { - "version": "1.1.7", - "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", - "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", - "requires": { - "inherits": "^2.0.3", - "minimalistic-assert": "^1.0.1" - } - }, - "hmac-drbg": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", - "integrity": "sha1-0nRXAQJabHdabFRXk+1QL8DGSaE=", - "requires": { - "hash.js": "^1.0.3", - "minimalistic-assert": "^1.0.0", - "minimalistic-crypto-utils": "^1.0.1" - } - }, - "inherits": { - "version": "2.0.4", - "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", - "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" - }, - "isomorphic-ws": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/isomorphic-ws/-/isomorphic-ws-4.0.1.tgz", - "integrity": "sha512-BhBvN2MBpWTaSHdWRb/bwdZJ1WaehQ2L1KngkCkfLUGF0mAWAT1sQUQacEmQ0jXkFw/czDXPNQSL5u2/Krsz1w==", - "requires": {} - }, - "js-sha3": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", - "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" - }, - "js-sha512": { - "version": "0.8.0", - "resolved": "https://registry.npmjs.org/js-sha512/-/js-sha512-0.8.0.tgz", - "integrity": "sha512-PWsmefG6Jkodqt+ePTvBZCSMFgN7Clckjd0O7su3I0+BW2QWUTJNzjktHsztGLhncP2h8mcF9V9Y2Ha59pAViQ==" - }, - "libsodium": { - "version": "0.7.9", - "resolved": "https://registry.npmjs.org/libsodium/-/libsodium-0.7.9.tgz", - "integrity": "sha512-gfeADtR4D/CM0oRUviKBViMGXZDgnFdMKMzHsvBdqLBHd9ySi6EtYnmuhHVDDYgYpAO8eU8hEY+F8vIUAPh08A==" - }, - "libsodium-wrappers": { - "version": "0.7.9", - "resolved": "https://registry.npmjs.org/libsodium-wrappers/-/libsodium-wrappers-0.7.9.tgz", - "integrity": "sha512-9HaAeBGk1nKTRFRHkt7nzxqCvnkWTjn1pdjKgcUnZxj0FyOP4CnhgFhMdrFfgNsukijBGyBLpP2m2uKT1vuWhQ==", - "requires": { - "libsodium": "^0.7.0" - } - }, - "long": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz", - "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA==" - }, - "md5.js": { - "version": "1.3.5", - "resolved": "https://registry.npmjs.org/md5.js/-/md5.js-1.3.5.tgz", - "integrity": "sha512-xitP+WxNPcTTOgnTJcrhM0xvdPepipPSf3I8EIpGKeFLjt3PlJLIDG3u8EX53ZIubkb+5U2+3rELYpEhHhzdkg==", - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1", - "safe-buffer": "^5.1.2" - } - }, - "minimalistic-assert": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", - "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" - }, - "minimalistic-crypto-utils": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", - "integrity": "sha1-9sAMHAsIIkblxNmd+4x8CDsrWCo=" - }, - "object-keys": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/object-keys/-/object-keys-1.1.1.tgz", - "integrity": "sha512-NuAESUOUMrlIXOfHKzD6bpPu3tYt3xvjNdRIQ+FeT0lNb4K8WR70CaDxhuNguS2XG+GjkyMwOzsN5ZktImfhLA==" - }, - "pbkdf2": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/pbkdf2/-/pbkdf2-3.1.2.tgz", - "integrity": "sha512-iuh7L6jA7JEGu2WxDwtQP1ddOpaJNC4KlDEFfdQajSGgGPNi4OyDc2R7QnbY2bR9QjBVGwgvTdNJZoE7RaxUMA==", - "requires": { - "create-hash": "^1.1.2", - "create-hmac": "^1.1.4", - "ripemd160": "^2.0.1", - "safe-buffer": "^5.0.1", - "sha.js": "^2.4.8" - } - }, - "protobufjs": { - "version": "6.10.2", - "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.10.2.tgz", - "integrity": "sha512-27yj+04uF6ya9l+qfpH187aqEzfCF4+Uit0I9ZBQVqK09hk/SQzKa2MUqUpXaVa7LOFRg1TSSr3lVxGOk6c0SQ==", - "requires": { - "@protobufjs/aspromise": "^1.1.2", - "@protobufjs/base64": "^1.1.2", - "@protobufjs/codegen": "^2.0.4", - "@protobufjs/eventemitter": "^1.1.0", - "@protobufjs/fetch": "^1.1.0", - "@protobufjs/float": "^1.0.2", - "@protobufjs/inquire": "^1.1.0", - "@protobufjs/path": "^1.1.2", - "@protobufjs/pool": "^1.1.0", - "@protobufjs/utf8": "^1.1.0", - "@types/long": "^4.0.1", - "@types/node": "^13.7.0", - "long": "^4.0.0" - }, - "dependencies": { - "@types/node": { - "version": "13.13.52", - "resolved": "https://registry.npmjs.org/@types/node/-/node-13.13.52.tgz", - "integrity": "sha512-s3nugnZumCC//n4moGGe6tkNMyYEdaDBitVjwPxXmR5lnMG5dHePinH2EdxkG3Rh1ghFHHixAG4NJhpJW1rthQ==" - } - } - }, - "randombytes": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", - "integrity": "sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==", - "requires": { - "safe-buffer": "^5.1.0" - } - }, - "readable-stream": { - "version": "3.6.0", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.0.tgz", - "integrity": "sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==", - "requires": { - "inherits": "^2.0.3", - "string_decoder": "^1.1.1", - "util-deprecate": "^1.0.1" - } - }, - "readonly-date": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/readonly-date/-/readonly-date-1.0.0.tgz", - "integrity": "sha512-tMKIV7hlk0h4mO3JTmmVuIlJVXjKk3Sep9Bf5OH0O+758ruuVkUy2J9SttDLm91IEX/WHlXPSpxMGjPj4beMIQ==" - }, - "ripemd160": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/ripemd160/-/ripemd160-2.0.2.tgz", - "integrity": "sha512-ii4iagi25WusVoiC4B4lq7pbXfAp3D9v5CwfkY33vffw2+pkDjY1D8GaN7spsxvCSx8dkPqOZCEZyfxcmJG2IA==", - "requires": { - "hash-base": "^3.0.0", - "inherits": "^2.0.1" - } - }, - "safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==" - }, - "sha.js": { - "version": "2.4.11", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.11.tgz", - "integrity": "sha512-QMEp5B7cftE7APOjk5Y6xgrbWu+WkLVQwk8JNjZ8nKRciZaByEW6MubieAiToS7+dwvrjGhH8jRXz3MVd0AYqQ==", - "requires": { - "inherits": "^2.0.1", - "safe-buffer": "^5.0.1" - } - }, - "string_decoder": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", - "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", - "requires": { - "safe-buffer": "~5.2.0" - } - }, - "symbol-observable": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-2.0.3.tgz", - "integrity": "sha512-sQV7phh2WCYAn81oAkakC5qjq2Ml0g8ozqz03wOGnx9dDlG1de6yrF+0RAzSJD8fPUow3PTSMf2SAbOGxb93BA==" - }, - "util-deprecate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", - "integrity": "sha1-RQ1Nyfpw3nMnYvvS1KKJgUGaDM8=" - }, - "ws": { - "version": "7.5.6", - "resolved": "https://registry.npmjs.org/ws/-/ws-7.5.6.tgz", - "integrity": "sha512-6GLgCqo2cy2A2rjCNFlxQS6ZljG/coZfZXclldI8FB/1G3CCI36Zd8xy2HrFVACi8tfk5XrgLQEk+P0Tnz9UcA==", - "requires": {} - }, - "xstream": { - "version": "11.14.0", - "resolved": "https://registry.npmjs.org/xstream/-/xstream-11.14.0.tgz", - "integrity": "sha512-1bLb+kKKtKPbgTK6i/BaoAn03g47PpFstlbe1BA+y3pNS/LfvcaghS5BFf9+EE1J+KwSQsEpfJvFN5GqFtiNmw==", - "requires": { - "globalthis": "^1.0.1", - "symbol-observable": "^2.0.3" - } - } - } -} diff --git a/tests/wallet/package.json b/tests/wallet/package.json deleted file mode 100644 index 3c6d90d..0000000 --- a/tests/wallet/package.json +++ /dev/null @@ -1,16 +0,0 @@ -{ - "name": "wallet", - "version": "1.0.0", - "description": "", - "main": "token_transaction.js", - "scripts": { - "test": "echo \"Error: no test specified\" && exit 1" - }, - "author": "", - "license": "ISC", - "dependencies": { - "@cosmjs/launchpad": "^0.27.0", - "@cosmjs/proto-signing": "^0.27.0", - "@cosmjs/stargate": "^0.27.0" - } -} diff --git a/tests/wallet/token_transaction.js b/tests/wallet/token_transaction.js deleted file mode 100644 index 674071a..0000000 --- a/tests/wallet/token_transaction.js +++ /dev/null @@ -1,39 +0,0 @@ -const { DirectSecp256k1HdWallet } = require("@cosmjs/proto-signing"); -const { SigningStargateClient, StargateClient } = require("@cosmjs/stargate"); - -const sendCoins = async () => { - const mnemonic = "crystal marble excuse boil vendor festival subject grape spatial absorb jaguar keep harbor pass argue fame easy borrow slide exhaust honey clutch attitude slab"; - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic); - const [firstAccount] = await wallet.getAccounts(); - - const rpcEndpoint = "http://localhost:26657"; - const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, wallet); - - const recipient = "cosmos1zd62yap0fvsy2xdvdjnqjva3qvetwrh0w99a0g"; - const amount = [{ - denom: "uatom", - amount: "100", - }]; - - const fee = { - amount: [ - { - denom: "uatom", - amount: "10", - }, - ], - gas: "62000", - }; - - console.log({ - addr: firstAccount.address, - recipient, - amount: [amount] - }); - - - const result = await client.sendTokens(firstAccount.address, recipient, amount, fee,"Have fun with your star coins"); - console.log(result) -}; - -sendCoins(); \ No newline at end of file diff --git a/tests/wallet/tx.js b/tests/wallet/tx.js deleted file mode 100644 index cf211c7..0000000 --- a/tests/wallet/tx.js +++ /dev/null @@ -1,552 +0,0 @@ -/* eslint-disable */ -const { Reader, util, configure, Writer } = require("protobufjs/minimal"); -const Long = require("long"); -const { Did, SignInfo } = require("./did"); - -const protobufPackage = "hypersignprotocol.hidnode.ssi"; - -const baseMsgCreateDID = { creator: "" }; - -const MsgCreateDID = { - encode(message, writer = Writer.create()) { - if (message.didDocString !== undefined) { - Did.encode(message.didDocString, writer.uint32(10).fork()).ldelim(); - } - for (const v of message.signatures) { - SignInfo.encode(v, writer.uint32(18).fork()).ldelim(); - } - if (message.creator !== "") { - writer.uint32(26).string(message.creator); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof Uint8Array ? new Reader(input) : input; - let end = length === undefined ? reader.len : reader.pos + length; - const message = { ...baseMsgCreateDID }; - message.signatures = []; - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.didDocString = Did.decode(reader, reader.uint32()); - break; - case 2: - message.signatures.push(SignInfo.decode(reader, reader.uint32())); - break; - case 3: - message.creator = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object) { - const message = { ...baseMsgCreateDID }; - message.signatures = []; - if (object.didDocString !== undefined && object.didDocString !== null) { - message.didDocString = Did.fromJSON(object.didDocString); - } - else { - message.didDocString = undefined; - } - if (object.signatures !== undefined && object.signatures !== null) { - for (const e of object.signatures) { - message.signatures.push(SignInfo.fromJSON(e)); - } - } - if (object.creator !== undefined && object.creator !== null) { - message.creator = String(object.creator); - } - else { - message.creator = ""; - } - return message; - }, - toJSON(message) { - const obj = {}; - message.didDocString !== undefined && - (obj.didDocString = message.didDocString - ? Did.toJSON(message.didDocString) - : undefined); - if (message.signatures) { - obj.signatures = message.signatures.map((e) => e ? SignInfo.toJSON(e) : undefined); - } - else { - obj.signatures = []; - } - message.creator !== undefined && (obj.creator = message.creator); - return obj; - }, - fromPartial(object) { - const message = { ...baseMsgCreateDID }; - message.signatures = []; - if (object.didDocString !== undefined && object.didDocString !== null) { - message.didDocString = Did.fromPartial(object.didDocString); - } - else { - message.didDocString = undefined; - } - if (object.signatures !== undefined && object.signatures !== null) { - for (const e of object.signatures) { - message.signatures.push(SignInfo.fromPartial(e)); - } - } - if (object.creator !== undefined && object.creator !== null) { - message.creator = object.creator; - } - else { - message.creator = ""; - } - return message; - }, -}; -const baseMsgCreateDIDResponse = { id: 0 }; -const MsgCreateDIDResponse = { - encode(message, writer = Writer.create()) { - if (message.id !== 0) { - writer.uint32(8).uint64(message.id); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof Uint8Array ? new Reader(input) : input; - let end = length === undefined ? reader.len : reader.pos + length; - const message = { ...baseMsgCreateDIDResponse }; - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = longToNumber(reader.uint64()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object) { - const message = { ...baseMsgCreateDIDResponse }; - if (object.id !== undefined && object.id !== null) { - message.id = Number(object.id); - } - else { - message.id = 0; - } - return message; - }, - toJSON(message) { - const obj = {}; - message.id !== undefined && (obj.id = message.id); - return obj; - }, - fromPartial(object) { - const message = { ...baseMsgCreateDIDResponse }; - if (object.id !== undefined && object.id !== null) { - message.id = object.id; - } - else { - message.id = 0; - } - return message; - }, -}; -const baseMsgUpdateDID = { versionId: "", creator: "" }; -const MsgUpdateDID = { - encode(message, writer = Writer.create()) { - if (message.didDocString !== undefined) { - Did.encode(message.didDocString, writer.uint32(10).fork()).ldelim(); - } - if (message.versionId !== "") { - writer.uint32(18).string(message.versionId); - } - for (const v of message.signatures) { - SignInfo.encode(v, writer.uint32(26).fork()).ldelim(); - } - if (message.creator !== "") { - writer.uint32(34).string(message.creator); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof Uint8Array ? new Reader(input) : input; - let end = length === undefined ? reader.len : reader.pos + length; - const message = { ...baseMsgUpdateDID }; - message.signatures = []; - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.didDocString = Did.decode(reader, reader.uint32()); - break; - case 2: - message.versionId = reader.string(); - break; - case 3: - message.signatures.push(SignInfo.decode(reader, reader.uint32())); - break; - case 4: - message.creator = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object) { - const message = { ...baseMsgUpdateDID }; - message.signatures = []; - if (object.didDocString !== undefined && object.didDocString !== null) { - message.didDocString = Did.fromJSON(object.didDocString); - } - else { - message.didDocString = undefined; - } - if (object.versionId !== undefined && object.versionId !== null) { - message.versionId = String(object.versionId); - } - else { - message.versionId = ""; - } - if (object.signatures !== undefined && object.signatures !== null) { - for (const e of object.signatures) { - message.signatures.push(SignInfo.fromJSON(e)); - } - } - if (object.creator !== undefined && object.creator !== null) { - message.creator = String(object.creator); - } - else { - message.creator = ""; - } - return message; - }, - toJSON(message) { - const obj = {}; - message.didDocString !== undefined && - (obj.didDocString = message.didDocString - ? Did.toJSON(message.didDocString) - : undefined); - message.versionId !== undefined && (obj.versionId = message.versionId); - if (message.signatures) { - obj.signatures = message.signatures.map((e) => e ? SignInfo.toJSON(e) : undefined); - } - else { - obj.signatures = []; - } - message.creator !== undefined && (obj.creator = message.creator); - return obj; - }, - fromPartial(object) { - const message = { ...baseMsgUpdateDID }; - message.signatures = []; - if (object.didDocString !== undefined && object.didDocString !== null) { - message.didDocString = Did.fromPartial(object.didDocString); - } - else { - message.didDocString = undefined; - } - if (object.versionId !== undefined && object.versionId !== null) { - message.versionId = object.versionId; - } - else { - message.versionId = ""; - } - if (object.signatures !== undefined && object.signatures !== null) { - for (const e of object.signatures) { - message.signatures.push(SignInfo.fromPartial(e)); - } - } - if (object.creator !== undefined && object.creator !== null) { - message.creator = object.creator; - } - else { - message.creator = ""; - } - return message; - }, -}; -const baseMsgUpdateDIDResponse = { updateId: "" }; -const MsgUpdateDIDResponse = { - encode(message, writer = Writer.create()) { - if (message.updateId !== "") { - writer.uint32(10).string(message.updateId); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof Uint8Array ? new Reader(input) : input; - let end = length === undefined ? reader.len : reader.pos + length; - const message = { ...baseMsgUpdateDIDResponse }; - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.updateId = reader.string(); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object) { - const message = { ...baseMsgUpdateDIDResponse }; - if (object.updateId !== undefined && object.updateId !== null) { - message.updateId = String(object.updateId); - } - else { - message.updateId = ""; - } - return message; - }, - toJSON(message) { - const obj = {}; - message.updateId !== undefined && (obj.updateId = message.updateId); - return obj; - }, - fromPartial(object) { - const message = { ...baseMsgUpdateDIDResponse }; - if (object.updateId !== undefined && object.updateId !== null) { - message.updateId = object.updateId; - } - else { - message.updateId = ""; - } - return message; - }, -}; - -const baseMsgDeactivateDID = { creator: "", versionId: "" }; -const MsgDeactivateDID = { - encode(message, writer = Writer.create()) { - if (message.creator !== "") { - writer.uint32(10).string(message.creator); - } - if (message.didDocString !== undefined) { - Did.encode(message.didDocString, writer.uint32(18).fork()).ldelim(); - } - if (message.versionId !== "") { - writer.uint32(26).string(message.versionId); - } - for (const v of message.signatures) { - SignInfo.encode(v, writer.uint32(34).fork()).ldelim(); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof Uint8Array ? new Reader(input) : input; - let end = length === undefined ? reader.len : reader.pos + length; - const message = { ...baseMsgDeactivateDID }; - message.signatures = []; - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.creator = reader.string(); - break; - case 2: - message.didDocString = Did.decode(reader, reader.uint32()); - break; - case 3: - message.versionId = reader.string(); - break; - case 4: - message.signatures.push(SignInfo.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object) { - const message = { ...baseMsgDeactivateDID }; - message.signatures = []; - if (object.creator !== undefined && object.creator !== null) { - message.creator = String(object.creator); - } - else { - message.creator = ""; - } - if (object.didDocString !== undefined && object.didDocString !== null) { - message.didDocString = Did.fromJSON(object.didDocString); - } - else { - message.didDocString = undefined; - } - if (object.versionId !== undefined && object.versionId !== null) { - message.versionId = String(object.versionId); - } - else { - message.versionId = ""; - } - if (object.signatures !== undefined && object.signatures !== null) { - for (const e of object.signatures) { - message.signatures.push(SignInfo.fromJSON(e)); - } - } - return message; - }, - toJSON(message) { - const obj = {}; - message.creator !== undefined && (obj.creator = message.creator); - message.didDocString !== undefined && - (obj.didDocString = message.didDocString - ? Did.toJSON(message.didDocString) - : undefined); - message.versionId !== undefined && (obj.versionId = message.versionId); - if (message.signatures) { - obj.signatures = message.signatures.map((e) => e ? SignInfo.toJSON(e) : undefined); - } - else { - obj.signatures = []; - } - return obj; - }, - fromPartial(object) { - const message = { ...baseMsgDeactivateDID }; - message.signatures = []; - if (object.creator !== undefined && object.creator !== null) { - message.creator = object.creator; - } - else { - message.creator = ""; - } - if (object.didDocString !== undefined && object.didDocString !== null) { - message.didDocString = Did.fromPartial(object.didDocString); - } - else { - message.didDocString = undefined; - } - if (object.versionId !== undefined && object.versionId !== null) { - message.versionId = object.versionId; - } - else { - message.versionId = ""; - } - if (object.signatures !== undefined && object.signatures !== null) { - for (const e of object.signatures) { - message.signatures.push(SignInfo.fromPartial(e)); - } - } - return message; - }, -}; -const baseMsgDeactivateDIDResponse = { id: 0 }; -const MsgDeactivateDIDResponse = { - encode(message, writer = Writer.create()) { - if (message.id !== 0) { - writer.uint32(8).uint64(message.id); - } - return writer; - }, - decode(input, length) { - const reader = input instanceof Uint8Array ? new Reader(input) : input; - let end = length === undefined ? reader.len : reader.pos + length; - const message = { - ...baseMsgDeactivateDIDResponse, - }; - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.id = longToNumber(reader.uint64()); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object) { - const message = { - ...baseMsgDeactivateDIDResponse, - }; - if (object.id !== undefined && object.id !== null) { - message.id = Number(object.id); - } - else { - message.id = 0; - } - return message; - }, - toJSON(message) { - const obj = {}; - message.id !== undefined && (obj.id = message.id); - return obj; - }, - fromPartial(object) { - const message = { - ...baseMsgDeactivateDIDResponse, - }; - if (object.id !== undefined && object.id !== null) { - message.id = object.id; - } - else { - message.id = 0; - } - return message; - }, -}; -class MsgClientImpl { - constructor(rpc) { - this.rpc = rpc; - } - CreateDID(request) { - const data = MsgCreateDID.encode(request).finish(); - const promise = this.rpc.request("hypersignprotocol.hidnode.ssi.Msg", "CreateDID", data); - return promise.then((data) => MsgCreateDIDResponse.decode(new Reader(data))); - } - UpdateDID(request) { - const data = MsgUpdateDID.encode(request).finish(); - const promise = this.rpc.request("hypersignprotocol.hidnode.ssi.Msg", "UpdateDID", data); - return promise.then((data) => MsgUpdateDIDResponse.decode(new Reader(data))); - } - DeactivateDID(request) { - const data = MsgDeactivateDID.encode(request).finish(); - const promise = this.rpc.request("hypersignprotocol.hidnode.ssi.Msg", "DeactivateDID", data); - return promise.then((data) => MsgDeactivateDIDResponse.decode(new Reader(data))); - } -} -var globalThis = (() => { - if (typeof globalThis !== "undefined") - return globalThis; - if (typeof self !== "undefined") - return self; - if (typeof window !== "undefined") - return window; - if (typeof global !== "undefined") - return global; - throw "Unable to locate global object"; -})(); -function longToNumber(long) { - if (long.gt(Number.MAX_SAFE_INTEGER)) { - throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER"); - } - return long.toNumber(); -} -if (util.Long !== Long) { - util.Long = Long; - configure(); -} - -module.exports = { - protobufPackage, - MsgCreateDID, - MsgCreateDIDResponse, - MsgUpdateDID, - MsgUpdateDIDResponse, - MsgDeactivateDID, - MsgDeactivateDIDResponse, - MsgClientImpl -} \ No newline at end of file diff --git a/tests/wallet/tx_custom_message.js b/tests/wallet/tx_custom_message.js deleted file mode 100644 index ec2f842..0000000 --- a/tests/wallet/tx_custom_message.js +++ /dev/null @@ -1,68 +0,0 @@ -const { DirectSecp256k1HdWallet, Registry } = require("@cosmjs/proto-signing"); -const { - defaultRegistryTypes, - SigningStargateClient, -} = require("@cosmjs/stargate"); - -// Note: The following tx.js being reffered here follows old javascript: vue/src/store/generated/hypersign-protocol/hid-node/hypersignprotocol.hidnode.did/module/types/did/tx.js -// The refactore tx.js file is the `wallet` folder of this repo -const { MsgCreateDID } = require("./tx.js"); - -const runfn = async () => { - const myRegistry = new Registry(defaultRegistryTypes); - myRegistry.register("/hypersignprotocol.hidnode.ssi.MsgCreateDID", MsgCreateDID); // Replace with your own type URL and Msg class - const mnemonic = // Replace with your own mnemonic - "crystal marble excuse boil vendor festival subject grape spatial absorb jaguar keep harbor pass argue fame easy borrow slide exhaust honey clutch attitude slab"; - - // Inside an async function... - // const signer = await DirectSecp256k1HdWallet.fromMnemonic( - // mnemonic, - // { prefix: "cosmos" }, // Replace with your own Bech32 address prefix - // ); - // const client = await SigningStargateClient.connectWithSigner( - // "http://localhost:26657", // Replace with your own RPC endpoint - // signer, - // { registry: myRegistry }, - // ); - - const wallet = await DirectSecp256k1HdWallet.fromMnemonic(mnemonic); - const rpcEndpoint = "http://localhost:26657"; - const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, wallet, { registry: myRegistry }); - - ////////// - const [firstAccount] = await wallet.getAccounts(); - const myAddress = firstAccount.address - console.log(myAddress) - const message = { - typeUrl: "/hypersignprotocol.hidnode.ssi.MsgCreateDID", // Same as above - value: MsgCreateDID.fromPartial({ - didDocString: "{\"@context\":[\"https://www.w3123.org/ns/did/v1\",\"https://w3id.org/security/v1\",\"https://schema.org\"],\"@type\":\"https://schema.org/Person\",\"id\":\"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51\",\"name\":\"Vishwas\",\"publicKey\":[{\"@context\":\"https://w3id.org/security/v2\",\"id\":\"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#z6MkjAwRoZNV1oifLPb2GzLatZ7sVxY5jZ16xYTTAgSgCqQQ\",\"type\":\"Ed25519VerificationKey2018\",\"publicKeyBase58\":\"5igPDK83gGECDtkKbRNk3TZsgPGEKfkkGXYXLQUfHcd2\"}],\"authentication\":[\"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#z6MkjAwRoZNV1oifLPb2GzLatZ7sVxY5jZ16xYTTAgSgCqQQ\"],\"assertionMethod\":[\"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#z6MkjAwRoZNV1oifLPb2GzLatZ7sVxY5jZ16xYTTAgSgCqQQ\"],\"keyAgreement\":[\"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#z6MkjAwRoZNV1oifLPb2GzLatZ7sVxY5jZ16xYTTAgSgCqQQ\"],\"capabilityInvocation\":[\"did:hs:0f49341a-20ef-43d1-bc93-de30993e6c51#z6MkjAwRoZNV1oifLPb2GzLatZ7sVxY5jZ16xYTTAgSgCqQQ\"],\"created\":\"2021-04-06T14:13:14.018Z\",\"updated\":\"2021-04-06T14:13:14.018Z\"}", - signatures: [], - creator: myAddress, - }), - }; - const fee = { - amount: [ - { - denom: "uatom", // Use the appropriate fee denom for your chain - amount: "1", - }, - ], - gas: "162000", - }; - - // Inside an async function... - // This method uses the registry you provided - const response = await client.signAndBroadcast(myAddress, [message], fee); - console.log(response); - /** Response Output - { - height: 2862, - transactionHash: '90ED03916FCBEDF03928E984F9B5361C56625395EDA69C7A22FEE86B5FD28720', - rawLog: '[{"events":[{"type":"message","attributes":[{"key":"action","value":"create_did"}]}]}]', - data: [ { msgType: '/hypersignprotocol.hidnode.did.MsgCreateDID' } ] - } - * **/ -} - -runfn(); \ No newline at end of file diff --git a/x/ssi/client/cli/tx_ssi.go b/x/ssi/client/cli/tx_ssi.go index 5001c08..fae6c89 100644 --- a/x/ssi/client/cli/tx_ssi.go +++ b/x/ssi/client/cli/tx_ssi.go @@ -16,7 +16,7 @@ const VerKeyFlag = "ver-key" func CmdCreateDID() *cobra.Command { cmd := &cobra.Command{ Use: "create-did [did-doc-string] [verification-method-id]", - Short: "Registers the DidDocString", + Short: "Registers Did Document", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { argDidDocString := args[0] @@ -69,7 +69,7 @@ func CmdCreateDID() *cobra.Command { func CmdUpdateDID() *cobra.Command { cmd := &cobra.Command{ Use: "update-did [did-doc-string] [version-id] [verification-method-id]", - Short: "Updates the DID", + Short: "Updates Did Document", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) (err error) { argDidDocString := args[0] @@ -125,7 +125,7 @@ func CmdUpdateDID() *cobra.Command { func CmdCreateSchema() *cobra.Command { cmd := &cobra.Command{ Use: "create-schema [schema] [verification-method-id]", - Short: "Creates a Schema", + Short: "Creates Schema", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { argSchema := args[0] @@ -177,11 +177,11 @@ func CmdCreateSchema() *cobra.Command { func CmdDeactivateDID() *cobra.Command { cmd := &cobra.Command{ - Use: "deactivate-did [did-doc-string] [version-id] [verification-method-id]", - Short: "Deactivates the DID", + Use: "deactivate-did [did-id] [version-id] [verification-method-id]", + Short: "Deactivates Did Document", Args: cobra.ExactArgs(3), RunE: func(cmd *cobra.Command, args []string) (err error) { - argDidDocString := args[0] + argDidId := args[0] argVersionId := args[1] argVerificationMethodId := args[2] @@ -190,18 +190,21 @@ func CmdDeactivateDID() *cobra.Command { return err } - var didDoc types.Did - err = clientCtx.Codec.UnmarshalJSON([]byte(argDidDocString), &didDoc) + // Query Did Document from store using Did Id + queryClient := types.NewQueryClient(clientCtx) + requestParams := &types.QueryGetDidDocByIdRequest{DidId: argDidId} + resolvedDidDocument, err := queryClient.ResolveDid(cmd.Context(), requestParams) if err != nil { return err } + didDoc := resolvedDidDocument.GetDidDocument() verKeyPriv, err := getVerKey(cmd, clientCtx) if err != nil { return err } - // // Build identity message + // Sign the Did Document signBytes := didDoc.GetSignBytes() signatureBytes := ed25519.Sign(verKeyPriv, signBytes) @@ -212,7 +215,7 @@ func CmdDeactivateDID() *cobra.Command { msg := types.MsgDeactivateDID{ Creator: clientCtx.GetFromAddress().String(), - DidDocString: &didDoc, + DidId: argDidId, VersionId: argVersionId, Signatures: []*types.SignInfo{&signInfo}, } @@ -233,7 +236,7 @@ func CmdDeactivateDID() *cobra.Command { func CmdRegisterCredentialStatus() *cobra.Command { cmd := &cobra.Command{ Use: "register-credential-status [credential-status] [proof]", - Short: "Registers the status of a Verifiable Credential", + Short: "Registers the status of Verifiable Credential", Args: cobra.ExactArgs(2), RunE: func(cmd *cobra.Command, args []string) (err error) { argCredStatus := args[0] diff --git a/x/ssi/keeper/msg_server_did.go b/x/ssi/keeper/msg_server_did.go index 287f9d9..685406e 100644 --- a/x/ssi/keeper/msg_server_did.go +++ b/x/ssi/keeper/msg_server_did.go @@ -146,60 +146,58 @@ func (k msgServer) UpdateDID(goCtx context.Context, msg *types.MsgUpdateDID) (*t func (k msgServer) DeactivateDID(goCtx context.Context, msg *types.MsgDeactivateDID) (*types.MsgDeactivateDIDResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) - didMsg := msg.GetDidDocString() - id := msg.GetDidDocString().GetId() + id := msg.GetDidId() versionId := msg.GetVersionId() - oldDIDDoc, err := k.GetDid(&ctx, didMsg.Id) + // Checks if the DID is not present in the store + if !k.HasDid(ctx, id) { + return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("DID doesnt exists %s", id)) + } + + didDocument, err := k.GetDid(&ctx, id) if err != nil { return nil, err } - oldDid := oldDIDDoc.GetDid() - oldMetaData := oldDIDDoc.GetMetadata() + did := didDocument.GetDid() + metadata := didDocument.GetMetadata() // Check if the didDoc is valid - didDocCheck := utils.IsValidDidDoc(didMsg) + didDocCheck := utils.IsValidDidDoc(did) if didDocCheck != "" { return nil, sdkerrors.Wrap(types.ErrInvalidDidDoc, didDocCheck) } - // Checks if the DID is not present in the store - if !k.HasDid(ctx, id) { - return nil, sdkerrors.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("DID doesnt exists %s", id)) - } - - if k.ValidateDidControllers(&ctx, id, didMsg.GetController(), didMsg.GetVerificationMethod()) != nil { + if k.ValidateDidControllers(&ctx, id, did.GetController(), did.GetVerificationMethod()) != nil { return nil, sdkerrors.Wrap(types.ErrInvalidDidDoc, "DID controller is not valid") } - if err := k.VerifySignatureOnDidUpdate(&ctx, oldDid, didMsg, msg.Signatures); err != nil { + if err := k.VerifySignature(&ctx, did, did.GetSigners(), msg.Signatures); err != nil { return nil, err } // Check if the versionId passed is the same as the one in the Latest DID Document in store - if oldMetaData.VersionId != versionId { - errMsg := fmt.Sprintf("Expected %s with version %s. Got version %s", didMsg.Id, oldMetaData.VersionId, versionId) + if metadata.GetVersionId() != versionId { + errMsg := fmt.Sprintf("Expected %s with version %s. Got version %s", did.GetId(), metadata.GetVersionId(), versionId) return nil, sdkerrors.Wrap(types.ErrUnexpectedDidVersion, errMsg) } // Check if the DID is already deactivated - if err := VerifyDidDeactivate(oldMetaData, didMsg.Id); err != nil { + if err := VerifyDidDeactivate(metadata, did.GetId()); err != nil { return nil, err } - // Create the Metadata - metadata := types.CreateNewMetadata(ctx) - // Assign `created` and `deactivated` to previous DIDDoc's metadata values - metadata.Created = oldDIDDoc.GetMetadata().Created - metadata.Deactivated = true + // Create updated metadata + updatedMetadata := types.CreateNewMetadata(ctx) + updatedMetadata.Created = didDocument.GetMetadata().Created + updatedMetadata.Deactivated = true - // Form the DID Document - didDoc := types.DidDocument{ - Did: nil, - Metadata: &metadata, + // Form the updated DID Document + updatedDidDocument := types.DidDocument{ + Did: did, + Metadata: &updatedMetadata, } - if err := k.SetDidDeactivate(ctx, didDoc, id); err != nil { + if err := k.SetDidDeactivate(ctx, updatedDidDocument, id); err != nil { return nil, err } diff --git a/x/ssi/keeper/verify.go b/x/ssi/keeper/verify.go index b714eb6..f6b6c23 100644 --- a/x/ssi/keeper/verify.go +++ b/x/ssi/keeper/verify.go @@ -234,7 +234,7 @@ func (k msgServer) ValidateDidControllers(ctx *sdk.Context, id string, controlle // Check the Deactivate status of DID func VerifyDidDeactivate(metadata *types.Metadata, id string) error { - if metadata.Deactivated { + if metadata.GetDeactivated() { return sdkerrors.Wrap(types.ErrDidDocDeactivated, fmt.Sprintf("DidDoc ID: %s", id)) } return nil @@ -272,9 +272,7 @@ func (k msgServer) VerifyCredentialSignature(msg *types.CredentialStatus, didDoc } func VerifyCredentialStatusDates(issuanceDate time.Time, expirationDate time.Time) error { - var dateDiff int64 - - dateDiff = int64(expirationDate.Sub(issuanceDate)) / 1e9 // converting nanoseconds to seconds + var dateDiff int64 = int64(expirationDate.Sub(issuanceDate)) / 1e9 // converting nanoseconds to seconds if dateDiff < 0 { return sdkerrors.Wrapf(types.ErrInvalidDate, fmt.Sprintf("expiration date %s cannot be less than issuance date %s", expirationDate, issuanceDate)) } diff --git a/x/ssi/types/message_did.go b/x/ssi/types/message_did.go index 6fada30..39cd9fd 100644 --- a/x/ssi/types/message_did.go +++ b/x/ssi/types/message_did.go @@ -134,10 +134,10 @@ const TypeMsgDeactivateDID = "deactivate_did" var _ sdk.Msg = &MsgDeactivateDID{} -func NewMsgDeactivateDID(creator string, didDocString *Did, versionId string, signatures []*SignInfo) *MsgDeactivateDID { +func NewMsgDeactivateDID(creator string, didId string, versionId string, signatures []*SignInfo) *MsgDeactivateDID { return &MsgDeactivateDID{ Creator: creator, - DidDocString: didDocString, + DidId: didId, VersionId: versionId, Signatures: signatures, } diff --git a/x/ssi/types/tx.pb.go b/x/ssi/types/tx.pb.go index 1340907..2a71664 100644 --- a/x/ssi/types/tx.pb.go +++ b/x/ssi/types/tx.pb.go @@ -348,10 +348,10 @@ func (m *MsgCreateSchemaResponse) GetId() uint64 { } type MsgDeactivateDID struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - DidDocString *Did `protobuf:"bytes,2,opt,name=didDocString,proto3" json:"didDocString,omitempty"` - VersionId string `protobuf:"bytes,3,opt,name=version_id,json=versionId,proto3" json:"version_id,omitempty"` - Signatures []*SignInfo `protobuf:"bytes,4,rep,name=signatures,proto3" json:"signatures,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + DidId string `protobuf:"bytes,2,opt,name=didId,proto3" json:"didId,omitempty"` + VersionId string `protobuf:"bytes,3,opt,name=version_id,json=versionId,proto3" json:"version_id,omitempty"` + Signatures []*SignInfo `protobuf:"bytes,4,rep,name=signatures,proto3" json:"signatures,omitempty"` } func (m *MsgDeactivateDID) Reset() { *m = MsgDeactivateDID{} } @@ -394,11 +394,11 @@ func (m *MsgDeactivateDID) GetCreator() string { return "" } -func (m *MsgDeactivateDID) GetDidDocString() *Did { +func (m *MsgDeactivateDID) GetDidId() string { if m != nil { - return m.DidDocString + return m.DidId } - return nil + return "" } func (m *MsgDeactivateDID) GetVersionId() string { @@ -579,45 +579,46 @@ func init() { func init() { proto.RegisterFile("ssi/v1/tx.proto", fileDescriptor_73a1aa6c7279248b) } var fileDescriptor_73a1aa6c7279248b = []byte{ - // 604 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcf, 0x6e, 0xd3, 0x4e, - 0x10, 0xee, 0x26, 0xf9, 0xf5, 0x47, 0x26, 0x85, 0x56, 0x06, 0xa9, 0x96, 0x51, 0xad, 0xca, 0x08, - 0x08, 0xa0, 0xda, 0xc2, 0x15, 0x20, 0x21, 0x71, 0x69, 0x2d, 0x50, 0x24, 0x22, 0x21, 0x47, 0x5c, - 0xe0, 0x80, 0x5c, 0xef, 0xd6, 0x59, 0xa9, 0xf1, 0x5a, 0xde, 0x4d, 0xd4, 0xbc, 0x05, 0x67, 0x5e, - 0x83, 0x13, 0x6f, 0xc0, 0xb1, 0xc7, 0x0a, 0x71, 0x40, 0xc9, 0x23, 0xf0, 0x02, 0xc8, 0x7f, 0xe2, - 0xc6, 0xae, 0x1c, 0x27, 0x55, 0x8e, 0x3b, 0x9e, 0x6f, 0xbe, 0x6f, 0xbe, 0x9d, 0x1d, 0xc3, 0x36, - 0xe7, 0xd4, 0x18, 0x3d, 0x37, 0xc4, 0xb9, 0x1e, 0x84, 0x4c, 0x30, 0x69, 0xaf, 0x3f, 0x0e, 0x48, - 0xc8, 0xa9, 0xe7, 0xc7, 0x67, 0x97, 0x9d, 0xe9, 0x7d, 0x8a, 0x7d, 0x86, 0x89, 0xce, 0x39, 0x55, - 0xee, 0xa6, 0xf9, 0xdc, 0xed, 0x93, 0x81, 0x93, 0x60, 0x94, 0x9d, 0x34, 0x88, 0x29, 0x4e, 0x23, - 0xbb, 0x69, 0xc4, 0x0d, 0x09, 0x26, 0xbe, 0xa0, 0xce, 0x59, 0xf2, 0x41, 0xfb, 0x81, 0x60, 0xab, - 0xcb, 0xbd, 0xe3, 0x90, 0x38, 0x82, 0x58, 0x1d, 0x4b, 0x7a, 0x0b, 0x5b, 0x98, 0x62, 0x8b, 0xb9, - 0x3d, 0x11, 0x52, 0xdf, 0x93, 0xd1, 0x3e, 0x6a, 0xb7, 0x4c, 0x4d, 0x5f, 0x28, 0x43, 0xb7, 0x28, - 0xb6, 0x73, 0x38, 0xe9, 0x1d, 0x40, 0x94, 0xed, 0x88, 0x61, 0x48, 0xb8, 0x5c, 0xdb, 0xaf, 0xb7, - 0x5b, 0xe6, 0xe3, 0x8a, 0x2a, 0x3d, 0xea, 0xf9, 0x1d, 0xff, 0x94, 0xd9, 0x73, 0x50, 0x49, 0x86, - 0xff, 0xdd, 0x48, 0x1d, 0x0b, 0xe5, 0xfa, 0x3e, 0x6a, 0x37, 0xed, 0xd9, 0x51, 0x7b, 0x04, 0xf7, - 0xe6, 0xa5, 0xdb, 0x84, 0x07, 0xcc, 0xe7, 0x44, 0xba, 0x03, 0x35, 0x8a, 0x63, 0xe1, 0x0d, 0xbb, - 0x46, 0xb1, 0x76, 0x99, 0xf4, 0xf8, 0x31, 0xc0, 0x6b, 0xee, 0x71, 0x0f, 0x60, 0x14, 0x01, 0x98, - 0xff, 0x85, 0x62, 0xb9, 0x16, 0xab, 0x6b, 0xa6, 0x91, 0x0e, 0x2e, 0x58, 0x50, 0x5f, 0x8b, 0x05, - 0x8d, 0xbc, 0x05, 0x66, 0x6c, 0x41, 0xd6, 0x59, 0x66, 0x81, 0x02, 0xb7, 0x86, 0x71, 0xb0, 0x93, - 0x18, 0xd1, 0xb4, 0xb3, 0xb3, 0xf6, 0x1d, 0xc1, 0x76, 0xe6, 0x5b, 0x2f, 0x9e, 0x9b, 0x79, 0x06, - 0x94, 0x63, 0x90, 0xde, 0xc0, 0x66, 0x32, 0x5b, 0x71, 0x7f, 0x2d, 0xf3, 0x61, 0x55, 0x03, 0x71, - 0xb2, 0x9d, 0x82, 0xd6, 0xe6, 0x81, 0xf6, 0x04, 0x76, 0x0b, 0xa2, 0x4b, 0xef, 0xfb, 0x37, 0x82, - 0x9d, 0x2e, 0xf7, 0x2c, 0xe2, 0xb8, 0x82, 0x8e, 0xd2, 0x3b, 0x2f, 0xef, 0xb0, 0x38, 0x0d, 0xb5, - 0xb5, 0x4c, 0x43, 0x7d, 0xf1, 0x34, 0x34, 0x6e, 0xee, 0xc4, 0x53, 0x90, 0x8b, 0xdd, 0x95, 0x5a, - 0xf1, 0x0b, 0xc1, 0xfd, 0x2e, 0xf7, 0x6c, 0xe2, 0x51, 0x2e, 0x48, 0x78, 0x9c, 0x3d, 0xff, 0x9e, - 0x70, 0xc4, 0x90, 0x2f, 0x70, 0xe5, 0x33, 0xec, 0xb8, 0x85, 0xec, 0xd4, 0x19, 0xa3, 0x42, 0x74, - 0x91, 0xc4, 0xbe, 0x56, 0x48, 0xb2, 0xe0, 0xbf, 0x20, 0x64, 0xec, 0x34, 0x76, 0xa9, 0x65, 0xea, - 0x4b, 0x57, 0xfc, 0x10, 0xa1, 0xec, 0x04, 0xac, 0xbd, 0x80, 0x07, 0x0b, 0x7a, 0x2b, 0xf3, 0xc4, - 0xfc, 0xdb, 0x80, 0x7a, 0x97, 0x7b, 0xd2, 0x00, 0x9a, 0x57, 0x6b, 0xef, 0x59, 0x85, 0x84, 0xf9, - 0x45, 0xa3, 0x1c, 0xae, 0x90, 0x9c, 0xc9, 0x18, 0x40, 0xf3, 0x6a, 0x03, 0x2d, 0x41, 0x97, 0x25, - 0x2f, 0x43, 0x77, 0x7d, 0x03, 0x8c, 0x60, 0x2b, 0xf7, 0xc2, 0xf5, 0x65, 0x35, 0x27, 0xf9, 0xca, - 0xcb, 0xd5, 0xf2, 0x33, 0xde, 0x31, 0xdc, 0xce, 0x3f, 0x3c, 0xa3, 0xba, 0x50, 0x0e, 0xa0, 0xbc, - 0x5a, 0x11, 0x90, 0x51, 0x7f, 0x43, 0x20, 0x97, 0x4e, 0xfa, 0xeb, 0xea, 0xaa, 0x65, 0x58, 0xe5, - 0xe8, 0xe6, 0xd8, 0x99, 0xb8, 0xa3, 0xf7, 0x3f, 0x27, 0x2a, 0xba, 0x98, 0xa8, 0xe8, 0xcf, 0x44, - 0x45, 0x5f, 0xa7, 0xea, 0xc6, 0xc5, 0x54, 0xdd, 0xb8, 0x9c, 0xaa, 0x1b, 0x9f, 0x4c, 0x8f, 0x8a, - 0xfe, 0xf0, 0x44, 0x77, 0xd9, 0xc0, 0xc8, 0x78, 0x0e, 0x66, 0x44, 0x46, 0x9f, 0xe2, 0x83, 0x88, - 0xc9, 0x38, 0x37, 0xa2, 0x9f, 0xb8, 0x18, 0x07, 0x84, 0x9f, 0x6c, 0xc6, 0x9f, 0x0f, 0xff, 0x05, - 0x00, 0x00, 0xff, 0xff, 0xf7, 0x6e, 0x3c, 0x20, 0x2f, 0x08, 0x00, 0x00, + // 609 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x55, 0xcb, 0x6e, 0xd3, 0x4c, + 0x14, 0xee, 0x24, 0x69, 0xff, 0x3f, 0x27, 0x85, 0x56, 0xa6, 0x52, 0x2d, 0xa3, 0x5a, 0x95, 0x11, + 0x50, 0x40, 0xb5, 0x85, 0x2b, 0x40, 0x42, 0x62, 0xd3, 0x5a, 0xa0, 0x48, 0x44, 0x42, 0x8e, 0xd8, + 0xc0, 0x02, 0xb9, 0x9e, 0xa9, 0x33, 0x52, 0xe3, 0xb1, 0x3c, 0x93, 0xa8, 0x79, 0x0b, 0xd6, 0x3c, + 0x02, 0x5b, 0x56, 0xbc, 0x01, 0xcb, 0x2e, 0x2b, 0x56, 0x28, 0x79, 0x04, 0x5e, 0x00, 0xf9, 0x12, + 0x37, 0x76, 0xe5, 0x38, 0xa9, 0xb2, 0x9c, 0xf1, 0xf9, 0xce, 0x77, 0x39, 0x33, 0x63, 0xd8, 0xe2, + 0x9c, 0x1a, 0xc3, 0xe7, 0x86, 0xb8, 0xd0, 0x83, 0x90, 0x09, 0x26, 0xed, 0xf5, 0x46, 0x01, 0x09, + 0x39, 0xf5, 0xfc, 0x78, 0xed, 0xb2, 0x73, 0xbd, 0x47, 0xb1, 0xcf, 0x30, 0xd1, 0x39, 0xa7, 0xca, + 0xbd, 0xb4, 0x9e, 0xbb, 0x3d, 0xd2, 0x77, 0x12, 0x8c, 0xb2, 0x9d, 0x6e, 0x62, 0x8a, 0xd3, 0x9d, + 0xdd, 0x74, 0xc7, 0x0d, 0x09, 0x26, 0xbe, 0xa0, 0xce, 0x79, 0xf2, 0x41, 0xfb, 0x89, 0x60, 0xb3, + 0xc3, 0xbd, 0x93, 0x90, 0x38, 0x82, 0x58, 0x6d, 0x4b, 0x7a, 0x0b, 0x9b, 0x98, 0x62, 0x8b, 0xb9, + 0x5d, 0x11, 0x52, 0xdf, 0x93, 0xd1, 0x3e, 0x3a, 0x68, 0x99, 0x9a, 0x3e, 0x57, 0x86, 0x6e, 0x51, + 0x6c, 0xe7, 0x70, 0xd2, 0x3b, 0x80, 0xa8, 0xda, 0x11, 0x83, 0x90, 0x70, 0xb9, 0xb6, 0x5f, 0x3f, + 0x68, 0x99, 0x8f, 0x2b, 0xba, 0x74, 0xa9, 0xe7, 0xb7, 0xfd, 0x33, 0x66, 0xcf, 0x40, 0x25, 0x19, + 0xfe, 0x73, 0x23, 0x75, 0x2c, 0x94, 0xeb, 0xfb, 0xe8, 0xa0, 0x69, 0x4f, 0x97, 0xda, 0x23, 0xd8, + 0x99, 0x95, 0x6e, 0x13, 0x1e, 0x30, 0x9f, 0x13, 0xe9, 0x2e, 0xd4, 0x28, 0x8e, 0x85, 0x37, 0xec, + 0x1a, 0xc5, 0xda, 0x55, 0xe2, 0xf1, 0x63, 0x80, 0x57, 0xec, 0x71, 0x0f, 0x60, 0x18, 0x01, 0x98, + 0xff, 0x85, 0x62, 0xb9, 0x16, 0xab, 0x6b, 0xa6, 0x3b, 0x6d, 0x5c, 0x88, 0xa0, 0xbe, 0x92, 0x08, + 0x1a, 0xf9, 0x08, 0xcc, 0x38, 0x82, 0xcc, 0x59, 0x16, 0x81, 0x02, 0xff, 0x0f, 0xe2, 0xcd, 0x76, + 0x12, 0x44, 0xd3, 0xce, 0xd6, 0xda, 0x0f, 0x04, 0x5b, 0x59, 0x6e, 0xdd, 0xf8, 0xdc, 0xcc, 0x32, + 0xa0, 0x1c, 0x83, 0xf4, 0x06, 0x36, 0x92, 0xb3, 0x15, 0xfb, 0x6b, 0x99, 0x0f, 0xab, 0x0c, 0xc4, + 0xc5, 0x76, 0x0a, 0x5a, 0x59, 0x06, 0xda, 0x13, 0xd8, 0x2d, 0x88, 0x2e, 0x9d, 0xf7, 0x77, 0x04, + 0xdb, 0x1d, 0xee, 0x59, 0xc4, 0x71, 0x05, 0x1d, 0xa6, 0x33, 0x2f, 0x77, 0xb8, 0x03, 0xeb, 0x98, + 0xe2, 0xf6, 0x74, 0x80, 0xc9, 0xa2, 0x30, 0xdb, 0xfa, 0xfc, 0xd9, 0x36, 0x6e, 0xef, 0xeb, 0x29, + 0xc8, 0x45, 0xad, 0xa5, 0xc6, 0x7e, 0x23, 0xb8, 0xdf, 0xe1, 0x9e, 0x4d, 0x3c, 0xca, 0x05, 0x09, + 0x4f, 0xb2, 0xcb, 0xdc, 0x15, 0x8e, 0x18, 0xf0, 0x39, 0x1e, 0x3f, 0xc3, 0xb6, 0x5b, 0xa8, 0x4e, + 0xe7, 0x69, 0x54, 0x88, 0x2e, 0x92, 0xd8, 0x37, 0x1a, 0x49, 0x16, 0xac, 0x07, 0x21, 0x63, 0x67, + 0x71, 0x4a, 0x2d, 0x53, 0x5f, 0xb8, 0xe3, 0x87, 0x08, 0x65, 0x27, 0x60, 0xed, 0x05, 0x3c, 0x98, + 0xe3, 0xad, 0x2c, 0x13, 0xf3, 0x6f, 0x03, 0xea, 0x1d, 0xee, 0x49, 0x7d, 0x68, 0x5e, 0x3f, 0x62, + 0xcf, 0x2a, 0x24, 0xcc, 0x3e, 0x1b, 0xca, 0xd1, 0x12, 0xc5, 0x99, 0x8c, 0x3e, 0x34, 0xaf, 0xdf, + 0x93, 0x05, 0xe8, 0xb2, 0xe2, 0x45, 0xe8, 0x6e, 0xde, 0xe7, 0x21, 0x6c, 0xe6, 0xee, 0xab, 0xbe, + 0xa8, 0xe6, 0xa4, 0x5e, 0x79, 0xb9, 0x5c, 0x7d, 0xc6, 0x3b, 0x82, 0x3b, 0xf9, 0x6b, 0x64, 0x54, + 0x37, 0xca, 0x01, 0x94, 0x57, 0x4b, 0x02, 0x32, 0xea, 0x6f, 0x08, 0xe4, 0xd2, 0x93, 0xfe, 0xba, + 0xba, 0x6b, 0x19, 0x56, 0x39, 0xbe, 0x3d, 0x76, 0x2a, 0xee, 0xf8, 0xfd, 0xaf, 0xb1, 0x8a, 0x2e, + 0xc7, 0x2a, 0xfa, 0x33, 0x56, 0xd1, 0xd7, 0x89, 0xba, 0x76, 0x39, 0x51, 0xd7, 0xae, 0x26, 0xea, + 0xda, 0x27, 0xd3, 0xa3, 0xa2, 0x37, 0x38, 0xd5, 0x5d, 0xd6, 0x37, 0x32, 0x9e, 0xc3, 0x29, 0x91, + 0xd1, 0xa3, 0xf8, 0x30, 0x62, 0x32, 0x2e, 0x8c, 0xe8, 0x97, 0x2c, 0x46, 0x01, 0xe1, 0xa7, 0x1b, + 0xf1, 0xe7, 0xa3, 0x7f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x8e, 0xb1, 0x82, 0xd8, 0xfd, 0x07, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1146,15 +1147,10 @@ func (m *MsgDeactivateDID) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x1a } - if m.DidDocString != nil { - { - size, err := m.DidDocString.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintTx(dAtA, i, uint64(size)) - } + if len(m.DidId) > 0 { + i -= len(m.DidId) + copy(dAtA[i:], m.DidId) + i = encodeVarintTx(dAtA, i, uint64(len(m.DidId))) i-- dAtA[i] = 0x12 } @@ -1409,8 +1405,8 @@ func (m *MsgDeactivateDID) Size() (n int) { if l > 0 { n += 1 + l + sovTx(uint64(l)) } - if m.DidDocString != nil { - l = m.DidDocString.Size() + l = len(m.DidId) + if l > 0 { n += 1 + l + sovTx(uint64(l)) } l = len(m.VersionId) @@ -2248,9 +2244,9 @@ func (m *MsgDeactivateDID) Unmarshal(dAtA []byte) error { iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DidDocString", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field DidId", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -2260,27 +2256,23 @@ func (m *MsgDeactivateDID) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - if m.DidDocString == nil { - m.DidDocString = &Did{} - } - if err := m.DidDocString.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.DidId = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 3: if wireType != 2 {