@dfns/sdk 0.2.1 → 0.2.3-rc.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.
- package/baseAuthApi.ts +236 -0
- package/codegen/Assets/AssetsClient.ts +137 -0
- package/codegen/Assets/DelegatedAssetsClient.ts +201 -0
- package/codegen/Assets/index.ts +3 -0
- package/codegen/Assets/types.ts +45 -0
- package/codegen/Auth/AuthClient.ts +729 -0
- package/codegen/Auth/DelegatedAuthClient.ts +1508 -0
- package/codegen/Auth/index.ts +3 -0
- package/codegen/Auth/types.ts +262 -0
- package/codegen/Blockchains/BlockchainsClient.ts +25 -0
- package/codegen/Blockchains/DelegatedBlockchainsClient.ts +25 -0
- package/codegen/Blockchains/index.ts +3 -0
- package/codegen/Blockchains/types.ts +8 -0
- package/codegen/Callbacks/CallbacksClient.ts +107 -0
- package/codegen/Callbacks/DelegatedCallbacksClient.ts +172 -0
- package/codegen/Callbacks/index.ts +3 -0
- package/codegen/Callbacks/{types.d.ts → types.ts} +26 -18
- package/codegen/Permissions/DelegatedPermissionsClient.ts +468 -0
- package/codegen/Permissions/PermissionsClient.ts +223 -0
- package/codegen/Permissions/index.ts +3 -0
- package/codegen/Permissions/types.ts +82 -0
- package/codegen/PolicyExecution/DelegatedPolicyExecutionClient.ts +99 -0
- package/codegen/PolicyExecution/PolicyExecutionClient.ts +63 -0
- package/codegen/PolicyExecution/index.ts +3 -0
- package/codegen/PolicyExecution/types.ts +24 -0
- package/codegen/PolicyManagement/DelegatedPolicyManagementClient.ts +384 -0
- package/codegen/PolicyManagement/PolicyManagementClient.ts +205 -0
- package/codegen/PolicyManagement/index.ts +3 -0
- package/codegen/PolicyManagement/{types.d.ts → types.ts} +56 -40
- package/codegen/PublicKeys/DelegatedPublicKeysClient.ts +299 -0
- package/codegen/PublicKeys/PublicKeysClient.ts +179 -0
- package/codegen/PublicKeys/index.ts +3 -0
- package/codegen/PublicKeys/types.ts +68 -0
- package/codegen/Signers/DelegatedSignersClient.ts +22 -0
- package/codegen/Signers/SignersClient.ts +22 -0
- package/codegen/Signers/index.ts +3 -0
- package/codegen/Signers/types.ts +3 -0
- package/codegen/Wallets/DelegatedWalletsClient.ts +511 -0
- package/codegen/Wallets/WalletsClient.ts +310 -0
- package/codegen/Wallets/index.ts +3 -0
- package/codegen/Wallets/types.ts +137 -0
- package/codegen/datamodel/ApiKeys/errors.ts +9 -0
- package/codegen/datamodel/ApiKeys/index.ts +3 -0
- package/codegen/datamodel/ApiKeys/responses.ts +68 -0
- package/codegen/datamodel/ApiKeys/types.ts +81 -0
- package/codegen/datamodel/Assets/errors.ts +24 -0
- package/codegen/datamodel/Assets/index.ts +3 -0
- package/codegen/datamodel/Assets/responses.ts +146 -0
- package/codegen/datamodel/Assets/types.ts +417 -0
- package/codegen/datamodel/Auth/index.ts +2 -0
- package/codegen/datamodel/Auth/responses.ts +1110 -0
- package/codegen/datamodel/Auth/types.ts +1404 -0
- package/codegen/datamodel/BlockchainIndexing/index.ts +1 -0
- package/codegen/datamodel/BlockchainIndexing/{responses.d.ts → responses.ts} +10 -5
- package/codegen/datamodel/Blockchains/index.ts +2 -0
- package/codegen/datamodel/Blockchains/responses.ts +41 -0
- package/codegen/datamodel/Blockchains/types.ts +695 -0
- package/codegen/datamodel/Callbacks/index.ts +2 -0
- package/codegen/datamodel/Callbacks/responses.ts +110 -0
- package/codegen/datamodel/Callbacks/types.ts +100 -0
- package/codegen/datamodel/Foundations/errors.ts +299 -0
- package/codegen/datamodel/Foundations/index.ts +2 -0
- package/codegen/datamodel/Foundations/types.ts +57921 -0
- package/codegen/datamodel/Orgs/index.ts +2 -0
- package/codegen/datamodel/Orgs/responses.ts +104 -0
- package/codegen/datamodel/Orgs/types.ts +322 -0
- package/codegen/datamodel/Permissions/index.ts +2 -0
- package/codegen/datamodel/Permissions/responses.ts +258 -0
- package/codegen/datamodel/Permissions/types.ts +221 -0
- package/codegen/datamodel/PolicyExecution/errors.ts +24 -0
- package/codegen/datamodel/PolicyExecution/index.ts +3 -0
- package/codegen/datamodel/PolicyExecution/responses.ts +59 -0
- package/codegen/datamodel/PolicyExecution/types.ts +122 -0
- package/codegen/datamodel/PolicyManagement/index.ts +2 -0
- package/codegen/datamodel/PolicyManagement/responses.ts +255 -0
- package/codegen/datamodel/PolicyManagement/types.ts +711 -0
- package/codegen/datamodel/PublicKeys/index.ts +2 -0
- package/codegen/datamodel/PublicKeys/responses.ts +190 -0
- package/codegen/datamodel/PublicKeys/types.ts +558 -0
- package/codegen/datamodel/Signers/index.ts +2 -0
- package/codegen/datamodel/Signers/responses.ts +64 -0
- package/codegen/datamodel/Signers/types.ts +31 -0
- package/codegen/datamodel/Wallets/errors.ts +0 -0
- package/codegen/datamodel/Wallets/index.ts +2 -0
- package/codegen/datamodel/Wallets/responses.ts +318 -0
- package/codegen/datamodel/Wallets/types.ts +1268 -0
- package/dfnsApiClient.ts +76 -0
- package/dfnsAuthenticator.ts +59 -0
- package/dfnsDelegatedApiClient.ts +75 -0
- package/dfnsError.ts +5 -0
- package/generated/permissions/client.ts +125 -0
- package/generated/permissions/delegatedClient.ts +266 -0
- package/generated/permissions/index.ts +3 -0
- package/generated/permissions/types.ts +202 -0
- package/generated/policies/client.ts +110 -0
- package/generated/policies/delegatedClient.ts +223 -0
- package/generated/policies/index.ts +3 -0
- package/generated/policies/{types.d.ts → types.ts} +29 -17
- package/generated/signers/client.ts +22 -0
- package/generated/signers/delegatedClient.ts +23 -0
- package/generated/signers/index.ts +3 -0
- package/generated/signers/{types.d.ts → types.ts} +1 -0
- package/generated/wallets/client.ts +282 -0
- package/generated/wallets/delegatedClient.ts +507 -0
- package/generated/wallets/index.ts +3 -0
- package/generated/wallets/{types.d.ts → types.ts} +120 -48
- package/generated/webhooks/client.ts +124 -0
- package/generated/webhooks/delegatedClient.ts +237 -0
- package/generated/webhooks/index.ts +3 -0
- package/generated/webhooks/{types.d.ts → types.ts} +34 -16
- package/index.ts +7 -0
- package/package.json +1 -8
- package/project.json +14 -0
- package/signer.ts +60 -0
- package/store.ts +99 -0
- package/tsconfig.json +7 -0
- package/typedoc.json +21 -0
- package/types/policies.ts +1 -0
- package/types/signers.ts +1 -0
- package/types/wallets.ts +1 -0
- package/types/webhooks.ts +1 -0
- package/utils/base64.ts +19 -0
- package/utils/fetch.ts +130 -0
- package/utils/index.ts +4 -0
- package/utils/nonce.ts +12 -0
- package/utils/url.ts +19 -0
- package/baseAuthApi.d.ts +0 -113
- package/baseAuthApi.js +0 -97
- package/codegen/Assets/AssetsClient.d.ts +0 -13
- package/codegen/Assets/AssetsClient.js +0 -93
- package/codegen/Assets/DelegatedAssetsClient.d.ts +0 -16
- package/codegen/Assets/DelegatedAssetsClient.js +0 -124
- package/codegen/Assets/index.d.ts +0 -3
- package/codegen/Assets/index.js +0 -19
- package/codegen/Assets/types.d.ts +0 -37
- package/codegen/Assets/types.js +0 -2
- package/codegen/Auth/AuthClient.d.ts +0 -50
- package/codegen/Auth/AuthClient.js +0 -518
- package/codegen/Auth/DelegatedAuthClient.d.ts +0 -78
- package/codegen/Auth/DelegatedAuthClient.js +0 -936
- package/codegen/Auth/index.d.ts +0 -3
- package/codegen/Auth/index.js +0 -19
- package/codegen/Auth/types.d.ts +0 -177
- package/codegen/Auth/types.js +0 -2
- package/codegen/Blockchains/BlockchainsClient.d.ts +0 -7
- package/codegen/Blockchains/BlockchainsClient.js +0 -23
- package/codegen/Blockchains/DelegatedBlockchainsClient.d.ts +0 -7
- package/codegen/Blockchains/DelegatedBlockchainsClient.js +0 -23
- package/codegen/Blockchains/index.d.ts +0 -3
- package/codegen/Blockchains/index.js +0 -19
- package/codegen/Blockchains/types.d.ts +0 -6
- package/codegen/Blockchains/types.js +0 -2
- package/codegen/Callbacks/CallbacksClient.d.ts +0 -12
- package/codegen/Callbacks/CallbacksClient.js +0 -78
- package/codegen/Callbacks/DelegatedCallbacksClient.d.ts +0 -15
- package/codegen/Callbacks/DelegatedCallbacksClient.js +0 -110
- package/codegen/Callbacks/index.d.ts +0 -3
- package/codegen/Callbacks/index.js +0 -19
- package/codegen/Callbacks/types.js +0 -2
- package/codegen/Permissions/DelegatedPermissionsClient.d.ts +0 -27
- package/codegen/Permissions/DelegatedPermissionsClient.js +0 -284
- package/codegen/Permissions/PermissionsClient.d.ts +0 -18
- package/codegen/Permissions/PermissionsClient.js +0 -156
- package/codegen/Permissions/index.d.ts +0 -3
- package/codegen/Permissions/index.js +0 -19
- package/codegen/Permissions/types.d.ts +0 -62
- package/codegen/Permissions/types.js +0 -2
- package/codegen/PolicyExecution/DelegatedPolicyExecutionClient.d.ts +0 -11
- package/codegen/PolicyExecution/DelegatedPolicyExecutionClient.js +0 -61
- package/codegen/PolicyExecution/PolicyExecutionClient.d.ts +0 -9
- package/codegen/PolicyExecution/PolicyExecutionClient.js +0 -45
- package/codegen/PolicyExecution/index.d.ts +0 -3
- package/codegen/PolicyExecution/index.js +0 -19
- package/codegen/PolicyExecution/types.d.ts +0 -18
- package/codegen/PolicyExecution/types.js +0 -2
- package/codegen/PolicyManagement/DelegatedPolicyManagementClient.d.ts +0 -25
- package/codegen/PolicyManagement/DelegatedPolicyManagementClient.js +0 -240
- package/codegen/PolicyManagement/PolicyManagementClient.d.ts +0 -18
- package/codegen/PolicyManagement/PolicyManagementClient.js +0 -146
- package/codegen/PolicyManagement/index.d.ts +0 -3
- package/codegen/PolicyManagement/index.js +0 -19
- package/codegen/PolicyManagement/types.js +0 -2
- package/codegen/PublicKeys/DelegatedPublicKeysClient.d.ts +0 -21
- package/codegen/PublicKeys/DelegatedPublicKeysClient.js +0 -189
- package/codegen/PublicKeys/PublicKeysClient.d.ts +0 -16
- package/codegen/PublicKeys/PublicKeysClient.js +0 -128
- package/codegen/PublicKeys/index.d.ts +0 -3
- package/codegen/PublicKeys/index.js +0 -19
- package/codegen/PublicKeys/types.d.ts +0 -51
- package/codegen/PublicKeys/types.js +0 -2
- package/codegen/Signers/DelegatedSignersClient.d.ts +0 -7
- package/codegen/Signers/DelegatedSignersClient.js +0 -22
- package/codegen/Signers/SignersClient.d.ts +0 -7
- package/codegen/Signers/SignersClient.js +0 -22
- package/codegen/Signers/index.d.ts +0 -3
- package/codegen/Signers/index.js +0 -19
- package/codegen/Signers/types.d.ts +0 -2
- package/codegen/Signers/types.js +0 -2
- package/codegen/Wallets/DelegatedWalletsClient.d.ts +0 -32
- package/codegen/Wallets/DelegatedWalletsClient.js +0 -325
- package/codegen/Wallets/WalletsClient.d.ts +0 -24
- package/codegen/Wallets/WalletsClient.js +0 -219
- package/codegen/Wallets/index.d.ts +0 -3
- package/codegen/Wallets/index.js +0 -19
- package/codegen/Wallets/types.d.ts +0 -101
- package/codegen/Wallets/types.js +0 -2
- package/codegen/datamodel/ApiKeys/errors.d.ts +0 -6
- package/codegen/datamodel/ApiKeys/errors.js +0 -15
- package/codegen/datamodel/ApiKeys/index.d.ts +0 -3
- package/codegen/datamodel/ApiKeys/index.js +0 -19
- package/codegen/datamodel/ApiKeys/responses.d.ts +0 -25
- package/codegen/datamodel/ApiKeys/responses.js +0 -2
- package/codegen/datamodel/ApiKeys/types.d.ts +0 -32
- package/codegen/datamodel/ApiKeys/types.js +0 -11
- package/codegen/datamodel/Assets/errors.d.ts +0 -11
- package/codegen/datamodel/Assets/errors.js +0 -17
- package/codegen/datamodel/Assets/index.d.ts +0 -3
- package/codegen/datamodel/Assets/index.js +0 -19
- package/codegen/datamodel/Assets/responses.d.ts +0 -47
- package/codegen/datamodel/Assets/responses.js +0 -2
- package/codegen/datamodel/Assets/types.d.ts +0 -225
- package/codegen/datamodel/Assets/types.js +0 -75
- package/codegen/datamodel/Auth/errors.js +0 -1
- package/codegen/datamodel/Auth/index.d.ts +0 -2
- package/codegen/datamodel/Auth/index.js +0 -18
- package/codegen/datamodel/Auth/responses.d.ts +0 -358
- package/codegen/datamodel/Auth/responses.js +0 -2
- package/codegen/datamodel/Auth/types.d.ts +0 -615
- package/codegen/datamodel/Auth/types.js +0 -127
- package/codegen/datamodel/BlockchainIndexing/errors.js +0 -1
- package/codegen/datamodel/BlockchainIndexing/index.d.ts +0 -1
- package/codegen/datamodel/BlockchainIndexing/index.js +0 -17
- package/codegen/datamodel/BlockchainIndexing/responses.js +0 -2
- package/codegen/datamodel/BlockchainIndexing/types.js +0 -1
- package/codegen/datamodel/Blockchains/errors.js +0 -1
- package/codegen/datamodel/Blockchains/index.d.ts +0 -2
- package/codegen/datamodel/Blockchains/index.js +0 -18
- package/codegen/datamodel/Blockchains/responses.d.ts +0 -12
- package/codegen/datamodel/Blockchains/responses.js +0 -2
- package/codegen/datamodel/Blockchains/types.d.ts +0 -270
- package/codegen/datamodel/Blockchains/types.js +0 -53
- package/codegen/datamodel/Callbacks/errors.js +0 -1
- package/codegen/datamodel/Callbacks/index.d.ts +0 -2
- package/codegen/datamodel/Callbacks/index.js +0 -18
- package/codegen/datamodel/Callbacks/responses.d.ts +0 -36
- package/codegen/datamodel/Callbacks/responses.js +0 -2
- package/codegen/datamodel/Callbacks/types.d.ts +0 -43
- package/codegen/datamodel/Callbacks/types.js +0 -39
- package/codegen/datamodel/Foundations/errors.d.ts +0 -131
- package/codegen/datamodel/Foundations/errors.js +0 -182
- package/codegen/datamodel/Foundations/index.d.ts +0 -2
- package/codegen/datamodel/Foundations/index.js +0 -18
- package/codegen/datamodel/Foundations/responses.js +0 -1
- package/codegen/datamodel/Foundations/types.d.ts +0 -9759
- package/codegen/datamodel/Foundations/types.js +0 -57755
- package/codegen/datamodel/Orgs/errors.js +0 -1
- package/codegen/datamodel/Orgs/index.d.ts +0 -2
- package/codegen/datamodel/Orgs/index.js +0 -18
- package/codegen/datamodel/Orgs/responses.d.ts +0 -45
- package/codegen/datamodel/Orgs/responses.js +0 -2
- package/codegen/datamodel/Orgs/types.d.ts +0 -240
- package/codegen/datamodel/Orgs/types.js +0 -39
- package/codegen/datamodel/Permissions/errors.js +0 -1
- package/codegen/datamodel/Permissions/index.d.ts +0 -2
- package/codegen/datamodel/Permissions/index.js +0 -18
- package/codegen/datamodel/Permissions/responses.d.ts +0 -75
- package/codegen/datamodel/Permissions/responses.js +0 -2
- package/codegen/datamodel/Permissions/types.d.ts +0 -93
- package/codegen/datamodel/Permissions/types.js +0 -43
- package/codegen/datamodel/PolicyExecution/errors.d.ts +0 -11
- package/codegen/datamodel/PolicyExecution/errors.js +0 -17
- package/codegen/datamodel/PolicyExecution/index.d.ts +0 -3
- package/codegen/datamodel/PolicyExecution/index.js +0 -19
- package/codegen/datamodel/PolicyExecution/responses.d.ts +0 -19
- package/codegen/datamodel/PolicyExecution/responses.js +0 -2
- package/codegen/datamodel/PolicyExecution/types.d.ts +0 -60
- package/codegen/datamodel/PolicyExecution/types.js +0 -17
- package/codegen/datamodel/PolicyManagement/errors.js +0 -1
- package/codegen/datamodel/PolicyManagement/index.d.ts +0 -2
- package/codegen/datamodel/PolicyManagement/index.js +0 -18
- package/codegen/datamodel/PolicyManagement/responses.d.ts +0 -83
- package/codegen/datamodel/PolicyManagement/responses.js +0 -2
- package/codegen/datamodel/PolicyManagement/types.d.ts +0 -391
- package/codegen/datamodel/PolicyManagement/types.js +0 -95
- package/codegen/datamodel/PublicKeys/errors.js +0 -1
- package/codegen/datamodel/PublicKeys/index.d.ts +0 -2
- package/codegen/datamodel/PublicKeys/index.js +0 -18
- package/codegen/datamodel/PublicKeys/responses.d.ts +0 -56
- package/codegen/datamodel/PublicKeys/responses.js +0 -2
- package/codegen/datamodel/PublicKeys/types.d.ts +0 -223
- package/codegen/datamodel/PublicKeys/types.js +0 -59
- package/codegen/datamodel/Signers/errors.js +0 -1
- package/codegen/datamodel/Signers/index.d.ts +0 -2
- package/codegen/datamodel/Signers/index.js +0 -18
- package/codegen/datamodel/Signers/responses.d.ts +0 -27
- package/codegen/datamodel/Signers/responses.js +0 -2
- package/codegen/datamodel/Signers/types.d.ts +0 -21
- package/codegen/datamodel/Signers/types.js +0 -2
- package/codegen/datamodel/Wallets/errors.js +0 -1
- package/codegen/datamodel/Wallets/index.d.ts +0 -2
- package/codegen/datamodel/Wallets/index.js +0 -18
- package/codegen/datamodel/Wallets/responses.d.ts +0 -92
- package/codegen/datamodel/Wallets/responses.js +0 -2
- package/codegen/datamodel/Wallets/types.d.ts +0 -677
- package/codegen/datamodel/Wallets/types.js +0 -251
- package/dfnsApiClient.d.ts +0 -39
- package/dfnsApiClient.js +0 -63
- package/dfnsAuthenticator.d.ts +0 -17
- package/dfnsAuthenticator.js +0 -29
- package/dfnsDelegatedApiClient.d.ts +0 -38
- package/dfnsDelegatedApiClient.js +0 -63
- package/dfnsError.d.ts +0 -5
- package/dfnsError.js +0 -11
- package/generated/policies/client.d.ts +0 -13
- package/generated/policies/client.js +0 -92
- package/generated/policies/delegatedClient.d.ts +0 -18
- package/generated/policies/delegatedClient.js +0 -153
- package/generated/policies/index.d.ts +0 -3
- package/generated/policies/index.js +0 -19
- package/generated/policies/types.js +0 -2
- package/generated/signers/client.d.ts +0 -7
- package/generated/signers/client.js +0 -22
- package/generated/signers/delegatedClient.d.ts +0 -7
- package/generated/signers/delegatedClient.js +0 -22
- package/generated/signers/index.d.ts +0 -3
- package/generated/signers/index.js +0 -19
- package/generated/signers/types.js +0 -2
- package/generated/wallets/client.d.ts +0 -25
- package/generated/wallets/client.js +0 -228
- package/generated/wallets/delegatedClient.d.ts +0 -34
- package/generated/wallets/delegatedClient.js +0 -349
- package/generated/wallets/index.d.ts +0 -3
- package/generated/wallets/index.js +0 -19
- package/generated/wallets/types.js +0 -2
- package/generated/webhooks/client.d.ts +0 -14
- package/generated/webhooks/client.js +0 -103
- package/generated/webhooks/delegatedClient.d.ts +0 -19
- package/generated/webhooks/delegatedClient.js +0 -164
- package/generated/webhooks/index.d.ts +0 -3
- package/generated/webhooks/index.js +0 -19
- package/generated/webhooks/types.js +0 -2
- package/index.d.ts +0 -7
- package/index.js +0 -23
- package/signer.d.ts +0 -52
- package/signer.js +0 -2
- package/store.d.ts +0 -79
- package/store.js +0 -2
- package/types/policies.d.ts +0 -1
- package/types/policies.js +0 -17
- package/types/signers.d.ts +0 -1
- package/types/signers.js +0 -17
- package/types/wallets.d.ts +0 -1
- package/types/wallets.js +0 -17
- package/types/webhooks.d.ts +0 -1
- package/types/webhooks.js +0 -17
- package/utils/base64.d.ts +0 -3
- package/utils/base64.js +0 -20
- package/utils/fetch.d.ts +0 -12
- package/utils/fetch.js +0 -94
- package/utils/index.d.ts +0 -4
- package/utils/index.js +0 -20
- package/utils/nonce.d.ts +0 -1
- package/utils/nonce.js +0 -12
- package/utils/url.d.ts +0 -4
- package/utils/url.js +0 -16
- /package/{codegen/datamodel/Auth/errors.d.ts → README.md} +0 -0
- /package/codegen/datamodel/{BlockchainIndexing/errors.d.ts → Auth/errors.ts} +0 -0
- /package/codegen/datamodel/BlockchainIndexing/{types.d.ts → errors.ts} +0 -0
- /package/codegen/datamodel/{Blockchains/errors.d.ts → BlockchainIndexing/types.ts} +0 -0
- /package/codegen/datamodel/{Callbacks/errors.d.ts → Blockchains/errors.ts} +0 -0
- /package/codegen/datamodel/{Foundations/responses.d.ts → Callbacks/errors.ts} +0 -0
- /package/codegen/datamodel/{Orgs/errors.d.ts → Foundations/responses.ts} +0 -0
- /package/codegen/datamodel/{Permissions/errors.d.ts → Orgs/errors.ts} +0 -0
- /package/codegen/datamodel/{PolicyManagement/errors.d.ts → Permissions/errors.ts} +0 -0
- /package/codegen/datamodel/{PublicKeys/errors.d.ts → PolicyManagement/errors.ts} +0 -0
- /package/codegen/datamodel/{Signers/errors.d.ts → PublicKeys/errors.ts} +0 -0
- /package/codegen/datamodel/{Wallets/errors.d.ts → Signers/errors.ts} +0 -0
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
export type ArchivePermissionBody = {
|
|
2
|
+
isArchived: boolean;
|
|
3
|
+
};
|
|
4
|
+
|
|
5
|
+
export type ArchivePermissionParams = {
|
|
6
|
+
permissionId: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export type ArchivePermissionResponse = {
|
|
10
|
+
id: string;
|
|
11
|
+
orgId: string;
|
|
12
|
+
requester: {
|
|
13
|
+
userId: string;
|
|
14
|
+
tokenId: string;
|
|
15
|
+
appId: string;
|
|
16
|
+
};
|
|
17
|
+
kind: "Assignment" | "Permission";
|
|
18
|
+
operationKind: "Create" | "Update" | "Delete";
|
|
19
|
+
status: "Applied" | "Failed" | "Pending" | "Rejected";
|
|
20
|
+
entityId: string;
|
|
21
|
+
body: {
|
|
22
|
+
[x: string]: unknown;
|
|
23
|
+
};
|
|
24
|
+
dateCreated: Date;
|
|
25
|
+
dateResolved: Date;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export type ArchivePermissionRequest = ArchivePermissionParams & { body: ArchivePermissionBody }
|
|
29
|
+
|
|
30
|
+
export type CreateAssignmentBody = {
|
|
31
|
+
identityId: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export type CreateAssignmentParams = {
|
|
35
|
+
permissionId: string;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export type CreateAssignmentResponse = {
|
|
39
|
+
id: string;
|
|
40
|
+
orgId: string;
|
|
41
|
+
requester: {
|
|
42
|
+
userId: string;
|
|
43
|
+
tokenId: string;
|
|
44
|
+
appId: string;
|
|
45
|
+
};
|
|
46
|
+
kind: "Assignment" | "Permission";
|
|
47
|
+
operationKind: "Create" | "Update" | "Delete";
|
|
48
|
+
status: "Applied" | "Failed" | "Pending" | "Rejected";
|
|
49
|
+
entityId: string;
|
|
50
|
+
body: {
|
|
51
|
+
[x: string]: unknown;
|
|
52
|
+
};
|
|
53
|
+
dateCreated: Date;
|
|
54
|
+
dateResolved: Date;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export type CreateAssignmentRequest = CreateAssignmentParams & { body: CreateAssignmentBody }
|
|
58
|
+
|
|
59
|
+
export type CreatePermissionBody = {
|
|
60
|
+
name: string;
|
|
61
|
+
operations: (("ApiKeys:Create" | "ApiKeys:Read" | "ApiKeys:Revoke" | "AssetAccounts" | "AssetAccounts:Archive" | "AssetAccounts:Create" | "AssetAccounts:Read" | "Auth:Action:Sign" | "Auth:Apps:Create" | "Auth:Apps:Read" | "Auth:Apps:Update" | "Auth:Creds:Create" | "Auth:Creds:Read" | "Auth:Creds:Update" | "Auth:Types:Application" | "Auth:Types:Employee" | "Auth:Types:EndUser" | "Auth:Types:Pat" | "Auth:Types:ServiceAccount" | "Auth:Users:Create" | "Auth:Users:Delegate" | "Auth:Users:Read" | "Auth:Users:Update" | "Balances" | "Balances:Read" | "CallbackEvents:Read" | "CallbackSubscriptions:Archive" | "CallbackSubscriptions:Create" | "CallbackSubscriptions:Read" | "Employees:Read" | "Payments" | "Payments:Create" | "Payments:Read" | "PermissionAssignments" | "PermissionAssignments:Create" | "PermissionAssignments:Read" | "PermissionAssignments:Revoke" | "PermissionPredicates" | "PermissionPredicates:Archive" | "PermissionPredicates:Create" | "PermissionPredicates:Read" | "PermissionPredicates:Update" | "Permissions" | "Permissions:Archive" | "Permissions:Create" | "PermissionsHistorical" | "PermissionsHistorical:Read" | "Permissions:Read" | "Permissions:Update" | "Policies:Archive" | "Policies:Create" | "Policies:Read" | "Policies:Update" | "Policies:Approvals:Read" | "Policies:Approvals:Approve" | "PolicyControlExecutions:Read" | "PolicyControlExecutions:Update" | "PolicyControls:Archive" | "PolicyControls:Create" | "PolicyControls:Read" | "PolicyControls:Update" | "PolicyRules:Archive" | "PolicyRules:Create" | "PolicyRules:Read" | "PolicyRules:Update" | "PublicKeyAddresses:Read" | "PublicKeys:Create" | "PublicKeys:Read" | "Signatures:Create" | "Signatures:Read" | "Signers:ListSigners" | "Transactions:Create" | "Transactions:Read" | "Wallets:BroadcastTransaction" | "Wallets:Create" | "Wallets:Delegate" | "Wallets:Export" | "Wallets:GenerateSignature" | "Wallets:Import" | "Wallets:Read" | "Wallets:ReadSignature" | "Wallets:ReadTransaction" | "Wallets:ReadTransfer" | "Wallets:TransferAsset" | "Wallets:Update" | "Webhooks:Create" | "Webhooks:Read" | "Webhooks:Update" | "Webhooks:Delete" | "Webhooks:Ping" | "Webhooks:Events:Read") | ("Internal:Auth:Orgs:Create" | "Internal:Auth:OrgSettings:Create" | "Internal:Auth:OrgSettings:Read" | "Internal:Auth:Orgs:Read" | "Internal:Auth:Types:Staff" | "Internal:Auth:Utils" | "Internal:Bik:TokenMetadata:Read" | "Internal:Bik:TokenMetadata:Update" | "Internal:BlockchainIndexing:Read" | "Internal:BlockchainIndexing:Replay" | "Internal:BlockchainIndexing:Update" | "Internal:Signers:Clusters:Create" | "Internal:Signers:Clusters:Read" | "Internal:Signers:Clusters:Update" | "Internal:Signers:Clusters:Provision" | "Internal:Signers:KeyPresigs:Update"))[];
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export type CreatePermissionResponse = {
|
|
65
|
+
id: string;
|
|
66
|
+
orgId: string;
|
|
67
|
+
requester: {
|
|
68
|
+
userId: string;
|
|
69
|
+
tokenId: string;
|
|
70
|
+
appId: string;
|
|
71
|
+
};
|
|
72
|
+
kind: "Assignment" | "Permission";
|
|
73
|
+
operationKind: "Create" | "Update" | "Delete";
|
|
74
|
+
status: "Applied" | "Failed" | "Pending" | "Rejected";
|
|
75
|
+
entityId: string;
|
|
76
|
+
body: {
|
|
77
|
+
[x: string]: unknown;
|
|
78
|
+
};
|
|
79
|
+
dateCreated: Date;
|
|
80
|
+
dateResolved: Date;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export type CreatePermissionRequest = { body: CreatePermissionBody }
|
|
84
|
+
|
|
85
|
+
export type DeleteAssignmentParams = {
|
|
86
|
+
permissionId: string;
|
|
87
|
+
assignmentId: string;
|
|
88
|
+
};
|
|
89
|
+
|
|
90
|
+
export type DeleteAssignmentResponse = {
|
|
91
|
+
id: string;
|
|
92
|
+
orgId: string;
|
|
93
|
+
requester: {
|
|
94
|
+
userId: string;
|
|
95
|
+
tokenId: string;
|
|
96
|
+
appId: string;
|
|
97
|
+
};
|
|
98
|
+
kind: "Assignment" | "Permission";
|
|
99
|
+
operationKind: "Create" | "Update" | "Delete";
|
|
100
|
+
status: "Applied" | "Failed" | "Pending" | "Rejected";
|
|
101
|
+
entityId: string;
|
|
102
|
+
body: {
|
|
103
|
+
[x: string]: unknown;
|
|
104
|
+
};
|
|
105
|
+
dateCreated: Date;
|
|
106
|
+
dateResolved: Date;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
export type DeleteAssignmentRequest = DeleteAssignmentParams
|
|
110
|
+
|
|
111
|
+
export type GetPermissionParams = {
|
|
112
|
+
permissionId: string;
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
export type GetPermissionResponse = {
|
|
116
|
+
id: string;
|
|
117
|
+
orgId: string;
|
|
118
|
+
name: string;
|
|
119
|
+
operations: string[];
|
|
120
|
+
resourceId?: (string | undefined) | null;
|
|
121
|
+
status: "Active";
|
|
122
|
+
predicateIds: string[];
|
|
123
|
+
isImmutable: boolean;
|
|
124
|
+
dateCreated: Date;
|
|
125
|
+
dateUpdated: Date;
|
|
126
|
+
isArchived: boolean;
|
|
127
|
+
};
|
|
128
|
+
|
|
129
|
+
export type GetPermissionRequest = GetPermissionParams
|
|
130
|
+
|
|
131
|
+
export type ListAssignmentsParams = {
|
|
132
|
+
permissionId: string;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
export type ListAssignmentsResponse = {
|
|
136
|
+
items: {
|
|
137
|
+
id: string;
|
|
138
|
+
permissionId: string;
|
|
139
|
+
identityId: string;
|
|
140
|
+
isImmutable: boolean;
|
|
141
|
+
dateCreated: Date;
|
|
142
|
+
dateUpdated: Date;
|
|
143
|
+
}[];
|
|
144
|
+
nextPageToken?: string | undefined;
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
export type ListAssignmentsRequest = ListAssignmentsParams
|
|
148
|
+
|
|
149
|
+
export type ListPermissionsQuery = {
|
|
150
|
+
limit?: string | undefined;
|
|
151
|
+
paginationToken?: string | undefined;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
export type ListPermissionsResponse = {
|
|
155
|
+
items: {
|
|
156
|
+
id: string;
|
|
157
|
+
orgId: string;
|
|
158
|
+
name: string;
|
|
159
|
+
operations: string[];
|
|
160
|
+
resourceId?: (string | undefined) | null;
|
|
161
|
+
status: "Active";
|
|
162
|
+
predicateIds: string[];
|
|
163
|
+
isImmutable: boolean;
|
|
164
|
+
dateCreated: Date;
|
|
165
|
+
dateUpdated: Date;
|
|
166
|
+
isArchived: boolean;
|
|
167
|
+
}[];
|
|
168
|
+
nextPageToken?: string | undefined;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export type ListPermissionsRequest = { query?: ListPermissionsQuery }
|
|
172
|
+
|
|
173
|
+
export type UpdatePermissionBody = {
|
|
174
|
+
name?: string | undefined;
|
|
175
|
+
operations?: (("ApiKeys:Create" | "ApiKeys:Read" | "ApiKeys:Revoke" | "AssetAccounts" | "AssetAccounts:Archive" | "AssetAccounts:Create" | "AssetAccounts:Read" | "Auth:Action:Sign" | "Auth:Apps:Create" | "Auth:Apps:Read" | "Auth:Apps:Update" | "Auth:Creds:Create" | "Auth:Creds:Read" | "Auth:Creds:Update" | "Auth:Types:Application" | "Auth:Types:Employee" | "Auth:Types:EndUser" | "Auth:Types:Pat" | "Auth:Types:ServiceAccount" | "Auth:Users:Create" | "Auth:Users:Delegate" | "Auth:Users:Read" | "Auth:Users:Update" | "Balances" | "Balances:Read" | "CallbackEvents:Read" | "CallbackSubscriptions:Archive" | "CallbackSubscriptions:Create" | "CallbackSubscriptions:Read" | "Employees:Read" | "Payments" | "Payments:Create" | "Payments:Read" | "PermissionAssignments" | "PermissionAssignments:Create" | "PermissionAssignments:Read" | "PermissionAssignments:Revoke" | "PermissionPredicates" | "PermissionPredicates:Archive" | "PermissionPredicates:Create" | "PermissionPredicates:Read" | "PermissionPredicates:Update" | "Permissions" | "Permissions:Archive" | "Permissions:Create" | "PermissionsHistorical" | "PermissionsHistorical:Read" | "Permissions:Read" | "Permissions:Update" | "Policies:Archive" | "Policies:Create" | "Policies:Read" | "Policies:Update" | "Policies:Approvals:Read" | "Policies:Approvals:Approve" | "PolicyControlExecutions:Read" | "PolicyControlExecutions:Update" | "PolicyControls:Archive" | "PolicyControls:Create" | "PolicyControls:Read" | "PolicyControls:Update" | "PolicyRules:Archive" | "PolicyRules:Create" | "PolicyRules:Read" | "PolicyRules:Update" | "PublicKeyAddresses:Read" | "PublicKeys:Create" | "PublicKeys:Read" | "Signatures:Create" | "Signatures:Read" | "Signers:ListSigners" | "Transactions:Create" | "Transactions:Read" | "Wallets:BroadcastTransaction" | "Wallets:Create" | "Wallets:Delegate" | "Wallets:Export" | "Wallets:GenerateSignature" | "Wallets:Import" | "Wallets:Read" | "Wallets:ReadSignature" | "Wallets:ReadTransaction" | "Wallets:ReadTransfer" | "Wallets:TransferAsset" | "Wallets:Update" | "Webhooks:Create" | "Webhooks:Read" | "Webhooks:Update" | "Webhooks:Delete" | "Webhooks:Ping" | "Webhooks:Events:Read") | ("Internal:Auth:Orgs:Create" | "Internal:Auth:OrgSettings:Create" | "Internal:Auth:OrgSettings:Read" | "Internal:Auth:Orgs:Read" | "Internal:Auth:Types:Staff" | "Internal:Auth:Utils" | "Internal:Bik:TokenMetadata:Read" | "Internal:Bik:TokenMetadata:Update" | "Internal:BlockchainIndexing:Read" | "Internal:BlockchainIndexing:Replay" | "Internal:BlockchainIndexing:Update" | "Internal:Signers:Clusters:Create" | "Internal:Signers:Clusters:Read" | "Internal:Signers:Clusters:Update" | "Internal:Signers:Clusters:Provision" | "Internal:Signers:KeyPresigs:Update"))[] | undefined;
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
export type UpdatePermissionParams = {
|
|
179
|
+
permissionId: string;
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
export type UpdatePermissionResponse = {
|
|
183
|
+
id: string;
|
|
184
|
+
orgId: string;
|
|
185
|
+
requester: {
|
|
186
|
+
userId: string;
|
|
187
|
+
tokenId: string;
|
|
188
|
+
appId: string;
|
|
189
|
+
};
|
|
190
|
+
kind: "Assignment" | "Permission";
|
|
191
|
+
operationKind: "Create" | "Update" | "Delete";
|
|
192
|
+
status: "Applied" | "Failed" | "Pending" | "Rejected";
|
|
193
|
+
entityId: string;
|
|
194
|
+
body: {
|
|
195
|
+
[x: string]: unknown;
|
|
196
|
+
};
|
|
197
|
+
dateCreated: Date;
|
|
198
|
+
dateResolved: Date;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export type UpdatePermissionRequest = UpdatePermissionParams & { body: UpdatePermissionBody }
|
|
202
|
+
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { DfnsApiClientOptions } from '../../dfnsApiClient'
|
|
2
|
+
import { simpleFetch, userActionFetch } from '../../utils/fetch'
|
|
3
|
+
import { buildPathAndQuery } from '../../utils/url'
|
|
4
|
+
import * as T from './types'
|
|
5
|
+
|
|
6
|
+
export class PoliciesClient {
|
|
7
|
+
constructor(private apiOptions: DfnsApiClientOptions) {}
|
|
8
|
+
|
|
9
|
+
async archivePolicy(request: T.ArchivePolicyRequest): Promise<T.ArchivePolicyResponse> {
|
|
10
|
+
const path = buildPathAndQuery('/v2/policies/:policyId', {
|
|
11
|
+
path: request ?? {},
|
|
12
|
+
query: {},
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const response = await userActionFetch(path, {
|
|
16
|
+
method: 'DELETE',
|
|
17
|
+
body: {},
|
|
18
|
+
apiOptions: this.apiOptions,
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
return response.json()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async createApprovalDecision(request: T.CreateApprovalDecisionRequest): Promise<T.CreateApprovalDecisionResponse> {
|
|
25
|
+
const path = buildPathAndQuery('/v2/policy-approvals/:approvalId/decisions', {
|
|
26
|
+
path: request ?? {},
|
|
27
|
+
query: {},
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
const response = await userActionFetch(path, {
|
|
31
|
+
method: 'POST',
|
|
32
|
+
body: request.body,
|
|
33
|
+
apiOptions: this.apiOptions,
|
|
34
|
+
})
|
|
35
|
+
|
|
36
|
+
return response.json()
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async createPolicy(request: T.CreatePolicyRequest): Promise<T.CreatePolicyResponse> {
|
|
40
|
+
const path = buildPathAndQuery('/v2/policies', {
|
|
41
|
+
path: request ?? {},
|
|
42
|
+
query: {},
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const response = await userActionFetch(path, {
|
|
46
|
+
method: 'POST',
|
|
47
|
+
body: request.body,
|
|
48
|
+
apiOptions: this.apiOptions,
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
return response.json()
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
async getPolicy(request: T.GetPolicyRequest): Promise<T.GetPolicyResponse> {
|
|
55
|
+
const path = buildPathAndQuery('/v2/policies/:policyId', {
|
|
56
|
+
path: request ?? {},
|
|
57
|
+
query: {},
|
|
58
|
+
})
|
|
59
|
+
|
|
60
|
+
const response = await simpleFetch(path, {
|
|
61
|
+
method: 'GET',
|
|
62
|
+
apiOptions: this.apiOptions,
|
|
63
|
+
})
|
|
64
|
+
|
|
65
|
+
return response.json()
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async listApprovals(request?: T.ListApprovalsRequest): Promise<T.ListApprovalsResponse> {
|
|
69
|
+
const path = buildPathAndQuery('/v2/policy-approvals', {
|
|
70
|
+
path: request ?? {},
|
|
71
|
+
query: request?.query ?? {},
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
const response = await simpleFetch(path, {
|
|
75
|
+
method: 'GET',
|
|
76
|
+
apiOptions: this.apiOptions,
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
return response.json()
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
async listPolicies(request?: T.ListPoliciesRequest): Promise<T.ListPoliciesResponse> {
|
|
83
|
+
const path = buildPathAndQuery('/v2/policies', {
|
|
84
|
+
path: request ?? {},
|
|
85
|
+
query: request?.query ?? {},
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
const response = await simpleFetch(path, {
|
|
89
|
+
method: 'GET',
|
|
90
|
+
apiOptions: this.apiOptions,
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
return response.json()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async updatePolicy(request: T.UpdatePolicyRequest): Promise<T.UpdatePolicyResponse> {
|
|
97
|
+
const path = buildPathAndQuery('/v2/policies/:policyId', {
|
|
98
|
+
path: request ?? {},
|
|
99
|
+
query: {},
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
const response = await userActionFetch(path, {
|
|
103
|
+
method: 'PUT',
|
|
104
|
+
body: request.body,
|
|
105
|
+
apiOptions: this.apiOptions,
|
|
106
|
+
})
|
|
107
|
+
|
|
108
|
+
return response.json()
|
|
109
|
+
}
|
|
110
|
+
}
|
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
import { BaseAuthApi, SignUserActionChallengeRequest, UserActionChallengeResponse } from '../../baseAuthApi'
|
|
2
|
+
import { DfnsDelegatedApiClientOptions } from '../../dfnsDelegatedApiClient'
|
|
3
|
+
import { simpleFetch } from '../../utils/fetch'
|
|
4
|
+
import { buildPathAndQuery } from '../../utils/url'
|
|
5
|
+
import * as T from './types'
|
|
6
|
+
|
|
7
|
+
export class DelegatedPoliciesClient {
|
|
8
|
+
constructor(private apiOptions: DfnsDelegatedApiClientOptions) {}
|
|
9
|
+
|
|
10
|
+
async archivePolicyInit(request: T.ArchivePolicyRequest): Promise<UserActionChallengeResponse> {
|
|
11
|
+
const path = buildPathAndQuery('/v2/policies/:policyId', {
|
|
12
|
+
path: request ?? {},
|
|
13
|
+
query: {},
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
const challenge = await BaseAuthApi.createUserActionChallenge(
|
|
17
|
+
{
|
|
18
|
+
userActionHttpMethod: 'DELETE',
|
|
19
|
+
userActionHttpPath: path,
|
|
20
|
+
userActionPayload: JSON.stringify({}),
|
|
21
|
+
userActionServerKind: 'Api',
|
|
22
|
+
},
|
|
23
|
+
this.apiOptions
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
return challenge
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async archivePolicyComplete(
|
|
30
|
+
request: T.ArchivePolicyRequest,
|
|
31
|
+
signedChallenge: SignUserActionChallengeRequest
|
|
32
|
+
): Promise<T.ArchivePolicyResponse> {
|
|
33
|
+
const path = buildPathAndQuery('/v2/policies/:policyId', {
|
|
34
|
+
path: request ?? {},
|
|
35
|
+
query: {},
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
const { userAction } = await BaseAuthApi.signUserActionChallenge(
|
|
39
|
+
signedChallenge,
|
|
40
|
+
this.apiOptions
|
|
41
|
+
)
|
|
42
|
+
|
|
43
|
+
const response = await simpleFetch(path, {
|
|
44
|
+
method: 'DELETE',
|
|
45
|
+
body: {},
|
|
46
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
47
|
+
apiOptions: this.apiOptions,
|
|
48
|
+
})
|
|
49
|
+
|
|
50
|
+
return response.json()
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
async createApprovalDecisionInit(request: T.CreateApprovalDecisionRequest): Promise<UserActionChallengeResponse> {
|
|
54
|
+
const path = buildPathAndQuery('/v2/policy-approvals/:approvalId/decisions', {
|
|
55
|
+
path: request ?? {},
|
|
56
|
+
query: {},
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const challenge = await BaseAuthApi.createUserActionChallenge(
|
|
60
|
+
{
|
|
61
|
+
userActionHttpMethod: 'POST',
|
|
62
|
+
userActionHttpPath: path,
|
|
63
|
+
userActionPayload: JSON.stringify(request.body),
|
|
64
|
+
userActionServerKind: 'Api',
|
|
65
|
+
},
|
|
66
|
+
this.apiOptions
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
return challenge
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
async createApprovalDecisionComplete(
|
|
73
|
+
request: T.CreateApprovalDecisionRequest,
|
|
74
|
+
signedChallenge: SignUserActionChallengeRequest
|
|
75
|
+
): Promise<T.CreateApprovalDecisionResponse> {
|
|
76
|
+
const path = buildPathAndQuery('/v2/policy-approvals/:approvalId/decisions', {
|
|
77
|
+
path: request ?? {},
|
|
78
|
+
query: {},
|
|
79
|
+
})
|
|
80
|
+
|
|
81
|
+
const { userAction } = await BaseAuthApi.signUserActionChallenge(
|
|
82
|
+
signedChallenge,
|
|
83
|
+
this.apiOptions
|
|
84
|
+
)
|
|
85
|
+
|
|
86
|
+
const response = await simpleFetch(path, {
|
|
87
|
+
method: 'POST',
|
|
88
|
+
body: request.body,
|
|
89
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
90
|
+
apiOptions: this.apiOptions,
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
return response.json()
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async createPolicyInit(request: T.CreatePolicyRequest): Promise<UserActionChallengeResponse> {
|
|
97
|
+
const path = buildPathAndQuery('/v2/policies', {
|
|
98
|
+
path: request ?? {},
|
|
99
|
+
query: {},
|
|
100
|
+
})
|
|
101
|
+
|
|
102
|
+
const challenge = await BaseAuthApi.createUserActionChallenge(
|
|
103
|
+
{
|
|
104
|
+
userActionHttpMethod: 'POST',
|
|
105
|
+
userActionHttpPath: path,
|
|
106
|
+
userActionPayload: JSON.stringify(request.body),
|
|
107
|
+
userActionServerKind: 'Api',
|
|
108
|
+
},
|
|
109
|
+
this.apiOptions
|
|
110
|
+
)
|
|
111
|
+
|
|
112
|
+
return challenge
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
async createPolicyComplete(
|
|
116
|
+
request: T.CreatePolicyRequest,
|
|
117
|
+
signedChallenge: SignUserActionChallengeRequest
|
|
118
|
+
): Promise<T.CreatePolicyResponse> {
|
|
119
|
+
const path = buildPathAndQuery('/v2/policies', {
|
|
120
|
+
path: request ?? {},
|
|
121
|
+
query: {},
|
|
122
|
+
})
|
|
123
|
+
|
|
124
|
+
const { userAction } = await BaseAuthApi.signUserActionChallenge(
|
|
125
|
+
signedChallenge,
|
|
126
|
+
this.apiOptions
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
const response = await simpleFetch(path, {
|
|
130
|
+
method: 'POST',
|
|
131
|
+
body: request.body,
|
|
132
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
133
|
+
apiOptions: this.apiOptions,
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
return response.json()
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
async getPolicy(request: T.GetPolicyRequest): Promise<T.GetPolicyResponse> {
|
|
140
|
+
const path = buildPathAndQuery('/v2/policies/:policyId', {
|
|
141
|
+
path: request ?? {},
|
|
142
|
+
query: {},
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
const response = await simpleFetch(path, {
|
|
146
|
+
method: 'GET',
|
|
147
|
+
apiOptions: this.apiOptions,
|
|
148
|
+
})
|
|
149
|
+
|
|
150
|
+
return response.json()
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async listApprovals(request?: T.ListApprovalsRequest): Promise<T.ListApprovalsResponse> {
|
|
154
|
+
const path = buildPathAndQuery('/v2/policy-approvals', {
|
|
155
|
+
path: request ?? {},
|
|
156
|
+
query: request?.query ?? {},
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
const response = await simpleFetch(path, {
|
|
160
|
+
method: 'GET',
|
|
161
|
+
apiOptions: this.apiOptions,
|
|
162
|
+
})
|
|
163
|
+
|
|
164
|
+
return response.json()
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async listPolicies(request?: T.ListPoliciesRequest): Promise<T.ListPoliciesResponse> {
|
|
168
|
+
const path = buildPathAndQuery('/v2/policies', {
|
|
169
|
+
path: request ?? {},
|
|
170
|
+
query: request?.query ?? {},
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
const response = await simpleFetch(path, {
|
|
174
|
+
method: 'GET',
|
|
175
|
+
apiOptions: this.apiOptions,
|
|
176
|
+
})
|
|
177
|
+
|
|
178
|
+
return response.json()
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async updatePolicyInit(request: T.UpdatePolicyRequest): Promise<UserActionChallengeResponse> {
|
|
182
|
+
const path = buildPathAndQuery('/v2/policies/:policyId', {
|
|
183
|
+
path: request ?? {},
|
|
184
|
+
query: {},
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
const challenge = await BaseAuthApi.createUserActionChallenge(
|
|
188
|
+
{
|
|
189
|
+
userActionHttpMethod: 'PUT',
|
|
190
|
+
userActionHttpPath: path,
|
|
191
|
+
userActionPayload: JSON.stringify(request.body),
|
|
192
|
+
userActionServerKind: 'Api',
|
|
193
|
+
},
|
|
194
|
+
this.apiOptions
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
return challenge
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
async updatePolicyComplete(
|
|
201
|
+
request: T.UpdatePolicyRequest,
|
|
202
|
+
signedChallenge: SignUserActionChallengeRequest
|
|
203
|
+
): Promise<T.UpdatePolicyResponse> {
|
|
204
|
+
const path = buildPathAndQuery('/v2/policies/:policyId', {
|
|
205
|
+
path: request ?? {},
|
|
206
|
+
query: {},
|
|
207
|
+
})
|
|
208
|
+
|
|
209
|
+
const { userAction } = await BaseAuthApi.signUserActionChallenge(
|
|
210
|
+
signedChallenge,
|
|
211
|
+
this.apiOptions
|
|
212
|
+
)
|
|
213
|
+
|
|
214
|
+
const response = await simpleFetch(path, {
|
|
215
|
+
method: 'PUT',
|
|
216
|
+
body: request.body,
|
|
217
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
218
|
+
apiOptions: this.apiOptions,
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
return response.json()
|
|
222
|
+
}
|
|
223
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type ArchivePolicyParams = {
|
|
2
2
|
policyId: string;
|
|
3
3
|
};
|
|
4
|
+
|
|
4
5
|
export type ArchivePolicyResponse = {
|
|
5
6
|
id: string;
|
|
6
7
|
orgId: string;
|
|
@@ -19,11 +20,14 @@ export type ArchivePolicyResponse = {
|
|
|
19
20
|
dateCreated: Date;
|
|
20
21
|
dateResolved: Date;
|
|
21
22
|
};
|
|
22
|
-
|
|
23
|
+
|
|
24
|
+
export type ArchivePolicyRequest = ArchivePolicyParams
|
|
25
|
+
|
|
23
26
|
export type CreateApprovalDecisionBody = {
|
|
24
27
|
value: "Approved" | "Denied";
|
|
25
28
|
reason?: string | undefined;
|
|
26
29
|
};
|
|
30
|
+
|
|
27
31
|
export type CreateApprovalDecisionResponse = {
|
|
28
32
|
id: string;
|
|
29
33
|
orgId: string;
|
|
@@ -50,9 +54,9 @@ export type CreateApprovalDecisionResponse = {
|
|
|
50
54
|
value: "Approved" | "Denied";
|
|
51
55
|
}[];
|
|
52
56
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
57
|
+
|
|
58
|
+
export type CreateApprovalDecisionRequest = { body: CreateApprovalDecisionBody }
|
|
59
|
+
|
|
56
60
|
export type CreatePolicyBody = {
|
|
57
61
|
name: string;
|
|
58
62
|
approvalGroups: {
|
|
@@ -148,6 +152,7 @@ export type CreatePolicyBody = {
|
|
|
148
152
|
};
|
|
149
153
|
} | undefined;
|
|
150
154
|
};
|
|
155
|
+
|
|
151
156
|
export type CreatePolicyResponse = {
|
|
152
157
|
id: string;
|
|
153
158
|
orgId: string;
|
|
@@ -166,12 +171,13 @@ export type CreatePolicyResponse = {
|
|
|
166
171
|
dateCreated: Date;
|
|
167
172
|
dateResolved: Date;
|
|
168
173
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
174
|
+
|
|
175
|
+
export type CreatePolicyRequest = { body: CreatePolicyBody }
|
|
176
|
+
|
|
172
177
|
export type GetPolicyParams = {
|
|
173
178
|
policyId: string;
|
|
174
179
|
};
|
|
180
|
+
|
|
175
181
|
export type GetPolicyResponse = ({
|
|
176
182
|
name: string;
|
|
177
183
|
approvalGroups: {
|
|
@@ -272,7 +278,9 @@ export type GetPolicyResponse = ({
|
|
|
272
278
|
dateCreated?: string | undefined;
|
|
273
279
|
dateUpdated?: string | undefined;
|
|
274
280
|
};
|
|
275
|
-
|
|
281
|
+
|
|
282
|
+
export type GetPolicyRequest = GetPolicyParams
|
|
283
|
+
|
|
276
284
|
export type ListApprovalsQuery = {
|
|
277
285
|
limit?: string | undefined;
|
|
278
286
|
paginationToken?: string | undefined;
|
|
@@ -281,6 +289,7 @@ export type ListApprovalsQuery = {
|
|
|
281
289
|
initiatorId?: string | undefined;
|
|
282
290
|
approverId?: string | undefined;
|
|
283
291
|
};
|
|
292
|
+
|
|
284
293
|
export type ListApprovalsResponse = {
|
|
285
294
|
items: {
|
|
286
295
|
id: string;
|
|
@@ -310,13 +319,14 @@ export type ListApprovalsResponse = {
|
|
|
310
319
|
}[];
|
|
311
320
|
nextPageToken?: string | undefined;
|
|
312
321
|
};
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
322
|
+
|
|
323
|
+
export type ListApprovalsRequest = { query?: ListApprovalsQuery }
|
|
324
|
+
|
|
316
325
|
export type ListPoliciesQuery = {
|
|
317
326
|
limit?: string | undefined;
|
|
318
327
|
paginationToken?: string | undefined;
|
|
319
328
|
};
|
|
329
|
+
|
|
320
330
|
export type ListPoliciesResponse = {
|
|
321
331
|
items: (({
|
|
322
332
|
name: string;
|
|
@@ -420,9 +430,9 @@ export type ListPoliciesResponse = {
|
|
|
420
430
|
})[];
|
|
421
431
|
nextPageToken?: string | undefined;
|
|
422
432
|
};
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
433
|
+
|
|
434
|
+
export type ListPoliciesRequest = { query?: ListPoliciesQuery }
|
|
435
|
+
|
|
426
436
|
export type UpdatePolicyBody = {
|
|
427
437
|
name: string;
|
|
428
438
|
approvalGroups: {
|
|
@@ -518,9 +528,11 @@ export type UpdatePolicyBody = {
|
|
|
518
528
|
};
|
|
519
529
|
} | undefined;
|
|
520
530
|
};
|
|
531
|
+
|
|
521
532
|
export type UpdatePolicyParams = {
|
|
522
533
|
policyId: string;
|
|
523
534
|
};
|
|
535
|
+
|
|
524
536
|
export type UpdatePolicyResponse = {
|
|
525
537
|
id: string;
|
|
526
538
|
orgId: string;
|
|
@@ -539,6 +551,6 @@ export type UpdatePolicyResponse = {
|
|
|
539
551
|
dateCreated: Date;
|
|
540
552
|
dateResolved: Date;
|
|
541
553
|
};
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
554
|
+
|
|
555
|
+
export type UpdatePolicyRequest = UpdatePolicyParams & { body: UpdatePolicyBody }
|
|
556
|
+
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DfnsApiClientOptions } from '../../dfnsApiClient'
|
|
2
|
+
import { simpleFetch, userActionFetch } from '../../utils/fetch'
|
|
3
|
+
import { buildPathAndQuery } from '../../utils/url'
|
|
4
|
+
import * as T from './types'
|
|
5
|
+
|
|
6
|
+
export class SignersClient {
|
|
7
|
+
constructor(private apiOptions: DfnsApiClientOptions) {}
|
|
8
|
+
|
|
9
|
+
async listSigners(): Promise<T.ListSignersResponse> {
|
|
10
|
+
const path = buildPathAndQuery('/signers', {
|
|
11
|
+
path: {},
|
|
12
|
+
query: {},
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
const response = await simpleFetch(path, {
|
|
16
|
+
method: 'GET',
|
|
17
|
+
apiOptions: this.apiOptions,
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
return response.json()
|
|
21
|
+
}
|
|
22
|
+
}
|