@doko/react-native-yubikit 0.0.2
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/LICENSE +20 -0
- package/README.md +126 -0
- package/RNYubikit.podspec +22 -0
- package/android/build.gradle +63 -0
- package/android/src/main/AndroidManifest.xml +9 -0
- package/android/src/main/java/com/yubikit/YubiKitManagerHolder.kt +330 -0
- package/android/src/main/java/com/yubikit/YubikitCoreModule.kt +142 -0
- package/android/src/main/java/com/yubikit/YubikitFidoModule.kt +418 -0
- package/android/src/main/java/com/yubikit/YubikitManagementModule.kt +132 -0
- package/android/src/main/java/com/yubikit/YubikitOathModule.kt +224 -0
- package/android/src/main/java/com/yubikit/YubikitOpenPgpModule.kt +317 -0
- package/android/src/main/java/com/yubikit/YubikitPackage.kt +44 -0
- package/android/src/main/java/com/yubikit/YubikitPivModule.kt +310 -0
- package/android/src/main/java/com/yubikit/YubikitSupportModule.kt +108 -0
- package/android/src/main/java/com/yubikit/YubikitYubiOtpModule.kt +248 -0
- package/android/src/main/java/com/yubikit/utils/YubikitUtils.kt +321 -0
- package/ios/YubikitCore.h +5 -0
- package/ios/YubikitCore.mm +101 -0
- package/ios/YubikitDeviceInfoHelper.h +13 -0
- package/ios/YubikitDeviceInfoHelper.mm +110 -0
- package/ios/YubikitFido.h +5 -0
- package/ios/YubikitFido.mm +373 -0
- package/ios/YubikitManagement.h +5 -0
- package/ios/YubikitManagement.mm +153 -0
- package/ios/YubikitManager.h +27 -0
- package/ios/YubikitManager.m +169 -0
- package/ios/YubikitOath.h +5 -0
- package/ios/YubikitOath.mm +583 -0
- package/ios/YubikitOpenPgp.h +5 -0
- package/ios/YubikitOpenPgp.mm +210 -0
- package/ios/YubikitPiv.h +5 -0
- package/ios/YubikitPiv.mm +813 -0
- package/ios/YubikitSupport.h +5 -0
- package/ios/YubikitSupport.mm +58 -0
- package/ios/YubikitYubiOtp.h +5 -0
- package/ios/YubikitYubiOtp.mm +120 -0
- package/lib/module/core.js +34 -0
- package/lib/module/core.js.map +1 -0
- package/lib/module/fido.js +40 -0
- package/lib/module/fido.js.map +1 -0
- package/lib/module/hooks/index.js +5 -0
- package/lib/module/hooks/index.js.map +1 -0
- package/lib/module/hooks/use-yubikey.js +12 -0
- package/lib/module/hooks/use-yubikey.js.map +1 -0
- package/lib/module/hooks/yubikey-provider.js +85 -0
- package/lib/module/hooks/yubikey-provider.js.map +1 -0
- package/lib/module/index.js +12 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/management.js +17 -0
- package/lib/module/management.js.map +1 -0
- package/lib/module/oath.js +53 -0
- package/lib/module/oath.js.map +1 -0
- package/lib/module/openpgp.js +89 -0
- package/lib/module/openpgp.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/module/piv.js +71 -0
- package/lib/module/piv.js.map +1 -0
- package/lib/module/specs/NativeYubikitCore.js +10 -0
- package/lib/module/specs/NativeYubikitCore.js.map +1 -0
- package/lib/module/specs/NativeYubikitFido.js +5 -0
- package/lib/module/specs/NativeYubikitFido.js.map +1 -0
- package/lib/module/specs/NativeYubikitManagement.js +5 -0
- package/lib/module/specs/NativeYubikitManagement.js.map +1 -0
- package/lib/module/specs/NativeYubikitOath.js +5 -0
- package/lib/module/specs/NativeYubikitOath.js.map +1 -0
- package/lib/module/specs/NativeYubikitOpenPgp.js +5 -0
- package/lib/module/specs/NativeYubikitOpenPgp.js.map +1 -0
- package/lib/module/specs/NativeYubikitPiv.js +5 -0
- package/lib/module/specs/NativeYubikitPiv.js.map +1 -0
- package/lib/module/specs/NativeYubikitSupport.js +5 -0
- package/lib/module/specs/NativeYubikitSupport.js.map +1 -0
- package/lib/module/specs/NativeYubikitYubiOtp.js +5 -0
- package/lib/module/specs/NativeYubikitYubiOtp.js.map +1 -0
- package/lib/module/support.js +11 -0
- package/lib/module/support.js.map +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -0
- package/lib/module/yubiotp.js +32 -0
- package/lib/module/yubiotp.js.map +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/core.d.ts +14 -0
- package/lib/typescript/src/core.d.ts.map +1 -0
- package/lib/typescript/src/fido.d.ts +24 -0
- package/lib/typescript/src/fido.d.ts.map +1 -0
- package/lib/typescript/src/hooks/index.d.ts +3 -0
- package/lib/typescript/src/hooks/index.d.ts.map +1 -0
- package/lib/typescript/src/hooks/use-yubikey.d.ts +3 -0
- package/lib/typescript/src/hooks/use-yubikey.d.ts.map +1 -0
- package/lib/typescript/src/hooks/yubikey-provider.d.ts +23 -0
- package/lib/typescript/src/hooks/yubikey-provider.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +10 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/management.d.ts +8 -0
- package/lib/typescript/src/management.d.ts.map +1 -0
- package/lib/typescript/src/oath.d.ts +20 -0
- package/lib/typescript/src/oath.d.ts.map +1 -0
- package/lib/typescript/src/openpgp.d.ts +35 -0
- package/lib/typescript/src/openpgp.d.ts.map +1 -0
- package/lib/typescript/src/piv.d.ts +26 -0
- package/lib/typescript/src/piv.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeYubikitCore.d.ts +49 -0
- package/lib/typescript/src/specs/NativeYubikitCore.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeYubikitFido.d.ts +121 -0
- package/lib/typescript/src/specs/NativeYubikitFido.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeYubikitManagement.d.ts +53 -0
- package/lib/typescript/src/specs/NativeYubikitManagement.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeYubikitOath.d.ts +70 -0
- package/lib/typescript/src/specs/NativeYubikitOath.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeYubikitOpenPgp.d.ts +53 -0
- package/lib/typescript/src/specs/NativeYubikitOpenPgp.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeYubikitPiv.d.ts +47 -0
- package/lib/typescript/src/specs/NativeYubikitPiv.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeYubikitSupport.d.ts +49 -0
- package/lib/typescript/src/specs/NativeYubikitSupport.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeYubikitYubiOtp.d.ts +45 -0
- package/lib/typescript/src/specs/NativeYubikitYubiOtp.d.ts.map +1 -0
- package/lib/typescript/src/support.d.ts +6 -0
- package/lib/typescript/src/support.d.ts.map +1 -0
- package/lib/typescript/src/types.d.ts +293 -0
- package/lib/typescript/src/types.d.ts.map +1 -0
- package/lib/typescript/src/yubiotp.d.ts +13 -0
- package/lib/typescript/src/yubiotp.d.ts.map +1 -0
- package/package.json +181 -0
- package/src/core.ts +58 -0
- package/src/fido.ts +112 -0
- package/src/hooks/index.tsx +2 -0
- package/src/hooks/use-yubikey.tsx +10 -0
- package/src/hooks/yubikey-provider.tsx +146 -0
- package/src/index.tsx +10 -0
- package/src/management.ts +44 -0
- package/src/oath.ts +134 -0
- package/src/openpgp.ts +220 -0
- package/src/piv.ts +193 -0
- package/src/specs/NativeYubikitCore.ts +68 -0
- package/src/specs/NativeYubikitFido.ts +149 -0
- package/src/specs/NativeYubikitManagement.ts +78 -0
- package/src/specs/NativeYubikitOath.ts +110 -0
- package/src/specs/NativeYubikitOpenPgp.ts +148 -0
- package/src/specs/NativeYubikitPiv.ts +108 -0
- package/src/specs/NativeYubikitSupport.ts +61 -0
- package/src/specs/NativeYubikitYubiOtp.ts +82 -0
- package/src/support.ts +18 -0
- package/src/types.ts +404 -0
- package/src/yubiotp.ts +96 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared TypeScript types mirroring the YubiKit Android SDK v3 public API.
|
|
3
|
+
* Serialization over the bridge uses plain objects and base64-encoded byte arrays.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
export type Base64String = string;
|
|
7
|
+
|
|
8
|
+
export type Transport = 'usb' | 'nfc';
|
|
9
|
+
|
|
10
|
+
export interface Version {
|
|
11
|
+
major: number;
|
|
12
|
+
minor: number;
|
|
13
|
+
micro: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface YubiKeyDevice {
|
|
17
|
+
/** Unique handle for this device within the current session. */
|
|
18
|
+
handle: string;
|
|
19
|
+
transport: Transport;
|
|
20
|
+
/** Types of connections supported by the device, e.g. ["SmartCardConnection"]. */
|
|
21
|
+
supportedConnections: string[];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export type ConnectionType =
|
|
25
|
+
| 'SmartCardConnection'
|
|
26
|
+
| 'OtpConnection'
|
|
27
|
+
| 'FidoConnection';
|
|
28
|
+
|
|
29
|
+
export interface UsbConfiguration {
|
|
30
|
+
handlePermissions?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export interface NfcConfiguration {
|
|
34
|
+
timeout?: number;
|
|
35
|
+
disableNfcDiscoverySound?: boolean;
|
|
36
|
+
skipNdefCheck?: boolean;
|
|
37
|
+
handleUnavailableNfc?: boolean;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export interface NfcNotAvailableError {
|
|
41
|
+
disabled: boolean;
|
|
42
|
+
message: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type YubiKeyEvent =
|
|
46
|
+
| { type: 'attached'; device: YubiKeyDevice }
|
|
47
|
+
| { type: 'detached'; handle: string }
|
|
48
|
+
| { type: 'error'; error: string };
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Wire shape emitted by the native `onYubiKeyEvent` EventEmitter. Codegen doesn't
|
|
52
|
+
* support discriminated union payloads, so all variant fields are optional here;
|
|
53
|
+
* `addYubiKeyListener` narrows this to {@link YubiKeyEvent} for consumers.
|
|
54
|
+
*/
|
|
55
|
+
export interface YubiKeyEventPayload {
|
|
56
|
+
type: 'attached' | 'detached' | 'error';
|
|
57
|
+
device?: YubiKeyDevice;
|
|
58
|
+
handle?: string;
|
|
59
|
+
error?: string;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/** Core module enums */
|
|
63
|
+
|
|
64
|
+
export type YubiKeyType = 'YKS' | 'NEO' | 'SKY' | 'YKP' | 'YK4' | 'OTHER';
|
|
65
|
+
|
|
66
|
+
export type FormFactor =
|
|
67
|
+
| 'UNKNOWN'
|
|
68
|
+
| 'USB_A_KEYCHAIN'
|
|
69
|
+
| 'USB_A_NANO'
|
|
70
|
+
| 'USB_C_KEYCHAIN'
|
|
71
|
+
| 'USB_C_NANO'
|
|
72
|
+
| 'USB_C_LIGHTNING'
|
|
73
|
+
| 'USB_A_BIO'
|
|
74
|
+
| 'USB_C_BIO';
|
|
75
|
+
|
|
76
|
+
export type Capability =
|
|
77
|
+
| 'OTP'
|
|
78
|
+
| 'U2F'
|
|
79
|
+
| 'OPENPGP'
|
|
80
|
+
| 'PIV'
|
|
81
|
+
| 'OATH'
|
|
82
|
+
| 'HSMAUTH'
|
|
83
|
+
| 'FIDO2';
|
|
84
|
+
|
|
85
|
+
export interface DeviceConfig {
|
|
86
|
+
enabledCapabilities?: Partial<Record<Transport, number>>;
|
|
87
|
+
autoEjectTimeout?: number;
|
|
88
|
+
challengeResponseTimeout?: number;
|
|
89
|
+
nfcRestricted?: boolean;
|
|
90
|
+
deviceFlags?: number;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
export interface DeviceInfo {
|
|
94
|
+
config?: DeviceConfig;
|
|
95
|
+
serialNumber?: number;
|
|
96
|
+
version: Version;
|
|
97
|
+
versionName: string;
|
|
98
|
+
formFactor: FormFactor;
|
|
99
|
+
supportedCapabilities: Partial<Record<Transport, number>>;
|
|
100
|
+
hasTransportUsb: boolean;
|
|
101
|
+
hasTransportNfc: boolean;
|
|
102
|
+
isLocked: boolean;
|
|
103
|
+
isFips: boolean;
|
|
104
|
+
isSky: boolean;
|
|
105
|
+
partNumber?: string;
|
|
106
|
+
fipsCapable: number;
|
|
107
|
+
fipsApproved: number;
|
|
108
|
+
pinComplexity: boolean;
|
|
109
|
+
resetBlocked: number;
|
|
110
|
+
fpsVersion?: Version;
|
|
111
|
+
stmVersion?: Version;
|
|
112
|
+
versionQualifier?: string;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export type UsbMode =
|
|
116
|
+
| 'OTP'
|
|
117
|
+
| 'FIDO'
|
|
118
|
+
| 'CCID'
|
|
119
|
+
| 'OTP_FIDO'
|
|
120
|
+
| 'OTP_CCID'
|
|
121
|
+
| 'FIDO_CCID'
|
|
122
|
+
| 'OTP_FIDO_CCID';
|
|
123
|
+
|
|
124
|
+
/** OATH module */
|
|
125
|
+
|
|
126
|
+
export type OathType = 'HOTP' | 'TOTP';
|
|
127
|
+
export type HashAlgorithm = 'SHA1' | 'SHA256' | 'SHA512';
|
|
128
|
+
|
|
129
|
+
export interface Credential {
|
|
130
|
+
id: Base64String;
|
|
131
|
+
oathType: OathType;
|
|
132
|
+
issuer?: string;
|
|
133
|
+
accountName: string;
|
|
134
|
+
period: number;
|
|
135
|
+
touchRequired: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface Code {
|
|
139
|
+
value: string;
|
|
140
|
+
validFrom: number;
|
|
141
|
+
validUntil: number;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface CredentialData {
|
|
145
|
+
accountName: string;
|
|
146
|
+
oathType: OathType;
|
|
147
|
+
hashAlgorithm: HashAlgorithm;
|
|
148
|
+
secret: Base64String;
|
|
149
|
+
digits: number;
|
|
150
|
+
period: number;
|
|
151
|
+
counter: number;
|
|
152
|
+
issuer?: string;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export interface OathCredentialsResult {
|
|
156
|
+
credentials: Credential[];
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface OathCodesResult {
|
|
160
|
+
codes: Array<{ credential: Credential; code?: Code }>;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/** PIV module */
|
|
164
|
+
|
|
165
|
+
export type PivSlot =
|
|
166
|
+
| 'AUTHENTICATION'
|
|
167
|
+
| 'SIGNATURE'
|
|
168
|
+
| 'KEY_MANAGEMENT'
|
|
169
|
+
| 'CARD_AUTH'
|
|
170
|
+
| 'RETIRED1'
|
|
171
|
+
| 'RETIRED2'
|
|
172
|
+
| 'RETIRED3'
|
|
173
|
+
| 'RETIRED4'
|
|
174
|
+
| 'RETIRED5'
|
|
175
|
+
| 'RETIRED6'
|
|
176
|
+
| 'RETIRED7'
|
|
177
|
+
| 'RETIRED8'
|
|
178
|
+
| 'RETIRED9'
|
|
179
|
+
| 'RETIRED10'
|
|
180
|
+
| 'RETIRED11'
|
|
181
|
+
| 'RETIRED12'
|
|
182
|
+
| 'RETIRED13'
|
|
183
|
+
| 'RETIRED14'
|
|
184
|
+
| 'RETIRED15'
|
|
185
|
+
| 'RETIRED16'
|
|
186
|
+
| 'RETIRED17'
|
|
187
|
+
| 'RETIRED18'
|
|
188
|
+
| 'RETIRED19'
|
|
189
|
+
| 'RETIRED20'
|
|
190
|
+
| 'ATTESTATION';
|
|
191
|
+
|
|
192
|
+
export type PivKeyType =
|
|
193
|
+
| 'RSA1024'
|
|
194
|
+
| 'RSA2048'
|
|
195
|
+
| 'RSA3072'
|
|
196
|
+
| 'RSA4096'
|
|
197
|
+
| 'ECCP256'
|
|
198
|
+
| 'ECCP384'
|
|
199
|
+
| 'ED25519'
|
|
200
|
+
| 'X25519';
|
|
201
|
+
|
|
202
|
+
export type PivPinPolicy =
|
|
203
|
+
| 'DEFAULT'
|
|
204
|
+
| 'NEVER'
|
|
205
|
+
| 'ONCE'
|
|
206
|
+
| 'ALWAYS'
|
|
207
|
+
| 'MATCH_ONCE'
|
|
208
|
+
| 'MATCH_ALWAYS';
|
|
209
|
+
|
|
210
|
+
export type PivTouchPolicy = 'DEFAULT' | 'NEVER' | 'ALWAYS' | 'CACHED';
|
|
211
|
+
|
|
212
|
+
export type PivManagementKeyType = 'TDES' | 'AES128' | 'AES192' | 'AES256';
|
|
213
|
+
|
|
214
|
+
export interface PivPinMetadata {
|
|
215
|
+
attemptsRemaining: number;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
export interface PivSlotMetadata {
|
|
219
|
+
keyType: PivKeyType;
|
|
220
|
+
pinPolicy: PivPinPolicy;
|
|
221
|
+
touchPolicy: PivTouchPolicy;
|
|
222
|
+
generated: boolean;
|
|
223
|
+
publicKey?: Base64String;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export interface PivManagementKeyMetadata {
|
|
227
|
+
keyType: PivManagementKeyType;
|
|
228
|
+
defaultValue: boolean;
|
|
229
|
+
touchRequired: boolean;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
export interface PivBioMetadata {
|
|
233
|
+
attemptsRemaining?: number;
|
|
234
|
+
temporaryPin?: boolean;
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** OpenPGP module */
|
|
238
|
+
|
|
239
|
+
export type OpenPgpKeyRef = 'SIG' | 'DEC' | 'AUT' | 'ATT';
|
|
240
|
+
|
|
241
|
+
export type OpenPgpUif = 'OFF' | 'ON' | 'FIXED' | 'CACHED' | 'CACHED_FIXED';
|
|
242
|
+
|
|
243
|
+
export type OpenPgpPinPolicy = 'ALWAYS' | 'ONCE';
|
|
244
|
+
|
|
245
|
+
export type OpenPgpCurve =
|
|
246
|
+
| 'SECP256R1'
|
|
247
|
+
| 'SECP256K1'
|
|
248
|
+
| 'SECP384R1'
|
|
249
|
+
| 'SECP521R1'
|
|
250
|
+
| 'BrainpoolP256R1'
|
|
251
|
+
| 'BrainpoolP384R1'
|
|
252
|
+
| 'BrainpoolP512R1'
|
|
253
|
+
| 'X25519'
|
|
254
|
+
| 'Ed25519';
|
|
255
|
+
|
|
256
|
+
export interface OpenPgpAlgorithmAttributes {
|
|
257
|
+
keyRef: OpenPgpKeyRef;
|
|
258
|
+
algorithm: string;
|
|
259
|
+
curve?: OpenPgpCurve;
|
|
260
|
+
keySize?: number;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
export interface OpenPgpApplicationRelatedData {
|
|
264
|
+
aid: Base64String;
|
|
265
|
+
historical: Base64String;
|
|
266
|
+
signatureCounter: number;
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/** YubiOTP module */
|
|
270
|
+
|
|
271
|
+
export type OtpSlot = 'ONE' | 'TWO';
|
|
272
|
+
|
|
273
|
+
export interface ConfigurationState {
|
|
274
|
+
slot1Configured: boolean;
|
|
275
|
+
slot2Configured: boolean;
|
|
276
|
+
slot1TouchTriggered: boolean;
|
|
277
|
+
slot2TouchTriggered: boolean;
|
|
278
|
+
ledInverted: boolean;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
export type OtpConfigurationType =
|
|
282
|
+
| 'YubiOtp'
|
|
283
|
+
| 'HOTP'
|
|
284
|
+
| 'HmacSha1'
|
|
285
|
+
| 'StaticPassword'
|
|
286
|
+
| 'StaticTicket'
|
|
287
|
+
| 'Update';
|
|
288
|
+
|
|
289
|
+
export interface OtpSlotConfiguration {
|
|
290
|
+
type: OtpConfigurationType;
|
|
291
|
+
/** Base64-encoded fixed public ID (YubiOTP/StaticTicket). */
|
|
292
|
+
fixed?: Base64String;
|
|
293
|
+
/** Base64-encoded private ID (YubiOTP/StaticTicket). */
|
|
294
|
+
uid?: Base64String;
|
|
295
|
+
/** Base64-encoded AES key. */
|
|
296
|
+
key?: Base64String;
|
|
297
|
+
/** Base64-encoded HOTP/HMAC secret. */
|
|
298
|
+
secret?: Base64String;
|
|
299
|
+
/** Base64-encoded scan codes (StaticPassword). */
|
|
300
|
+
scanCodes?: Base64String;
|
|
301
|
+
/** HOTP digits: 6 or 8. */
|
|
302
|
+
digits?: number;
|
|
303
|
+
/** HOTP initial moving factor. */
|
|
304
|
+
imf?: number;
|
|
305
|
+
/** HMAC-SHA1: require touch to trigger. */
|
|
306
|
+
requireTouch?: boolean;
|
|
307
|
+
/** HMAC-SHA1: allow less than 64 byte challenges. */
|
|
308
|
+
lt64?: boolean;
|
|
309
|
+
/** Common flags. */
|
|
310
|
+
appendCr?: boolean;
|
|
311
|
+
serialApiVisible?: boolean;
|
|
312
|
+
serialUsbVisible?: boolean;
|
|
313
|
+
allowUpdate?: boolean;
|
|
314
|
+
dormant?: boolean;
|
|
315
|
+
invertLed?: boolean;
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/** FIDO module */
|
|
319
|
+
|
|
320
|
+
export interface PublicKeyCredentialCreationOptions {
|
|
321
|
+
rp: { id: string; name: string };
|
|
322
|
+
user: { id: Base64String; name: string; displayName: string };
|
|
323
|
+
challenge: Base64String;
|
|
324
|
+
pubKeyCredParams: Array<{ type: string; alg: number }>;
|
|
325
|
+
timeout?: number;
|
|
326
|
+
excludeCredentials?: Array<{
|
|
327
|
+
id: Base64String;
|
|
328
|
+
type: string;
|
|
329
|
+
transports?: string[];
|
|
330
|
+
}>;
|
|
331
|
+
authenticatorSelection?: {
|
|
332
|
+
authenticatorAttachment?: string;
|
|
333
|
+
residentKey?: string;
|
|
334
|
+
userVerification?: string;
|
|
335
|
+
};
|
|
336
|
+
attestation?: string;
|
|
337
|
+
extensions?: Record<string, unknown>;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export interface PublicKeyCredentialRequestOptions {
|
|
341
|
+
challenge: Base64String;
|
|
342
|
+
timeout?: number;
|
|
343
|
+
rpId?: string;
|
|
344
|
+
allowCredentials?: Array<{
|
|
345
|
+
id: Base64String;
|
|
346
|
+
type: string;
|
|
347
|
+
transports?: string[];
|
|
348
|
+
}>;
|
|
349
|
+
userVerification?: string;
|
|
350
|
+
extensions?: Record<string, unknown>;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
export interface PublicKeyCredential {
|
|
354
|
+
id: Base64String;
|
|
355
|
+
rawId: Base64String;
|
|
356
|
+
type: 'public-key';
|
|
357
|
+
response: {
|
|
358
|
+
clientDataJSON: Base64String;
|
|
359
|
+
authenticatorData?: Base64String;
|
|
360
|
+
attestationObject?: Base64String;
|
|
361
|
+
signature?: Base64String;
|
|
362
|
+
userHandle?: Base64String;
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export interface Ctap2Info {
|
|
367
|
+
versions: string[];
|
|
368
|
+
extensions?: string[];
|
|
369
|
+
aaguid?: Base64String;
|
|
370
|
+
options?: Record<string, boolean>;
|
|
371
|
+
maxMsgSize?: number;
|
|
372
|
+
pinUvAuthProtocols?: number[];
|
|
373
|
+
maxCredentialCountInList?: number;
|
|
374
|
+
maxCredentialIdLength?: number;
|
|
375
|
+
transports?: string[];
|
|
376
|
+
algorithms?: Array<{ type: string; alg: number }>;
|
|
377
|
+
maxLargeBlob?: number;
|
|
378
|
+
minPinLength?: number;
|
|
379
|
+
firmwareVersion?: number;
|
|
380
|
+
maxCredBlobLength?: number;
|
|
381
|
+
maxRpidsForMinPinLength?: number;
|
|
382
|
+
preferredPlatformUvAttempts?: number;
|
|
383
|
+
uvModality?: number;
|
|
384
|
+
certifications?: Record<string, number>;
|
|
385
|
+
remainingDiscoverableCredentials?: number;
|
|
386
|
+
vendorPrototypeConfigCommands?: number[];
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
export interface FidoCredentialDescriptor {
|
|
390
|
+
id: Base64String;
|
|
391
|
+
type: string;
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
export interface FidoCredentialUserEntity {
|
|
395
|
+
id: Base64String;
|
|
396
|
+
name: string;
|
|
397
|
+
displayName: string;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
/** Support module */
|
|
401
|
+
|
|
402
|
+
export interface SupportDeviceInfo extends DeviceInfo {
|
|
403
|
+
name: string;
|
|
404
|
+
}
|
package/src/yubiotp.ts
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import NativeYubikitYubiOtp from './specs/NativeYubikitYubiOtp';
|
|
2
|
+
import type {
|
|
3
|
+
Base64String,
|
|
4
|
+
ConfigurationState,
|
|
5
|
+
OtpSlot,
|
|
6
|
+
OtpSlotConfiguration,
|
|
7
|
+
Version,
|
|
8
|
+
} from './types';
|
|
9
|
+
|
|
10
|
+
export function getConfigurationState(
|
|
11
|
+
deviceHandle: string
|
|
12
|
+
): Promise<ConfigurationState> {
|
|
13
|
+
return NativeYubikitYubiOtp.getConfigurationState(
|
|
14
|
+
deviceHandle
|
|
15
|
+
) as Promise<ConfigurationState>;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function getVersion(deviceHandle: string): Promise<Version> {
|
|
19
|
+
return NativeYubikitYubiOtp.getVersion(deviceHandle) as Promise<Version>;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export function getSerialNumber(deviceHandle: string): Promise<number> {
|
|
23
|
+
return NativeYubikitYubiOtp.getSerialNumber(deviceHandle);
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export function swapConfigurations(deviceHandle: string): Promise<void> {
|
|
27
|
+
return NativeYubikitYubiOtp.swapConfigurations(deviceHandle);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function deleteConfiguration(
|
|
31
|
+
deviceHandle: string,
|
|
32
|
+
slot: OtpSlot,
|
|
33
|
+
currentAccessCode?: Base64String
|
|
34
|
+
): Promise<void> {
|
|
35
|
+
return NativeYubikitYubiOtp.deleteConfiguration(
|
|
36
|
+
deviceHandle,
|
|
37
|
+
slot,
|
|
38
|
+
currentAccessCode
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function putConfiguration(
|
|
43
|
+
deviceHandle: string,
|
|
44
|
+
slot: OtpSlot,
|
|
45
|
+
configuration: OtpSlotConfiguration,
|
|
46
|
+
accessCode?: Base64String,
|
|
47
|
+
currentAccessCode?: Base64String
|
|
48
|
+
): Promise<void> {
|
|
49
|
+
return NativeYubikitYubiOtp.putConfiguration(
|
|
50
|
+
deviceHandle,
|
|
51
|
+
slot,
|
|
52
|
+
configuration,
|
|
53
|
+
accessCode,
|
|
54
|
+
currentAccessCode
|
|
55
|
+
);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export function updateConfiguration(
|
|
59
|
+
deviceHandle: string,
|
|
60
|
+
slot: OtpSlot,
|
|
61
|
+
configuration: OtpSlotConfiguration,
|
|
62
|
+
accessCode?: Base64String,
|
|
63
|
+
currentAccessCode?: Base64String
|
|
64
|
+
): Promise<void> {
|
|
65
|
+
return NativeYubikitYubiOtp.updateConfiguration(
|
|
66
|
+
deviceHandle,
|
|
67
|
+
slot,
|
|
68
|
+
configuration,
|
|
69
|
+
accessCode,
|
|
70
|
+
currentAccessCode
|
|
71
|
+
);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export function setNdefConfiguration(
|
|
75
|
+
deviceHandle: string,
|
|
76
|
+
slot: OtpSlot,
|
|
77
|
+
uri?: string,
|
|
78
|
+
currentAccessCode?: Base64String
|
|
79
|
+
): Promise<void> {
|
|
80
|
+
return NativeYubikitYubiOtp.setNdefConfiguration(
|
|
81
|
+
deviceHandle,
|
|
82
|
+
slot,
|
|
83
|
+
uri,
|
|
84
|
+
currentAccessCode
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
export function calculateHmacSha1(
|
|
89
|
+
deviceHandle: string,
|
|
90
|
+
slot: OtpSlot,
|
|
91
|
+
challenge: Base64String
|
|
92
|
+
): Promise<Base64String> {
|
|
93
|
+
return NativeYubikitYubiOtp.calculateHmacSha1(deviceHandle, slot, challenge);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
export { NativeYubikitYubiOtp };
|