@3sixty/node 0.0.0-stage → 0.20.0-next.0

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 (47) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +34 -2
  3. package/bin/index.js +4 -0
  4. package/dist/locales/en.json +18011 -0
  5. package/docs/changelog.md +0 -0
  6. package/docs/commands/bootstrap-dev.md +51 -0
  7. package/docs/commands/help.md +61 -0
  8. package/docs/commands/identity-create.md +67 -0
  9. package/docs/commands/identity-import.md +37 -0
  10. package/docs/commands/identity-list.md +31 -0
  11. package/docs/commands/identity-remove.md +46 -0
  12. package/docs/commands/identity-resolve.md +38 -0
  13. package/docs/commands/identity-verifiable-credential-create.md +58 -0
  14. package/docs/commands/identity-verification-method-create.md +55 -0
  15. package/docs/commands/identity-verification-method-import.md +46 -0
  16. package/docs/commands/node-identity-get.md +31 -0
  17. package/docs/commands/node-identity-set.md +36 -0
  18. package/docs/commands/node-org-id-get.md +32 -0
  19. package/docs/commands/node-org-id-set.md +37 -0
  20. package/docs/commands/org-users-list.md +40 -0
  21. package/docs/commands/tenant-create.md +55 -0
  22. package/docs/commands/tenant-get.md +34 -0
  23. package/docs/commands/tenant-import.md +46 -0
  24. package/docs/commands/tenant-list-by-org.md +34 -0
  25. package/docs/commands/tenant-list.md +31 -0
  26. package/docs/commands/tenant-org-alias-remove.md +39 -0
  27. package/docs/commands/tenant-org-id-set.md +39 -0
  28. package/docs/commands/tenant-remove.md +34 -0
  29. package/docs/commands/tenant-update.md +46 -0
  30. package/docs/commands/user-create.md +73 -0
  31. package/docs/commands/user-get.md +43 -0
  32. package/docs/commands/user-remove.md +43 -0
  33. package/docs/commands/user-update-password.md +58 -0
  34. package/docs/commands/user-update.md +58 -0
  35. package/docs/commands/vault-key-create.md +58 -0
  36. package/docs/commands/vault-key-import.md +43 -0
  37. package/docs/commands/vault-key-remove.md +37 -0
  38. package/docs/commands/vault-key-update.md +40 -0
  39. package/docs/configuration.md +234 -0
  40. package/docs/deployment-docker.md +142 -0
  41. package/docs/deployment-ec2.md +193 -0
  42. package/docs/deployment.md +4 -0
  43. package/docs/open-api/spec.json +24802 -0
  44. package/docs/usage.md +239 -0
  45. package/locales/en.json +1 -0
  46. package/package.json +39 -5
  47. package/src/index.js +12 -0
