signify-ts 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/README.md +96 -47
  2. package/dist/buffer-polyfill.d.ts +1 -0
  3. package/dist/exports.d.ts +40 -0
  4. package/dist/index.d.ts +4 -3
  5. package/dist/keri/app/aiding.d.ts +138 -0
  6. package/dist/keri/app/clienting.d.ts +182 -0
  7. package/dist/keri/app/contacting.d.ts +93 -0
  8. package/dist/keri/app/controller.d.ts +49 -0
  9. package/dist/keri/app/coring.d.ts +121 -0
  10. package/dist/keri/app/credentialing.d.ts +245 -0
  11. package/dist/keri/app/escrowing.d.ts +19 -0
  12. package/dist/keri/app/exchanging.d.ts +60 -0
  13. package/dist/keri/app/grouping.d.ts +44 -0
  14. package/dist/keri/app/habery.d.ts +48 -47
  15. package/dist/keri/app/notifying.d.ts +34 -0
  16. package/dist/keri/core/authing.d.ts +10 -9
  17. package/dist/keri/core/bexter.d.ts +7 -0
  18. package/dist/keri/core/cigar.d.ts +8 -8
  19. package/dist/keri/core/cipher.d.ts +5 -5
  20. package/dist/keri/core/core.d.ts +59 -53
  21. package/dist/keri/core/counter.d.ts +43 -43
  22. package/dist/keri/core/decrypter.d.ts +10 -10
  23. package/dist/keri/core/diger.d.ts +21 -21
  24. package/dist/keri/core/encrypter.d.ts +9 -9
  25. package/dist/keri/core/eventing.d.ts +54 -21
  26. package/dist/keri/core/httping.d.ts +44 -34
  27. package/dist/keri/core/indexer.d.ts +98 -88
  28. package/dist/keri/core/keeping.d.ts +103 -1
  29. package/dist/keri/core/kering.d.ts +5 -5
  30. package/dist/keri/core/manager.d.ts +174 -172
  31. package/dist/keri/core/matter.d.ts +116 -69
  32. package/dist/keri/core/number.d.ts +7 -6
  33. package/dist/keri/core/pather.d.ts +7 -0
  34. package/dist/keri/core/prefixer.d.ts +15 -15
  35. package/dist/keri/core/saider.d.ts +23 -23
  36. package/dist/keri/core/salter.d.ts +23 -23
  37. package/dist/keri/core/seqner.d.ts +15 -0
  38. package/dist/keri/core/serder.d.ts +31 -23
  39. package/dist/keri/core/siger.d.ts +18 -18
  40. package/dist/keri/core/signer.d.ts +34 -34
  41. package/dist/keri/core/tholder.d.ts +29 -14
  42. package/dist/keri/core/utils.d.ts +20 -15
  43. package/dist/keri/core/vdring.d.ts +16 -0
  44. package/dist/keri/core/verfer.d.ts +13 -12
  45. package/dist/keri/end/ending.d.ts +13 -13
  46. package/dist/math.d.ts +1 -0
  47. package/dist/ready.d.ts +1 -0
  48. package/dist/signify-ts.cjs +7842 -0
  49. package/dist/signify-ts.cjs.development.js +6369 -256
  50. package/dist/signify-ts.cjs.development.js.map +1 -1
  51. package/dist/signify-ts.cjs.map +7 -0
  52. package/dist/signify-ts.cjs.production.min.js +1 -1
  53. package/dist/signify-ts.cjs.production.min.js.map +1 -1
  54. package/dist/signify-ts.esm.js +6205 -229
  55. package/dist/signify-ts.esm.js.map +1 -1
  56. package/dist/signify-ts.mjs +7818 -0
  57. package/dist/signify-ts.mjs.map +7 -0
  58. package/package.json +49 -49
  59. package/src/buffer-polyfill.ts +5 -0
  60. package/src/exports.ts +44 -0
  61. package/src/index.ts +4 -5
  62. package/src/keri/app/aiding.ts +493 -0
  63. package/src/keri/app/clienting.ts +492 -0
  64. package/src/keri/app/contacting.ts +188 -0
  65. package/src/keri/app/controller.ts +372 -0
  66. package/src/keri/app/coring.ts +225 -0
  67. package/src/keri/app/credentialing.ts +841 -0
  68. package/src/keri/app/escrowing.ts +34 -0
  69. package/src/keri/app/exchanging.ts +220 -0
  70. package/src/keri/app/grouping.ts +90 -0
  71. package/src/keri/app/habery.ts +118 -85
  72. package/src/keri/app/notifying.ts +69 -0
  73. package/src/keri/core/authing.ts +73 -85
  74. package/src/keri/core/bexter.ts +138 -0
  75. package/src/keri/core/cigar.ts +10 -11
  76. package/src/keri/core/cipher.ts +23 -14
  77. package/src/keri/core/core.ts +223 -81
  78. package/src/keri/core/counter.ts +182 -116
  79. package/src/keri/core/decrypter.ts +48 -34
  80. package/src/keri/core/diger.ts +23 -22
  81. package/src/keri/core/encrypter.ts +37 -27
  82. package/src/keri/core/eventing.ts +468 -106
  83. package/src/keri/core/httping.ts +151 -105
  84. package/src/keri/core/indexer.ts +313 -211
  85. package/src/keri/core/keeping.ts +679 -3
  86. package/src/keri/core/kering.ts +4 -6
  87. package/src/keri/core/manager.ts +660 -499
  88. package/src/keri/core/matter.ts +382 -148
  89. package/src/keri/core/number.ts +56 -11
  90. package/src/keri/core/pather.ts +98 -0
  91. package/src/keri/core/prefixer.ts +122 -101
  92. package/src/keri/core/saider.ts +104 -76
  93. package/src/keri/core/salter.ts +71 -40
  94. package/src/keri/core/seqner.ts +46 -0
  95. package/src/keri/core/serder.ts +102 -38
  96. package/src/keri/core/siger.ts +19 -18
  97. package/src/keri/core/signer.ts +73 -53
  98. package/src/keri/core/tholder.ts +196 -30
  99. package/src/keri/core/utils.ts +121 -50
  100. package/src/keri/core/vdring.ts +94 -0
  101. package/src/keri/core/verfer.ts +22 -9
  102. package/src/keri/end/ending.ts +111 -101
  103. package/src/math.ts +3 -0
  104. package/src/ready.ts +5 -0
  105. package/dist/keri/app/accountant.d.ts +0 -10
  106. package/dist/keri/app/apping.d.ts +0 -1
  107. package/dist/keri/app/client.d.ts +0 -7
  108. package/dist/keri/app/signify.d.ts +0 -6
  109. package/src/keri/app/accountant.ts +0 -35
  110. package/src/keri/app/apping.ts +0 -12
  111. package/src/keri/app/client.ts +0 -30
  112. package/src/keri/app/signify.ts +0 -12
  113. package/src/keri/app/tsconfig.json +0 -100
  114. package/src/keri/core/tsconfig.json +0 -100
  115. package/src/keri/end/tsconfig.json +0 -100
