@zkpassport/sdk 0.1.1 → 0.2.0
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 +97 -40
- package/dist/cjs/encryption.js +69 -0
- package/dist/cjs/index.d.ts +191 -0
- package/dist/cjs/index.js +857 -0
- package/dist/{json-rpc.d.ts → cjs/json-rpc.d.ts} +2 -2
- package/dist/cjs/json-rpc.js +48 -0
- package/dist/{logger.js → cjs/logger.js} +5 -38
- package/dist/cjs/mobile.js +131 -0
- package/dist/{websocket.js → cjs/websocket.js} +2 -2
- package/dist/esm/encryption.d.ts +7 -0
- package/dist/esm/encryption.js +40 -0
- package/dist/esm/index.d.ts +191 -0
- package/dist/esm/index.js +846 -0
- package/dist/esm/json-rpc.d.ts +6 -0
- package/dist/esm/json-rpc.js +41 -0
- package/dist/esm/logger.d.ts +7 -0
- package/dist/esm/logger.js +37 -0
- package/dist/esm/mobile.d.ts +39 -0
- package/dist/esm/mobile.js +126 -0
- package/dist/esm/websocket.d.ts +2 -0
- package/dist/esm/websocket.js +15 -0
- package/package.json +15 -7
- package/src/index.ts +978 -67
- package/src/json-rpc.ts +9 -5
- package/src/mobile.ts +18 -9
- package/tsconfig.json +14 -9
- package/dist/constants/index.d.ts +0 -13
- package/dist/constants/index.js +0 -52
- package/dist/encryption.js +0 -126
- package/dist/index.d.ts +0 -79
- package/dist/index.js +0 -384
- package/dist/json-rpc.js +0 -105
- package/dist/mobile.js +0 -253
- package/dist/types/countries.d.ts +0 -1
- package/dist/types/countries.js +0 -2
- package/dist/types/credentials.d.ts +0 -17
- package/dist/types/credentials.js +0 -2
- package/dist/types/index.d.ts +0 -4
- package/dist/types/index.js +0 -2
- package/dist/types/json-rpc.d.ts +0 -12
- package/dist/types/json-rpc.js +0 -2
- package/dist/types/query-result.d.ts +0 -46
- package/dist/types/query-result.js +0 -2
- package/src/circuits/proof_age.json +0 -1
- package/src/constants/index.ts +0 -54
- package/src/types/countries.ts +0 -278
- package/src/types/credentials.ts +0 -40
- package/src/types/index.ts +0 -13
- package/src/types/json-rpc.ts +0 -13
- package/src/types/query-result.ts +0 -49
- /package/dist/{encryption.d.ts → cjs/encryption.d.ts} +0 -0
- /package/dist/{logger.d.ts → cjs/logger.d.ts} +0 -0
- /package/dist/{mobile.d.ts → cjs/mobile.d.ts} +0 -0
- /package/dist/{websocket.d.ts → cjs/websocket.d.ts} +0 -0
package/src/json-rpc.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { randomBytes } from 'crypto'
|
|
2
|
-
import { JsonRpcRequest, JsonRpcResponse } from '
|
|
3
|
-
import { encrypt } from '
|
|
4
|
-
import { WebSocketClient } from '
|
|
5
|
-
import logger from '
|
|
2
|
+
import type { JsonRpcRequest, JsonRpcResponse } from '@zkpassport/utils'
|
|
3
|
+
import { encrypt } from './encryption'
|
|
4
|
+
import { WebSocketClient } from './websocket'
|
|
5
|
+
import logger from './logger'
|
|
6
6
|
|
|
7
7
|
export function createJsonRpcRequest(method: string, params: any): JsonRpcRequest {
|
|
8
8
|
return {
|
|
@@ -19,7 +19,11 @@ export async function createEncryptedJsonRpcRequest(
|
|
|
19
19
|
sharedSecret: Uint8Array,
|
|
20
20
|
topic: string,
|
|
21
21
|
): Promise<JsonRpcRequest> {
|
|
22
|
-
const encryptedMessage = await encrypt(
|
|
22
|
+
const encryptedMessage = await encrypt(
|
|
23
|
+
JSON.stringify({ method, params: params || {} }),
|
|
24
|
+
sharedSecret,
|
|
25
|
+
topic,
|
|
26
|
+
)
|
|
23
27
|
return createJsonRpcRequest('encryptedMessage', {
|
|
24
28
|
payload: Buffer.from(encryptedMessage).toString('base64'),
|
|
25
29
|
})
|
package/src/mobile.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { bytesToHex } from '@noble/ciphers/utils'
|
|
2
|
-
import { getWebSocketClient, WebSocketClient } from '
|
|
3
|
-
import { sendEncryptedJsonRpcRequest } from '
|
|
4
|
-
import { decrypt, generateECDHKeyPair, getSharedSecret } from '
|
|
5
|
-
import { JsonRpcRequest } from '
|
|
6
|
-
import logger from '
|
|
2
|
+
import { getWebSocketClient, WebSocketClient } from './websocket'
|
|
3
|
+
import { sendEncryptedJsonRpcRequest } from './json-rpc'
|
|
4
|
+
import { decrypt, generateECDHKeyPair, getSharedSecret } from './encryption'
|
|
5
|
+
import type { JsonRpcRequest } from '@zkpassport/utils'
|
|
6
|
+
import logger from './logger'
|
|
7
7
|
|
|
8
8
|
export class ZkPassportProver {
|
|
9
9
|
private domain?: string
|
|
@@ -24,7 +24,11 @@ export class ZkPassportProver {
|
|
|
24
24
|
* @param request The request.
|
|
25
25
|
* @param outerRequest The outer request.
|
|
26
26
|
*/
|
|
27
|
-
private async handleEncryptedMessage(
|
|
27
|
+
private async handleEncryptedMessage(
|
|
28
|
+
topic: string,
|
|
29
|
+
request: JsonRpcRequest,
|
|
30
|
+
outerRequest: JsonRpcRequest,
|
|
31
|
+
) {
|
|
28
32
|
logger.debug('Received encrypted message:', request)
|
|
29
33
|
if (request.method === 'hello') {
|
|
30
34
|
logger.info(`Successfully verified origin domain name: ${outerRequest.origin}`)
|
|
@@ -66,7 +70,10 @@ export class ZkPassportProver {
|
|
|
66
70
|
publicKey: keyPair.publicKey,
|
|
67
71
|
}
|
|
68
72
|
this.topicToRemotePublicKey[topic] = pubkey
|
|
69
|
-
this.topicToSharedSecret[topic] = await getSharedSecret(
|
|
73
|
+
this.topicToSharedSecret[topic] = await getSharedSecret(
|
|
74
|
+
bytesToHex(keyPair.privateKey),
|
|
75
|
+
bytesToHex(pubkey),
|
|
76
|
+
)
|
|
70
77
|
this.topicToRemoteDomainVerified[topic] = false
|
|
71
78
|
this.onDomainVerifiedCallbacks[topic] = []
|
|
72
79
|
this.onBridgeConnectCallbacks[topic] = []
|
|
@@ -134,8 +141,10 @@ export class ZkPassportProver {
|
|
|
134
141
|
requestId: topic,
|
|
135
142
|
isBridgeConnected: () => this.topicToWebSocketClient[topic].readyState === WebSocket.OPEN,
|
|
136
143
|
isDomainVerified: () => this.topicToRemoteDomainVerified[topic] === true,
|
|
137
|
-
onDomainVerified: (callback: () => void) =>
|
|
138
|
-
|
|
144
|
+
onDomainVerified: (callback: () => void) =>
|
|
145
|
+
this.onDomainVerifiedCallbacks[topic].push(callback),
|
|
146
|
+
onBridgeConnect: (callback: () => void) =>
|
|
147
|
+
this.onBridgeConnectCallbacks[topic].push(callback),
|
|
139
148
|
notifyReject: async () => {
|
|
140
149
|
await sendEncryptedJsonRpcRequest(
|
|
141
150
|
'reject',
|
package/tsconfig.json
CHANGED
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "es5",
|
|
4
|
-
"module": "Node16",
|
|
5
|
-
"lib": ["es2015", "dom"],
|
|
6
|
-
"declaration": true,
|
|
7
|
-
"outDir": "./dist",
|
|
8
|
-
"rootDir": "./src",
|
|
9
|
-
"baseUrl": ".",
|
|
10
3
|
"strict": true,
|
|
11
4
|
"esModuleInterop": true,
|
|
12
5
|
"resolveJsonModule": true,
|
|
6
|
+
"experimentalDecorators": true,
|
|
7
|
+
"skipLibCheck": true,
|
|
8
|
+
"target": "es2020",
|
|
9
|
+
"module": "es2020",
|
|
10
|
+
"moduleResolution": "node",
|
|
11
|
+
"outDir": "./dist/esm",
|
|
12
|
+
"rootDir": "./src",
|
|
13
|
+
"baseUrl": ".",
|
|
13
14
|
"paths": {
|
|
14
15
|
"@/*": ["./src/*"],
|
|
15
|
-
"@/types
|
|
16
|
-
}
|
|
16
|
+
"@/types": ["src/types/index.ts"]
|
|
17
|
+
},
|
|
18
|
+
"declaration": true,
|
|
19
|
+
"isolatedModules": true,
|
|
20
|
+
"forceConsistentCasingInFileNames": true,
|
|
21
|
+
"importHelpers": true
|
|
17
22
|
},
|
|
18
23
|
"include": ["src"],
|
|
19
24
|
"exclude": ["node_modules", "**/__tests__/*"]
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { CountryName } from '@/types/countries';
|
|
2
|
-
/**
|
|
3
|
-
* List of countries that are sanctioned by the US government.
|
|
4
|
-
*/
|
|
5
|
-
export declare const SANCTIONED_COUNTRIES: CountryName[];
|
|
6
|
-
export declare const EU_COUNTRIES: CountryName[];
|
|
7
|
-
declare const constants: {
|
|
8
|
-
countries: {
|
|
9
|
-
EU: CountryName[];
|
|
10
|
-
SANCTIONED: CountryName[];
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
export default constants;
|
package/dist/constants/index.js
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.EU_COUNTRIES = exports.SANCTIONED_COUNTRIES = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* List of countries that are sanctioned by the US government.
|
|
6
|
-
*/
|
|
7
|
-
exports.SANCTIONED_COUNTRIES = [
|
|
8
|
-
'North Korea',
|
|
9
|
-
'Iran',
|
|
10
|
-
'Iraq',
|
|
11
|
-
'Libya',
|
|
12
|
-
'Somalia',
|
|
13
|
-
'Sudan',
|
|
14
|
-
'Syrian Arab Republic',
|
|
15
|
-
'Yemen',
|
|
16
|
-
];
|
|
17
|
-
exports.EU_COUNTRIES = [
|
|
18
|
-
'Austria',
|
|
19
|
-
'Belgium',
|
|
20
|
-
'Bulgaria',
|
|
21
|
-
'Croatia',
|
|
22
|
-
'Cyprus',
|
|
23
|
-
'Czech Republic',
|
|
24
|
-
'Denmark',
|
|
25
|
-
'Estonia',
|
|
26
|
-
'Finland',
|
|
27
|
-
'France',
|
|
28
|
-
'Germany',
|
|
29
|
-
'Greece',
|
|
30
|
-
'Hungary',
|
|
31
|
-
'Ireland',
|
|
32
|
-
'Italy',
|
|
33
|
-
'Latvia',
|
|
34
|
-
'Lithuania',
|
|
35
|
-
'Luxembourg',
|
|
36
|
-
'Malta',
|
|
37
|
-
'Netherlands',
|
|
38
|
-
'Poland',
|
|
39
|
-
'Portugal',
|
|
40
|
-
'Romania',
|
|
41
|
-
'Slovakia',
|
|
42
|
-
'Slovenia',
|
|
43
|
-
'Spain',
|
|
44
|
-
'Sweden',
|
|
45
|
-
];
|
|
46
|
-
var constants = {
|
|
47
|
-
countries: {
|
|
48
|
-
EU: exports.EU_COUNTRIES,
|
|
49
|
-
SANCTIONED: exports.SANCTIONED_COUNTRIES,
|
|
50
|
-
},
|
|
51
|
-
};
|
|
52
|
-
exports.default = constants;
|
package/dist/encryption.js
DELETED
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
12
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
13
|
-
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
14
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
15
|
-
function step(op) {
|
|
16
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
17
|
-
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
18
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
19
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
20
|
-
switch (op[0]) {
|
|
21
|
-
case 0: case 1: t = op; break;
|
|
22
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
23
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
24
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
25
|
-
default:
|
|
26
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
27
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
28
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
29
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
30
|
-
if (t[2]) _.ops.pop();
|
|
31
|
-
_.trys.pop(); continue;
|
|
32
|
-
}
|
|
33
|
-
op = body.call(thisArg, _);
|
|
34
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
35
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
-
exports.generateECDHKeyPair = generateECDHKeyPair;
|
|
40
|
-
exports.getSharedSecret = getSharedSecret;
|
|
41
|
-
exports.encrypt = encrypt;
|
|
42
|
-
exports.decrypt = decrypt;
|
|
43
|
-
var aes_1 = require("@noble/ciphers/aes");
|
|
44
|
-
var utils_1 = require("@noble/ciphers/utils");
|
|
45
|
-
function sha256Truncate(topic) {
|
|
46
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
47
|
-
var encoder, data, hashBuffer, fullHashArray, truncatedHashArray;
|
|
48
|
-
return __generator(this, function (_a) {
|
|
49
|
-
switch (_a.label) {
|
|
50
|
-
case 0:
|
|
51
|
-
encoder = new TextEncoder();
|
|
52
|
-
data = encoder.encode(topic);
|
|
53
|
-
return [4 /*yield*/, crypto.subtle.digest('SHA-256', data)];
|
|
54
|
-
case 1:
|
|
55
|
-
hashBuffer = _a.sent();
|
|
56
|
-
fullHashArray = new Uint8Array(hashBuffer);
|
|
57
|
-
truncatedHashArray = fullHashArray.slice(0, 12);
|
|
58
|
-
return [2 /*return*/, truncatedHashArray];
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function generateECDHKeyPair() {
|
|
64
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
65
|
-
var secp256k1, privKey, pubKey;
|
|
66
|
-
return __generator(this, function (_a) {
|
|
67
|
-
switch (_a.label) {
|
|
68
|
-
case 0: return [4 /*yield*/, import('@noble/secp256k1')];
|
|
69
|
-
case 1:
|
|
70
|
-
secp256k1 = _a.sent();
|
|
71
|
-
privKey = secp256k1.utils.randomPrivateKey();
|
|
72
|
-
pubKey = secp256k1.getPublicKey(privKey);
|
|
73
|
-
return [2 /*return*/, {
|
|
74
|
-
privateKey: privKey,
|
|
75
|
-
publicKey: pubKey,
|
|
76
|
-
}];
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
function getSharedSecret(privateKey, publicKey) {
|
|
82
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
83
|
-
var secp256k1, sharedSecret;
|
|
84
|
-
return __generator(this, function (_a) {
|
|
85
|
-
switch (_a.label) {
|
|
86
|
-
case 0: return [4 /*yield*/, import('@noble/secp256k1')];
|
|
87
|
-
case 1:
|
|
88
|
-
secp256k1 = _a.sent();
|
|
89
|
-
sharedSecret = secp256k1.getSharedSecret(privateKey, publicKey);
|
|
90
|
-
return [2 /*return*/, sharedSecret.slice(0, 32)];
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
function encrypt(message, sharedSecret, topic) {
|
|
96
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
97
|
-
var nonce, aes, data, ciphertext;
|
|
98
|
-
return __generator(this, function (_a) {
|
|
99
|
-
switch (_a.label) {
|
|
100
|
-
case 0: return [4 /*yield*/, sha256Truncate(topic)];
|
|
101
|
-
case 1:
|
|
102
|
-
nonce = _a.sent();
|
|
103
|
-
aes = (0, aes_1.gcm)(sharedSecret, nonce);
|
|
104
|
-
data = (0, utils_1.utf8ToBytes)(message);
|
|
105
|
-
ciphertext = aes.encrypt(data);
|
|
106
|
-
return [2 /*return*/, ciphertext];
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
function decrypt(ciphertext, sharedSecret, topic) {
|
|
112
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
113
|
-
var nonce, aes, data, dataString;
|
|
114
|
-
return __generator(this, function (_a) {
|
|
115
|
-
switch (_a.label) {
|
|
116
|
-
case 0: return [4 /*yield*/, sha256Truncate(topic)];
|
|
117
|
-
case 1:
|
|
118
|
-
nonce = _a.sent();
|
|
119
|
-
aes = (0, aes_1.gcm)(sharedSecret, nonce);
|
|
120
|
-
data = aes.decrypt(ciphertext);
|
|
121
|
-
dataString = new TextDecoder().decode(data);
|
|
122
|
-
return [2 /*return*/, dataString];
|
|
123
|
-
}
|
|
124
|
-
});
|
|
125
|
-
});
|
|
126
|
-
}
|
package/dist/index.d.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { DisclosableIDCredential, IDCredential, IDCredentialValue, NumericalIDCredential } from '@/types/credentials';
|
|
2
|
-
import { ProofResult } from '@/types/query-result';
|
|
3
|
-
export * from './constants';
|
|
4
|
-
export * from './types';
|
|
5
|
-
export declare class ZkPassport {
|
|
6
|
-
private domain;
|
|
7
|
-
private topicToConfig;
|
|
8
|
-
private topicToKeyPair;
|
|
9
|
-
private topicToWebSocketClient;
|
|
10
|
-
private topicToSharedSecret;
|
|
11
|
-
private topicToQRCodeScanned;
|
|
12
|
-
private onQRCodeScannedCallbacks;
|
|
13
|
-
private onGeneratingProofCallbacks;
|
|
14
|
-
private onBridgeConnectCallbacks;
|
|
15
|
-
private onProofGeneratedCallbacks;
|
|
16
|
-
private onRejectCallbacks;
|
|
17
|
-
private onErrorCallbacks;
|
|
18
|
-
private topicToService;
|
|
19
|
-
constructor(_domain?: string);
|
|
20
|
-
/**
|
|
21
|
-
* @notice Handle an encrypted message.
|
|
22
|
-
* @param request The request.
|
|
23
|
-
* @param outerRequest The outer request.
|
|
24
|
-
*/
|
|
25
|
-
private handleEncryptedMessage;
|
|
26
|
-
private getZkPassportRequest;
|
|
27
|
-
/**
|
|
28
|
-
* @notice Create a new request.
|
|
29
|
-
* @returns The query builder object.
|
|
30
|
-
*/
|
|
31
|
-
request({ name, logo, purpose, topicOverride, keyPairOverride, }: {
|
|
32
|
-
name: string;
|
|
33
|
-
logo: string;
|
|
34
|
-
purpose: string;
|
|
35
|
-
topicOverride?: string;
|
|
36
|
-
keyPairOverride?: {
|
|
37
|
-
privateKey: Uint8Array;
|
|
38
|
-
publicKey: Uint8Array;
|
|
39
|
-
};
|
|
40
|
-
}): Promise<{
|
|
41
|
-
eq: <T extends IDCredential>(key: T, value: IDCredentialValue<T>) => any;
|
|
42
|
-
gte: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => any;
|
|
43
|
-
gt: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => any;
|
|
44
|
-
lte: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => any;
|
|
45
|
-
lt: <T extends NumericalIDCredential>(key: T, value: IDCredentialValue<T>) => any;
|
|
46
|
-
range: <T extends NumericalIDCredential>(key: T, start: IDCredentialValue<T>, end: IDCredentialValue<T>) => any;
|
|
47
|
-
in: <T extends IDCredential>(key: T, value: IDCredentialValue<T>[]) => any;
|
|
48
|
-
out: <T extends IDCredential>(key: T, value: IDCredentialValue<T>[]) => any;
|
|
49
|
-
disclose: (key: DisclosableIDCredential) => any;
|
|
50
|
-
done: () => {
|
|
51
|
-
url: string;
|
|
52
|
-
requestId: string;
|
|
53
|
-
onQRCodeScanned: (callback: () => void) => number;
|
|
54
|
-
onGeneratingProof: (callback: () => void) => number;
|
|
55
|
-
onBridgeConnect: (callback: () => void) => number;
|
|
56
|
-
onProofGenerated: (callback: (result: ProofResult) => void) => number;
|
|
57
|
-
onReject: (callback: () => void) => number;
|
|
58
|
-
onError: (callback: (error: string) => void) => number;
|
|
59
|
-
isBridgeConnected: () => boolean;
|
|
60
|
-
isQRCodeScanned: () => boolean;
|
|
61
|
-
};
|
|
62
|
-
}>;
|
|
63
|
-
/**
|
|
64
|
-
* @notice Verifies a proof.
|
|
65
|
-
* @param proof The proof to verify.
|
|
66
|
-
* @returns True if the proof is valid, false otherwise.
|
|
67
|
-
*/
|
|
68
|
-
/**
|
|
69
|
-
* @notice Returns the URL of the request.
|
|
70
|
-
* @param requestId The request ID.
|
|
71
|
-
* @returns The URL of the request.
|
|
72
|
-
*/
|
|
73
|
-
getUrl(requestId: string): string;
|
|
74
|
-
/**
|
|
75
|
-
* @notice Cancels a request by closing the WebSocket connection and deleting the associated data.
|
|
76
|
-
* @param requestId The request ID.
|
|
77
|
-
*/
|
|
78
|
-
cancelRequest(requestId: string): void;
|
|
79
|
-
}
|