Skip to content

Commit

Permalink
feat: Validating returnType
Browse files Browse the repository at this point in the history
  • Loading branch information
simonas-notcat committed Oct 9, 2020
1 parent 2c868f7 commit c7d1ef3
Show file tree
Hide file tree
Showing 81 changed files with 409 additions and 444 deletions.
6 changes: 3 additions & 3 deletions __tests__/shared/documentationExamples.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ export default (testContext: {
id: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
publicKey: [
{
id: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#owner',
id: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',
type: 'Secp256k1VerificationKey2018',
owner: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
controller: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
ethereumAddress: '0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
},
],
authentication: [
{
type: 'Secp256k1SignatureAuthentication2018',
publicKey: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#owner',
publicKey: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',
},
],
})
Expand Down
8 changes: 4 additions & 4 deletions __tests__/shared/identityManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ export default (testContext: {
description: 'Handles incoming messages',
},
})
expect(result).toEqual(true)
expect(result).toEqual({success: true})

const webIdentity2 = await agent.identityManagerGetOrCreateIdentity({
alias: 'foobar.com',
Expand All @@ -177,7 +177,7 @@ export default (testContext: {
id: 'did:web:foobar.com#msg',
})

expect(result).toEqual(true)
expect(result).toEqual({success: true})

const webIdentity = await agent.identityManagerGetOrCreateIdentity({
alias: 'foobar.com',
Expand Down Expand Up @@ -205,7 +205,7 @@ export default (testContext: {
key: newKey,
})

expect(result).toEqual(true)
expect(result).toEqual({success: true})

const webIdentity2 = await agent.identityManagerGetOrCreateIdentity({
alias: 'foobar.com',
Expand All @@ -227,7 +227,7 @@ export default (testContext: {
kid: webIdentity.keys[1].kid,
})

expect(result).toEqual(true)
expect(result).toEqual({success: true})

const webIdentity2 = await agent.identityManagerGetIdentity({
did: 'did:web:foobar.com',
Expand Down
2 changes: 1 addition & 1 deletion __tests__/shared/messageHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export default (testContext: {

it('should get message from db', async () => {
const message = await agent.dataStoreGetMessage({ id: parsedMessage.id })
expect(message).toEqual({...parsedMessage, ...{replyTo: null, replyUrl: null}})
expect(message).toEqual(parsedMessage)
})

it('should throw error for non existing message', async () => {
Expand Down
20 changes: 20 additions & 0 deletions docs/api/daf-core.ecdsasignature.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [EcdsaSignature](./daf-core.ecdsasignature.md)

## EcdsaSignature interface

<b>Signature:</b>

```typescript
export interface EcdsaSignature
```

## Properties

| Property | Type | Description |
| --- | --- | --- |
| [r](./daf-core.ecdsasignature.r.md) | string | |
| [recoveryParam](./daf-core.ecdsasignature.recoveryparam.md) | 1 | |
| [s](./daf-core.ecdsasignature.s.md) | string | |

11 changes: 11 additions & 0 deletions docs/api/daf-core.ecdsasignature.r.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [EcdsaSignature](./daf-core.ecdsasignature.md) &gt; [r](./daf-core.ecdsasignature.r.md)

## EcdsaSignature.r property

<b>Signature:</b>

```typescript
r: string;
```
11 changes: 11 additions & 0 deletions docs/api/daf-core.ecdsasignature.recoveryparam.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [EcdsaSignature](./daf-core.ecdsasignature.md) &gt; [recoveryParam](./daf-core.ecdsasignature.recoveryparam.md)

## EcdsaSignature.recoveryParam property

<b>Signature:</b>

```typescript
recoveryParam: 1;
```
11 changes: 11 additions & 0 deletions docs/api/daf-core.ecdsasignature.s.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [daf-core](./daf-core.md) &gt; [EcdsaSignature](./daf-core.ecdsasignature.md) &gt; [s](./daf-core.ecdsasignature.s.md)

## EcdsaSignature.s property

<b>Signature:</b>

```typescript
s: string;
```
4 changes: 2 additions & 2 deletions docs/api/daf-core.ikeymanager.keymanagersignjwt.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Signs JWT
<b>Signature:</b>

```typescript
keyManagerSignJWT(args: IKeyManagerSignJWTArgs): Promise<string>;
keyManagerSignJWT(args: IKeyManagerSignJWTArgs): Promise<EcdsaSignature>;
```

## Parameters
Expand All @@ -20,5 +20,5 @@ keyManagerSignJWT(args: IKeyManagerSignJWTArgs): Promise<string>;

<b>Returns:</b>

Promise&lt;string&gt;
Promise&lt;[EcdsaSignature](./daf-core.ecdsasignature.md)<!-- -->&gt;

6 changes: 3 additions & 3 deletions docs/api/daf-core.iresolver.resolvedid.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,16 @@ expect(doc).toEqual({
id: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
publicKey: [
{
id: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#owner',
id: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller',
type: 'Secp256k1VerificationKey2018',
owner: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
controller: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190',
ethereumAddress: '0xb09b66026ba5909a7cfe99b76875431d2b8d5190'
}
],
authentication: [
{
type: 'Secp256k1SignatureAuthentication2018',
publicKey: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#owner'
publicKey: 'did:ethr:rinkeby:0xb09b66026ba5909a7cfe99b76875431d2b8d5190#controller'
}
]
})
Expand Down
1 change: 1 addition & 0 deletions docs/api/daf-core.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Provides [Agent](./daf-core.agent.md) implementation and defines [IResolver](./d

| Interface | Description |
| --- | --- |
| [EcdsaSignature](./daf-core.ecdsasignature.md) | |
| [IAgent](./daf-core.iagent.md) | Agent that can execute methods |
| [IAgentBase](./daf-core.iagentbase.md) | Agent base interface |
| [IAgentContext](./daf-core.iagentcontext.md) | Standard plugin method context interface |
Expand Down
2 changes: 1 addition & 1 deletion docs/api/daf-did-comm.didcomm.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Be advised that this spec is still not final and that this protocol may need to
| Property | Modifiers | Type | Description |
| --- | --- | --- | --- |
| [methods](./daf-did-comm.didcomm.methods.md) | | [IDIDComm](./daf-did-comm.ididcomm.md) | <b><i>(BETA)</i></b> Plugin methods |
| [schema](./daf-did-comm.didcomm.schema.md) | | { components: { schemas: { ISendMessageDIDCommAlpha1Args: { type: string; properties: { url: { type: string; }; save: { type: string; }; data: { type: string; properties: { id: { type: string; }; from: { type: string; }; to: { type: string; }; type: { type: string; }; body: { anyOf: { type: string; }\[\]; }; }; required: string\[\]; additionalProperties: boolean; }; }; required: string\[\]; additionalProperties: boolean; description: string; }; IMessage: { type: string; properties: { id: { type: string; description: string; }; type: { type: string; description: string; }; createdAt: { type: string; description: string; }; expiresAt: { type: string; description: string; }; threadId: { type: string; description: string; }; raw: { type: string; /\*\* {@inheritdoc IDIDComm.sendMessageDIDCommAlpha1} \*/ description: string; }; data: { anyOf: { type: string; }\[\]; description: string; }; replyTo: { type: string; items: { type: string; }; description: string; }; replyUrl: { type: string; description: string; }; from: { type: string; description: string; }; to: { type: string; description: string; }; metaData: { type: string; items: { $ref: string; }; description: string; }; credentials: { type: string; items: { $ref: string; }; description: string; }; presentations: { type: string; items: { $ref: string; }; description: string; }; }; required: string\[\]; additionalProperties: boolean; description: string; }; IMetaData: { type: string; properties: { type: { type: string; description: string; }; value: { type: string; description: string; }; }; required: string\[\]; additionalProperties: boolean; description: string; }; VerifiableCredential: { type: string; properties: { "@context": { type: string; items: { type: string; }; }; id: { type: string; }; type: { type: string; items: { type: string; }; }; issuer: { type: string; properties: { id: { type: string; }; }; required: string\[\]; }; issuanceDate: { type: string; }; expirationDate: { type: string; }; credentialSubject: { type: string; properties: { id: { type: string; }; }; }; credentialStatus: { type: string; properties: { id: { type: string; }; type: { type: string; }; }; required: string\[\]; additionalProperties: boolean; }; proof: { type: string; properties: { type: { type: string; }; }; }; }; required: string\[\]; description: string; }; VerifiablePresentation: { type: string; properties: { id: { type: string; }; holder: { type: string; }; issuanceDate: { type: string; }; expirationDate: { type: string; }; "@context": { type: string; items: { type: string; }; }; type: { type: string; items: { type: string; }; }; verifier: { type: string; items: { type: string; }; }; verifiableCredential: { type: string; items: { $ref: string; }; }; proof: { type: string; properties: { type: { type: string; }; }; }; }; required: string\[\]; description: string; }; }; methods: { sendMessageDIDCommAlpha1: { description: string; arguments: { $ref: string; }; returnType: { $ref: string; }; }; }; }; } | <b><i>(BETA)</i></b> |
| [schema](./daf-did-comm.didcomm.schema.md) | | { components: { schemas: { ISendMessageDIDCommAlpha1Args: { type: string; properties: { url: { type: string; }; save: { type: string; }; data: { type: string; properties: { id: { type: string; }; from: { type: string; }; to: { type: string; }; type: { type: string; }; body: { anyOf: { type: string; }\[\]; }; }; required: string\[\]; }; }; required: string\[\]; description: string; }; IMessage: { type: string; properties: { id: { type: string; description: string; }; type: { type: string; description: string; }; createdAt: { type: string; description: string; }; expiresAt: { type: string; description: string; }; threadId: { type: string; /\*\* Plugin methods \*/ description: string; }; raw: { type: string; description: string; }; data: { anyOf: { type: string; }\[\]; description: string; }; replyTo: { type: string; items: { type: string; }; description: string; }; replyUrl: { type: string; description: string; }; from: { type: string; description: string; }; to: { type: string; description: string; }; metaData: { type: string; items: { $ref: string; }; description: string; }; credentials: { type: string; items: { $ref: string; }; description: string; }; presentations: { type: string; items: { $ref: string; }; description: string; }; }; required: string\[\]; description: string; }; IMetaData: { type: string; properties: { type: { type: string; description: string; }; value: { type: string; description: string; }; }; required: string\[\]; description: string; }; VerifiableCredential: { type: string; properties: { "@context": { type: string; items: { type: string; }; }; id: { type: string; }; type: { type: string; items: { type: string; }; }; issuer: { type: string; properties: { id: { type: string; }; }; required: string\[\]; }; issuanceDate: { type: string; }; expirationDate: { type: string; }; credentialSubject: { type: string; properties: { id: { type: string; }; }; }; credentialStatus: { type: string; properties: { id: { type: string; }; type: { type: string; }; }; required: string\[\]; }; proof: { type: string; properties: { type: { type: string; }; }; }; }; required: string\[\]; description: string; }; VerifiablePresentation: { type: string; properties: { id: { type: string; }; holder: { type: string; }; issuanceDate: { type: string; }; expirationDate: { type: string; }; "@context": { type: string; items: { type: string; }; }; type: { type: string; items: { type: string; }; }; verifier: { type: string; items: { type: string; }; }; verifiableCredential: { type: string; items: { $ref: string; }; }; proof: { type: string; properties: { type: { type: string; }; }; }; }; required: string\[\]; description: string; }; }; methods: { sendMessageDIDCommAlpha1: { description: string; arguments: { $ref: string; }; returnType: { $ref: string; }; }; }; }; } | <b><i>(BETA)</i></b> |
## Methods
Expand Down
9 changes: 2 additions & 7 deletions docs/api/daf-did-comm.didcomm.schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,9 @@ readonly schema: {
};
};
required: string[];
additionalProperties: boolean;
};
};
required: string[];
additionalProperties: boolean;
description: string;
};
IMessage: {
Expand All @@ -71,11 +69,11 @@ readonly schema: {
description: string;
};
threadId: {
type: string;
type: string; /** Plugin methods */
description: string;
};
raw: {
type: string; /** {@inheritdoc IDIDComm.sendMessageDIDCommAlpha1} */
type: string;
description: string;
};
data: {
Expand Down Expand Up @@ -126,7 +124,6 @@ readonly schema: {
};
};
required: string[];
additionalProperties: boolean;
description: string;
};
IMetaData: {
Expand All @@ -142,7 +139,6 @@ readonly schema: {
};
};
required: string[];
additionalProperties: boolean;
description: string;
};
VerifiableCredential: {
Expand Down Expand Up @@ -197,7 +193,6 @@ readonly schema: {
};
};
required: string[];
additionalProperties: boolean;
};
proof: {
type: string;
Expand Down
Loading

0 comments on commit c7d1ef3

Please sign in to comment.