package/docs/usage.md ADDED
@@ -0,0 +1,239 @@
1
+ # Node Usage
2
+
3
+ These commands cover local installation, on demand execution, and a complete bootstrap flow that can be reused in deployment scripts.
4
+
5
+ ## Running
6
+
7
+ To install and run the CLI locally use either npm or pnpm:
8
+
9
+ ```shell
10
+ npm install @3sixty/node -g
11
+ 3sixty-node
12
+ ```
13
+
14
+ ```shell
15
+ pnpm add @3sixty/node -g
16
+ 3sixty-node
17
+ ```
18
+
19
+ or run it directly without installing, using npx or pnpm dlx:
20
+
21
+ ```shell
22
+ npx "@3sixty/node"
23
+ ```
24
+
25
+ ```shell
26
+ pnpm dlx "@3sixty/node"
27
+ ```
28
+
29
+ ## Commands
30
+
31
+ Each command has its own page describing its parameters, how it behaves in single-tenant and multi-tenant mode, and examples. Run any command with `--help` to show its parameters from the command line.
32
+
33
+ ### General
34
+
35
+ | Command | Description | Tenancy |
36
+ | ------------------------------------------ | ------------------------------------------------------------------ | ------- |
37
+ | [help](commands/help.md) | List all the commands, or show the parameters for a single command | Both |
38
+ | [bootstrap-dev](commands/bootstrap-dev.md) | Bootstrap the development environment | Both |
39
+
40
+ ### Node
41
+
42
+ | Command | Description | Tenancy |
43
+ | -------------------------------------------------- | ------------------------------------------------------ | ------------- |
44
+ | [node-identity-get](commands/node-identity-get.md) | Get the identity currently assigned to the node | Both |
45
+ | [node-identity-set](commands/node-identity-set.md) | Set the node identity | Both |
46
+ | [node-org-id-get](commands/node-org-id-get.md) | Get the organization ID currently assigned to the node | Single-tenant |
47
+ | [node-org-id-set](commands/node-org-id-set.md) | Set the node organization ID | Single-tenant |
48
+
49
+ ### Identity
50
+
51
+ | Command | Description | Tenancy |
52
+ | ------------------------------------------------------------------------------------------ | ----------------------------------------------- | ------- |
53
+ | [identity-create](commands/identity-create.md) | Create an identity | Both |
54
+ | [identity-import](commands/identity-import.md) | Import an identity | Both |
55
+ | [identity-list](commands/identity-list.md) | List all identities held in custody by the node | Both |
56
+ | [identity-remove](commands/identity-remove.md) | Remove an identity | Both |
57
+ | [identity-resolve](commands/identity-resolve.md) | Resolve an identity DID to its full document | Both |
58
+ | [identity-verification-method-create](commands/identity-verification-method-create.md) | Create an identity verification method | Both |
59
+ | [identity-verification-method-import](commands/identity-verification-method-import.md) | Import an identity verification method | Both |
60
+ | [identity-verifiable-credential-create](commands/identity-verifiable-credential-create.md) | Create a verifiable credential | Both |
61
+
62
+ ### Vault
63
+
64
+ | Command | Description | Tenancy |
65
+ | ------------------------------------------------ | ----------------------------------------------------------------- | ------- |
66
+ | [vault-key-create](commands/vault-key-create.md) | Create a vault key for an identity | Both |
67
+ | [vault-key-import](commands/vault-key-import.md) | Import a vault key for an identity | Both |
68
+ | [vault-key-remove](commands/vault-key-remove.md) | Remove a vault key for an identity | Both |
69
+ | [vault-key-update](commands/vault-key-update.md) | Replace the key material of an existing vault key for an identity | Both |
70
+
71
+ ### Tenant
72
+
73
+ | Command | Description | Tenancy |
74
+ | -------------------------------------------------------------- | ----------------------------------------------------------- | ------------ |
75
+ | [tenant-create](commands/tenant-create.md) | Create a tenant with associated api key | Multi-tenant |
76
+ | [tenant-get](commands/tenant-get.md) | Get the full configuration record for a single tenant | Multi-tenant |
77
+ | [tenant-import](commands/tenant-import.md) | Import a tenant with associated api key | Multi-tenant |
78
+ | [tenant-list](commands/tenant-list.md) | List all tenants | Multi-tenant |
79
+ | [tenant-list-by-org](commands/tenant-list-by-org.md) | List all tenants associated with a given organization DID | Multi-tenant |
80
+ | [tenant-org-id-set](commands/tenant-org-id-set.md) | Set the organization ID for a tenant | Multi-tenant |
81
+ | [tenant-org-alias-remove](commands/tenant-org-alias-remove.md) | Remove an alias from the tenant organization ID legacy list | Multi-tenant |
82
+ | [tenant-remove](commands/tenant-remove.md) | Remove a tenant | Multi-tenant |
83
+ | [tenant-update](commands/tenant-update.md) | Update a tenant with associated api key | Multi-tenant |
84
+
85
+ ### User
86
+
87
+ | Command | Description | Tenancy |
88
+ | -------------------------------------------------------- | ----------------------------------------------- | ------- |
89
+ | [user-create](commands/user-create.md) | Create a user | Both |
90
+ | [user-get](commands/user-get.md) | Get a user by email address | Both |
91
+ | [user-remove](commands/user-remove.md) | Remove a user and their identity profile | Both |
92
+ | [user-update](commands/user-update.md) | Update a user | Both |
93
+ | [user-update-password](commands/user-update-password.md) | Update the password of a user | Both |
94
+ | [org-users-list](commands/org-users-list.md) | List all users belonging to an organization DID | Both |
95
+
96
+ The user commands take `--tenant-id` in multi-tenant mode and reject it in single-tenant mode.
97
+
98
+ ## Server Configuration
99
+
100
+ Key environment variables that control how the node server handles authentication. A full reference is in the `.env` example files.
101
+
102
+ | Variable | Default | Description |
103
+ | -------------------------- | -------------- | ---------------------------------------------- |
104
+ | `TWIN_AUTH_API_KEY_HEADER` | `x-api-key` | HTTP header name for the API key on requests. |
105
+ | `TWIN_AUTH_SIGNING_KEY_ID` | `auth-signing` | Vault key ID used to sign authentication JWTs. |
106
+
107
+ ## Bootstrap step-by-step
108
+
109
+ ### Single command
110
+
111
+ Runs the complete bootstrap sequence in one step using values from `.env.bootstrap-dev`, see [bootstrap-dev](commands/bootstrap-dev.md) for the variables it reads:
112
+
113
+ ```shell
114
+ 3sixty-node bootstrap-dev --load-env=".env.bootstrap-dev"
115
+ ```
116
+
117
+ The sections below show the equivalent step-by-step commands that replicate the bootstrap-dev process.
118
+
119
+ ---
120
+
121
+ ### Step 1 - Create the node identity and associate it with the node
122
+
123
+ Supply `--fund-wallet=true` when the `wallet` feature is enabled. `--node-id=true` sets the created identity as the node identity in the same step.
124
+
125
+ ```shell
126
+ 3sixty-node identity-create --node-id=true --fund-wallet=true --output-json="node-identity.json" --output-env="node-identity.env" --output-env-prefix=node
127
+ ```
128
+
129
+ ### Step 2 - Create the authentication signing key for the node
130
+
131
+ ```shell
132
+ 3sixty-node vault-key-create --load-env="node-identity.env" --identity=!NODE_DID --key-type=Ed25519 --key-id=!TWIN_AUTH_SIGNING_KEY_ID --overwrite-mode=skip --output-json="node-auth-key.json" --output-env="node-auth-key.env"
133
+ ```
134
+
135
+ To import an existing authentication signing key instead:
136
+
137
+ ```shell
138
+ 3sixty-node vault-key-import --load-env="node-identity.env,node-auth-key.json" --identity=!NODE_DID --key-id=!TWIN_AUTH_SIGNING_KEY_ID --key-type=!KEY_TYPE --private-key-hex=!PRIVATE_KEY_HEX
139
+ ```
140
+
141
+ ### Step 3 - Create the organisation identity
142
+
143
+ ```shell
144
+ 3sixty-node identity-create --load-env="node-identity.env" --fund-wallet=true --output-json="organization-identity.json" --output-env="organization-identity.env" --output-env-prefix=organization
145
+ ```
146
+
147
+ ### Step 4 - Add the trust verification method to the organisation identity
148
+
149
+ ```shell
150
+ 3sixty-node identity-verification-method-create --load-env="node-identity.env,organization-identity.env" --identity=!ORGANIZATION_DID --verification-method-type=assertionMethod --verification-method-id=!TWIN_TRUST_VERIFICATION_METHOD_ID --overwrite-mode=skip --output-json="organization-trust.json" --output-env="organization-trust.env"
151
+ ```
152
+
153
+ ### Step 5 - Set the organisation identity on the node (single-tenant)
154
+
155
+ ```shell
156
+ 3sixty-node node-org-id-set --load-env="organization-identity.env" --organization-id=!ORGANIZATION_DID
157
+ ```
158
+
159
+ ### Step 6 - Create the node tenant and associate the organisation (multi-tenant only)
160
+
161
+ ```shell
162
+ 3sixty-node tenant-create --load-env="organization-identity.env" --organization-id=!ORGANIZATION_DID --label="Node" --output-json="node-tenant.json" --output-env="node-tenant.env" --output-env-prefix=node
163
+ ```
164
+
165
+ ```shell
166
+ 3sixty-node tenant-org-id-set --load-env="node-tenant.env,organization-identity.env" --tenant-id=!NODE_TENANT_ID --organization-id=!ORGANIZATION_DID
167
+ ```
168
+
169
+ To import an existing tenant instead:
170
+
171
+ ```shell
172
+ 3sixty-node tenant-import --load-env="node-tenant.env,organization-identity.env" --tenant-id=!NODE_TENANT_ID --api-key=!NODE_API_KEY --organization-id=!ORGANIZATION_DID --label=!NODE_LABEL --public-origin="https://api.example.com"
173
+ ```
174
+
175
+ To update an existing tenant:
176
+
177
+ ```shell
178
+ 3sixty-node tenant-update --load-env="node-tenant.json" --tenant-id=!NODE_TENANT_ID --label="New Label"
179
+ ```
180
+
181
+ To remove a stale organisation alias from a tenant:
182
+
183
+ ```shell
184
+ 3sixty-node tenant-org-alias-remove --load-env="node-tenant.env" --tenant-id=!NODE_TENANT_ID --alias=!OLD_ORGANIZATION_DID
185
+ ```
186
+
187
+ ---
188
+
189
+ The following steps run when the `admin-user` feature is enabled.
190
+
191
+ ### Step 7 - Add the blob encryption key to the organisation (if blob encryption is enabled)
192
+
193
+ ```shell
194
+ 3sixty-node vault-key-create --load-env="organization-identity.env" --identity=!ORGANIZATION_DID --key-type=ChaCha20Poly1305 --key-id=!TWIN_BLOB_STORAGE_ENCRYPTION_KEY_ID --overwrite-mode=skip --output-json="organization-blob-encryption.json" --output-env="organization-blob-encryption.env"
195
+ ```
196
+
197
+ ### Step 8 - Add the attestation verification method to the organisation (if attestation is enabled)
198
+
199
+ ```shell
200
+ 3sixty-node identity-verification-method-create --load-env="node-identity.env,organization-identity.env" --identity=!ORGANIZATION_DID --verification-method-type=assertionMethod --verification-method-id=!TWIN_ATTESTATION_VERIFICATION_METHOD_ID --overwrite-mode=skip --output-json="organization-attestation.json" --output-env="organization-attestation.env"
201
+ ```
202
+
203
+ To import an existing attestation verification method:
204
+
205
+ ```shell
206
+ 3sixty-node identity-verification-method-import --load-env="node-identity.env,organization-identity.env,organization-attestation.env" --identity=!ORGANIZATION_DID --verification-method-type=assertionMethod --verification-method-id=!DID_VERIFICATION_METHOD_ID --private-key-hex=!DID_VERIFICATION_METHOD_PRIVATE_KEY_HEX
207
+ ```
208
+
209
+ To create a verifiable credential using the attestation verification method:
210
+
211
+ ```shell
212
+ 3sixty-node identity-verifiable-credential-create --load-env="organization-identity.env,organization-attestation.env" --identity=!ORGANIZATION_DID --verification-method-id=!TWIN_ATTESTATION_VERIFICATION_METHOD_ID --subject-json="subject.json" --output-json="organization-attestation-credential.json" --output-env="organization-attestation-credential.env"
213
+ ```
214
+
215
+ ### Step 9 - Add the immutable proof verification method to the organisation (if immutable proofs are enabled)
216
+
217
+ ```shell
218
+ 3sixty-node identity-verification-method-create --load-env="node-identity.env,organization-identity.env" --identity=!ORGANIZATION_DID --verification-method-type=assertionMethod --verification-method-id=!TWIN_IMMUTABLE_PROOF_VERIFICATION_METHOD_ID --overwrite-mode=skip --output-json="organization-immutable-proof.json" --output-env="organization-immutable-proof.env"
219
+ ```
220
+
221
+ ### Step 10 - Create the admin user identity
222
+
223
+ ```shell
224
+ 3sixty-node identity-create --load-env="organization-identity.env" --controller=!ORGANIZATION_DID --output-json="admin-user-identity.json" --output-env="admin-user-identity.env" --output-env-prefix=admin_user
225
+ ```
226
+
227
+ ### Step 11 - Create the admin user account
228
+
229
+ In single-tenant mode omit `--tenant-id` and `node-tenant.env`.
230
+
231
+ ```shell
232
+ 3sixty-node user-create --load-env="organization-identity.env,admin-user-identity.env,node-tenant.env" --user-identity=!ADMIN_USER_DID --organization-identity=!ORGANIZATION_DID --tenant-id=!NODE_TENANT_ID --email="admin@node" --given-name="Node" --family-name="Admin" --scope="tenant-admin,user-admin" --output-json="user-account-admin.json" --output-env="user-account-admin.env" --output-env-prefix=admin
233
+ ```
234
+
235
+ To update an existing user:
236
+
237
+ ```shell
238
+ 3sixty-node user-update --load-env="organization-identity.env,admin-user-identity.env,node-tenant.env" --tenant-id=!NODE_TENANT_ID --email="admin@node" --scope="tenant-admin,user-admin,foo"
239
+ ```
@@ -0,0 +1 @@
1
+ {}
package/package.json CHANGED
@@ -1,6 +1,40 @@
1
1
  {
2
- "name": "@3sixty/node",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
2
+ "name": "@3sixty/node",
3
+ "version": "0.20.0-next.0",
4
+ "description": "3Sixty Node serving APIs using the specified configuration",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "git+https://github.com/3sixtyglobal/node.git",
8
+ "directory": "apps/node"
9
+ },
10
+ "author": "martyn.janes@iota.org",
11
+ "license": "Apache-2.0",
12
+ "type": "module",
13
+ "engines": {
14
+ "node": ">=24.0.0"
15
+ },
16
+ "dependencies": {
17
+ "@3sixty/node-core": "0.20.0-next.0"
18
+ },
19
+ "bugs": {
20
+ "url": "git+https://github.com/3sixtyglobal/node/issues"
21
+ },
22
+ "homepage": "https://3sixty.global",
23
+ "main": "./src/index.js",
24
+ "exports": {
25
+ ".": {
26
+ "import": "./src/index.js",
27
+ "default": "./src/index.js"
28
+ }
29
+ },
30
+ "files": [
31
+ "bin",
32
+ "dist/locales",
33
+ "src/index.js",
34
+ "locales",
35
+ "docs"
36
+ ],
37
+ "bin": {
38
+ "3sixty-node": "bin/index.js"
39
+ }
40
+ }
package/src/index.js ADDED
@@ -0,0 +1,12 @@
1
+ // Copyright 2024 IOTA Stiftung.
2
+ // SPDX-License-Identifier: Apache-2.0.
3
+ import path from 'node:path';
4
+ import { run } from '@3sixty/node-core';
5
+
6
+ await run(
7
+ {
8
+ openApiSpecFile: path.resolve('docs/open-api/spec.json'),
9
+ favIconFile: path.resolve('static/favicon.ico')
10
+ },
11
+ process.argv
12
+ );