@superorange/zka-js-sdk 1.0.119 → 1.0.122

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.
@@ -0,0 +1,113 @@
1
+ declare global {
2
+ interface Window {
3
+ primus?: any;
4
+ }
5
+ }
6
+
7
+ type AttestationParams = {
8
+ chainID: number;
9
+ walletAddress: string;
10
+ attestationTypeID: string;
11
+ attestationParameters: any[];
12
+ algorithmType?: string;
13
+ }
14
+
15
+ type AttNetworkRequest = {
16
+ url: string,
17
+ header: string, // json string
18
+ method: string,
19
+ body: string
20
+ }
21
+ type AttNetworkResponseResolve = {
22
+ keyName: string,
23
+ parseType: string, //json or html
24
+ parsePath: string
25
+ }
26
+ type Attestor = {
27
+ attestorAddr: string,
28
+ url: string
29
+ }
30
+ type Attestation = {
31
+ recipient: string,
32
+ request: AttNetworkRequest,
33
+ reponseResolve: AttNetworkResponseResolve[],
34
+ data: string, // json string
35
+ attConditions: string, // json string
36
+ timestamp: number,
37
+ additionParams: string,
38
+ attestors: Attestor[],
39
+ signatures: string[],
40
+ }
41
+ type ErrorData = {
42
+ code: string;
43
+ title: string;
44
+ desc: string;
45
+ }
46
+
47
+
48
+ type StartAttestationReturn = {
49
+ result: boolean;
50
+ data?: Attestation;
51
+ errorData?: ErrorData,
52
+ reStartFlag?: boolean;
53
+ }
54
+
55
+ type VerifyParamsReturn = {
56
+ result: boolean;
57
+ message: string;
58
+ }
59
+
60
+ type InitAttestationReturn = {
61
+ result: boolean;
62
+ errorData?: ErrorData;
63
+ }
64
+
65
+ type Env = 'development' | 'test' | 'production'
66
+
67
+ type AttModeAlgorithmType = 'mpctls' | 'proxytls'
68
+ type AttModeResultType = 'plain' | 'cipher'
69
+ type AttMode = {
70
+ algorithmType: AttModeAlgorithmType;
71
+ resultType: AttModeResultType;
72
+ }
73
+ type BaseAttestationParams = {
74
+ appId: string;
75
+ attTemplateID: string;
76
+ userAddress: string;
77
+ }
78
+ type FullAttestationParams = BaseAttestationParams & {
79
+ timestamp: number;
80
+ attMode?: AttMode;
81
+ attConditions?: AttConditions;
82
+ additionParams?: string;
83
+ requestid?: string;
84
+ backUrl?: string;
85
+ }
86
+ type SignedAttRequest = {
87
+ attRequest: FullAttestationParams,
88
+ appSignature: string
89
+ }
90
+
91
+ declare global {
92
+ interface Window {
93
+ primus?: any;
94
+ }
95
+ }
96
+ type ComparisonOp = '>' | '>=' | '=' | '!=' | '<' | '<=';
97
+ type OpType = ComparisonOp | 'SHA256' | 'REVEAL_STRING';
98
+ type AttSubCondition = {
99
+ field: string,
100
+ op: OpType,
101
+ value?: string,
102
+ }
103
+ type AttCondition = AttSubCondition[]
104
+ type AttConditions = AttCondition[]
105
+
106
+ type InitOptions = {
107
+ platform?: string,
108
+ env?: Env,
109
+ }
110
+
111
+ type ComputeMode = 'nonecomplete' | 'nonepartial' | 'normal';
112
+
113
+ export type { AttCondition, AttConditions, AttMode, AttModeAlgorithmType, AttModeResultType, AttNetworkRequest, AttNetworkResponseResolve, AttSubCondition, Attestation, AttestationParams, Attestor, BaseAttestationParams, ComparisonOp, ComputeMode, Env, ErrorData, FullAttestationParams, InitAttestationReturn, InitOptions, OpType, SignedAttRequest, StartAttestationReturn, VerifyParamsReturn };
package/dist/index.d.ts CHANGED
@@ -1,19 +1,113 @@
1
- import { Attestation, SignedAttRequest } from './index.d';
2
- import { AttRequest } from './classes/AttRequest';
3
- declare class PrimusZKTLS {
4
- private _env;
5
- private _padoAddress;
6
- isInstalled?: boolean;
7
- isInitialized: boolean;
8
- padoExtensionVersion: string;
9
- appId: string;
10
- appSecret?: string;
11
- constructor();
12
- init(appId: string, appSecret?: string): Promise<string | boolean>;
13
- generateRequestParams(attTemplateID: string, userAddress?: string): AttRequest;
14
- sign(signParams: string): Promise<string>;
15
- startAttestation(attestationParamsStr: string): Promise<Attestation>;
16
- verifyAttestation(attestation: Attestation): boolean;
17
- _verifyAttestationParams(attestationParams: SignedAttRequest): boolean;
18
- }
19
- export { PrimusZKTLS, AttRequest };
1
+ declare global {
2
+ interface Window {
3
+ primus?: any;
4
+ }
5
+ }
6
+
7
+ type AttestationParams = {
8
+ chainID: number;
9
+ walletAddress: string;
10
+ attestationTypeID: string;
11
+ attestationParameters: any[];
12
+ algorithmType?: string;
13
+ }
14
+
15
+ type AttNetworkRequest = {
16
+ url: string,
17
+ header: string, // json string
18
+ method: string,
19
+ body: string
20
+ }
21
+ type AttNetworkResponseResolve = {
22
+ keyName: string,
23
+ parseType: string, //json or html
24
+ parsePath: string
25
+ }
26
+ type Attestor = {
27
+ attestorAddr: string,
28
+ url: string
29
+ }
30
+ type Attestation = {
31
+ recipient: string,
32
+ request: AttNetworkRequest,
33
+ reponseResolve: AttNetworkResponseResolve[],
34
+ data: string, // json string
35
+ attConditions: string, // json string
36
+ timestamp: number,
37
+ additionParams: string,
38
+ attestors: Attestor[],
39
+ signatures: string[],
40
+ }
41
+ type ErrorData = {
42
+ code: string;
43
+ title: string;
44
+ desc: string;
45
+ }
46
+
47
+
48
+ type StartAttestationReturn = {
49
+ result: boolean;
50
+ data?: Attestation;
51
+ errorData?: ErrorData,
52
+ reStartFlag?: boolean;
53
+ }
54
+
55
+ type VerifyParamsReturn = {
56
+ result: boolean;
57
+ message: string;
58
+ }
59
+
60
+ type InitAttestationReturn = {
61
+ result: boolean;
62
+ errorData?: ErrorData;
63
+ }
64
+
65
+ type Env = 'development' | 'test' | 'production'
66
+
67
+ type AttModeAlgorithmType = 'mpctls' | 'proxytls'
68
+ type AttModeResultType = 'plain' | 'cipher'
69
+ type AttMode = {
70
+ algorithmType: AttModeAlgorithmType;
71
+ resultType: AttModeResultType;
72
+ }
73
+ type BaseAttestationParams = {
74
+ appId: string;
75
+ attTemplateID: string;
76
+ userAddress: string;
77
+ }
78
+ type FullAttestationParams = BaseAttestationParams & {
79
+ timestamp: number;
80
+ attMode?: AttMode;
81
+ attConditions?: AttConditions;
82
+ additionParams?: string;
83
+ requestid?: string;
84
+ backUrl?: string;
85
+ }
86
+ type SignedAttRequest = {
87
+ attRequest: FullAttestationParams,
88
+ appSignature: string
89
+ }
90
+
91
+ declare global {
92
+ interface Window {
93
+ primus?: any;
94
+ }
95
+ }
96
+ type ComparisonOp = '>' | '>=' | '=' | '!=' | '<' | '<=';
97
+ type OpType = ComparisonOp | 'SHA256' | 'REVEAL_STRING';
98
+ type AttSubCondition = {
99
+ field: string,
100
+ op: OpType,
101
+ value?: string,
102
+ }
103
+ type AttCondition = AttSubCondition[]
104
+ type AttConditions = AttCondition[]
105
+
106
+ type InitOptions = {
107
+ platform?: string,
108
+ env?: Env,
109
+ }
110
+
111
+ type ComputeMode = 'nonecomplete' | 'nonepartial' | 'normal';
112
+
113
+ export type { AttCondition, AttConditions, AttMode, AttModeAlgorithmType, AttModeResultType, AttNetworkRequest, AttNetworkResponseResolve, AttSubCondition, Attestation, AttestationParams, Attestor, BaseAttestationParams, ComparisonOp, ComputeMode, Env, ErrorData, FullAttestationParams, InitAttestationReturn, InitOptions, OpType, SignedAttRequest, StartAttestationReturn, VerifyParamsReturn };