@astrox/agent 0.0.20 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +4 -4
- package/lib/cjs/actor.d.ts +0 -126
- package/lib/cjs/actor.js +0 -207
- package/lib/cjs/actor.js.map +0 -1
- package/lib/cjs/agent/api.d.ts +0 -140
- package/lib/cjs/agent/api.js +0 -16
- package/lib/cjs/agent/api.js.map +0 -1
- package/lib/cjs/agent/http/index.d.ts +0 -49
- package/lib/cjs/agent/http/index.js +0 -355
- package/lib/cjs/agent/http/index.js.map +0 -1
- package/lib/cjs/agent/http/transforms.d.ts +0 -20
- package/lib/cjs/agent/http/transforms.js +0 -70
- package/lib/cjs/agent/http/transforms.js.map +0 -1
- package/lib/cjs/agent/http/types.d.ts +0 -77
- package/lib/cjs/agent/http/types.js +0 -24
- package/lib/cjs/agent/http/types.js.map +0 -1
- package/lib/cjs/agent/index.d.ts +0 -7
- package/lib/cjs/agent/index.js +0 -42
- package/lib/cjs/agent/index.js.map +0 -1
- package/lib/cjs/agent/proxy.d.ts +0 -85
- package/lib/cjs/agent/proxy.js +0 -159
- package/lib/cjs/agent/proxy.js.map +0 -1
- package/lib/cjs/auth.d.ts +0 -87
- package/lib/cjs/auth.js +0 -70
- package/lib/cjs/auth.js.map +0 -1
- package/lib/cjs/canisters/asset.d.ts +0 -10
- package/lib/cjs/canisters/asset.js +0 -18
- package/lib/cjs/canisters/asset.js.map +0 -1
- package/lib/cjs/canisters/asset_idl.d.ts +0 -7
- package/lib/cjs/canisters/asset_idl.js +0 -14
- package/lib/cjs/canisters/asset_idl.js.map +0 -1
- package/lib/cjs/canisters/management.d.ts +0 -33
- package/lib/cjs/canisters/management.js +0 -30
- package/lib/cjs/canisters/management.js.map +0 -1
- package/lib/cjs/canisters/management_idl.d.ts +0 -7
- package/lib/cjs/canisters/management_idl.js +0 -29
- package/lib/cjs/canisters/management_idl.js.map +0 -1
- package/lib/cjs/cbor.d.ts +0 -9
- package/lib/cjs/cbor.js +0 -138
- package/lib/cjs/cbor.js.map +0 -1
- package/lib/cjs/certificate.d.ts +0 -43
- package/lib/cjs/certificate.js +0 -227
- package/lib/cjs/certificate.js.map +0 -1
- package/lib/cjs/errors.d.ts +0 -8
- package/lib/cjs/errors.js +0 -13
- package/lib/cjs/errors.js.map +0 -1
- package/lib/cjs/index.d.ts +0 -52
- package/lib/cjs/index.js +0 -38
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/polling/index.d.ts +0 -16
- package/lib/cjs/polling/index.js +0 -81
- package/lib/cjs/polling/index.js.map +0 -1
- package/lib/cjs/polling/strategy.d.ts +0 -47
- package/lib/cjs/polling/strategy.js +0 -106
- package/lib/cjs/polling/strategy.js.map +0 -1
- package/lib/cjs/request_id.d.ts +0 -15
- package/lib/cjs/request_id.js +0 -89
- package/lib/cjs/request_id.js.map +0 -1
- package/lib/cjs/utils/bls.d.ts +0 -9
- package/lib/cjs/utils/bls.js +0 -65
- package/lib/cjs/utils/bls.js.map +0 -1
- package/lib/cjs/utils/buffer.d.ts +0 -16
- package/lib/cjs/utils/buffer.js +0 -59
- package/lib/cjs/utils/buffer.js.map +0 -1
- package/lib/cjs/vendor/bls/bls.d.ts +0 -28
- package/lib/cjs/vendor/bls/bls.js +0 -894
- package/lib/cjs/vendor/bls/bls.js.map +0 -1
- package/lib/esm/actor.d.ts +0 -126
- package/lib/esm/actor.js +0 -200
- package/lib/esm/actor.js.map +0 -1
- package/lib/esm/agent/api.d.ts +0 -140
- package/lib/esm/agent/api.js +0 -13
- package/lib/esm/agent/api.js.map +0 -1
- package/lib/esm/agent/http/index.d.ts +0 -49
- package/lib/esm/agent/http/index.js +0 -328
- package/lib/esm/agent/http/index.js.map +0 -1
- package/lib/esm/agent/http/transforms.d.ts +0 -20
- package/lib/esm/agent/http/transforms.js +0 -45
- package/lib/esm/agent/http/transforms.js.map +0 -1
- package/lib/esm/agent/http/types.d.ts +0 -77
- package/lib/esm/agent/http/types.js +0 -20
- package/lib/esm/agent/http/types.js.map +0 -1
- package/lib/esm/agent/index.d.ts +0 -7
- package/lib/esm/agent/index.js +0 -27
- package/lib/esm/agent/index.js.map +0 -1
- package/lib/esm/agent/proxy.d.ts +0 -85
- package/lib/esm/agent/proxy.js +0 -154
- package/lib/esm/agent/proxy.js.map +0 -1
- package/lib/esm/auth.d.ts +0 -87
- package/lib/esm/auth.js +0 -64
- package/lib/esm/auth.js.map +0 -1
- package/lib/esm/canisters/asset.d.ts +0 -10
- package/lib/esm/canisters/asset.js +0 -11
- package/lib/esm/canisters/asset.js.map +0 -1
- package/lib/esm/canisters/asset_idl.d.ts +0 -7
- package/lib/esm/canisters/asset_idl.js +0 -12
- package/lib/esm/canisters/asset_idl.js.map +0 -1
- package/lib/esm/canisters/management.d.ts +0 -37
- package/lib/esm/canisters/management.js +0 -23
- package/lib/esm/canisters/management.js.map +0 -1
- package/lib/esm/canisters/management_idl.d.ts +0 -7
- package/lib/esm/canisters/management_idl.js +0 -27
- package/lib/esm/canisters/management_idl.js.map +0 -1
- package/lib/esm/cbor.d.ts +0 -9
- package/lib/esm/cbor.js +0 -111
- package/lib/esm/cbor.js.map +0 -1
- package/lib/esm/certificate.d.ts +0 -43
- package/lib/esm/certificate.js +0 -200
- package/lib/esm/certificate.js.map +0 -1
- package/lib/esm/errors.d.ts +0 -8
- package/lib/esm/errors.js +0 -9
- package/lib/esm/errors.js.map +0 -1
- package/lib/esm/index.d.ts +0 -52
- package/lib/esm/index.js +0 -14
- package/lib/esm/index.js.map +0 -1
- package/lib/esm/polling/index.d.ts +0 -16
- package/lib/esm/polling/index.js +0 -57
- package/lib/esm/polling/index.js.map +0 -1
- package/lib/esm/polling/strategy.d.ts +0 -47
- package/lib/esm/polling/strategy.js +0 -95
- package/lib/esm/polling/strategy.js.map +0 -1
- package/lib/esm/request_id.d.ts +0 -15
- package/lib/esm/request_id.js +0 -81
- package/lib/esm/request_id.js.map +0 -1
- package/lib/esm/utils/bls.d.ts +0 -9
- package/lib/esm/utils/bls.js +0 -43
- package/lib/esm/utils/bls.js.map +0 -1
- package/lib/esm/utils/buffer.d.ts +0 -16
- package/lib/esm/utils/buffer.js +0 -52
- package/lib/esm/utils/buffer.js.map +0 -1
- package/lib/esm/vendor/bls/bls.d.ts +0 -28
- package/lib/esm/vendor/bls/bls.js +0 -870
- package/lib/esm/vendor/bls/bls.js.map +0 -1
package/lib/cjs/agent/proxy.d.ts
DELETED
@@ -1,85 +0,0 @@
|
|
1
|
-
import { CallOptions, QueryFields, QueryResponse, ReadStateOptions, ReadStateResponse, SubmitResponse } from '..';
|
2
|
-
import { JsonObject } from '@astrox/candid';
|
3
|
-
import { Agent } from './api';
|
4
|
-
import { Principal } from '@astrox/principal';
|
5
|
-
export declare enum ProxyMessageKind {
|
6
|
-
Error = "err",
|
7
|
-
GetPrincipal = "gp",
|
8
|
-
GetPrincipalResponse = "gpr",
|
9
|
-
Query = "q",
|
10
|
-
QueryResponse = "qr",
|
11
|
-
Call = "c",
|
12
|
-
CallResponse = "cr",
|
13
|
-
ReadState = "rs",
|
14
|
-
ReadStateResponse = "rsr",
|
15
|
-
Status = "s",
|
16
|
-
StatusResponse = "sr"
|
17
|
-
}
|
18
|
-
export interface ProxyMessageBase {
|
19
|
-
id: number;
|
20
|
-
type: ProxyMessageKind;
|
21
|
-
}
|
22
|
-
export interface ProxyMessageError extends ProxyMessageBase {
|
23
|
-
type: ProxyMessageKind.Error;
|
24
|
-
error: any;
|
25
|
-
}
|
26
|
-
export interface ProxyMessageGetPrincipal extends ProxyMessageBase {
|
27
|
-
type: ProxyMessageKind.GetPrincipal;
|
28
|
-
}
|
29
|
-
export interface ProxyMessageGetPrincipalResponse extends ProxyMessageBase {
|
30
|
-
type: ProxyMessageKind.GetPrincipalResponse;
|
31
|
-
response: string;
|
32
|
-
}
|
33
|
-
export interface ProxyMessageQuery extends ProxyMessageBase {
|
34
|
-
type: ProxyMessageKind.Query;
|
35
|
-
args: [string, QueryFields];
|
36
|
-
}
|
37
|
-
export interface ProxyMessageQueryResponse extends ProxyMessageBase {
|
38
|
-
type: ProxyMessageKind.QueryResponse;
|
39
|
-
response: QueryResponse;
|
40
|
-
}
|
41
|
-
export interface ProxyMessageCall extends ProxyMessageBase {
|
42
|
-
type: ProxyMessageKind.Call;
|
43
|
-
args: [string, CallOptions];
|
44
|
-
}
|
45
|
-
export interface ProxyMessageCallResponse extends ProxyMessageBase {
|
46
|
-
type: ProxyMessageKind.CallResponse;
|
47
|
-
response: SubmitResponse;
|
48
|
-
}
|
49
|
-
export interface ProxyMessageReadState extends ProxyMessageBase {
|
50
|
-
type: ProxyMessageKind.ReadState;
|
51
|
-
args: [string, ReadStateOptions];
|
52
|
-
}
|
53
|
-
export interface ProxyMessageReadStateResponse extends ProxyMessageBase {
|
54
|
-
type: ProxyMessageKind.ReadStateResponse;
|
55
|
-
response: ReadStateResponse;
|
56
|
-
}
|
57
|
-
export interface ProxyMessageStatus extends ProxyMessageBase {
|
58
|
-
type: ProxyMessageKind.Status;
|
59
|
-
}
|
60
|
-
export interface ProxyMessageStatusResponse extends ProxyMessageBase {
|
61
|
-
type: ProxyMessageKind.StatusResponse;
|
62
|
-
response: JsonObject;
|
63
|
-
}
|
64
|
-
export declare type ProxyMessage = ProxyMessageError | ProxyMessageGetPrincipal | ProxyMessageGetPrincipalResponse | ProxyMessageQuery | ProxyMessageQueryResponse | ProxyMessageCall | ProxyMessageReadState | ProxyMessageReadStateResponse | ProxyMessageCallResponse | ProxyMessageStatus | ProxyMessageStatusResponse;
|
65
|
-
export declare class ProxyStubAgent {
|
66
|
-
private _frontend;
|
67
|
-
private _agent;
|
68
|
-
constructor(_frontend: (msg: ProxyMessage) => void, _agent: Agent);
|
69
|
-
onmessage(msg: ProxyMessage): void;
|
70
|
-
}
|
71
|
-
export declare class ProxyAgent implements Agent {
|
72
|
-
private _backend;
|
73
|
-
private _nextId;
|
74
|
-
private _pendingCalls;
|
75
|
-
rootKey: null;
|
76
|
-
constructor(_backend: (msg: ProxyMessage) => void);
|
77
|
-
onmessage(msg: ProxyMessage): void;
|
78
|
-
getPrincipal(): Promise<Principal>;
|
79
|
-
readState(canisterId: Principal | string, fields: ReadStateOptions): Promise<ReadStateResponse>;
|
80
|
-
call(canisterId: Principal | string, fields: CallOptions): Promise<SubmitResponse>;
|
81
|
-
status(): Promise<JsonObject>;
|
82
|
-
query(canisterId: Principal | string, fields: QueryFields): Promise<QueryResponse>;
|
83
|
-
private _sendAndWait;
|
84
|
-
fetchRootKey(): Promise<ArrayBuffer>;
|
85
|
-
}
|
package/lib/cjs/agent/proxy.js
DELETED
@@ -1,159 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.ProxyAgent = exports.ProxyStubAgent = exports.ProxyMessageKind = void 0;
|
4
|
-
const principal_1 = require("@astrox/principal");
|
5
|
-
var ProxyMessageKind;
|
6
|
-
(function (ProxyMessageKind) {
|
7
|
-
ProxyMessageKind["Error"] = "err";
|
8
|
-
ProxyMessageKind["GetPrincipal"] = "gp";
|
9
|
-
ProxyMessageKind["GetPrincipalResponse"] = "gpr";
|
10
|
-
ProxyMessageKind["Query"] = "q";
|
11
|
-
ProxyMessageKind["QueryResponse"] = "qr";
|
12
|
-
ProxyMessageKind["Call"] = "c";
|
13
|
-
ProxyMessageKind["CallResponse"] = "cr";
|
14
|
-
ProxyMessageKind["ReadState"] = "rs";
|
15
|
-
ProxyMessageKind["ReadStateResponse"] = "rsr";
|
16
|
-
ProxyMessageKind["Status"] = "s";
|
17
|
-
ProxyMessageKind["StatusResponse"] = "sr";
|
18
|
-
})(ProxyMessageKind = exports.ProxyMessageKind || (exports.ProxyMessageKind = {}));
|
19
|
-
// A Stub Agent that forwards calls to another Agent implementation.
|
20
|
-
class ProxyStubAgent {
|
21
|
-
constructor(_frontend, _agent) {
|
22
|
-
this._frontend = _frontend;
|
23
|
-
this._agent = _agent;
|
24
|
-
}
|
25
|
-
onmessage(msg) {
|
26
|
-
switch (msg.type) {
|
27
|
-
case ProxyMessageKind.GetPrincipal:
|
28
|
-
this._agent.getPrincipal().then(response => {
|
29
|
-
this._frontend({
|
30
|
-
id: msg.id,
|
31
|
-
type: ProxyMessageKind.GetPrincipalResponse,
|
32
|
-
response: response.toText(),
|
33
|
-
});
|
34
|
-
});
|
35
|
-
break;
|
36
|
-
case ProxyMessageKind.Query:
|
37
|
-
this._agent.query(...msg.args).then(response => {
|
38
|
-
this._frontend({
|
39
|
-
id: msg.id,
|
40
|
-
type: ProxyMessageKind.QueryResponse,
|
41
|
-
response,
|
42
|
-
});
|
43
|
-
});
|
44
|
-
break;
|
45
|
-
case ProxyMessageKind.Call:
|
46
|
-
this._agent.call(...msg.args).then(response => {
|
47
|
-
this._frontend({
|
48
|
-
id: msg.id,
|
49
|
-
type: ProxyMessageKind.CallResponse,
|
50
|
-
response,
|
51
|
-
});
|
52
|
-
});
|
53
|
-
break;
|
54
|
-
case ProxyMessageKind.ReadState:
|
55
|
-
this._agent.readState(...msg.args).then(response => {
|
56
|
-
this._frontend({
|
57
|
-
id: msg.id,
|
58
|
-
type: ProxyMessageKind.ReadStateResponse,
|
59
|
-
response,
|
60
|
-
});
|
61
|
-
});
|
62
|
-
break;
|
63
|
-
case ProxyMessageKind.Status:
|
64
|
-
this._agent.status().then(response => {
|
65
|
-
this._frontend({
|
66
|
-
id: msg.id,
|
67
|
-
type: ProxyMessageKind.StatusResponse,
|
68
|
-
response,
|
69
|
-
});
|
70
|
-
});
|
71
|
-
break;
|
72
|
-
default:
|
73
|
-
throw new Error(`Invalid message received: ${JSON.stringify(msg)}`);
|
74
|
-
}
|
75
|
-
}
|
76
|
-
}
|
77
|
-
exports.ProxyStubAgent = ProxyStubAgent;
|
78
|
-
// An Agent that forwards calls to a backend. The calls are serialized
|
79
|
-
class ProxyAgent {
|
80
|
-
constructor(_backend) {
|
81
|
-
this._backend = _backend;
|
82
|
-
this._nextId = 0;
|
83
|
-
this._pendingCalls = new Map();
|
84
|
-
this.rootKey = null;
|
85
|
-
}
|
86
|
-
onmessage(msg) {
|
87
|
-
const id = msg.id;
|
88
|
-
const maybePromise = this._pendingCalls.get(id);
|
89
|
-
if (!maybePromise) {
|
90
|
-
throw new Error('A proxy get the same message twice...');
|
91
|
-
}
|
92
|
-
this._pendingCalls.delete(id);
|
93
|
-
const [resolve, reject] = maybePromise;
|
94
|
-
switch (msg.type) {
|
95
|
-
case ProxyMessageKind.Error:
|
96
|
-
return reject(msg.error);
|
97
|
-
case ProxyMessageKind.GetPrincipalResponse:
|
98
|
-
case ProxyMessageKind.CallResponse:
|
99
|
-
case ProxyMessageKind.QueryResponse:
|
100
|
-
case ProxyMessageKind.ReadStateResponse:
|
101
|
-
case ProxyMessageKind.StatusResponse:
|
102
|
-
return resolve(msg.response);
|
103
|
-
default:
|
104
|
-
throw new Error(`Invalid message being sent to ProxyAgent: ${JSON.stringify(msg)}`);
|
105
|
-
}
|
106
|
-
}
|
107
|
-
async getPrincipal() {
|
108
|
-
return this._sendAndWait({
|
109
|
-
id: this._nextId++,
|
110
|
-
type: ProxyMessageKind.GetPrincipal,
|
111
|
-
}).then(principal => {
|
112
|
-
if (typeof principal !== 'string') {
|
113
|
-
throw new Error('Invalid principal received.');
|
114
|
-
}
|
115
|
-
return principal_1.Principal.fromText(principal);
|
116
|
-
});
|
117
|
-
}
|
118
|
-
readState(canisterId, fields) {
|
119
|
-
return this._sendAndWait({
|
120
|
-
id: this._nextId++,
|
121
|
-
type: ProxyMessageKind.ReadState,
|
122
|
-
args: [canisterId.toString(), fields],
|
123
|
-
});
|
124
|
-
}
|
125
|
-
call(canisterId, fields) {
|
126
|
-
return this._sendAndWait({
|
127
|
-
id: this._nextId++,
|
128
|
-
type: ProxyMessageKind.Call,
|
129
|
-
args: [canisterId.toString(), fields],
|
130
|
-
});
|
131
|
-
}
|
132
|
-
status() {
|
133
|
-
return this._sendAndWait({
|
134
|
-
id: this._nextId++,
|
135
|
-
type: ProxyMessageKind.Status,
|
136
|
-
});
|
137
|
-
}
|
138
|
-
query(canisterId, fields) {
|
139
|
-
return this._sendAndWait({
|
140
|
-
id: this._nextId++,
|
141
|
-
type: ProxyMessageKind.Query,
|
142
|
-
args: [canisterId.toString(), fields],
|
143
|
-
});
|
144
|
-
}
|
145
|
-
async _sendAndWait(msg) {
|
146
|
-
return new Promise((resolve, reject) => {
|
147
|
-
this._pendingCalls.set(msg.id, [resolve, reject]);
|
148
|
-
this._backend(msg);
|
149
|
-
});
|
150
|
-
}
|
151
|
-
async fetchRootKey() {
|
152
|
-
// Hex-encoded version of the replica root key
|
153
|
-
const rootKey = (await this.status()).root_key;
|
154
|
-
this.rootKey = rootKey;
|
155
|
-
return rootKey;
|
156
|
-
}
|
157
|
-
}
|
158
|
-
exports.ProxyAgent = ProxyAgent;
|
159
|
-
//# sourceMappingURL=proxy.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"proxy.js","sourceRoot":"","sources":["../../../src/agent/proxy.ts"],"names":[],"mappings":";;;AAUA,iDAA8C;AAE9C,IAAY,gBAYX;AAZD,WAAY,gBAAgB;IAC1B,iCAAa,CAAA;IACb,uCAAmB,CAAA;IACnB,gDAA4B,CAAA;IAC5B,+BAAW,CAAA;IACX,wCAAoB,CAAA;IACpB,8BAAU,CAAA;IACV,uCAAmB,CAAA;IACnB,oCAAgB,CAAA;IAChB,6CAAyB,CAAA;IACzB,gCAAY,CAAA;IACZ,yCAAqB,CAAA;AACvB,CAAC,EAZW,gBAAgB,GAAhB,wBAAgB,KAAhB,wBAAgB,QAY3B;AAyED,oEAAoE;AACpE,MAAa,cAAc;IACzB,YAAoB,SAAsC,EAAU,MAAa;QAA7D,cAAS,GAAT,SAAS,CAA6B;QAAU,WAAM,GAAN,MAAM,CAAO;IAAG,CAAC;IAE9E,SAAS,CAAC,GAAiB;QAChC,QAAQ,GAAG,CAAC,IAAI,EAAE;YAChB,KAAK,gBAAgB,CAAC,YAAY;gBAChC,IAAI,CAAC,MAAM,CAAC,YAAY,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,E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5B,CAAC;IAEM,KAAK,CAAC,UAA8B,EAAE,MAAmB;QAC9D,OAAO,IAAI,CAAC,YAAY,CAAC;YACvB,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE;YAClB,IAAI,EAAE,gBAAgB,CAAC,KAAK;YAC5B,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,EAAE,EAAE,MAAM,CAAC;SACtC,CAA2B,CAAC;IAC/B,CAAC;IAEO,KAAK,CAAC,YAAY,CAAC,GAAiB;QAC1C,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YACrC,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;YAElD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,KAAK,CAAC,YAAY;QACvB,8CAA8C;QAC9C,MAAM,OAAO,GAAI,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAS,CAAC,QAAQ,CAAC;QACxD,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,OAAO,OAAO,CAAC;IACjB,CAAC;CACF;AA5FD,gCA4FC"}
|
package/lib/cjs/auth.d.ts
DELETED
@@ -1,87 +0,0 @@
|
|
1
|
-
import { Principal } from '@astrox/principal';
|
2
|
-
import { HttpAgentRequest } from './agent/http/types';
|
3
|
-
/**
|
4
|
-
* A Key Pair, containing a secret and public key.
|
5
|
-
*/
|
6
|
-
export interface KeyPair {
|
7
|
-
secretKey: ArrayBuffer;
|
8
|
-
publicKey: PublicKey;
|
9
|
-
}
|
10
|
-
/**
|
11
|
-
* A public key that is DER encoded. This is a branded ArrayBuffer.
|
12
|
-
*/
|
13
|
-
export declare type DerEncodedPublicKey = ArrayBuffer & {
|
14
|
-
__derEncodedPublicKey__: void;
|
15
|
-
};
|
16
|
-
/**
|
17
|
-
* A signature array buffer.
|
18
|
-
*/
|
19
|
-
export declare type Signature = ArrayBuffer & {
|
20
|
-
__signature__: void;
|
21
|
-
};
|
22
|
-
/**
|
23
|
-
* A Public Key implementation.
|
24
|
-
*/
|
25
|
-
export interface PublicKey {
|
26
|
-
toDer(): DerEncodedPublicKey;
|
27
|
-
}
|
28
|
-
/**
|
29
|
-
* A General Identity object. This does not have to be a private key (for example,
|
30
|
-
* the Anonymous identity), but it must be able to transform request.
|
31
|
-
*/
|
32
|
-
export interface Identity {
|
33
|
-
/**
|
34
|
-
* Get the principal represented by this identity. Normally should be a
|
35
|
-
* `Principal.selfAuthenticating()`.
|
36
|
-
*/
|
37
|
-
getPrincipal(): Principal;
|
38
|
-
/**
|
39
|
-
* Transform a request into a signed version of the request. This is done last
|
40
|
-
* after the transforms on the body of a request. The returned object can be
|
41
|
-
* anything, but must be serializable to CBOR.
|
42
|
-
*/
|
43
|
-
transformRequest(request: HttpAgentRequest): Promise<unknown>;
|
44
|
-
}
|
45
|
-
/**
|
46
|
-
* An Identity that can sign blobs.
|
47
|
-
*/
|
48
|
-
export declare abstract class SignIdentity implements Identity {
|
49
|
-
protected _principal: Principal | undefined;
|
50
|
-
/**
|
51
|
-
* Returns the public key that would match this identity's signature.
|
52
|
-
*/
|
53
|
-
abstract getPublicKey(): PublicKey;
|
54
|
-
/**
|
55
|
-
* Signs a blob of data, with this identity's private key.
|
56
|
-
*/
|
57
|
-
abstract sign(blob: ArrayBuffer): Promise<Signature>;
|
58
|
-
/**
|
59
|
-
* Get the principal represented by this identity. Normally should be a
|
60
|
-
* `Principal.selfAuthenticating()`.
|
61
|
-
*/
|
62
|
-
getPrincipal(): Principal;
|
63
|
-
/**
|
64
|
-
* Transform a request into a signed version of the request. This is done last
|
65
|
-
* after the transforms on the body of a request. The returned object can be
|
66
|
-
* anything, but must be serializable to CBOR.
|
67
|
-
* @param request - internet computer request to transform
|
68
|
-
*/
|
69
|
-
transformRequest(request: HttpAgentRequest): Promise<unknown>;
|
70
|
-
}
|
71
|
-
export declare class AnonymousIdentity implements Identity {
|
72
|
-
getPrincipal(): Principal;
|
73
|
-
transformRequest(request: HttpAgentRequest): Promise<unknown>;
|
74
|
-
}
|
75
|
-
export interface AnonymousIdentityDescriptor {
|
76
|
-
type: 'AnonymousIdentity';
|
77
|
-
}
|
78
|
-
export interface PublicKeyIdentityDescriptor {
|
79
|
-
type: 'PublicKeyIdentity';
|
80
|
-
publicKey: string;
|
81
|
-
}
|
82
|
-
export declare type IdentityDescriptor = AnonymousIdentityDescriptor | PublicKeyIdentityDescriptor;
|
83
|
-
/**
|
84
|
-
* Create an IdentityDescriptor from a @astrox/authentication Identity
|
85
|
-
* @param identity - identity describe in returned descriptor
|
86
|
-
*/
|
87
|
-
export declare function createIdentityDescriptor(identity: SignIdentity | AnonymousIdentity): IdentityDescriptor;
|
package/lib/cjs/auth.js
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
3
|
-
var t = {};
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
5
|
-
t[p] = s[p];
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
9
|
-
t[p[i]] = s[p[i]];
|
10
|
-
}
|
11
|
-
return t;
|
12
|
-
};
|
13
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
14
|
-
exports.createIdentityDescriptor = exports.AnonymousIdentity = exports.SignIdentity = void 0;
|
15
|
-
const principal_1 = require("@astrox/principal");
|
16
|
-
const request_id_1 = require("./request_id");
|
17
|
-
const buffer_1 = require("./utils/buffer");
|
18
|
-
const domainSeparator = new TextEncoder().encode('\x0Aic-request');
|
19
|
-
/**
|
20
|
-
* An Identity that can sign blobs.
|
21
|
-
*/
|
22
|
-
class SignIdentity {
|
23
|
-
/**
|
24
|
-
* Get the principal represented by this identity. Normally should be a
|
25
|
-
* `Principal.selfAuthenticating()`.
|
26
|
-
*/
|
27
|
-
getPrincipal() {
|
28
|
-
if (!this._principal) {
|
29
|
-
this._principal = principal_1.Principal.selfAuthenticating(new Uint8Array(this.getPublicKey().toDer()));
|
30
|
-
}
|
31
|
-
return this._principal;
|
32
|
-
}
|
33
|
-
/**
|
34
|
-
* Transform a request into a signed version of the request. This is done last
|
35
|
-
* after the transforms on the body of a request. The returned object can be
|
36
|
-
* anything, but must be serializable to CBOR.
|
37
|
-
* @param request - internet computer request to transform
|
38
|
-
*/
|
39
|
-
async transformRequest(request) {
|
40
|
-
const { body } = request, fields = __rest(request, ["body"]);
|
41
|
-
const requestId = await request_id_1.requestIdOf(body);
|
42
|
-
return Object.assign(Object.assign({}, fields), { body: {
|
43
|
-
content: body,
|
44
|
-
sender_pubkey: this.getPublicKey().toDer(),
|
45
|
-
sender_sig: await this.sign(buffer_1.concat(domainSeparator, requestId)),
|
46
|
-
} });
|
47
|
-
}
|
48
|
-
}
|
49
|
-
exports.SignIdentity = SignIdentity;
|
50
|
-
class AnonymousIdentity {
|
51
|
-
getPrincipal() {
|
52
|
-
return principal_1.Principal.anonymous();
|
53
|
-
}
|
54
|
-
async transformRequest(request) {
|
55
|
-
return Object.assign(Object.assign({}, request), { body: { content: request.body } });
|
56
|
-
}
|
57
|
-
}
|
58
|
-
exports.AnonymousIdentity = AnonymousIdentity;
|
59
|
-
/**
|
60
|
-
* Create an IdentityDescriptor from a @astrox/authentication Identity
|
61
|
-
* @param identity - identity describe in returned descriptor
|
62
|
-
*/
|
63
|
-
function createIdentityDescriptor(identity) {
|
64
|
-
const identityIndicator = 'getPublicKey' in identity
|
65
|
-
? { type: 'PublicKeyIdentity', publicKey: buffer_1.toHex(identity.getPublicKey().toDer()) }
|
66
|
-
: { type: 'AnonymousIdentity' };
|
67
|
-
return identityIndicator;
|
68
|
-
}
|
69
|
-
exports.createIdentityDescriptor = createIdentityDescriptor;
|
70
|
-
//# sourceMappingURL=auth.js.map
|
package/lib/cjs/auth.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"auth.js","sourceRoot":"","sources":["../../src/auth.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,iDAA8C;AAE9C,6CAA2C;AAC3C,2CAA+C;AAE/C,MAAM,eAAe,GAAG,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AA+CnE;;GAEG;AACH,MAAsB,YAAY;IAahC;;;OAGG;IACI,YAAY;QACjB,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB,IAAI,CAAC,UAAU,GAAG,qBAAS,CAAC,kBAAkB,CAAC,IAAI,UAAU,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;SAC7F;QACD,OAAO,IAAI,CAAC,UAAU,CAAC;IACzB,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,gBAAgB,CAAC,OAAyB;QACrD,MAAM,EAAE,IAAI,KAAgB,OAAO,EAAlB,MAAM,UAAK,OAAO,EAA7B,QAAmB,CAAU,CAAC;QACpC,MAAM,SAAS,GAAG,MAAM,wBAAW,CAAC,IAAI,CAAC,CAAC;QAC1C,uCACK,MAAM,KACT,IAAI,EAAE;gBACJ,OAAO,EAAE,IAAI;gBACb,aAAa,EAAE,IAAI,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE;gBAC1C,UAAU,EAAE,MAAM,IAAI,CAAC,IAAI,CAAC,eAAM,CAAC,eAAe,EAAE,SAAS,CAAC,CAAC;aAChE,IACD;IACJ,CAAC;CACF;AA1CD,oCA0CC;AAED,MAAa,iBAAiB;IACrB,YAAY;QACjB,OAAO,qBAAS,CAAC,SAAS,EAAE,CAAC;IAC/B,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,OAAyB;QACrD,uCACK,OAAO,KACV,IAAI,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,IAC/B;IACJ,CAAC;CACF;AAXD,8CAWC;AAuBD;;;GAGG;AACH,SAAgB,wBAAwB,CACtC,QAA0C;IAE1C,MAAM,iBAAiB,GACrB,cAAc,IAAI,QAAQ;QACxB,CAAC,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,SAAS,EAAE,cAAK,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC,KAAK,EAAE,CAAC,EAAE;QAClF,CAAC,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,CAAC;IACpC,OAAO,iBAAiB,CAAC;AAC3B,CAAC;AARD,4DAQC"}
|
@@ -1,10 +0,0 @@
|
|
1
|
-
import { ActorConfig, ActorSubclass } from '../actor';
|
2
|
-
export interface AssetCanisterRecord {
|
3
|
-
store(path: string, content: number[]): Promise<void>;
|
4
|
-
retrieve(path: string): Promise<number[]>;
|
5
|
-
}
|
6
|
-
/**
|
7
|
-
* Create a management canister actor.
|
8
|
-
* @param config
|
9
|
-
*/
|
10
|
-
export declare function createAssetCanisterActor(config: ActorConfig): ActorSubclass<AssetCanisterRecord>;
|
@@ -1,18 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.createAssetCanisterActor = void 0;
|
7
|
-
const actor_1 = require("../actor");
|
8
|
-
const asset_idl_1 = __importDefault(require("./asset_idl"));
|
9
|
-
/* tslint:enable */
|
10
|
-
/**
|
11
|
-
* Create a management canister actor.
|
12
|
-
* @param config
|
13
|
-
*/
|
14
|
-
function createAssetCanisterActor(config) {
|
15
|
-
return actor_1.Actor.createActor(asset_idl_1.default, config);
|
16
|
-
}
|
17
|
-
exports.createAssetCanisterActor = createAssetCanisterActor;
|
18
|
-
//# sourceMappingURL=asset.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"asset.js","sourceRoot":"","sources":["../../../src/canisters/asset.ts"],"names":[],"mappings":";;;;;;AAAA,oCAAyE;AACzE,4DAAwC;AAOxC,mBAAmB;AAEnB;;;GAGG;AACH,SAAgB,wBAAwB,CAAC,MAAmB;IAC1D,OAAO,aAAK,CAAC,WAAW,CAAsB,mBAAa,EAAE,MAAM,CAAC,CAAC;AACvE,CAAC;AAFD,4DAEC"}
|
@@ -1,14 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
/**
|
4
|
-
* This file is generated from the candid for asset management.
|
5
|
-
*/
|
6
|
-
/* tslint:disable */
|
7
|
-
// @ts-ignore
|
8
|
-
exports.default = ({ IDL }) => {
|
9
|
-
return IDL.Service({
|
10
|
-
retrieve: IDL.Func([IDL.Text], [IDL.Vec(IDL.Nat8)], ['query']),
|
11
|
-
store: IDL.Func([IDL.Text, IDL.Vec(IDL.Nat8)], [], []),
|
12
|
-
});
|
13
|
-
};
|
14
|
-
//# sourceMappingURL=asset_idl.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"asset_idl.js","sourceRoot":"","sources":["../../../src/canisters/asset_idl.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,oBAAoB;AACpB,aAAa;AACb,kBAAe,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IACzB,OAAO,GAAG,CAAC,OAAO,CAAC;QACjB,QAAQ,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC;QAC9D,KAAK,EAAE,GAAG,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,CAAC;KACvD,CAAC,CAAC;AACL,CAAC,CAAC"}
|
@@ -1,33 +0,0 @@
|
|
1
|
-
import { ActorMethod, ActorSubclass, CallConfig } from '../actor';
|
2
|
-
import { Principal } from '@astrox/principal';
|
3
|
-
export interface CanisterSettings {
|
4
|
-
controller: [] | [Principal];
|
5
|
-
compute_allocation: [] | [bigint];
|
6
|
-
memory_allocation: [] | [bigint];
|
7
|
-
freezing_threshold: [] | [bigint];
|
8
|
-
}
|
9
|
-
export interface ManagementCanisterRecord {
|
10
|
-
provisional_create_canister_with_cycles: ActorMethod<[{
|
11
|
-
amount: [] | [number];
|
12
|
-
settings: [] | [CanisterSettings];
|
13
|
-
}], {
|
14
|
-
canister_id: Principal;
|
15
|
-
}>;
|
16
|
-
install_code: ActorMethod<[{
|
17
|
-
mode: {
|
18
|
-
install: null;
|
19
|
-
} | {
|
20
|
-
reinstall: null;
|
21
|
-
} | {
|
22
|
-
upgrade: null;
|
23
|
-
};
|
24
|
-
canister_id: Principal;
|
25
|
-
wasm_module: number[];
|
26
|
-
arg: number[];
|
27
|
-
}], void>;
|
28
|
-
}
|
29
|
-
/**
|
30
|
-
* Create a management canister actor.
|
31
|
-
* @param config
|
32
|
-
*/
|
33
|
-
export declare function getManagementCanister(config: CallConfig): ActorSubclass<ManagementCanisterRecord>;
|
@@ -1,30 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
-
};
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.getManagementCanister = void 0;
|
7
|
-
const actor_1 = require("../actor");
|
8
|
-
const principal_1 = require("@astrox/principal");
|
9
|
-
const management_idl_1 = __importDefault(require("./management_idl"));
|
10
|
-
/* tslint:enable */
|
11
|
-
/**
|
12
|
-
* Create a management canister actor.
|
13
|
-
* @param config
|
14
|
-
*/
|
15
|
-
function getManagementCanister(config) {
|
16
|
-
function transform(methodName, args, callConfig) {
|
17
|
-
const first = args[0];
|
18
|
-
let effectiveCanisterId = principal_1.Principal.fromHex('');
|
19
|
-
if (first && typeof first === 'object' && first.canister_id) {
|
20
|
-
effectiveCanisterId = principal_1.Principal.from(first.canister_id);
|
21
|
-
}
|
22
|
-
return { effectiveCanisterId };
|
23
|
-
}
|
24
|
-
return actor_1.Actor.createActor(management_idl_1.default, Object.assign(Object.assign(Object.assign({}, config), { canisterId: principal_1.Principal.fromHex('') }), {
|
25
|
-
callTransform: transform,
|
26
|
-
queryTransform: transform,
|
27
|
-
}));
|
28
|
-
}
|
29
|
-
exports.getManagementCanister = getManagementCanister;
|
30
|
-
//# sourceMappingURL=management.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"management.js","sourceRoot":"","sources":["../../../src/canisters/management.ts"],"names":[],"mappings":";;;;;;AAAA,oCAAyE;AACzE,iDAA8C;AAC9C,sEAAqD;AAgCrD,mBAAmB;AAEnB;;;GAGG;AACH,SAAgB,qBAAqB,CAAC,MAAkB;IACtD,SAAS,SAAS,CAAC,UAAkB,EAAE,IAAe,EAAE,UAAsB;QAC5E,MAAM,KAAK,GAAG,IAAI,CAAC,CAAC,CAAQ,CAAC;QAC7B,IAAI,mBAAmB,GAAG,qBAAS,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAChD,IAAI,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,WAAW,EAAE;YAC3D,mBAAmB,GAAG,qBAAS,CAAC,IAAI,CAAC,KAAK,CAAC,WAAsB,CAAC,CAAC;SACpE;QACD,OAAO,EAAE,mBAAmB,EAAE,CAAC;IACjC,CAAC;IAED,OAAO,aAAK,CAAC,WAAW,CAA2B,wBAAqB,gDACnE,MAAM,KACT,UAAU,EAAE,qBAAS,CAAC,OAAO,CAAC,EAAE,CAAC,KAC9B;QACD,aAAa,EAAE,SAAS;QACxB,cAAc,EAAE,SAAS;KAC1B,EACD,CAAC;AACL,CAAC;AAlBD,sDAkBC"}
|
@@ -1,29 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
/**
|
4
|
-
* This file is generated from the candid for asset management.
|
5
|
-
*/
|
6
|
-
/* tslint:disable */
|
7
|
-
// @ts-ignore
|
8
|
-
exports.default = ({ IDL }) => {
|
9
|
-
const canister_id = IDL.Principal;
|
10
|
-
const wasm_module = IDL.Vec(IDL.Nat8);
|
11
|
-
const CanisterSettings = IDL.Record({
|
12
|
-
compute_allocation: IDL.Opt(IDL.Nat),
|
13
|
-
memory_allocation: IDL.Opt(IDL.Nat),
|
14
|
-
});
|
15
|
-
return IDL.Service({
|
16
|
-
provisional_create_canister_with_cycles: IDL.Func([IDL.Record({ amount: IDL.Opt(IDL.Nat), settings: IDL.Opt(CanisterSettings) })], [IDL.Record({ canister_id: canister_id })], []),
|
17
|
-
create_canister: IDL.Func([], [IDL.Record({ canister_id: canister_id })], []),
|
18
|
-
install_code: IDL.Func([
|
19
|
-
IDL.Record({
|
20
|
-
mode: IDL.Variant({ install: IDL.Null, reinstall: IDL.Null, upgrade: IDL.Null }),
|
21
|
-
canister_id: canister_id,
|
22
|
-
wasm_module: wasm_module,
|
23
|
-
arg: IDL.Vec(IDL.Nat8),
|
24
|
-
}),
|
25
|
-
], [], []),
|
26
|
-
set_controller: IDL.Func([IDL.Record({ canister_id: canister_id, new_controller: IDL.Principal })], [], []),
|
27
|
-
});
|
28
|
-
};
|
29
|
-
//# sourceMappingURL=management_idl.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"management_idl.js","sourceRoot":"","sources":["../../../src/canisters/management_idl.ts"],"names":[],"mappings":";;AAAA;;GAEG;AACH,oBAAoB;AACpB,aAAa;AACb,kBAAe,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE;IACzB,MAAM,WAAW,GAAG,GAAG,CAAC,SAA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