UNPKG

@i3m/wallet-desktop-openapi

Version:

i3M-Wallet Developers API that can be used to interact with the i3M-Wallet. In production it is encapsulated inside a secure connection. Please use the @i3m/wallet-protocol-api to interact with the wallet.

1,210 lines (1,209 loc) 237 kB
{ "openapi": "3.0.3", "info": { "version": "v2", "title": "i3M-Wallet Developers API", "description": "i3M-Wallet Developers API that can be used to interact with the i3M-Wallet. In production it is encapsulated inside a secure connection. Please use the @i3m/wallet-protocol-api to interact with the wallet.", "license": { "name": "EUPL-1.2", "url": "https://joinup.ec.europa.eu/sites/default/files/custom-page/attachment/2020-03/EUPL-1.2%20EN.txt" }, "contact": { "name": "Juan Hernández Serrano", "email": "j.hernandez@upc.edu", "url": "https://github.com/juanelas" } }, "tags": [ { "name": "identities", "description": "Endpoints to manage identities (DIDs).\n" }, { "name": "resources", "description": "Besides identities, the wallet MAY securely store arbitrary resources in a secure vault, which may be selectively disclosed upon request. Currently storing verifiable credentials\n" }, { "name": "selectiveDisclosure", "description": "Ednpoints for the selective disclosure process (used to present verifiable credentials)\n" }, { "name": "transaction", "description": "Endpoints for deploying signed transactions to the DLT the wallet is connected to.\n" }, { "name": "utils", "description": "Additional helpler functions\n" } ], "paths": { "/identities": { "get": { "summary": "List all DIDs", "operationId": "identityList", "x-eov-operation-handler": "identities", "tags": [ "identities" ], "parameters": [ { "in": "query", "name": "alias", "schema": { "type": "string", "description": "An alias for the identity" } } ], "responses": { "200": { "description": "An array of identities", "content": { "application/json": { "schema": { "title": "IdentityListInput", "description": "A list of DIDs", "type": "array", "items": { "type": "object", "properties": { "did": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" } }, "required": [ "did" ] } } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } } } } }, "post": { "summary": "Create an account", "operationId": "identityCreate", "x-eov-operation-handler": "identities", "tags": [ "identities" ], "requestBody": { "description": "Create a DID.", "required": false, "content": { "application/json": { "schema": { "title": "IdentityCreateInput", "description": "Besides the here defined options, provider specific properties should be added here if necessary, e.g. \"path\" for BIP21 wallets, or the key algorithm (if the wallet supports multiple algorithm).\n", "type": "object", "properties": { "alias": { "type": "string" } }, "additionalProperties": true } } } }, "responses": { "201": { "description": "the ID and type of the created account", "content": { "application/json": { "schema": { "title": "IdentityCreateOutput", "description": "It returns the account id and type\n", "type": "object", "properties": { "did": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" } }, "additionalProperties": true, "required": [ "did" ] } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } } } } } }, "/identities/select": { "get": { "summary": "Gets an identity selected by the user.", "operationId": "identitySelect", "x-eov-operation-handler": "identities", "tags": [ "identities" ], "parameters": [ { "in": "query", "name": "reason", "schema": { "type": "string", "description": "Message to show to the user with the reason to pick an identity" } } ], "responses": { "200": { "description": "Selected identity", "content": { "application/json": { "schema": { "title": "IdentitySelectOutput", "type": "object", "properties": { "did": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" } }, "required": [ "did" ] } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } } } } } }, "/identities/{did}/sign": { "post": { "summary": "Signs a message", "operationId": "identitySign", "x-eov-operation-handler": "identities", "tags": [ "identities" ], "parameters": [ { "in": "path", "name": "did", "schema": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" }, "required": true } ], "requestBody": { "description": "Data to sign.", "required": true, "content": { "application/json": { "schema": { "title": "SignInput", "oneOf": [ { "title": "SignTransaction", "type": "object", "properties": { "type": { "enum": [ "Transaction" ] }, "data": { "title": "Transaction", "type": "object", "additionalProperties": true, "properties": { "from": { "type": "string" }, "to": { "type": "string" }, "nonce": { "type": "number" } } } }, "required": [ "type", "data" ] }, { "title": "SignRaw", "type": "object", "properties": { "type": { "enum": [ "Raw" ] }, "data": { "type": "object", "properties": { "payload": { "description": "Base64Url encoded data to sign", "type": "string", "pattern": "^[A-Za-z0-9_-]+$" } }, "required": [ "payload" ] } }, "required": [ "type", "data" ] }, { "title": "SignJWT", "type": "object", "properties": { "type": { "enum": [ "JWT" ] }, "data": { "type": "object", "properties": { "header": { "description": "header fields to be added to the JWS header. \"alg\" and \"kid\" will be ignored since they are automatically added by the wallet.", "type": "object", "additionalProperties": true }, "payload": { "description": "A JSON object to be signed by the wallet. It will become the payload of the generated JWS. 'iss' (issuer) and 'iat' (issued at) will be automatically added by the wallet and will override provided values.", "type": "object", "additionalProperties": true } }, "required": [ "payload" ] } }, "required": [ "type", "data" ] } ] } } } }, "responses": { "200": { "description": "Signed data", "content": { "application/json": { "schema": { "title": "SignOutput", "type": "object", "properties": { "signature": { "type": "string" } }, "required": [ "signature" ] } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } } } } } }, "/identities/{did}/info": { "get": { "summary": "Gets extra information of an identity.", "operationId": "identityInfo", "x-eov-operation-handler": "identities", "tags": [ "identities" ], "parameters": [ { "in": "path", "name": "did", "schema": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" }, "required": true } ], "responses": { "200": { "description": "Identity data", "content": { "application/json": { "schema": { "title": "Identity Data", "type": "object", "properties": { "did": { "type": "string", "example": "did:ethr:i3m:0x03142f480f831e835822fc0cd35726844a7069d28df58fb82037f1598812e1ade8" }, "alias": { "type": "string", "example": "identity1" }, "provider": { "type": "string", "example": "did:ethr:i3m" }, "addresses": { "type": "array", "items": { "description": "Ethereum Address in EIP-55 format (with checksum)", "type": "string", "pattern": "^0x([0-9A-Fa-f]){40}$", "example": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F" }, "example": [ "0x8646cAcF516de1292be1D30AB68E7Ea51e9B1BE7" ] } }, "required": [ "did" ] } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } } } } } }, "/identities/{did}/deploy-tx": { "post": { "summary": "Signs and deploys a transaction", "operationId": "identityDeployTransaction", "x-eov-operation-handler": "identities", "tags": [ "identities" ], "parameters": [ { "in": "path", "name": "did", "schema": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" }, "required": true } ], "requestBody": { "description": "Transaction to sign and deploy", "required": true, "content": { "application/json": { "schema": { "title": "Transaction", "type": "object", "additionalProperties": true, "properties": { "from": { "type": "string" }, "to": { "type": "string" }, "nonce": { "type": "number" } } } } } }, "responses": { "200": { "description": "Selected identity", "content": { "application/json": { "schema": { "title": "Receipt", "type": "object", "properties": { "receipt": { "type": "string" } }, "required": [ "receipt" ] } } } }, "default": { "description": "unexpected error", "content": { "application/json": { "schema": { "type": "object", "title": "Error", "required": [ "code", "message" ], "properties": { "code": { "type": "integer", "format": "int32" }, "message": { "type": "string" } } } } } } } } }, "/resources": { "get": { "summary": "Lists the resources that match the filter specified in the query parameters.", "operationId": "resourceList", "x-eov-operation-handler": "resources", "tags": [ "resources" ], "parameters": [ { "in": "query", "name": "type", "example": "Contract", "required": false, "schema": { "type": "string", "enum": [ "VerifiableCredential", "Object", "KeyPair", "Contract", "DataExchange", "NonRepudiationProof" ] }, "description": "Filter the resources by resource type." }, { "in": "query", "name": "identity", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863", "allowEmptyValue": true, "required": false, "schema": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" }, "description": "Filter the resource associated to an identity DID. Send empty value to get all the resources that are not associated to any identity." }, { "in": "query", "name": "parentResource", "required": false, "schema": { "type": "string" }, "description": "Get only resources with the given parent resource id." } ], "responses": { "200": { "description": "A paged array of resources. Only the props requested will be returned. Security policies may prevent some props from being returned.", "content": { "application/json": { "schema": { "title": "ResourceListOutput", "description": "A list of resources", "type": "array", "items": { "title": "Resource", "anyOf": [ { "title": "VerifiableCredential", "type": "object", "properties": { "type": { "example": "VerifiableCredential", "enum": [ "VerifiableCredential" ] }, "name": { "type": "string", "example": "Resource name" }, "resource": { "type": "object", "properties": { "@context": { "type": "array", "items": { "type": "string" }, "example": [ "https://www.w3.org/2018/credentials/v1" ] }, "id": { "type": "string", "example": "http://example.edu/credentials/1872" }, "type": { "type": "array", "items": { "type": "string" }, "example": [ "VerifiableCredential" ] }, "issuer": { "type": "object", "properties": { "id": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" } }, "additionalProperties": true, "required": [ "id" ] }, "issuanceDate": { "type": "string", "format": "date-time", "example": "2021-06-10T19:07:28.000Z" }, "credentialSubject": { "type": "object", "properties": { "id": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" } }, "required": [ "id" ], "additionalProperties": true }, "proof": { "type": "object", "properties": { "type": { "type": "string", "enum": [ "JwtProof2020" ] } }, "required": [ "type" ], "additionalProperties": true } }, "additionalProperties": true, "required": [ "@context", "type", "issuer", "issuanceDate", "credentialSubject", "proof" ] } }, "required": [ "type", "resource" ] }, { "title": "ObjectResource", "type": "object", "properties": { "type": { "example": "Object", "enum": [ "Object" ] }, "name": { "type": "string", "example": "Resource name" }, "parentResource": { "type": "string" }, "identity": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" }, "resource": { "type": "object", "additionalProperties": true } }, "required": [ "type", "resource" ] }, { "title": "JWK pair", "type": "object", "properties": { "type": { "example": "KeyPair", "enum": [ "KeyPair" ] }, "name": { "type": "string", "example": "Resource name" }, "identity": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" }, "resource": { "type": "object", "properties": { "keyPair": { "type": "object", "properties": { "privateJwk": { "type": "string", "description": "A stringified JWK with alphabetically sorted claims that represents a private key (complementary to `publicJwk`)\n", "example": "{\"alg\":\"ES256\",\"crv\":\"P-256\",\"d\":\"rQp_3eZzvXwt1sK7WWsRhVYipqNGblzYDKKaYirlqs0\",\"kty\":\"EC\",\"x\":\"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8\",\"y\":\"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE\"}" }, "publicJwk": { "type": "string", "description": "A stringified JWK with alphabetically sorted claims that represents the public key (complementary to `privateJwk`).\n", "example": "{\"alg\":\"ES256\",\"crv\":\"P-256\",\"kty\":\"EC\",\"x\":\"sMGSjfIlRJRseMpx3iHhCx4uh-6N4-AUKX18lmoeSD8\",\"y\":\"Hu8EcpyH2XrCd-oKqm9keEhnMx2v2QaPs6P4Vs8OkpE\"}" } }, "required": [ "privateJwk", "publicJwk" ] } }, "required": [ "keyPair" ] } }, "required": [ "type", "resource" ] }, { "title": "Contract", "type": "object", "properties": { "type": { "example": "Contract", "enum": [ "Contract" ] }, "name": { "type": "string", "example": "Resource name" }, "identity": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" }, "resource": { "type": "object", "properties": { "dataSharingAgreement": { "type": "object", "required": [ "dataOfferingDescription", "parties", "purpose", "duration", "intendedUse", "licenseGrant", "dataStream", "personalData", "pricingModel", "dataExchangeAgreement", "signatures" ], "properties": { "dataOfferingDescription": { "type": "object", "required": [ "dataOfferingId", "version", "active" ], "properties": { "dataOfferingId": { "type": "string" }, "version": { "type": "integer" }, "category": { "type": "string" }, "active": { "type": "boolean" }, "title": { "type": "string" } } }, "parties": { "type": "object", "required": [ "providerDid", "consumerDid" ], "properties": { "providerDid": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" }, "consumerDid": { "description": "a DID using the ethr resolver", "type": "string", "pattern": "^did:ethr:(\\w+:)?0x[0-9a-fA-F]{40}([0-9a-fA-F]{26})?$", "example": "did:ethr:i3m:0x031bee96cfae8bad99ea0dd3d08d1a3296084f894e9ddfe1ffe141133e81ac5863" } } }, "purpose": { "type": "string" }, "duration": { "type": "object", "required": [ "creationDate", "startDate", "endDate" ], "properties": { "creationDate": { "type": "integer" }, "startDate": { "type": "integer" }, "endDate": { "type": "integer" } } }, "intendedUse": { "type": "object", "required": [ "processData", "shareDataWithThirdParty", "editData" ], "properties": { "processData": { "type": "boolean" }, "shareDataWithThirdParty": { "type": "boolean" }, "editData": { "type": "boolean" } } }, "licenseGrant": { "type": "object", "required": [ "transferable", "exclusiveness", "paidUp", "revocable", "processing", "modifying", "analyzing", "storingData", "storingCopy", "reproducing", "distributing", "loaning", "selling", "renting", "furtherLicensing", "leasing" ], "properties": { "transferable": { "type": "boolean" }, "exclusiveness": { "type": "boolean" }, "paidUp": { "type": "boolean" }, "revocable": { "type": "boolean" }, "processing": { "type": "boolean" }, "modifying": { "type": "boolean" }, "analyzing": { "type": "boolean" }, "storingData": { "type": "boolean" }, "storingCopy": { "type": "boolean" }, "reproducing": { "type": "boolean" }, "distributing": { "type": "boolean" }, "loaning": { "type": "boolean" }, "selling": { "type": "boolean" }, "renting": { "type": "boolean" }, "furtherLicensing": { "type": "boolean" }, "leasing": { "type": "boolean" } } }, "dataStream": { "type": "boolean" }, "personalData": { "type": "boolean" }, "pricingModel": { "type": "object", "required": [ "basicPrice", "currency", "hasFreePrice" ], "properties": { "paymentType": { "type": "string" }, "pricingModelName": { "type": "string" }, "basicPrice": { "type": "number", "format": "float" }, "currency": { "type": "string" }, "fee": { "type": "number", "format": "float" }, "hasPaymentOnSubscription": { "type": "object", "properties": { "paymentOnSubscriptionName": { "type": "string" }, "paymentType": { "type": "string" }, "timeDuration": { "type": "string" }, "description": { "type": "string" }, "repeat": { "type": "string" }, "hasSubscriptionPrice": { "type": "number" } } }, "hasFreePrice": { "type": "object", "properties": { "hasPriceFree": { "type": "boolean" } } } } }, "dataExchangeAgreement": { "type": "object", "required": [ "orig", "dest", "encAlg", "signingAlg", "hashAlg", "ledgerContractAddress", "ledgerSignerAddress", "pooToPorDelay", "pooToPopDelay", "pooToSecretDelay" ], "properties": { "orig": { "type": "string", "description": "A stringified JWK with alphabetically sorted claims", "example": "{\"alg\":\"ES256\",\"crv\":\"P-256\",\"kty\":\"EC\",\"x\":\"t0ueMqN9j8lWYa2FXZjSw3cycpwSgxjl26qlV6zkFEo\",\"y\":\"rMqWC9jGfXXLEh_1cku4-f0PfbFa1igbNWLPzos_gb0\"}" }, "dest": { "type": "string", "description": "A stringified JWK with alphabetically sorted claims", "example": "{\"alg\":\"ES256\",\"crv\":\"P-256\",\"kty\":\"EC\",\"x\":\"sI5lkRCGpfeViQzAnu-gLnZnIGdbtfPiY7dGk4yVn-k\",\"y\":\"4iFXDnEzPEb7Ce_18RSV22jW6VaVCpwH3FgTAKj3Cf4\"}" }, "encAlg": { "type": "string", "enum": [ "A128GCM", "A256GCM" ], "example": "A256GCM" }, "signingAlg": { "type": "string", "enum": [ "ES256", "ES384", "ES512" ], "example": "ES256" }, "hashAlg": { "type": "string", "enum": [ "SHA-256", "SHA-384", "SHA-512" ], "example": "SHA-256" }, "ledgerContractAddress": { "description": "Ethereum Address in EIP-55 format (with checksum)", "type": "string", "pattern": "^0x([0-9A-Fa-f]){40}$", "example": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F" }, "ledgerSignerAddress": { "description": "Ethereum Address in EIP-55 format (with checksum)", "type": "string", "pattern": "^0x([0-9A-Fa-f]){40}$", "example": "0x71C7656EC7ab88b098defB751B7401B5f6d8976F" }, "pooToPorDelay": { "description": "Maximum acceptable time in milliseconds between issued PoO and verified PoR", "type": "integer", "minimum": 1, "example": 10000 }, "pooToPopDelay": { "description": "Maximum acceptable time in milliseconds between issued PoO and issued PoP", "type": "integer", "minimum": 1, "example": 20000 }, "pooToSecretDelay": { "description": "Maximum acceptable time between issued PoO and secret published on the ledger", "type": "integer", "minimum": 1, "example": 180000 }, "schema": { "description": "A stringified JSON-LD schema describing the data format",