@dfns/sdk 0.1.0-alpha.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.d.ts +53 -0
- package/baseAuthApi.js +39 -0
- package/codegen/ApiKeys/ApiKeysClient.d.ts +10 -0
- package/codegen/ApiKeys/ApiKeysClient.js +56 -0
- package/codegen/ApiKeys/DelegatedApiKeysClient.d.ts +13 -0
- package/codegen/ApiKeys/DelegatedApiKeysClient.js +88 -0
- package/codegen/ApiKeys/index.d.ts +3 -0
- package/codegen/ApiKeys/index.js +19 -0
- package/codegen/ApiKeys/types.d.ts +16 -0
- package/codegen/ApiKeys/types.js +2 -0
- package/codegen/Assets/AssetsClient.d.ts +14 -0
- package/codegen/Assets/AssetsClient.js +105 -0
- package/codegen/Assets/DelegatedAssetsClient.d.ts +18 -0
- package/codegen/Assets/DelegatedAssetsClient.js +152 -0
- package/codegen/Assets/index.d.ts +3 -0
- package/codegen/Assets/index.js +19 -0
- package/codegen/Assets/types.d.ts +39 -0
- package/codegen/Assets/types.js +2 -0
- package/codegen/Auth/AuthClient.d.ts +62 -0
- package/codegen/Auth/AuthClient.js +667 -0
- package/codegen/Auth/DelegatedAuthClient.d.ts +98 -0
- package/codegen/Auth/DelegatedAuthClient.js +1223 -0
- package/codegen/Auth/index.d.ts +3 -0
- package/codegen/Auth/index.js +19 -0
- package/codegen/Auth/types.d.ts +243 -0
- package/codegen/Auth/types.js +2 -0
- package/codegen/Callbacks/CallbacksClient.d.ts +12 -0
- package/codegen/Callbacks/CallbacksClient.js +78 -0
- package/codegen/Callbacks/DelegatedCallbacksClient.d.ts +15 -0
- package/codegen/Callbacks/DelegatedCallbacksClient.js +110 -0
- package/codegen/Callbacks/index.d.ts +3 -0
- package/codegen/Callbacks/index.js +19 -0
- package/codegen/Callbacks/types.d.ts +23 -0
- package/codegen/Callbacks/types.js +2 -0
- package/codegen/Permissions/DelegatedPermissionsClient.d.ts +28 -0
- package/codegen/Permissions/DelegatedPermissionsClient.js +297 -0
- package/codegen/Permissions/PermissionsClient.d.ts +19 -0
- package/codegen/Permissions/PermissionsClient.js +169 -0
- package/codegen/Permissions/index.d.ts +3 -0
- package/codegen/Permissions/index.js +19 -0
- package/codegen/Permissions/types.d.ts +71 -0
- package/codegen/Permissions/types.js +2 -0
- package/codegen/PolicyExecution/DelegatedPolicyExecutionClient.d.ts +11 -0
- package/codegen/PolicyExecution/DelegatedPolicyExecutionClient.js +62 -0
- package/codegen/PolicyExecution/PolicyExecutionClient.d.ts +9 -0
- package/codegen/PolicyExecution/PolicyExecutionClient.js +46 -0
- package/codegen/PolicyExecution/index.d.ts +3 -0
- package/codegen/PolicyExecution/index.js +19 -0
- package/codegen/PolicyExecution/types.d.ts +16 -0
- package/codegen/PolicyExecution/types.js +2 -0
- package/codegen/PolicyManagement/DelegatedPolicyManagementClient.d.ts +31 -0
- package/codegen/PolicyManagement/DelegatedPolicyManagementClient.js +324 -0
- package/codegen/PolicyManagement/PolicyManagementClient.d.ts +21 -0
- package/codegen/PolicyManagement/PolicyManagementClient.js +185 -0
- package/codegen/PolicyManagement/index.d.ts +3 -0
- package/codegen/PolicyManagement/index.js +19 -0
- package/codegen/PolicyManagement/types.d.ts +91 -0
- package/codegen/PolicyManagement/types.js +2 -0
- package/codegen/PublicKeys/DelegatedPublicKeysClient.d.ts +21 -0
- package/codegen/PublicKeys/DelegatedPublicKeysClient.js +191 -0
- package/codegen/PublicKeys/PublicKeysClient.d.ts +16 -0
- package/codegen/PublicKeys/PublicKeysClient.js +130 -0
- package/codegen/PublicKeys/index.d.ts +3 -0
- package/codegen/PublicKeys/index.js +19 -0
- package/codegen/PublicKeys/types.d.ts +51 -0
- package/codegen/PublicKeys/types.js +2 -0
- package/codegen/Wallets/DelegatedWalletsClient.d.ts +26 -0
- package/codegen/Wallets/DelegatedWalletsClient.js +249 -0
- package/codegen/Wallets/WalletsClient.d.ts +21 -0
- package/codegen/Wallets/WalletsClient.js +188 -0
- package/codegen/Wallets/index.d.ts +3 -0
- package/codegen/Wallets/index.js +19 -0
- package/codegen/Wallets/types.d.ts +87 -0
- package/codegen/Wallets/types.js +2 -0
- package/codegen/datamodel/ApiKeys/errors.d.ts +6 -0
- package/codegen/datamodel/ApiKeys/errors.js +15 -0
- package/codegen/datamodel/ApiKeys/index.d.ts +3 -0
- package/codegen/datamodel/ApiKeys/index.js +19 -0
- package/codegen/datamodel/ApiKeys/responses.d.ts +25 -0
- package/codegen/datamodel/ApiKeys/responses.js +2 -0
- package/codegen/datamodel/ApiKeys/types.d.ts +32 -0
- package/codegen/datamodel/ApiKeys/types.js +11 -0
- package/codegen/datamodel/Assets/errors.d.ts +11 -0
- package/codegen/datamodel/Assets/errors.js +17 -0
- package/codegen/datamodel/Assets/index.d.ts +3 -0
- package/codegen/datamodel/Assets/index.js +19 -0
- package/codegen/datamodel/Assets/responses.d.ts +45 -0
- package/codegen/datamodel/Assets/responses.js +2 -0
- package/codegen/datamodel/Assets/types.d.ts +225 -0
- package/codegen/datamodel/Assets/types.js +75 -0
- package/codegen/datamodel/Auth/index.d.ts +2 -0
- package/codegen/datamodel/Auth/index.js +18 -0
- package/codegen/datamodel/Auth/responses.d.ts +348 -0
- package/codegen/datamodel/Auth/responses.js +2 -0
- package/codegen/datamodel/Auth/types.d.ts +610 -0
- package/codegen/datamodel/Auth/types.js +127 -0
- package/codegen/datamodel/Callbacks/index.d.ts +2 -0
- package/codegen/datamodel/Callbacks/index.js +18 -0
- package/codegen/datamodel/Callbacks/responses.d.ts +36 -0
- package/codegen/datamodel/Callbacks/responses.js +2 -0
- package/codegen/datamodel/Callbacks/types.d.ts +43 -0
- package/codegen/datamodel/Callbacks/types.js +39 -0
- package/codegen/datamodel/Foundations/errors.d.ts +121 -0
- package/codegen/datamodel/Foundations/errors.js +169 -0
- package/codegen/datamodel/Foundations/index.d.ts +2 -0
- package/codegen/datamodel/Foundations/index.js +18 -0
- package/codegen/datamodel/Foundations/types.d.ts +9754 -0
- package/codegen/datamodel/Foundations/types.js +57741 -0
- package/codegen/datamodel/Permissions/index.d.ts +2 -0
- package/codegen/datamodel/Permissions/index.js +18 -0
- package/codegen/datamodel/Permissions/responses.d.ts +75 -0
- package/codegen/datamodel/Permissions/responses.js +2 -0
- package/codegen/datamodel/Permissions/types.d.ts +106 -0
- package/codegen/datamodel/Permissions/types.js +65 -0
- package/codegen/datamodel/PolicyExecution/errors.d.ts +11 -0
- package/codegen/datamodel/PolicyExecution/errors.js +17 -0
- package/codegen/datamodel/PolicyExecution/index.d.ts +3 -0
- package/codegen/datamodel/PolicyExecution/index.js +19 -0
- package/codegen/datamodel/PolicyExecution/responses.d.ts +17 -0
- package/codegen/datamodel/PolicyExecution/responses.js +2 -0
- package/codegen/datamodel/PolicyExecution/types.d.ts +45 -0
- package/codegen/datamodel/PolicyExecution/types.js +15 -0
- package/codegen/datamodel/PolicyManagement/index.d.ts +2 -0
- package/codegen/datamodel/PolicyManagement/index.js +18 -0
- package/codegen/datamodel/PolicyManagement/responses.d.ts +83 -0
- package/codegen/datamodel/PolicyManagement/responses.js +2 -0
- package/codegen/datamodel/PolicyManagement/types.d.ts +252 -0
- package/codegen/datamodel/PolicyManagement/types.js +81 -0
- package/codegen/datamodel/PublicKeys/index.d.ts +2 -0
- package/codegen/datamodel/PublicKeys/index.js +18 -0
- package/codegen/datamodel/PublicKeys/responses.d.ts +56 -0
- package/codegen/datamodel/PublicKeys/responses.js +2 -0
- package/codegen/datamodel/PublicKeys/types.d.ts +222 -0
- package/codegen/datamodel/PublicKeys/types.js +59 -0
- package/codegen/datamodel/Wallets/index.d.ts +2 -0
- package/codegen/datamodel/Wallets/index.js +18 -0
- package/codegen/datamodel/Wallets/responses.d.ts +77 -0
- package/codegen/datamodel/Wallets/responses.js +2 -0
- package/codegen/datamodel/Wallets/types.d.ts +261 -0
- package/codegen/datamodel/Wallets/types.js +89 -0
- package/dfnsApiClient.d.ts +27 -0
- package/dfnsApiClient.js +45 -0
- package/dfnsAuthenticator.d.ts +11 -0
- package/dfnsAuthenticator.js +18 -0
- package/dfnsDelegatedApiClient.d.ts +24 -0
- package/dfnsDelegatedApiClient.js +41 -0
- package/dfnsError.d.ts +5 -0
- package/dfnsError.js +11 -0
- package/index.d.ts +3 -0
- package/index.js +19 -0
- package/package.json +11 -0
- package/signer.d.ts +47 -0
- package/signer.js +2 -0
- package/utils/base64.d.ts +3 -0
- package/utils/base64.js +20 -0
- package/utils/fetch.d.ts +12 -0
- package/utils/fetch.js +89 -0
- package/utils/nonce.d.ts +1 -0
- package/utils/nonce.js +12 -0
- package/utils/url.d.ts +4 -0
- package/utils/url.js +15 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DelegatedPolicyManagementClient"), exports);
|
|
18
|
+
__exportStar(require("./PolicyManagementClient"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import * as PolicyManagement from '../datamodel/PolicyManagement';
|
|
2
|
+
export type CreatePolicyRequest = {
|
|
3
|
+
body: PolicyManagement.CreatePolicyInput;
|
|
4
|
+
};
|
|
5
|
+
export type CreatePolicyResponse = PolicyManagement.Policy;
|
|
6
|
+
export type UpdatePolicyRequest = {
|
|
7
|
+
policyId: string;
|
|
8
|
+
body: PolicyManagement.UpdatePolicyInput;
|
|
9
|
+
};
|
|
10
|
+
export type UpdatePolicyResponse = PolicyManagement.Policy;
|
|
11
|
+
export type GetPolicyByIdRequest = {
|
|
12
|
+
policyId: string;
|
|
13
|
+
};
|
|
14
|
+
export type GetPolicyByIdResponse = PolicyManagement.Policy;
|
|
15
|
+
export type ListPoliciesRequest = {
|
|
16
|
+
query?: {
|
|
17
|
+
dateCreated?: string;
|
|
18
|
+
dateUpdated?: string;
|
|
19
|
+
activityKind?: PolicyManagement.PolicyActivityKind;
|
|
20
|
+
isEnabled?: boolean;
|
|
21
|
+
isDisabled?: boolean;
|
|
22
|
+
isArchived?: boolean;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export type ListPoliciesResponse = {
|
|
26
|
+
items: PolicyManagement.Policy[];
|
|
27
|
+
};
|
|
28
|
+
export type ArchivePolicyRequest = {
|
|
29
|
+
policyId: string;
|
|
30
|
+
};
|
|
31
|
+
export type ArchivePolicyResponse = PolicyManagement.Policy;
|
|
32
|
+
export type CreatePolicyControlRequest = {
|
|
33
|
+
body: PolicyManagement.CreatePolicyControlInput;
|
|
34
|
+
};
|
|
35
|
+
export type CreatePolicyControlResponse = PolicyManagement.PolicyControl;
|
|
36
|
+
export type UpdatePolicyControlRequest = {
|
|
37
|
+
policyControlId: string;
|
|
38
|
+
body: PolicyManagement.UpdatePolicyControlInput;
|
|
39
|
+
};
|
|
40
|
+
export type UpdatePolicyControlResponse = PolicyManagement.PolicyControl;
|
|
41
|
+
export type GetPolicyControlByIdRequest = {
|
|
42
|
+
policyControlId: string;
|
|
43
|
+
};
|
|
44
|
+
export type GetPolicyControlByIdResponse = PolicyManagement.PolicyControl;
|
|
45
|
+
export type ListPolicyControlsRequest = {
|
|
46
|
+
query?: {
|
|
47
|
+
dateCreated?: string;
|
|
48
|
+
dateUpdated?: string;
|
|
49
|
+
policyControlKind?: PolicyManagement.PolicyControlKind;
|
|
50
|
+
isEnabled?: boolean;
|
|
51
|
+
isDisabled?: boolean;
|
|
52
|
+
isArchived?: boolean;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
export type ListPolicyControlsResponse = {
|
|
56
|
+
items: PolicyManagement.PolicyControl[];
|
|
57
|
+
};
|
|
58
|
+
export type ArchivePolicyControlRequest = {
|
|
59
|
+
policyControlId: string;
|
|
60
|
+
};
|
|
61
|
+
export type ArchivePolicyControlResponse = PolicyManagement.PolicyControl;
|
|
62
|
+
export type CreatePolicyRuleRequest = {
|
|
63
|
+
body: PolicyManagement.CreatePolicyInput;
|
|
64
|
+
};
|
|
65
|
+
export type CreatePolicyRuleResponse = PolicyManagement.Policy;
|
|
66
|
+
export type UpdatePolicyRuleRequest = {
|
|
67
|
+
policyRuleId: string;
|
|
68
|
+
body: PolicyManagement.UpdatePolicyInput;
|
|
69
|
+
};
|
|
70
|
+
export type UpdatePolicyRuleResponse = PolicyManagement.Policy;
|
|
71
|
+
export type GetPolicyRuleByIdRequest = {
|
|
72
|
+
policyRuleId: string;
|
|
73
|
+
};
|
|
74
|
+
export type GetPolicyRuleByIdResponse = PolicyManagement.Policy;
|
|
75
|
+
export type ListPolicyRulesRequest = {
|
|
76
|
+
query?: {
|
|
77
|
+
dateCreated?: string;
|
|
78
|
+
dateUpdated?: string;
|
|
79
|
+
activityKind?: PolicyManagement.PolicyActivityKind;
|
|
80
|
+
isEnabled?: boolean;
|
|
81
|
+
isDisabled?: boolean;
|
|
82
|
+
isArchived?: boolean;
|
|
83
|
+
};
|
|
84
|
+
};
|
|
85
|
+
export type ListPolicyRulesResponse = {
|
|
86
|
+
items: PolicyManagement.Policy[];
|
|
87
|
+
};
|
|
88
|
+
export type ArchivePolicyRuleRequest = {
|
|
89
|
+
policyRuleId: string;
|
|
90
|
+
};
|
|
91
|
+
export type ArchivePolicyRuleResponse = PolicyManagement.Policy;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SignUserActionChallengeRequest, UserActionChallengeResponse } from '../../baseAuthApi';
|
|
2
|
+
import { DfnsDelegatedApiClientOptions } from '../../dfnsDelegatedApiClient';
|
|
3
|
+
import * as T from './types';
|
|
4
|
+
export declare class DelegatedPublicKeysClient {
|
|
5
|
+
private apiOptions;
|
|
6
|
+
constructor(apiOptions: DfnsDelegatedApiClientOptions);
|
|
7
|
+
getPublicKeyById(request: T.GetPublicKeyByIdRequest): Promise<T.GetPublicKeyByIdResponse>;
|
|
8
|
+
createPublicKeyInit(request: T.CreatePublicKeyRequest): Promise<UserActionChallengeResponse>;
|
|
9
|
+
createPublicKeyComplete(request: T.CreatePublicKeyRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreatePublicKeyResponse>;
|
|
10
|
+
listPublicKeys(): Promise<T.ListPublicKeysResponse>;
|
|
11
|
+
getAddressForNetwork(request: T.GetAddressForNetworkRequest): Promise<T.GetAddressForNetworkResponse>;
|
|
12
|
+
getSignatureById(request: T.GetSignatureByIdRequest): Promise<T.GetSignatureByIdResponse>;
|
|
13
|
+
createSignatureInit(request: T.CreateSignatureRequest): Promise<UserActionChallengeResponse>;
|
|
14
|
+
createSignatureComplete(request: T.CreateSignatureRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreateSignatureResponse>;
|
|
15
|
+
startWalletConnectSessionInit(request: T.StartWalletConnectSessionRequest): Promise<UserActionChallengeResponse>;
|
|
16
|
+
startWalletConnectSessionComplete(request: T.StartWalletConnectSessionRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.StartWalletConnectSessionResponse>;
|
|
17
|
+
listTransactions(request: T.ListTransactionsRequest): Promise<T.ListTransactionsResponse>;
|
|
18
|
+
createTransactionInit(request: T.CreateTransactionRequest): Promise<UserActionChallengeResponse>;
|
|
19
|
+
createTransactionComplete(request: T.CreateTransactionRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreateTransactionResponse>;
|
|
20
|
+
getTransactionById(request: T.GetTransactionByIdRequest): Promise<T.GetTransactionByIdResponse>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DelegatedPublicKeysClient = void 0;
|
|
4
|
+
const baseAuthApi_1 = require("../../baseAuthApi");
|
|
5
|
+
const fetch_1 = require("../../utils/fetch");
|
|
6
|
+
const url_1 = require("../../utils/url");
|
|
7
|
+
class DelegatedPublicKeysClient {
|
|
8
|
+
constructor(apiOptions) {
|
|
9
|
+
this.apiOptions = apiOptions;
|
|
10
|
+
}
|
|
11
|
+
async getPublicKeyById(request) {
|
|
12
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId', {
|
|
13
|
+
path: { publicKeyId: request.publicKeyId },
|
|
14
|
+
query: {},
|
|
15
|
+
});
|
|
16
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
17
|
+
method: 'GET',
|
|
18
|
+
apiOptions: this.apiOptions,
|
|
19
|
+
});
|
|
20
|
+
return response.json();
|
|
21
|
+
}
|
|
22
|
+
async createPublicKeyInit(request) {
|
|
23
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys', {
|
|
24
|
+
path: {},
|
|
25
|
+
query: {},
|
|
26
|
+
});
|
|
27
|
+
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
28
|
+
userActionHttpMethod: 'POST',
|
|
29
|
+
userActionHttpPath: path,
|
|
30
|
+
userActionPayload: JSON.stringify(request.body),
|
|
31
|
+
userActionServerKind: 'Api',
|
|
32
|
+
}, this.apiOptions);
|
|
33
|
+
return challenge;
|
|
34
|
+
}
|
|
35
|
+
async createPublicKeyComplete(request, signedChallenge) {
|
|
36
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys', {
|
|
37
|
+
path: {},
|
|
38
|
+
query: {},
|
|
39
|
+
});
|
|
40
|
+
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
41
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
42
|
+
method: 'POST',
|
|
43
|
+
body: request.body,
|
|
44
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
45
|
+
apiOptions: this.apiOptions,
|
|
46
|
+
});
|
|
47
|
+
return response.json();
|
|
48
|
+
}
|
|
49
|
+
async listPublicKeys() {
|
|
50
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys', {
|
|
51
|
+
path: {},
|
|
52
|
+
query: {},
|
|
53
|
+
});
|
|
54
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
55
|
+
method: 'GET',
|
|
56
|
+
apiOptions: this.apiOptions,
|
|
57
|
+
});
|
|
58
|
+
return response.json();
|
|
59
|
+
}
|
|
60
|
+
async getAddressForNetwork(request) {
|
|
61
|
+
var _a;
|
|
62
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId/address', {
|
|
63
|
+
path: { publicKeyId: request.publicKeyId },
|
|
64
|
+
query: (_a = request.query) !== null && _a !== void 0 ? _a : {},
|
|
65
|
+
});
|
|
66
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
67
|
+
method: 'GET',
|
|
68
|
+
apiOptions: this.apiOptions,
|
|
69
|
+
});
|
|
70
|
+
return response.json();
|
|
71
|
+
}
|
|
72
|
+
async getSignatureById(request) {
|
|
73
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId/signatures/:signatureId', {
|
|
74
|
+
path: {
|
|
75
|
+
publicKeyId: request.publicKeyId,
|
|
76
|
+
signatureId: request.signatureId,
|
|
77
|
+
},
|
|
78
|
+
query: {},
|
|
79
|
+
});
|
|
80
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
81
|
+
method: 'GET',
|
|
82
|
+
apiOptions: this.apiOptions,
|
|
83
|
+
});
|
|
84
|
+
return response.json();
|
|
85
|
+
}
|
|
86
|
+
async createSignatureInit(request) {
|
|
87
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId/signatures', {
|
|
88
|
+
path: { publicKeyId: request.publicKeyId },
|
|
89
|
+
query: {},
|
|
90
|
+
});
|
|
91
|
+
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
92
|
+
userActionHttpMethod: 'POST',
|
|
93
|
+
userActionHttpPath: path,
|
|
94
|
+
userActionPayload: JSON.stringify(request.body),
|
|
95
|
+
userActionServerKind: 'Api',
|
|
96
|
+
}, this.apiOptions);
|
|
97
|
+
return challenge;
|
|
98
|
+
}
|
|
99
|
+
async createSignatureComplete(request, signedChallenge) {
|
|
100
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId/signatures', {
|
|
101
|
+
path: { publicKeyId: request.publicKeyId },
|
|
102
|
+
query: {},
|
|
103
|
+
});
|
|
104
|
+
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
105
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
106
|
+
method: 'POST',
|
|
107
|
+
body: request.body,
|
|
108
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
109
|
+
apiOptions: this.apiOptions,
|
|
110
|
+
});
|
|
111
|
+
return response.json();
|
|
112
|
+
}
|
|
113
|
+
async startWalletConnectSessionInit(request) {
|
|
114
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId/walletconnect-session', {
|
|
115
|
+
path: { publicKeyId: request.publicKeyId },
|
|
116
|
+
query: {},
|
|
117
|
+
});
|
|
118
|
+
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
119
|
+
userActionHttpMethod: 'POST',
|
|
120
|
+
userActionHttpPath: path,
|
|
121
|
+
userActionPayload: JSON.stringify(request.body),
|
|
122
|
+
userActionServerKind: 'Api',
|
|
123
|
+
}, this.apiOptions);
|
|
124
|
+
return challenge;
|
|
125
|
+
}
|
|
126
|
+
async startWalletConnectSessionComplete(request, signedChallenge) {
|
|
127
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId/walletconnect-session', {
|
|
128
|
+
path: { publicKeyId: request.publicKeyId },
|
|
129
|
+
query: {},
|
|
130
|
+
});
|
|
131
|
+
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
132
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
133
|
+
method: 'POST',
|
|
134
|
+
body: request.body,
|
|
135
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
136
|
+
apiOptions: this.apiOptions,
|
|
137
|
+
});
|
|
138
|
+
return response.json();
|
|
139
|
+
}
|
|
140
|
+
async listTransactions(request) {
|
|
141
|
+
var _a;
|
|
142
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId/transactions', {
|
|
143
|
+
path: { publicKeyId: request.publicKeyId },
|
|
144
|
+
query: (_a = request.query) !== null && _a !== void 0 ? _a : {},
|
|
145
|
+
});
|
|
146
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
147
|
+
method: 'GET',
|
|
148
|
+
apiOptions: this.apiOptions,
|
|
149
|
+
});
|
|
150
|
+
return response.json();
|
|
151
|
+
}
|
|
152
|
+
async createTransactionInit(request) {
|
|
153
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/transactions', {
|
|
154
|
+
path: {},
|
|
155
|
+
query: {},
|
|
156
|
+
});
|
|
157
|
+
const challenge = await baseAuthApi_1.BaseAuthApi.createUserActionChallenge({
|
|
158
|
+
userActionHttpMethod: 'POST',
|
|
159
|
+
userActionHttpPath: path,
|
|
160
|
+
userActionPayload: JSON.stringify(request.body),
|
|
161
|
+
userActionServerKind: 'Api',
|
|
162
|
+
}, this.apiOptions);
|
|
163
|
+
return challenge;
|
|
164
|
+
}
|
|
165
|
+
async createTransactionComplete(request, signedChallenge) {
|
|
166
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/transactions', {
|
|
167
|
+
path: {},
|
|
168
|
+
query: {},
|
|
169
|
+
});
|
|
170
|
+
const { userAction } = await baseAuthApi_1.BaseAuthApi.signUserActionChallenge(signedChallenge, this.apiOptions);
|
|
171
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
172
|
+
method: 'POST',
|
|
173
|
+
body: request.body,
|
|
174
|
+
headers: { 'x-dfns-useraction': userAction },
|
|
175
|
+
apiOptions: this.apiOptions,
|
|
176
|
+
});
|
|
177
|
+
return response.json();
|
|
178
|
+
}
|
|
179
|
+
async getTransactionById(request) {
|
|
180
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/transactions/:transactionId', {
|
|
181
|
+
path: { transactionId: request.transactionId },
|
|
182
|
+
query: {},
|
|
183
|
+
});
|
|
184
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
185
|
+
method: 'GET',
|
|
186
|
+
apiOptions: this.apiOptions,
|
|
187
|
+
});
|
|
188
|
+
return response.json();
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
exports.DelegatedPublicKeysClient = DelegatedPublicKeysClient;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { DfnsApiClientOptions } from '../../dfnsApiClient';
|
|
2
|
+
import * as T from './types';
|
|
3
|
+
export declare class PublicKeysClient {
|
|
4
|
+
private apiOptions;
|
|
5
|
+
constructor(apiOptions: DfnsApiClientOptions);
|
|
6
|
+
getPublicKeyById(request: T.GetPublicKeyByIdRequest): Promise<T.GetPublicKeyByIdResponse>;
|
|
7
|
+
createPublicKey(request: T.CreatePublicKeyRequest): Promise<T.CreatePublicKeyResponse>;
|
|
8
|
+
listPublicKeys(): Promise<T.ListPublicKeysResponse>;
|
|
9
|
+
getAddressForNetwork(request: T.GetAddressForNetworkRequest): Promise<T.GetAddressForNetworkResponse>;
|
|
10
|
+
getSignatureById(request: T.GetSignatureByIdRequest): Promise<T.GetSignatureByIdResponse>;
|
|
11
|
+
createSignature(request: T.CreateSignatureRequest): Promise<T.CreateSignatureResponse>;
|
|
12
|
+
startWalletConnectSession(request: T.StartWalletConnectSessionRequest): Promise<T.StartWalletConnectSessionResponse>;
|
|
13
|
+
listTransactions(request: T.ListTransactionsRequest): Promise<T.ListTransactionsResponse>;
|
|
14
|
+
createTransaction(request: T.CreateTransactionRequest): Promise<T.CreateTransactionResponse>;
|
|
15
|
+
getTransactionById(request: T.GetTransactionByIdRequest): Promise<T.GetTransactionByIdResponse>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PublicKeysClient = void 0;
|
|
4
|
+
const fetch_1 = require("../../utils/fetch");
|
|
5
|
+
const url_1 = require("../../utils/url");
|
|
6
|
+
class PublicKeysClient {
|
|
7
|
+
constructor(apiOptions) {
|
|
8
|
+
this.apiOptions = apiOptions;
|
|
9
|
+
}
|
|
10
|
+
async getPublicKeyById(request) {
|
|
11
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId', {
|
|
12
|
+
path: { publicKeyId: request.publicKeyId },
|
|
13
|
+
query: {},
|
|
14
|
+
});
|
|
15
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
16
|
+
method: 'GET',
|
|
17
|
+
apiOptions: this.apiOptions,
|
|
18
|
+
});
|
|
19
|
+
return response.json();
|
|
20
|
+
}
|
|
21
|
+
async createPublicKey(request) {
|
|
22
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys', {
|
|
23
|
+
path: {},
|
|
24
|
+
query: {},
|
|
25
|
+
});
|
|
26
|
+
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
27
|
+
method: 'POST',
|
|
28
|
+
body: request.body,
|
|
29
|
+
apiOptions: this.apiOptions,
|
|
30
|
+
});
|
|
31
|
+
return response.json();
|
|
32
|
+
}
|
|
33
|
+
async listPublicKeys() {
|
|
34
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys', {
|
|
35
|
+
path: {},
|
|
36
|
+
query: {},
|
|
37
|
+
});
|
|
38
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
39
|
+
method: 'GET',
|
|
40
|
+
apiOptions: this.apiOptions,
|
|
41
|
+
});
|
|
42
|
+
return response.json();
|
|
43
|
+
}
|
|
44
|
+
async getAddressForNetwork(request) {
|
|
45
|
+
var _a;
|
|
46
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId/address', {
|
|
47
|
+
path: { publicKeyId: request.publicKeyId },
|
|
48
|
+
query: (_a = request.query) !== null && _a !== void 0 ? _a : {},
|
|
49
|
+
});
|
|
50
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
51
|
+
method: 'GET',
|
|
52
|
+
apiOptions: this.apiOptions,
|
|
53
|
+
});
|
|
54
|
+
return response.json();
|
|
55
|
+
}
|
|
56
|
+
async getSignatureById(request) {
|
|
57
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId/signatures/:signatureId', {
|
|
58
|
+
path: {
|
|
59
|
+
publicKeyId: request.publicKeyId,
|
|
60
|
+
signatureId: request.signatureId,
|
|
61
|
+
},
|
|
62
|
+
query: {},
|
|
63
|
+
});
|
|
64
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
65
|
+
method: 'GET',
|
|
66
|
+
apiOptions: this.apiOptions,
|
|
67
|
+
});
|
|
68
|
+
return response.json();
|
|
69
|
+
}
|
|
70
|
+
async createSignature(request) {
|
|
71
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId/signatures', {
|
|
72
|
+
path: { publicKeyId: request.publicKeyId },
|
|
73
|
+
query: {},
|
|
74
|
+
});
|
|
75
|
+
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
76
|
+
method: 'POST',
|
|
77
|
+
body: request.body,
|
|
78
|
+
apiOptions: this.apiOptions,
|
|
79
|
+
});
|
|
80
|
+
return response.json();
|
|
81
|
+
}
|
|
82
|
+
async startWalletConnectSession(request) {
|
|
83
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId/walletconnect-session', {
|
|
84
|
+
path: { publicKeyId: request.publicKeyId },
|
|
85
|
+
query: {},
|
|
86
|
+
});
|
|
87
|
+
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
88
|
+
method: 'POST',
|
|
89
|
+
body: request.body,
|
|
90
|
+
apiOptions: this.apiOptions,
|
|
91
|
+
});
|
|
92
|
+
return response.json();
|
|
93
|
+
}
|
|
94
|
+
async listTransactions(request) {
|
|
95
|
+
var _a;
|
|
96
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/:publicKeyId/transactions', {
|
|
97
|
+
path: { publicKeyId: request.publicKeyId },
|
|
98
|
+
query: (_a = request.query) !== null && _a !== void 0 ? _a : {},
|
|
99
|
+
});
|
|
100
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
101
|
+
method: 'GET',
|
|
102
|
+
apiOptions: this.apiOptions,
|
|
103
|
+
});
|
|
104
|
+
return response.json();
|
|
105
|
+
}
|
|
106
|
+
async createTransaction(request) {
|
|
107
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/transactions', {
|
|
108
|
+
path: {},
|
|
109
|
+
query: {},
|
|
110
|
+
});
|
|
111
|
+
const response = await (0, fetch_1.userActionFetch)(path, {
|
|
112
|
+
method: 'POST',
|
|
113
|
+
body: request.body,
|
|
114
|
+
apiOptions: this.apiOptions,
|
|
115
|
+
});
|
|
116
|
+
return response.json();
|
|
117
|
+
}
|
|
118
|
+
async getTransactionById(request) {
|
|
119
|
+
const path = (0, url_1.buildPathAndQuery)('/public-keys/transactions/:transactionId', {
|
|
120
|
+
path: { transactionId: request.transactionId },
|
|
121
|
+
query: {},
|
|
122
|
+
});
|
|
123
|
+
const response = await (0, fetch_1.simpleFetch)(path, {
|
|
124
|
+
method: 'GET',
|
|
125
|
+
apiOptions: this.apiOptions,
|
|
126
|
+
});
|
|
127
|
+
return response.json();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
exports.PublicKeysClient = PublicKeysClient;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DelegatedPublicKeysClient"), exports);
|
|
18
|
+
__exportStar(require("./PublicKeysClient"), exports);
|
|
19
|
+
__exportStar(require("./types"), exports);
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import * as PublicKeys from '../datamodel/PublicKeys';
|
|
2
|
+
export type GetPublicKeyByIdRequest = {
|
|
3
|
+
publicKeyId: string;
|
|
4
|
+
};
|
|
5
|
+
export type GetPublicKeyByIdResponse = PublicKeys.GetPublicKeyResponse;
|
|
6
|
+
export type CreatePublicKeyRequest = {
|
|
7
|
+
body: PublicKeys.CreatePublicKeyInput;
|
|
8
|
+
};
|
|
9
|
+
export type CreatePublicKeyResponse = PublicKeys.PublicKeyRecord;
|
|
10
|
+
export type ListPublicKeysResponse = {
|
|
11
|
+
items: PublicKeys.GetPublicKeyResponse[];
|
|
12
|
+
};
|
|
13
|
+
export type GetAddressForNetworkRequest = {
|
|
14
|
+
publicKeyId: string;
|
|
15
|
+
query?: {
|
|
16
|
+
network: string;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
export type GetAddressForNetworkResponse = PublicKeys.GetPublicKeyAddressResponse;
|
|
20
|
+
export type GetSignatureByIdRequest = {
|
|
21
|
+
publicKeyId: string;
|
|
22
|
+
signatureId: string;
|
|
23
|
+
};
|
|
24
|
+
export type GetSignatureByIdResponse = PublicKeys.Signature;
|
|
25
|
+
export type CreateSignatureRequest = {
|
|
26
|
+
publicKeyId: string;
|
|
27
|
+
body: PublicKeys.CreateSignatureInput;
|
|
28
|
+
};
|
|
29
|
+
export type CreateSignatureResponse = PublicKeys.SignatureResponse;
|
|
30
|
+
export type StartWalletConnectSessionRequest = {
|
|
31
|
+
publicKeyId: string;
|
|
32
|
+
body: PublicKeys.StartWalletConnectSessionInput;
|
|
33
|
+
};
|
|
34
|
+
export type StartWalletConnectSessionResponse = PublicKeys.StartWalletConnectSessionOutput;
|
|
35
|
+
export type ListTransactionsRequest = {
|
|
36
|
+
publicKeyId: string;
|
|
37
|
+
query?: {
|
|
38
|
+
assets: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
export type ListTransactionsResponse = {
|
|
42
|
+
items: PublicKeys.BroadcastedTransaction[];
|
|
43
|
+
};
|
|
44
|
+
export type CreateTransactionRequest = {
|
|
45
|
+
body: PublicKeys.CreateWalletTxInput;
|
|
46
|
+
};
|
|
47
|
+
export type CreateTransactionResponse = PublicKeys.BroadcastedTransaction;
|
|
48
|
+
export type GetTransactionByIdRequest = {
|
|
49
|
+
transactionId: string;
|
|
50
|
+
};
|
|
51
|
+
export type GetTransactionByIdResponse = PublicKeys.BroadcastedTransaction;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SignUserActionChallengeRequest, UserActionChallengeResponse } from '../../baseAuthApi';
|
|
2
|
+
import { DfnsDelegatedApiClientOptions } from '../../dfnsDelegatedApiClient';
|
|
3
|
+
import * as T from './types';
|
|
4
|
+
export declare class DelegatedWalletsClient {
|
|
5
|
+
private apiOptions;
|
|
6
|
+
constructor(apiOptions: DfnsDelegatedApiClientOptions);
|
|
7
|
+
createWalletInit(request: T.CreateWalletRequest): Promise<UserActionChallengeResponse>;
|
|
8
|
+
createWalletComplete(request: T.CreateWalletRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.CreateWalletResponse>;
|
|
9
|
+
getWallet(request: T.GetWalletRequest): Promise<T.GetWalletResponse>;
|
|
10
|
+
getWalletAssets(request: T.GetWalletAssetsRequest): Promise<T.GetWalletAssetsResponse>;
|
|
11
|
+
getWalletNfts(request: T.GetWalletNftsRequest): Promise<T.GetWalletNftsResponse>;
|
|
12
|
+
listWallets(request: T.ListWalletsRequest): Promise<T.ListWalletsResponse>;
|
|
13
|
+
getWalletHistory(request: T.GetWalletHistoryRequest): Promise<T.GetWalletHistoryResponse>;
|
|
14
|
+
transferAssetInit(request: T.TransferAssetRequest): Promise<UserActionChallengeResponse>;
|
|
15
|
+
transferAssetComplete(request: T.TransferAssetRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.TransferAssetResponse>;
|
|
16
|
+
getTransfer(request: T.GetTransferRequest): Promise<T.GetTransferResponse>;
|
|
17
|
+
listTransfers(request: T.ListTransfersRequest): Promise<T.ListTransfersResponse>;
|
|
18
|
+
broadcastTransactionInit(request: T.BroadcastTransactionRequest): Promise<UserActionChallengeResponse>;
|
|
19
|
+
broadcastTransactionComplete(request: T.BroadcastTransactionRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.BroadcastTransactionResponse>;
|
|
20
|
+
getTransaction(request: T.GetTransactionRequest): Promise<T.GetTransactionResponse>;
|
|
21
|
+
listTransactions(request: T.ListTransactionsRequest): Promise<T.ListTransactionsResponse>;
|
|
22
|
+
generateSignatureInit(request: T.GenerateSignatureRequest): Promise<UserActionChallengeResponse>;
|
|
23
|
+
generateSignatureComplete(request: T.GenerateSignatureRequest, signedChallenge: SignUserActionChallengeRequest): Promise<T.GenerateSignatureResponse>;
|
|
24
|
+
getSignature(request: T.GetSignatureRequest): Promise<T.GetSignatureResponse>;
|
|
25
|
+
listSignatures(request: T.ListSignaturesRequest): Promise<T.ListSignaturesResponse>;
|
|
26
|
+
}
|