@astrox/connection 0.0.20 → 0.0.29
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/README.md +22 -10
- package/lib/cjs/canisters/internet_identity_idl.js +2 -1
- package/lib/cjs/canisters/internet_identity_idl.js.map +1 -1
- package/lib/cjs/canisters/ledger.idl.js +2 -1
- package/lib/cjs/canisters/ledger.idl.js.map +1 -1
- package/lib/cjs/canisters/me.idl.js +2 -1
- package/lib/cjs/canisters/me.idl.js.map +1 -1
- package/lib/cjs/canisters/nns-dapp-cert.idl.js +2 -1
- package/lib/cjs/canisters/nns-dapp-cert.idl.js.map +1 -1
- package/lib/cjs/canisters/nns-dapp.idl.js +2 -1
- package/lib/cjs/canisters/nns-dapp.idl.js.map +1 -1
- package/lib/cjs/connections/baseConnection.js +5 -3
- package/lib/cjs/connections/baseConnection.js.map +1 -1
- package/lib/cjs/connections/ledgerConnection.js +7 -7
- package/lib/cjs/connections/ledgerConnection.js.map +1 -1
- package/lib/cjs/connections/nnsConnection.js +3 -3
- package/lib/cjs/connections/nnsConnection.js.map +1 -1
- package/lib/cjs/ic/icAuthClient.js +6 -5
- package/lib/cjs/ic/icAuthClient.js.map +1 -1
- package/lib/cjs/ic/icConnect.d.ts +1 -0
- package/lib/cjs/ic/icConnect.js +35 -37
- package/lib/cjs/ic/icConnect.js.map +1 -1
- package/lib/cjs/ic/icWindow.d.ts +1 -0
- package/lib/cjs/ic/icWindow.js +7 -3
- package/lib/cjs/ic/icWindow.js.map +1 -1
- package/lib/cjs/ic/index.js +1 -0
- package/lib/cjs/ic/index.js.map +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/cjs/types/index.d.ts +1 -1
- package/lib/cjs/utils/converter.js +42 -25
- package/lib/cjs/utils/converter.js.map +1 -1
- package/lib/cjs/utils/index.js +1 -1
- package/lib/esm/connections/baseConnection.js.map +1 -1
- package/lib/esm/connections/ledgerConnection.js.map +1 -1
- package/lib/esm/ic/icAuthClient.js +2 -1
- package/lib/esm/ic/icAuthClient.js.map +1 -1
- package/lib/esm/ic/icConnect.d.ts +1 -0
- package/lib/esm/ic/icConnect.js +35 -37
- package/lib/esm/ic/icConnect.js.map +1 -1
- package/lib/esm/ic/icWindow.d.ts +1 -0
- package/lib/esm/ic/icWindow.js +7 -3
- package/lib/esm/ic/icWindow.js.map +1 -1
- package/lib/esm/types/index.d.ts +1 -1
- package/lib/esm/utils/converter.js.map +1 -1
- package/lib/tsconfig-cjs.tsbuildinfo +1 -2839
- package/lib/tsconfig.tsbuildinfo +1 -2838
- package/package.json +2 -2
- package/lib/cjs/ic/types.d.ts +0 -129
- package/lib/cjs/ic/types.js +0 -17
- package/lib/cjs/ic/types.js.map +0 -1
- package/lib/esm/ic/types.d.ts +0 -129
- package/lib/esm/ic/types.js +0 -14
- package/lib/esm/ic/types.js.map +0 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@astrox/connection",
|
3
|
-
"version": "0.0.
|
3
|
+
"version": "0.0.29",
|
4
4
|
"author": "AstroX",
|
5
5
|
"license": "Apache-2.0",
|
6
6
|
"description": "JavaScript and TypeScript library to work with candid interfaces",
|
@@ -49,5 +49,5 @@
|
|
49
49
|
"@types/crc": "^3.4.0",
|
50
50
|
"crc": "^3.8.0"
|
51
51
|
},
|
52
|
-
"gitHead": "
|
52
|
+
"gitHead": "55ae0b67fbd1658ffcc17d504ce2eba5e2a5f155"
|
53
53
|
}
|
package/lib/cjs/ic/types.d.ts
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
import { SignIdentity } from '@dfinity/agent';
|
2
|
-
import { Principal } from '@dfinity/principal';
|
3
|
-
import { IC } from './icConnect';
|
4
|
-
import { AccountIdentifier } from '../utils/common/types';
|
5
|
-
import { SendOpts } from '../connections/ledgerConnection';
|
6
|
-
/**
|
7
|
-
* List of options for creating an {@link AuthClient}.
|
8
|
-
*/
|
9
|
-
export interface AuthClientCreateOptions {
|
10
|
-
/**
|
11
|
-
* An identity to use as the base
|
12
|
-
*/
|
13
|
-
identity?: SignIdentity;
|
14
|
-
/**
|
15
|
-
* Optional storage with get, set, and remove. Uses SessionStorage by default
|
16
|
-
*/
|
17
|
-
storage?: AuthClientStorage;
|
18
|
-
appId?: string;
|
19
|
-
idpWindowOption?: string;
|
20
|
-
}
|
21
|
-
export interface AuthClientLoginOptions extends AuthClientCreateOptions {
|
22
|
-
/**
|
23
|
-
* Identity provider. By default, use the identity service.
|
24
|
-
*/
|
25
|
-
identityProvider?: string | URL;
|
26
|
-
permissions?: PermissionsType[];
|
27
|
-
/**
|
28
|
-
* Experiation of the authentication
|
29
|
-
*/
|
30
|
-
maxTimeToLive?: bigint;
|
31
|
-
/**
|
32
|
-
* Callback once login has completed
|
33
|
-
*/
|
34
|
-
onSuccess?: () => void | Promise<void>;
|
35
|
-
/**
|
36
|
-
* Callback in case authentication fails
|
37
|
-
*/
|
38
|
-
onError?: (error?: string) => void;
|
39
|
-
/**
|
40
|
-
* Callback once is authenticated
|
41
|
-
*/
|
42
|
-
onAuthenticated?: (ic: IC) => void | Promise<void>;
|
43
|
-
}
|
44
|
-
export interface TransactionOptions {
|
45
|
-
/**
|
46
|
-
* Identity provider. By default, use the identity service.
|
47
|
-
*/
|
48
|
-
walletProvider?: string | URL;
|
49
|
-
from: AccountIdentifier;
|
50
|
-
to: AccountIdentifier;
|
51
|
-
amount: bigint;
|
52
|
-
sendOpts: SendOpts;
|
53
|
-
/**
|
54
|
-
* Callback once login has completed
|
55
|
-
*/
|
56
|
-
onSuccess?: () => void | Promise<void>;
|
57
|
-
/**
|
58
|
-
* Callback in case authentication fails
|
59
|
-
*/
|
60
|
-
onError?: (error?: string) => void;
|
61
|
-
}
|
62
|
-
/**
|
63
|
-
* Interface for persisting user authentication data
|
64
|
-
*/
|
65
|
-
export interface AuthClientStorage {
|
66
|
-
get(key: string): Promise<string | null>;
|
67
|
-
set(key: string, value: string): Promise<void>;
|
68
|
-
remove(key: string): Promise<void>;
|
69
|
-
}
|
70
|
-
export interface InternetIdentityAuthRequest {
|
71
|
-
kind: 'authorize-client';
|
72
|
-
sessionPublicKey: Uint8Array;
|
73
|
-
permissions?: PermissionsType[];
|
74
|
-
maxTimeToLive?: bigint;
|
75
|
-
appId?: string;
|
76
|
-
}
|
77
|
-
export interface DelegationResult {
|
78
|
-
delegations: {
|
79
|
-
delegation: {
|
80
|
-
pubkey: Uint8Array;
|
81
|
-
expiration: bigint;
|
82
|
-
targets?: Principal[];
|
83
|
-
};
|
84
|
-
signature: Uint8Array;
|
85
|
-
}[];
|
86
|
-
userPublicKey: Uint8Array;
|
87
|
-
}
|
88
|
-
export interface MeAuthResponseSuccess {
|
89
|
-
kind: 'authorize-client-success';
|
90
|
-
identity: DelegationResult;
|
91
|
-
wallet?: string;
|
92
|
-
}
|
93
|
-
export interface IIAuthResponseSuccess extends DelegationResult {
|
94
|
-
kind: 'authorize-client-success';
|
95
|
-
}
|
96
|
-
export declare type AuthResponseSuccess = MeAuthResponseSuccess | IIAuthResponseSuccess;
|
97
|
-
export declare type EventHandler = (event: MessageEvent) => Promise<void>;
|
98
|
-
export declare enum PermissionsType {
|
99
|
-
identity = "permissions-identity",
|
100
|
-
wallet = "permissions-wallet"
|
101
|
-
}
|
102
|
-
export declare type ConnectOptions = AuthClientLoginOptions;
|
103
|
-
export declare enum TransactionMessageKind {
|
104
|
-
client = "transaction-client",
|
105
|
-
ready = "transaction-ready",
|
106
|
-
success = "transaction-client-success",
|
107
|
-
fail = "transaction-client-failure"
|
108
|
-
}
|
109
|
-
export interface TransactionReadyMessage {
|
110
|
-
kind: TransactionMessageKind.ready;
|
111
|
-
}
|
112
|
-
export interface TransactionResponseFailure {
|
113
|
-
kind: TransactionMessageKind.fail;
|
114
|
-
text: string;
|
115
|
-
}
|
116
|
-
export interface TransactionResponseSuccess {
|
117
|
-
kind: TransactionMessageKind.success;
|
118
|
-
}
|
119
|
-
export declare type TransactionResponseMessage = TransactionReadyMessage | TransactionResponse;
|
120
|
-
export declare type TransactionResponse = TransactionResponseSuccess | TransactionResponseFailure;
|
121
|
-
export interface AuthReadyMessage {
|
122
|
-
kind: 'authorize-ready';
|
123
|
-
}
|
124
|
-
export interface AuthResponseFailure {
|
125
|
-
kind: 'authorize-client-failure';
|
126
|
-
text: string;
|
127
|
-
}
|
128
|
-
export declare type IdentityServiceResponseMessage = AuthReadyMessage | AuthResponse;
|
129
|
-
export declare type AuthResponse = AuthResponseSuccess | AuthResponseFailure;
|
package/lib/cjs/ic/types.js
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.TransactionMessageKind = exports.PermissionsType = void 0;
|
4
|
-
var PermissionsType;
|
5
|
-
(function (PermissionsType) {
|
6
|
-
PermissionsType["identity"] = "permissions-identity";
|
7
|
-
PermissionsType["wallet"] = "permissions-wallet";
|
8
|
-
})(PermissionsType = exports.PermissionsType || (exports.PermissionsType = {}));
|
9
|
-
// Transaction Types
|
10
|
-
var TransactionMessageKind;
|
11
|
-
(function (TransactionMessageKind) {
|
12
|
-
TransactionMessageKind["client"] = "transaction-client";
|
13
|
-
TransactionMessageKind["ready"] = "transaction-ready";
|
14
|
-
TransactionMessageKind["success"] = "transaction-client-success";
|
15
|
-
TransactionMessageKind["fail"] = "transaction-client-failure";
|
16
|
-
})(TransactionMessageKind = exports.TransactionMessageKind || (exports.TransactionMessageKind = {}));
|
17
|
-
//# sourceMappingURL=types.js.map
|
package/lib/cjs/ic/types.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ic/types.ts"],"names":[],"mappings":";;;AAkHA,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,oDAAiC,CAAA;IACjC,gDAA6B,CAAA;AAC/B,CAAC,EAHW,eAAe,GAAf,uBAAe,KAAf,uBAAe,QAG1B;AAID,oBAAoB;AACpB,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,uDAA6B,CAAA;IAC7B,qDAA2B,CAAA;IAC3B,gEAAsC,CAAA;IACtC,6DAAmC,CAAA;AACrC,CAAC,EALW,sBAAsB,GAAtB,8BAAsB,KAAtB,8BAAsB,QAKjC"}
|
package/lib/esm/ic/types.d.ts
DELETED
@@ -1,129 +0,0 @@
|
|
1
|
-
import { SignIdentity } from '@dfinity/agent';
|
2
|
-
import { Principal } from '@dfinity/principal';
|
3
|
-
import { IC } from './icConnect';
|
4
|
-
import { AccountIdentifier } from '../utils/common/types';
|
5
|
-
import { SendOpts } from '../connections/ledgerConnection';
|
6
|
-
/**
|
7
|
-
* List of options for creating an {@link AuthClient}.
|
8
|
-
*/
|
9
|
-
export interface AuthClientCreateOptions {
|
10
|
-
/**
|
11
|
-
* An identity to use as the base
|
12
|
-
*/
|
13
|
-
identity?: SignIdentity;
|
14
|
-
/**
|
15
|
-
* Optional storage with get, set, and remove. Uses SessionStorage by default
|
16
|
-
*/
|
17
|
-
storage?: AuthClientStorage;
|
18
|
-
appId?: string;
|
19
|
-
idpWindowOption?: string;
|
20
|
-
}
|
21
|
-
export interface AuthClientLoginOptions extends AuthClientCreateOptions {
|
22
|
-
/**
|
23
|
-
* Identity provider. By default, use the identity service.
|
24
|
-
*/
|
25
|
-
identityProvider?: string | URL;
|
26
|
-
permissions?: PermissionsType[];
|
27
|
-
/**
|
28
|
-
* Experiation of the authentication
|
29
|
-
*/
|
30
|
-
maxTimeToLive?: bigint;
|
31
|
-
/**
|
32
|
-
* Callback once login has completed
|
33
|
-
*/
|
34
|
-
onSuccess?: () => void | Promise<void>;
|
35
|
-
/**
|
36
|
-
* Callback in case authentication fails
|
37
|
-
*/
|
38
|
-
onError?: (error?: string) => void;
|
39
|
-
/**
|
40
|
-
* Callback once is authenticated
|
41
|
-
*/
|
42
|
-
onAuthenticated?: (ic: IC) => void | Promise<void>;
|
43
|
-
}
|
44
|
-
export interface TransactionOptions {
|
45
|
-
/**
|
46
|
-
* Identity provider. By default, use the identity service.
|
47
|
-
*/
|
48
|
-
walletProvider?: string | URL;
|
49
|
-
from: AccountIdentifier;
|
50
|
-
to: AccountIdentifier;
|
51
|
-
amount: bigint;
|
52
|
-
sendOpts: SendOpts;
|
53
|
-
/**
|
54
|
-
* Callback once login has completed
|
55
|
-
*/
|
56
|
-
onSuccess?: () => void | Promise<void>;
|
57
|
-
/**
|
58
|
-
* Callback in case authentication fails
|
59
|
-
*/
|
60
|
-
onError?: (error?: string) => void;
|
61
|
-
}
|
62
|
-
/**
|
63
|
-
* Interface for persisting user authentication data
|
64
|
-
*/
|
65
|
-
export interface AuthClientStorage {
|
66
|
-
get(key: string): Promise<string | null>;
|
67
|
-
set(key: string, value: string): Promise<void>;
|
68
|
-
remove(key: string): Promise<void>;
|
69
|
-
}
|
70
|
-
export interface InternetIdentityAuthRequest {
|
71
|
-
kind: 'authorize-client';
|
72
|
-
sessionPublicKey: Uint8Array;
|
73
|
-
permissions?: PermissionsType[];
|
74
|
-
maxTimeToLive?: bigint;
|
75
|
-
appId?: string;
|
76
|
-
}
|
77
|
-
export interface DelegationResult {
|
78
|
-
delegations: {
|
79
|
-
delegation: {
|
80
|
-
pubkey: Uint8Array;
|
81
|
-
expiration: bigint;
|
82
|
-
targets?: Principal[];
|
83
|
-
};
|
84
|
-
signature: Uint8Array;
|
85
|
-
}[];
|
86
|
-
userPublicKey: Uint8Array;
|
87
|
-
}
|
88
|
-
export interface MeAuthResponseSuccess {
|
89
|
-
kind: 'authorize-client-success';
|
90
|
-
identity: DelegationResult;
|
91
|
-
wallet?: string;
|
92
|
-
}
|
93
|
-
export interface IIAuthResponseSuccess extends DelegationResult {
|
94
|
-
kind: 'authorize-client-success';
|
95
|
-
}
|
96
|
-
export declare type AuthResponseSuccess = MeAuthResponseSuccess | IIAuthResponseSuccess;
|
97
|
-
export declare type EventHandler = (event: MessageEvent) => Promise<void>;
|
98
|
-
export declare enum PermissionsType {
|
99
|
-
identity = "permissions-identity",
|
100
|
-
wallet = "permissions-wallet"
|
101
|
-
}
|
102
|
-
export declare type ConnectOptions = AuthClientLoginOptions;
|
103
|
-
export declare enum TransactionMessageKind {
|
104
|
-
client = "transaction-client",
|
105
|
-
ready = "transaction-ready",
|
106
|
-
success = "transaction-client-success",
|
107
|
-
fail = "transaction-client-failure"
|
108
|
-
}
|
109
|
-
export interface TransactionReadyMessage {
|
110
|
-
kind: TransactionMessageKind.ready;
|
111
|
-
}
|
112
|
-
export interface TransactionResponseFailure {
|
113
|
-
kind: TransactionMessageKind.fail;
|
114
|
-
text: string;
|
115
|
-
}
|
116
|
-
export interface TransactionResponseSuccess {
|
117
|
-
kind: TransactionMessageKind.success;
|
118
|
-
}
|
119
|
-
export declare type TransactionResponseMessage = TransactionReadyMessage | TransactionResponse;
|
120
|
-
export declare type TransactionResponse = TransactionResponseSuccess | TransactionResponseFailure;
|
121
|
-
export interface AuthReadyMessage {
|
122
|
-
kind: 'authorize-ready';
|
123
|
-
}
|
124
|
-
export interface AuthResponseFailure {
|
125
|
-
kind: 'authorize-client-failure';
|
126
|
-
text: string;
|
127
|
-
}
|
128
|
-
export declare type IdentityServiceResponseMessage = AuthReadyMessage | AuthResponse;
|
129
|
-
export declare type AuthResponse = AuthResponseSuccess | AuthResponseFailure;
|
package/lib/esm/ic/types.js
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
export var PermissionsType;
|
2
|
-
(function (PermissionsType) {
|
3
|
-
PermissionsType["identity"] = "permissions-identity";
|
4
|
-
PermissionsType["wallet"] = "permissions-wallet";
|
5
|
-
})(PermissionsType || (PermissionsType = {}));
|
6
|
-
// Transaction Types
|
7
|
-
export var TransactionMessageKind;
|
8
|
-
(function (TransactionMessageKind) {
|
9
|
-
TransactionMessageKind["client"] = "transaction-client";
|
10
|
-
TransactionMessageKind["ready"] = "transaction-ready";
|
11
|
-
TransactionMessageKind["success"] = "transaction-client-success";
|
12
|
-
TransactionMessageKind["fail"] = "transaction-client-failure";
|
13
|
-
})(TransactionMessageKind || (TransactionMessageKind = {}));
|
14
|
-
//# sourceMappingURL=types.js.map
|
package/lib/esm/ic/types.js.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/ic/types.ts"],"names":[],"mappings":"AAkHA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,oDAAiC,CAAA;IACjC,gDAA6B,CAAA;AAC/B,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAID,oBAAoB;AACpB,MAAM,CAAN,IAAY,sBAKX;AALD,WAAY,sBAAsB;IAChC,uDAA6B,CAAA;IAC7B,qDAA2B,CAAA;IAC3B,gEAAsC,CAAA;IACtC,6DAAmC,CAAA;AACrC,CAAC,EALW,sBAAsB,KAAtB,sBAAsB,QAKjC"}
|