@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/dist/mobile.js
DELETED
|
@@ -1,253 +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
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
39
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
|
-
};
|
|
41
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.ZkPassportProver = void 0;
|
|
43
|
-
var utils_1 = require("@noble/ciphers/utils");
|
|
44
|
-
var websocket_1 = require("@/websocket");
|
|
45
|
-
var json_rpc_1 = require("@/json-rpc");
|
|
46
|
-
var encryption_1 = require("@/encryption");
|
|
47
|
-
var logger_1 = __importDefault(require("@/logger"));
|
|
48
|
-
var ZkPassportProver = /** @class */ (function () {
|
|
49
|
-
function ZkPassportProver() {
|
|
50
|
-
this.topicToKeyPair = {};
|
|
51
|
-
this.topicToWebSocketClient = {};
|
|
52
|
-
this.topicToRemoteDomainVerified = {};
|
|
53
|
-
this.topicToSharedSecret = {};
|
|
54
|
-
this.topicToRemotePublicKey = {};
|
|
55
|
-
this.onDomainVerifiedCallbacks = {};
|
|
56
|
-
this.onBridgeConnectCallbacks = {};
|
|
57
|
-
this.onWebsiteDomainVerifyFailureCallbacks = {};
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* @notice Handle an encrypted message.
|
|
61
|
-
* @param request The request.
|
|
62
|
-
* @param outerRequest The outer request.
|
|
63
|
-
*/
|
|
64
|
-
ZkPassportProver.prototype.handleEncryptedMessage = function (topic, request, outerRequest) {
|
|
65
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
66
|
-
return __generator(this, function (_a) {
|
|
67
|
-
switch (_a.label) {
|
|
68
|
-
case 0:
|
|
69
|
-
logger_1.default.debug('Received encrypted message:', request);
|
|
70
|
-
if (!(request.method === 'hello')) return [3 /*break*/, 2];
|
|
71
|
-
logger_1.default.info("Successfully verified origin domain name: ".concat(outerRequest.origin));
|
|
72
|
-
this.topicToRemoteDomainVerified[topic] = true;
|
|
73
|
-
return [4 /*yield*/, Promise.all(this.onDomainVerifiedCallbacks[topic].map(function (callback) { return callback(); }))];
|
|
74
|
-
case 1:
|
|
75
|
-
_a.sent();
|
|
76
|
-
return [3 /*break*/, 3];
|
|
77
|
-
case 2:
|
|
78
|
-
if (request.method === 'closed_page') {
|
|
79
|
-
// TODO: Implement
|
|
80
|
-
}
|
|
81
|
-
_a.label = 3;
|
|
82
|
-
case 3: return [2 /*return*/];
|
|
83
|
-
}
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
/**
|
|
88
|
-
* @notice Scan a credentirequest QR code.
|
|
89
|
-
* @returns
|
|
90
|
-
*/
|
|
91
|
-
ZkPassportProver.prototype.scan = function (url_1) {
|
|
92
|
-
return __awaiter(this, arguments, void 0, function (url, _a) {
|
|
93
|
-
var parsedUrl, domain, topic, pubkeyHex, pubkey, keyPair, _b, _c, _d, wsClient;
|
|
94
|
-
var _this = this;
|
|
95
|
-
var _e = _a === void 0 ? {} : _a, keyPairOverride = _e.keyPairOverride;
|
|
96
|
-
return __generator(this, function (_f) {
|
|
97
|
-
switch (_f.label) {
|
|
98
|
-
case 0:
|
|
99
|
-
parsedUrl = new URL(url);
|
|
100
|
-
domain = parsedUrl.searchParams.get('d');
|
|
101
|
-
topic = parsedUrl.searchParams.get('t');
|
|
102
|
-
pubkeyHex = parsedUrl.searchParams.get('p');
|
|
103
|
-
if (!domain || !topic || !pubkeyHex) {
|
|
104
|
-
throw new Error('Invalid URL: missing required parameters');
|
|
105
|
-
}
|
|
106
|
-
pubkey = new Uint8Array(Buffer.from(pubkeyHex, 'hex'));
|
|
107
|
-
this.domain = domain;
|
|
108
|
-
_b = keyPairOverride;
|
|
109
|
-
if (_b) return [3 /*break*/, 2];
|
|
110
|
-
return [4 /*yield*/, (0, encryption_1.generateECDHKeyPair)()];
|
|
111
|
-
case 1:
|
|
112
|
-
_b = (_f.sent());
|
|
113
|
-
_f.label = 2;
|
|
114
|
-
case 2:
|
|
115
|
-
keyPair = _b;
|
|
116
|
-
this.topicToKeyPair[topic] = {
|
|
117
|
-
privateKey: keyPair.privateKey,
|
|
118
|
-
publicKey: keyPair.publicKey,
|
|
119
|
-
};
|
|
120
|
-
this.topicToRemotePublicKey[topic] = pubkey;
|
|
121
|
-
_c = this.topicToSharedSecret;
|
|
122
|
-
_d = topic;
|
|
123
|
-
return [4 /*yield*/, (0, encryption_1.getSharedSecret)((0, utils_1.bytesToHex)(keyPair.privateKey), (0, utils_1.bytesToHex)(pubkey))];
|
|
124
|
-
case 3:
|
|
125
|
-
_c[_d] = _f.sent();
|
|
126
|
-
this.topicToRemoteDomainVerified[topic] = false;
|
|
127
|
-
this.onDomainVerifiedCallbacks[topic] = [];
|
|
128
|
-
this.onBridgeConnectCallbacks[topic] = [];
|
|
129
|
-
wsClient = (0, websocket_1.getWebSocketClient)("wss://bridge.zkpassport.id?topic=".concat(topic, "&pubkey=").concat((0, utils_1.bytesToHex)(keyPair.publicKey)));
|
|
130
|
-
this.topicToWebSocketClient[topic] = wsClient;
|
|
131
|
-
wsClient.onopen = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
132
|
-
return __generator(this, function (_a) {
|
|
133
|
-
switch (_a.label) {
|
|
134
|
-
case 0:
|
|
135
|
-
logger_1.default.info('[mobile] WebSocket connection established');
|
|
136
|
-
return [4 /*yield*/, Promise.all(this.onBridgeConnectCallbacks[topic].map(function (callback) { return callback(); }))
|
|
137
|
-
// Server sends handshake automatically (when it sees a pubkey in websocket URI)
|
|
138
|
-
// wsClient.send(
|
|
139
|
-
// JSON.stringify(
|
|
140
|
-
// createJsonRpcRequest('handshake', {
|
|
141
|
-
// pubkey: bytesToHex(keyPair.publicKey),
|
|
142
|
-
// }),
|
|
143
|
-
// ),
|
|
144
|
-
// )
|
|
145
|
-
];
|
|
146
|
-
case 1:
|
|
147
|
-
_a.sent();
|
|
148
|
-
return [2 /*return*/];
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
}); };
|
|
152
|
-
wsClient.addEventListener('message', function (event) { return __awaiter(_this, void 0, void 0, function () {
|
|
153
|
-
var data, originDomain, payload, decrypted, decryptedJson, error_1, error_2;
|
|
154
|
-
return __generator(this, function (_a) {
|
|
155
|
-
switch (_a.label) {
|
|
156
|
-
case 0:
|
|
157
|
-
logger_1.default.info('[mobile] Received message:', event.data);
|
|
158
|
-
_a.label = 1;
|
|
159
|
-
case 1:
|
|
160
|
-
_a.trys.push([1, 7, , 8]);
|
|
161
|
-
data = JSON.parse(event.data);
|
|
162
|
-
originDomain = data.origin ? new URL(data.origin).hostname : undefined;
|
|
163
|
-
// Origin domain must match domain in QR code
|
|
164
|
-
if (originDomain !== this.domain) {
|
|
165
|
-
logger_1.default.warn("[mobile] Origin does not match domain in QR code. Expected ".concat(this.domain, " but got ").concat(originDomain));
|
|
166
|
-
return [2 /*return*/];
|
|
167
|
-
}
|
|
168
|
-
if (!(data.method === 'encryptedMessage')) return [3 /*break*/, 6];
|
|
169
|
-
payload = new Uint8Array(atob(data.params.payload)
|
|
170
|
-
.split('')
|
|
171
|
-
.map(function (c) { return c.charCodeAt(0); }));
|
|
172
|
-
_a.label = 2;
|
|
173
|
-
case 2:
|
|
174
|
-
_a.trys.push([2, 5, , 6]);
|
|
175
|
-
return [4 /*yield*/, (0, encryption_1.decrypt)(payload, this.topicToSharedSecret[topic], topic)];
|
|
176
|
-
case 3:
|
|
177
|
-
decrypted = _a.sent();
|
|
178
|
-
decryptedJson = JSON.parse(decrypted);
|
|
179
|
-
return [4 /*yield*/, this.handleEncryptedMessage(topic, decryptedJson, data)];
|
|
180
|
-
case 4:
|
|
181
|
-
_a.sent();
|
|
182
|
-
return [3 /*break*/, 6];
|
|
183
|
-
case 5:
|
|
184
|
-
error_1 = _a.sent();
|
|
185
|
-
logger_1.default.error('[mobile] Error decrypting message:', error_1);
|
|
186
|
-
return [3 /*break*/, 6];
|
|
187
|
-
case 6: return [3 /*break*/, 8];
|
|
188
|
-
case 7:
|
|
189
|
-
error_2 = _a.sent();
|
|
190
|
-
logger_1.default.error('[mobile] Error:', error_2);
|
|
191
|
-
return [3 /*break*/, 8];
|
|
192
|
-
case 8: return [2 /*return*/];
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
}); });
|
|
196
|
-
wsClient.onerror = function (error) {
|
|
197
|
-
logger_1.default.error('[mobile] WebSocket error:', error);
|
|
198
|
-
};
|
|
199
|
-
return [2 /*return*/, {
|
|
200
|
-
domain: this.domain,
|
|
201
|
-
requestId: topic,
|
|
202
|
-
isBridgeConnected: function () { return _this.topicToWebSocketClient[topic].readyState === WebSocket.OPEN; },
|
|
203
|
-
isDomainVerified: function () { return _this.topicToRemoteDomainVerified[topic] === true; },
|
|
204
|
-
onDomainVerified: function (callback) { return _this.onDomainVerifiedCallbacks[topic].push(callback); },
|
|
205
|
-
onBridgeConnect: function (callback) { return _this.onBridgeConnectCallbacks[topic].push(callback); },
|
|
206
|
-
notifyReject: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
207
|
-
return __generator(this, function (_a) {
|
|
208
|
-
switch (_a.label) {
|
|
209
|
-
case 0: return [4 /*yield*/, (0, json_rpc_1.sendEncryptedJsonRpcRequest)('reject', null, this.topicToSharedSecret[topic], topic, this.topicToWebSocketClient[topic])];
|
|
210
|
-
case 1:
|
|
211
|
-
_a.sent();
|
|
212
|
-
return [2 /*return*/];
|
|
213
|
-
}
|
|
214
|
-
});
|
|
215
|
-
}); },
|
|
216
|
-
notifyAccept: function () { return __awaiter(_this, void 0, void 0, function () {
|
|
217
|
-
return __generator(this, function (_a) {
|
|
218
|
-
switch (_a.label) {
|
|
219
|
-
case 0: return [4 /*yield*/, (0, json_rpc_1.sendEncryptedJsonRpcRequest)('accept', null, this.topicToSharedSecret[topic], topic, this.topicToWebSocketClient[topic])];
|
|
220
|
-
case 1:
|
|
221
|
-
_a.sent();
|
|
222
|
-
return [2 /*return*/];
|
|
223
|
-
}
|
|
224
|
-
});
|
|
225
|
-
}); },
|
|
226
|
-
notifyDone: function (proof) { return __awaiter(_this, void 0, void 0, function () {
|
|
227
|
-
return __generator(this, function (_a) {
|
|
228
|
-
switch (_a.label) {
|
|
229
|
-
case 0: return [4 /*yield*/, (0, json_rpc_1.sendEncryptedJsonRpcRequest)('done', { proof: proof }, this.topicToSharedSecret[topic], topic, this.topicToWebSocketClient[topic])];
|
|
230
|
-
case 1:
|
|
231
|
-
_a.sent();
|
|
232
|
-
return [2 /*return*/];
|
|
233
|
-
}
|
|
234
|
-
});
|
|
235
|
-
}); },
|
|
236
|
-
notifyError: function (error) { return __awaiter(_this, void 0, void 0, function () {
|
|
237
|
-
return __generator(this, function (_a) {
|
|
238
|
-
switch (_a.label) {
|
|
239
|
-
case 0: return [4 /*yield*/, (0, json_rpc_1.sendEncryptedJsonRpcRequest)('error', { error: error }, this.topicToSharedSecret[topic], topic, this.topicToWebSocketClient[topic])];
|
|
240
|
-
case 1:
|
|
241
|
-
_a.sent();
|
|
242
|
-
return [2 /*return*/];
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
}); },
|
|
246
|
-
}];
|
|
247
|
-
}
|
|
248
|
-
});
|
|
249
|
-
});
|
|
250
|
-
};
|
|
251
|
-
return ZkPassportProver;
|
|
252
|
-
}());
|
|
253
|
-
exports.ZkPassportProver = ZkPassportProver;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type CountryName = 'Afghanistan' | 'Albania' | 'Algeria' | 'American Samoa' | 'Andorra' | 'Angola' | 'Anguilla' | 'Antarctica' | 'Antigua and Barbuda' | 'Argentina' | 'Armenia' | 'Aruba' | 'Australia' | 'Austria' | 'Azerbaijan' | 'Bahamas' | 'Bahrain' | 'Bangladesh' | 'Barbados' | 'Belarus' | 'Belgium' | 'Belize' | 'Benin' | 'Bermuda' | 'Bhutan' | 'Bolivia' | 'Bosnia and Herzegovina' | 'Botswana' | 'Bouvet Island' | 'Brazil' | 'British Indian Ocean Territory' | 'Brunei Darussalam' | 'Bulgaria' | 'Burkina Faso' | 'Burundi' | 'Cambodia' | 'Cameroon' | 'Canada' | 'Cape Verde' | 'Cayman Islands' | 'Central African Republic' | 'Chad' | 'Chile' | "People's Republic of China" | 'China' | 'Christmas Island' | 'Cocos (Keeling) Islands' | 'Colombia' | 'Comoros' | 'Republic of the Congo' | 'Congo' | 'Democratic Republic of the Congo' | 'Cook Islands' | 'Costa Rica' | "Cote d'Ivoire" | "Côte d'Ivoire" | 'Ivory Coast' | 'Croatia' | 'Cuba' | 'Cyprus' | 'Czech Republic' | 'Czechia' | 'Denmark' | 'Djibouti' | 'Dominica' | 'Dominican Republic' | 'Ecuador' | 'Egypt' | 'El Salvador' | 'Equatorial Guinea' | 'Eritrea' | 'Estonia' | 'Ethiopia' | 'Falkland Islands (Malvinas)' | 'Faroe Islands' | 'Fiji' | 'Finland' | 'France' | 'French Guiana' | 'French Polynesia' | 'French Southern Territories' | 'Gabon' | 'Republic of The Gambia' | 'The Gambia' | 'Gambia' | 'Georgia' | 'Germany' | 'Ghana' | 'Gibraltar' | 'Greece' | 'Greenland' | 'Grenada' | 'Guadeloupe' | 'Guam' | 'Guatemala' | 'Guinea' | 'Guinea-Bissau' | 'Guyana' | 'Haiti' | 'Heard Island and McDonald Islands' | 'Holy See (Vatican City State)' | 'Honduras' | 'Hong Kong' | 'Hungary' | 'Iceland' | 'India' | 'Indonesia' | 'Islamic Republic of Iran' | 'Iran' | 'Iraq' | 'Ireland' | 'Israel' | 'Italy' | 'Jamaica' | 'Japan' | 'Jordan' | 'Kazakhstan' | 'Kenya' | 'Kiribati' | 'North Korea' | 'South Korea' | 'Korea, Republic of' | 'Republic of Korea' | 'Kuwait' | 'Kyrgyzstan' | "Lao People's Democratic Republic" | 'Latvia' | 'Lebanon' | 'Lesotho' | 'Liberia' | 'Libya' | 'Liechtenstein' | 'Lithuania' | 'Luxembourg' | 'Macao' | 'Madagascar' | 'Malawi' | 'Malaysia' | 'Maldives' | 'Mali' | 'Malta' | 'Marshall Islands' | 'Martinique' | 'Mauritania' | 'Mauritius' | 'Mayotte' | 'Mexico' | 'Micronesia, Federated States of' | 'Moldova, Republic of' | 'Monaco' | 'Mongolia' | 'Montserrat' | 'Morocco' | 'Mozambique' | 'Myanmar' | 'Namibia' | 'Nauru' | 'Nepal' | 'Netherlands' | 'The Netherlands' | 'Netherlands (Kingdom of the)' | 'New Caledonia' | 'New Zealand' | 'Nicaragua' | 'Niger' | 'Nigeria' | 'Niue' | 'Norfolk Island' | 'The Republic of North Macedonia' | 'North Macedonia' | 'Northern Mariana Islands' | 'Norway' | 'Oman' | 'Pakistan' | 'Palau' | 'State of Palestine' | 'Palestine' | 'Panama' | 'Papua New Guinea' | 'Paraguay' | 'Peru' | 'Philippines' | 'Pitcairn' | 'Pitcairn Islands' | 'Poland' | 'Portugal' | 'Puerto Rico' | 'Qatar' | 'Reunion' | 'Romania' | 'Russian Federation' | 'Russia' | 'Rwanda' | 'Saint Helena' | 'Saint Kitts and Nevis' | 'Saint Lucia' | 'Saint Pierre and Miquelon' | 'Saint Vincent and the Grenadines' | 'Samoa' | 'San Marino' | 'Sao Tome and Principe' | 'Saudi Arabia' | 'Senegal' | 'Seychelles' | 'Sierra Leone' | 'Singapore' | 'Slovakia' | 'Slovenia' | 'Solomon Islands' | 'Somalia' | 'South Africa' | 'South Georgia and the South Sandwich Islands' | 'Spain' | 'Sri Lanka' | 'Sudan' | 'Suriname' | 'Svalbard and Jan Mayen' | 'Eswatini' | 'Sweden' | 'Switzerland' | 'Syrian Arab Republic' | 'Taiwan' | 'Tajikistan' | 'United Republic of Tanzania' | 'Tanzania' | 'Thailand' | 'Timor-Leste' | 'Togo' | 'Tokelau' | 'Tonga' | 'Trinidad and Tobago' | 'Tunisia' | 'Türkiye' | 'Turkey' | 'Turkmenistan' | 'Turks and Caicos Islands' | 'Tuvalu' | 'Uganda' | 'Ukraine' | 'United Arab Emirates' | 'UAE' | 'United Kingdom' | 'UK' | 'Great Britain' | 'United States of America' | 'United States' | 'USA' | 'U.S.A.' | 'US' | 'U.S.' | 'United States Minor Outlying Islands' | 'Uruguay' | 'Uzbekistan' | 'Vanuatu' | 'Venezuela' | 'Vietnam' | 'Virgin Islands, British' | 'Virgin Islands, U.S.' | 'Wallis and Futuna' | 'Western Sahara' | 'Yemen' | 'Zambia' | 'Zimbabwe' | 'Åland Islands' | 'Aland Islands' | 'Bonaire, Sint Eustatius and Saba' | 'Curaçao' | 'Guernsey' | 'Isle of Man' | 'Jersey' | 'Montenegro' | 'Saint Barthélemy' | 'Saint Martin (French part)' | 'Serbia' | 'Sint Maarten (Dutch part)' | 'South Sudan' | 'Kosovo';
|
package/dist/types/countries.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { Alpha3Code } from 'i18n-iso-countries';
|
|
2
|
-
import { CountryName } from './countries';
|
|
3
|
-
export type DisclosableIDCredential = 'birthdate' | 'expiry_date' | 'nationality' | 'firstname' | 'lastname' | 'fullname' | 'document_number' | 'document_type' | 'issuing_country' | 'gender';
|
|
4
|
-
export type NumericalIDCredential = 'age' | 'birthdate' | 'expiry_date';
|
|
5
|
-
export type IDCredential = NumericalIDCredential | DisclosableIDCredential;
|
|
6
|
-
export type IDCredentialValue<T extends IDCredential> = T extends 'nationality' | 'issuing_country' ? CountryName | Alpha3Code : T extends 'gender' ? 'male' | 'female' : T extends 'document_type' ? 'passport' | 'id_card' | 'residence_permit' | 'other' : T extends NumericalIDCredential ? number | Date : string;
|
|
7
|
-
export type IDCredentialConfig = {
|
|
8
|
-
eq?: any;
|
|
9
|
-
gte?: number | Date;
|
|
10
|
-
gt?: number | Date;
|
|
11
|
-
lte?: number | Date;
|
|
12
|
-
lt?: number | Date;
|
|
13
|
-
range?: [number | Date, number | Date];
|
|
14
|
-
in?: any[];
|
|
15
|
-
out?: any[];
|
|
16
|
-
disclose?: boolean;
|
|
17
|
-
};
|
package/dist/types/index.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export type { DisclosableIDCredential, IDCredential, IDCredentialConfig, IDCredentialValue, NumericalIDCredential, } from './credentials';
|
|
2
|
-
export type { CountryName } from './countries';
|
|
3
|
-
export type { JsonRpcRequest, JsonRpcResponse } from './json-rpc';
|
|
4
|
-
export type { QueryResultValue, QueryResult, ProofResult } from './query-result';
|
package/dist/types/index.js
DELETED
package/dist/types/json-rpc.d.ts
DELETED
package/dist/types/json-rpc.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { IDCredential } from './credentials';
|
|
2
|
-
export type QueryResultValue = {
|
|
3
|
-
eq?: {
|
|
4
|
-
expected: any;
|
|
5
|
-
result: boolean;
|
|
6
|
-
};
|
|
7
|
-
gte?: {
|
|
8
|
-
expected: number | Date;
|
|
9
|
-
result: boolean;
|
|
10
|
-
};
|
|
11
|
-
gt?: {
|
|
12
|
-
expected: number | Date;
|
|
13
|
-
result: boolean;
|
|
14
|
-
};
|
|
15
|
-
lte?: {
|
|
16
|
-
expected: number | Date;
|
|
17
|
-
result: boolean;
|
|
18
|
-
};
|
|
19
|
-
lt?: {
|
|
20
|
-
expected: number | Date;
|
|
21
|
-
result: boolean;
|
|
22
|
-
};
|
|
23
|
-
range?: {
|
|
24
|
-
expected: [number | Date, number | Date];
|
|
25
|
-
result: boolean;
|
|
26
|
-
};
|
|
27
|
-
in?: {
|
|
28
|
-
expected: any[];
|
|
29
|
-
result: boolean;
|
|
30
|
-
};
|
|
31
|
-
out?: {
|
|
32
|
-
expected: any[];
|
|
33
|
-
result: boolean;
|
|
34
|
-
};
|
|
35
|
-
disclose?: {
|
|
36
|
-
result: any;
|
|
37
|
-
};
|
|
38
|
-
};
|
|
39
|
-
export type QueryResult = {
|
|
40
|
-
[key in IDCredential]?: QueryResultValue;
|
|
41
|
-
};
|
|
42
|
-
export type ProofResult = {
|
|
43
|
-
queryResult: QueryResult;
|
|
44
|
-
proof?: string;
|
|
45
|
-
verificationKey?: string;
|
|
46
|
-
};
|