package/README.md CHANGED
@@ -3,6 +3,9 @@
3
3
  Project Name: signify-ts
4
4
 
5
5
  [![TypeScript](https://badges.frapsoft.com/typescript/code/typescript.png?v=101)](https://github.com/ellerbrock/typescript-badges/)
6
+ [![Tests](https://github.com/WebOfTrust/signify-ts/actions/workflows/main.yml/badge.svg?branch=main)](https://github.com/WebOfTrust/signify-ts/actions/workflows/main.yml)
7
+ [![codecov](https://codecov.io/gh/WebOfTrust/signify-ts/branch/main/graph/badge.svg?token=K3GK7MCYVW)](https://codecov.io/gh/WebOfTrust/signify-ts)
8
+ [![Documentation](https://img.shields.io/badge/documentation-grey?)](https://weboftrust.github.io/signify-ts/)
6
9
 
7
10
  ## Signify - KERI Signing at the Edge
8
11
 
@@ -15,58 +18,104 @@ Of the five functions in a KERI agent,
15
18
  5. Event Validation
16
19
 
17
20
  Signify-TS splits off two, key generation and event signing into a TypeScript library to provide "signing at the edge".
18
- It accomplishes this by using libsodium to generate ed25510 key pairs for signing and x25519 key pairs for encrypting the
21
+ It accomplishes this by using [libsodium](https://doc.libsodium.org/) to generate ed25519 key pairs for signing and x25519 key pairs for encrypting the
19
22
  private keys, next public keys and salts used to generate the private keys. The encrypted private key and salts are then stored on a
20
- remote cloud agent the never has access to the decryption keys. New key pair sets (current and next) will be generated
21
- for inception and rotation events with only the public keys and blake3 hash of next keys made available to the agent.
23
+ remote cloud agent that never has access to the decryption keys. New key pair sets (current and next) will be generated
24
+ for inception and rotation events with only the public keys and blake3 hash of the next keys made available to the agent.
22
25
 
23
- The communication protocol between a Signify client and KERI agent will encode all cryptographic primitives as CESR base64
26
+ The communication protocol between a Signify client and [KERI](https://github.com/WebOfTrust/keri) agent will encode all cryptographic primitives as CESR base64
24
27
  encoded strings for the initial implementation. Support for binary CESR can be added in the future.
25
28
 
26
29
 
30
+ ### Environment Setup
31
+
32
+ The code is built using Typescript and running code locally requires a Mac or Linux OS.
33
+
34
+ - Install [Node.js](https://nodejs.org)
35
+
36
+
37
+ - Install dependencies:
38
+ ```bash
39
+ npm install
40
+ ```
41
+
42
+ Typescript source files needs to be transpiled before running scripts or integration tests
43
+
44
+ - Build:
45
+ ```bash
46
+ npm run build
47
+ ```
48
+
49
+ ### Unit testing
50
+
51
+ To run unit tests
52
+
53
+ ```bash
54
+ npm test
55
+ ```
56
+
57
+ ### Integration testing
58
+
59
+ The integration tests depends on a local instance of KERIA, vLEI-Server and Witness Demo. These are specified in the [Docker Compose](./docker-compose.yaml) file. To start the dependencies, use docker compose:
60
+
61
+ ```bash
62
+ docker compose up deps
63
+ ```
64
+
65
+ If successful, it should print someting like this:
66
+
67
+ ```bash
68
+ $ docker compose up deps
69
+ [+] Running 5/4
70
+ ✔ Network signify-ts_default Created 0.0s
71
+ ✔ Container signify-ts-vlei-server-1 Created 0.1s
72
+ ✔ Container signify-ts-keria-1 Created 0.1s
73
+ ✔ Container signify-ts-witness-demo-1 Created 0.1s
74
+ ✔ Container signify-ts-deps-1 Created 0.0s
75
+ Attaching to signify-ts-deps-1
76
+ signify-ts-deps-1 | Dependencies running
77
+ signify-ts-deps-1 exited with code 0
78
+ ```
79
+
80
+ **Important!** The integration tests runs on the build output in `dist/` directory. Make sure to run build before running the integration tests.
81
+
82
+ ```bash
83
+ npm run build
84
+ ```
85
+
86
+ Use the npm script "test:integration" to run all integration tests in sequence:
87
+
88
+ ```bash
89
+ npm run test:integration
90
+ ```
91
+
92
+ Or, use execute `jest` directly to run a specific integration test, for example:
93
+
94
+ ```bash
95
+ npx jest examples/integration-scripts/credentials.test.ts
96
+ ```
97
+
98
+ It is also possible to run the tests using local instances of vLEI, Keria, and witness network. Set the environment variable `TEST_ENVIRONMENT` to `local`, e.g:
99
+
100
+ ```
101
+ TEST_ENVIRONMENT=local npx jest examples/integration-scripts/credentials.test.ts
102
+ ```
103
+
104
+ This changes the discovery urls to use `localhost` instead of the hostnames inside the docker network.
105
+
106
+ ### Old integration scripts
107
+
108
+ To run any of the old integration scripts that has not yet been converted to an integration test. Use `ts-node-esm`
109
+
110
+ ```bash
111
+ npx ts-node-esm examples/integration-scripts/challenge.ts
112
+ ```
113
+
114
+ # Diagrams
115
+
27
116
  Account Creation Workflow
28
117
 
118
+ ![Account Creation](/diagrams/account-creation-workflow.png)
119
+
29
120
 
30
- sequenceDiagram
31
- actor u as User
32
- participant s as Signify
33
- participant c as Cloud Agent
34
- u ->> s: Create Account
35
- s ->> s: Generate Pub/Pri Keys
36
- s ->>+ c: Request ICP Event Creation with Keys
37
- note over s,c: This call can not be secured
38
- note right of c: Creates ICP Event
39
- c ->>- s: Return ICP event
40
- s ->>+ c: Create Account with Signed ICP Event
41
- note over s,c: Call Signed by new Keys
42
- note right of c: Parses and Saves ICP
43
- note right of c: Create Account with new AID
44
- c ->>- s: Return New Account KeyState
45
- s ->>+ c: Save Key Information
46
- c ->>- s: Key Information Saved
47
- s ->> u: Return New Account Information
48
-
49
-
50
- sequenceDiagram
51
- actor u as User
52
- participant a as Web Page App
53
- participant s as Signify
54
- participant c as Cloud Agent
55
- u ->> a: Create Account
56
- a ->>+ s: Generate Pub/Pri Keys
57
- s ->>- a: Return new Pub/Pri Keypair
58
- a ->>+ c: Request ICP Event Creation with Keys
59
- note over s,c: This call can not be secured
60
- note right of c: Creates ICP Event
61
- c ->>- a: Return ICP event
62
- a ->>+ s: Sign ICP Event
63
- s ->>- a: Return Signed Event
64
- a ->>+ c: Create Account with Signed ICP Event
65
- note over s,c: Call Signed by new Keys
66
- note right of c: Parses and Saves ICP
67
- note right of c: Create Account with new AID
68
- c ->>- a: Return New Account KeyState
69
- a ->>+ s: Save Key Information
70
- s ->>+ c: Save Key Information
71
- c ->>- s: Key Information Saved
72
- a ->> u: Return New Account Information
121
+ ![Account Creation Webpage](/diagrams/account-creation-webpage-workflow.png)
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,40 @@
1
+ export * from './ready';
2
+ export * from './math';
3
+ export * from './keri/app/habery';
4
+ export * from './keri/app/controller';
5
+ export * from './keri/app/aiding';
6
+ export * from './keri/app/clienting';
7
+ export * from './keri/app/contacting';
8
+ export * from './keri/app/coring';
9
+ export * from './keri/app/credentialing';
10
+ export * from './keri/app/escrowing';
11
+ export * from './keri/app/exchanging';
12
+ export * from './keri/app/grouping';
13
+ export * from './keri/app/notifying';
14
+ export * from './keri/core/authing';
15
+ export * from './keri/core/cigar';
16
+ export * from './keri/core/cipher';
17
+ export * from './keri/core/core';
18
+ export * from './keri/core/counter';
19
+ export * from './keri/core/decrypter';
20
+ export * from './keri/core/diger';
21
+ export * from './keri/core/encrypter';
22
+ export * from './keri/core/eventing';
23
+ export * from './keri/core/httping';
24
+ export * from './keri/core/indexer';
25
+ export * from './keri/core/keeping';
26
+ export * from './keri/core/kering';
27
+ export * from './keri/core/manager';
28
+ export * from './keri/core/matter';
29
+ export * from './keri/core/number';
30
+ export * from './keri/core/prefixer';
31
+ export * from './keri/core/saider';
32
+ export * from './keri/core/salter';
33
+ export * from './keri/core/seqner';
34
+ export * from './keri/core/serder';
35
+ export * from './keri/core/siger';
36
+ export * from './keri/core/signer';
37
+ export * from './keri/core/tholder';
38
+ export * from './keri/core/utils';
39
+ export * from './keri/core/verfer';
40
+ export * from './keri/end/ending';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,4 @@
1
- export * from './keri/core/salter';
2
- export * from './keri/core/matter';
3
- export * from './keri/app/habery';
1
+ import './buffer-polyfill';
2
+ import * as exp from './exports';
3
+ export * from './exports';
4
+ export default exp;
@@ -0,0 +1,138 @@
1
+ import { Tier } from '../core/salter';
2
+ import { Algos } from '../core/manager';
3
+ import { Serder } from '../core/serder';
4
+ import { KeyManager } from '../core/keeping';
5
+ /** Arguments required to create an identfier */
6
+ export interface CreateIdentiferArgs {
7
+ transferable?: boolean;
8
+ isith?: string | number | string[];
9
+ nsith?: string | number | string[];
10
+ wits?: string[];
11
+ toad?: number;
12
+ proxy?: string;
13
+ delpre?: string;
14
+ dcode?: string;
15
+ data?: any;
16
+ algo?: Algos;
17
+ pre?: string;
18
+ states?: any[];
19
+ rstates?: any[];
20
+ prxs?: any[];
21
+ nxts?: any[];
22
+ mhab?: any;
23
+ keys?: any[];
24
+ ndigs?: any[];
25
+ bran?: string;
26
+ count?: number;
27
+ ncount?: number;
28
+ tier?: Tier;
29
+ extern_type?: string;
30
+ extern?: any;
31
+ }
32
+ /** Arguments required to rotate an identfier */
33
+ export interface RotateIdentifierArgs {
34
+ transferable?: boolean;
35
+ nsith?: string | number | string[];
36
+ toad?: number;
37
+ cuts?: string[];
38
+ adds?: string[];
39
+ data?: Array<object>;
40
+ ncode?: string;
41
+ ncount?: number;
42
+ ncodes?: string[];
43
+ states?: any[];
44
+ rstates?: any[];
45
+ }
46
+ /**
47
+ * Reducing the SignifyClient dependencies used by Identifier class
48
+ */
49
+ export interface IdentifierDeps {
50
+ fetch(pathname: string, method: string, body: unknown, headers?: Headers): Promise<Response>;
51
+ pidx: number;
52
+ manager: KeyManager | null;
53
+ }
54
+ /** Identifier */
55
+ export declare class Identifier {
56
+ client: IdentifierDeps;
57
+ /**
58
+ * Identifier
59
+ * @param {IdentifierDeps} client
60
+ */
61
+ constructor(client: IdentifierDeps);
62
+ /**
63
+ * List managed identifiers
64
+ * @async
65
+ * @param {number} [start=0] Start index of list of notifications, defaults to 0
66
+ * @param {number} [end=24] End index of list of notifications, defaults to 24
67
+ * @returns {Promise<any>} A promise to the list of managed identifiers
68
+ */
69
+ list(start?: number, end?: number): Promise<any>;
70
+ /**
71
+ * Get information for a managed identifier
72
+ * @async
73
+ * @param {string} name Name or alias of the identifier
74
+ * @returns {Promise<any>} A promise to the identifier information
75
+ */
76
+ get(name: string): Promise<any>;
77
+ /**
78
+ * Create a managed identifier
79
+ * @async
80
+ * @param {string} name Name or alias of the identifier
81
+ * @param {CreateIdentiferArgs} [kargs] Optional parameters to create the identifier
82
+ * @returns {EventResult} The inception result
83
+ */
84
+ create(name: string, kargs?: CreateIdentiferArgs): Promise<EventResult>;
85
+ /**
86
+ * Generate an interaction event in a managed identifier
87
+ * @async
88
+ * @param {string} name Name or alias of the identifier
89
+ * @param {any} [data] Option data to be anchored in the interaction event
90
+ * @returns {Promise<EventResult>} A promise to the interaction event result
91
+ */
92
+ interact(name: string, data?: any): Promise<EventResult>;
93
+ /**
94
+ * Generate a rotation event in a managed identifier
95
+ * @param {string} name Name or alias of the identifier
96
+ * @param {RotateIdentifierArgs} [kargs] Optional parameters requiered to generate the rotation event
97
+ * @returns {Promise<EventResult>} A promise to the rotation event result
98
+ */
99
+ rotate(name: string, kargs?: RotateIdentifierArgs): Promise<EventResult>;
100
+ /**
101
+ * Authorize an endpoint provider in a given role for a managed identifier
102
+ * @remarks
103
+ * Typically used to authorize the agent to be the endpoint provider for the identifier in the role of `agent`
104
+ * @async
105
+ * @param {string} name Name or alias of the identifier
106
+ * @param {string} role Authorized role for eid
107
+ * @param {string} [eid] Optional qb64 of endpoint provider to be authorized
108
+ * @param {string} [stamp=now] Optional date-time-stamp RFC-3339 profile of iso8601 datetime. Now is the default if not provided
109
+ * @returns {Promise<EventResult>} A promise to the result of the authorization
110
+ */
111
+ addEndRole(name: string, role: string, eid?: string, stamp?: string): Promise<EventResult>;
112
+ /**
113
+ * Generate an /end/role/add reply message
114
+ * @param {string} pre Prefix of the identifier
115
+ * @param {string} role Authorized role for eid
116
+ * @param {string} [eid] Optional qb64 of endpoint provider to be authorized
117
+ * @param {string} [stamp=now] Optional date-time-stamp RFC-3339 profile of iso8601 datetime. Now is the default if not provided
118
+ * @returns {Serder} The reply message
119
+ */
120
+ private makeEndRole;
121
+ /**
122
+ * Get the members of a group identifier
123
+ * @async
124
+ * @param {string} name - Name or alias of the identifier
125
+ * @returns {Promise<any>} - A promise to the list of members
126
+ */
127
+ members(name: string): Promise<any>;
128
+ }
129
+ /** Event Result */
130
+ export declare class EventResult {
131
+ private readonly _serder;
132
+ private readonly _sigs;
133
+ private readonly promise;
134
+ constructor(serder: Serder, sigs: string[], promise: Promise<Response> | Response);
135
+ get serder(): Serder;
136
+ get sigs(): string[];
137
+ op(): Promise<any>;
138
+ }
@@ -0,0 +1,182 @@
1
+ import { Agent, Controller } from './controller';
2
+ import { Tier } from '../core/salter';
3
+ import { Authenticater } from '../core/authing';
4
+ import { ExternalModule, KeyManager } from '../core/keeping';
5
+ import { Identifier } from './aiding';
6
+ import { Contacts, Challenges } from './contacting';
7
+ import { Oobis, Operations, KeyEvents, KeyStates } from './coring';
8
+ import { Credentials, Ipex, Registries, Schemas } from './credentialing';
9
+ import { Notifications } from './notifying';
10
+ import { Escrows } from './escrowing';
11
+ import { Groups } from './grouping';
12
+ import { Exchanges } from './exchanging';
13
+ declare class State {
14
+ agent: any | null;
15
+ controller: any | null;
16
+ ridx: number;
17
+ pidx: number;
18
+ constructor();
19
+ }
20
+ /** SignifyClient */
21
+ export declare class SignifyClient {
22
+ controller: Controller;
23
+ url: string;
24
+ bran: string;
25
+ pidx: number;
26
+ agent: Agent | null;
27
+ authn: Authenticater | null;
28
+ manager: KeyManager | null;
29
+ tier: Tier;
30
+ bootUrl: string;
31
+ exteralModules: ExternalModule[];
32
+ /**
33
+ * SignifyClient constructor
34
+ * @param {string} url KERIA admin interface URL
35
+ * @param {string} bran Base64 21 char string that is used as base material for seed of the client AID
36
+ * @param {Tier} tier Security tier for generating keys of the client AID (high | mewdium | low)
37
+ * @param {string} bootUrl KERIA boot interface URL
38
+ * @param {ExternalModule[]} externalModules list of external modules to load
39
+ */
40
+ constructor(url: string, bran: string, tier?: Tier, bootUrl?: string, externalModules?: ExternalModule[]);
41
+ get data(): (string | number | Authenticater | null)[];
42
+ /**
43
+ * Boot a KERIA agent
44
+ * @async
45
+ * @returns {Promise<Response>} A promise to the result of the boot
46
+ */
47
+ boot(): Promise<Response>;
48
+ /**
49
+ * Get state of the agent and the client
50
+ * @async
51
+ * @returns {Promise<Response>} A promise to the state
52
+ */
53
+ state(): Promise<State>;
54
+ /** Connect to a KERIA agent
55
+ * @async
56
+ */
57
+ connect(): Promise<void>;
58
+ /**
59
+ * Fetch a resource from the KERIA agent
60
+ * @async
61
+ * @param {string} path Path to the resource
62
+ * @param {string} method HTTP method
63
+ * @param {any} data Data to be sent in the body of the resource
64
+ * @param {Headers} [extraHeaders] Optional extra headers to be sent with the request
65
+ * @returns {Promise<Response>} A promise to the result of the fetch
66
+ */
67
+ fetch(path: string, method: string, data: any, extraHeaders?: Headers): Promise<Response>;
68
+ /**
69
+ * Fetch a resource from from an external URL with headers signed by an AID
70
+ * @async
71
+ * @param {string} url URL of the resource
72
+ * @param {string} path Path to the resource
73
+ * @param {string} method HTTP method
74
+ * @param {any} data Data to be sent in the body of the resource
75
+ * @param {string} aidName Name or alias of the AID to be used for signing
76
+ * @returns {Promise<Response>} A promise to the result of the fetch
77
+ */
78
+ signedFetch(url: string, path: string, method: string, data: any, aidName: string): Promise<Response>;
79
+ /**
80
+ * Approve the delegation of the client AID to the KERIA agent
81
+ * @async
82
+ * @returns {Promise<Response>} A promise to the result of the approval
83
+ */
84
+ approveDelegation(): Promise<Response>;
85
+ /**
86
+ * Save old client passcode in KERIA agent
87
+ * @async
88
+ * @param {string} passcode Passcode to be saved
89
+ * @returns {Promise<Response>} A promise to the result of the save
90
+ */
91
+ saveOldPasscode(passcode: string): Promise<Response>;
92
+ /**
93
+ * Delete a saved passcode from KERIA agent
94
+ * @async
95
+ * @returns {Promise<Response>} A promise to the result of the deletion
96
+ */
97
+ deletePasscode(): Promise<Response>;
98
+ /**
99
+ * Rotate the client AID
100
+ * @async
101
+ * @param {string} nbran Base64 21 char string that is used as base material for the new seed
102
+ * @param {Array<string>} aids List of managed AIDs to be rotated
103
+ * @returns {Promise<Response>} A promise to the result of the rotation
104
+ */
105
+ rotate(nbran: string, aids: string[]): Promise<Response>;
106
+ /**
107
+ * Get identifiers resource
108
+ * @returns {Identifier}
109
+ */
110
+ identifiers(): Identifier;
111
+ /**
112
+ * Get OOBIs resource
113
+ * @returns {Oobis}
114
+ */
115
+ oobis(): Oobis;
116
+ /**
117
+ * Get operations resource
118
+ * @returns {Operations}
119
+ */
120
+ operations(): Operations;
121
+ /**
122
+ * Get keyEvents resource
123
+ * @returns {KeyEvents}
124
+ */
125
+ keyEvents(): KeyEvents;
126
+ /**
127
+ * Get keyStates resource
128
+ * @returns {KeyStates}
129
+ */
130
+ keyStates(): KeyStates;
131
+ /**
132
+ * Get credentials resource
133
+ * @returns {Credentials}
134
+ */
135
+ credentials(): Credentials;
136
+ /**
137
+ * Get IPEX resource
138
+ * @returns {Ipex}
139
+ */
140
+ ipex(): Ipex;
141
+ /**
142
+ * Get registries resource
143
+ * @returns {Registries}
144
+ */
145
+ registries(): Registries;
146
+ /**
147
+ * Get schemas resource
148
+ * @returns {Schemas}
149
+ */
150
+ schemas(): Schemas;
151
+ /**
152
+ * Get challenges resource
153
+ * @returns {Challenges}
154
+ */
155
+ challenges(): Challenges;
156
+ /**
157
+ * Get contacts resource
158
+ * @returns {Contacts}
159
+ */
160
+ contacts(): Contacts;
161
+ /**
162
+ * Get notifications resource
163
+ * @returns {Notifications}
164
+ */
165
+ notifications(): Notifications;
166
+ /**
167
+ * Get escrows resource
168
+ * @returns {Escrows}
169
+ */
170
+ escrows(): Escrows;
171
+ /**
172
+ * Get groups resource
173
+ * @returns {Groups}
174
+ */
175
+ groups(): Groups;
176
+ /**
177
+ * Get exchange resource
178
+ * @returns {Exchanges}
179
+ */
180
+ exchanges(): Exchanges;
181
+ }
182
+ export {};
@@ -0,0 +1,93 @@
1
+ import { SignifyClient } from './clienting';
2
+ import { Operation } from './coring';
3
+ /**
4
+ * Contacts
5
+ */
6
+ export declare class Contacts {
7
+ client: SignifyClient;
8
+ /**
9
+ * Contacts
10
+ * @param {SignifyClient} client
11
+ */
12
+ constructor(client: SignifyClient);
13
+ /**
14
+ * List contacts
15
+ * @async
16
+ * @param {string} [group] Optional group name to filter contacts
17
+ * @param {string} [filterField] Optional field name to filter contacts
18
+ * @param {string} [filterValue] Optional field value to filter contacts
19
+ * @returns {Promise<any>} A promise to the list of contacts
20
+ */
21
+ list(group?: string, filterField?: string, filterValue?: string): Promise<any>;
22
+ /**
23
+ * Get a contact
24
+ * @async
25
+ * @param {string} pre Prefix of the contact
26
+ * @returns {Promise<any>} A promise to the contact
27
+ */
28
+ get(pre: string): Promise<any>;
29
+ /**
30
+ * Add a contact
31
+ * @async
32
+ * @param {string} pre Prefix of the contact
33
+ * @param {any} info Information about the contact
34
+ * @returns {Promise<any>} A promise to the result of the addition
35
+ */
36
+ add(pre: string, info: any): Promise<any>;
37
+ /**
38
+ * Delete a contact
39
+ * @async
40
+ * @param {string} pre Prefix of the contact
41
+ * @returns {Promise<any>} A promise to the result of the deletion
42
+ */
43
+ delete(pre: string): Promise<any>;
44
+ /**
45
+ * Update a contact
46
+ * @async
47
+ * @param {string} pre Prefix of the contact
48
+ * @param {any} info Updated information about the contact
49
+ * @returns {Promise<any>} A promise to the result of the update
50
+ */
51
+ update(pre: string, info: any): Promise<any>;
52
+ }
53
+ /**
54
+ * Challenges
55
+ */
56
+ export declare class Challenges {
57
+ client: SignifyClient;
58
+ /**
59
+ * Challenges
60
+ * @param {SignifyClient} client
61
+ */
62
+ constructor(client: SignifyClient);
63
+ /**
64
+ * Generate a random challenge word list based on BIP39
65
+ * @async
66
+ * @param {number} strength Integer representing the strength of the challenge. Typically 128 or 256
67
+ * @returns {Promise<any>} A promise to the list of random words
68
+ */
69
+ generate(strength?: number): Promise<any>;
70
+ /**
71
+ * Respond to a challenge by signing a message with the list of words
72
+ * @async
73
+ * @param {string} name Name or alias of the identifier
74
+ * @param {string} recipient Prefix of the recipient of the response
75
+ * @param {Array<string>} words List of words to embed in the signed response
76
+ * @returns {Promise<Response>} A promise to the result of the response
77
+ */
78
+ respond(name: string, recipient: string, words: string[]): Promise<Response>;
79
+ /**
80
+ * Ask Agent to verify a given sender signed the provided words
81
+ * @param {string} source Prefix of the identifier that was challenged
82
+ * @param {Array<string>} words List of challenge words to check for
83
+ * @returns A promise to the long running operation
84
+ */
85
+ verify(source: string, words: string[]): Promise<Operation<unknown>>;
86
+ /**
87
+ * Mark challenge response as signed and accepted
88
+ * @param {string} source Prefix of the identifier that was challenged
89
+ * @param {string} said qb64 AID of exn message representing the signed response
90
+ * @returns {Promise<Response>} A promise to the result
91
+ */
92
+ responded(source: string, said: string): Promise<Response>;
93
+ }
@@ -0,0 +1,49 @@
1
+ import { Tier } from '../core/salter';
2
+ import { Serder } from '../core/serder';
3
+ import { Verfer } from '../core/verfer';
4
+ import { Encrypter } from '../core/encrypter';
5
+ import { Decrypter } from '../core/decrypter';
6
+ /**
7
+ * Agent is a custodial entity that can be used in conjuntion with a local Client to establish the
8
+ * KERI "signing at the edge" semantic
9
+ */
10
+ export declare class Agent {
11
+ pre: string;
12
+ anchor: string;
13
+ verfer: Verfer | null;
14
+ state: any | null;
15
+ sn: number | undefined;
16
+ said: string | undefined;
17
+ constructor(agent: any);
18
+ private parse;
19
+ private event;
20
+ }
21
+ /**
22
+ * Controller is responsible for managing signing keys for the client and agent. The client
23
+ * signing key represents the Account for the client on the agent
24
+ */
25
+ export declare class Controller {
26
+ private bran;
27
+ stem: string;
28
+ tier: Tier;
29
+ ridx: number;
30
+ salter: any;
31
+ signer: any;
32
+ private nsigner;
33
+ serder: Serder;
34
+ private keys;
35
+ ndigs: string[];
36
+ constructor(bran: string, tier: Tier, ridx?: number, state?: any | null);
37
+ approveDelegation(_agent: Agent): any[];
38
+ get pre(): string;
39
+ get event(): any[];
40
+ get verfers(): [];
41
+ derive(state: any): Serder;
42
+ rotate(bran: string, aids: Array<any>): {
43
+ rot: import("../core/core").Dict<any>;
44
+ sigs: any[];
45
+ sxlt: any;
46
+ keys: Record<any, any>;
47
+ };
48
+ recrypt(enc: string, decrypter: Decrypter, encrypter: Encrypter): any;
49
+ }