electron-webauthn 0.0.16 → 0.0.17

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "electron-webauthn",
3
- "version": "0.0.16",
4
- "repository": "https://github.com/iamEvanYT/electron-webauthn",
3
+ "version": "0.0.17",
4
+ "repository": "https://github.com/iamEvanYT/electron-webauthn.git",
5
5
  "description": "Add support for WebAuthn for Electron.",
6
6
  "main": "dist/index.js",
7
7
  "module": "dist/index.js",
@@ -1 +0,0 @@
1
- export declare function getCredential(publicKey?: PublicKeyCredentialRequestOptions): void;
@@ -1 +0,0 @@
1
- export function getCredential(publicKey) { }
package/dist/helpers.d.ts DELETED
@@ -1,9 +0,0 @@
1
- export declare function PromiseWithResolvers<T = void>(): {
2
- promise: Promise<T>;
3
- resolve: (value: T | PromiseLike<T>) => void;
4
- reject: (reason?: unknown) => void;
5
- };
6
- export declare function clientDataJsonBufferToHash(clientDataJSON: Buffer): Buffer;
7
- export declare function serializeOrigin(origin: string): string | null;
8
- export declare function bufferToBase64Url(buffer: Buffer): string;
9
- export declare function base64UrlToBuffer(b64url: string): Buffer;
package/dist/helpers.js DELETED
@@ -1,63 +0,0 @@
1
- import { createHash } from "crypto";
2
- export function PromiseWithResolvers() {
3
- let resolve;
4
- let reject;
5
- const promise = new Promise((res, rej) => {
6
- resolve = res;
7
- reject = rej;
8
- });
9
- return { promise, resolve: resolve, reject: reject };
10
- }
11
- export function clientDataJsonBufferToHash(clientDataJSON) {
12
- if (!Buffer.isBuffer(clientDataJSON)) {
13
- throw new TypeError("clientDataJsonBufferToHash: clientDataJSON must be a Buffer");
14
- }
15
- if (clientDataJSON.length === 0) {
16
- throw new RangeError("clientDataJsonBufferToHash: clientDataJSON is empty");
17
- }
18
- return createHash("sha256").update(clientDataJSON).digest();
19
- }
20
- export function serializeOrigin(origin) {
21
- if (origin === "null" || !origin) {
22
- return null;
23
- }
24
- try {
25
- const url = new URL(origin);
26
- let result = url.protocol;
27
- if (!result.endsWith("://")) {
28
- result = result.replace(/:$/, "") + "://";
29
- }
30
- result += url.hostname;
31
- if (url.port) {
32
- result += ":" + url.port;
33
- }
34
- return result;
35
- }
36
- catch (error) {
37
- return null;
38
- }
39
- }
40
- export function bufferToBase64Url(buffer) {
41
- const bytes = new Uint8Array(buffer);
42
- let binary = "";
43
- for (let i = 0; i < bytes.length; i++) {
44
- binary += String.fromCharCode(bytes[i]);
45
- }
46
- return btoa(binary)
47
- .replace(/\+/g, "-")
48
- .replace(/\//g, "_")
49
- .replace(/=+$/, "");
50
- }
51
- export function base64UrlToBuffer(b64url) {
52
- if (typeof b64url !== "string")
53
- throw new TypeError("base64Url must be a string");
54
- let b64 = b64url.replace(/-/g, "+").replace(/_/g, "/");
55
- const pad = b64.length % 4;
56
- if (pad === 2)
57
- b64 += "==";
58
- else if (pad === 3)
59
- b64 += "=";
60
- else if (pad !== 0)
61
- throw new Error("Invalid base64url length");
62
- return Buffer.from(b64, "base64");
63
- }
@@ -1,14 +0,0 @@
1
- import type { NobjcObject } from "objc-js";
2
- import type { _ASAuthorizationPublicKeyCredentialLargeBlobRegistrationOutput } from "./as-authorization-public-key-credential-large-blob-registration-output.js";
3
- import type { _NSData } from "../foundation/nsdata.js";
4
- import type { ASAuthorizationPublicKeyCredentialAttachment } from "./enums/as-authorization-public-key-credential-attachment.js";
5
- declare class _ASAuthorizationPublicKeyCredentialRegistration extends NobjcObject {
6
- attachment(): ASAuthorizationPublicKeyCredentialAttachment;
7
- largeBlob(): _ASAuthorizationPublicKeyCredentialLargeBlobRegistrationOutput;
8
- rawClientDataJSON(): _NSData;
9
- credentialID(): _NSData;
10
- rawAuthenticatorData(): _NSData;
11
- rawAttestationObject(): _NSData;
12
- }
13
- export declare const ASAuthorizationPublicKeyCredentialRegistration: typeof _ASAuthorizationPublicKeyCredentialRegistration;
14
- export type { _ASAuthorizationPublicKeyCredentialRegistration };
@@ -1,2 +0,0 @@
1
- import { AuthenticationServices } from "./index.js";
2
- export const ASAuthorizationPublicKeyCredentialRegistration = AuthenticationServices.ASAuthorizationPublicKeyCredentialRegistration;
package/dist/prf.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export interface PRFInput {
2
- first: Buffer;
3
- second?: Buffer;
4
- }
5
- export declare function createPRFInput(prf: PRFInput): import("./objc/authentication-services/as-authorization-public-key-credential-prf-assertion-input-valuesas-authorization-public-key-credential-prf-assertion-input-values.js")._ASAuthorizationPublicKeyCredentialPRFAssertionInputValues;
package/dist/prf.js DELETED
@@ -1,5 +0,0 @@
1
- import { createASAuthorizationPublicKeyCredentialPRFAssertionInputValues } from "./objc/authentication-services/as-authorization-public-key-credential-prf-assertion-input-valuesas-authorization-public-key-credential-prf-assertion-input-values.js";
2
- import { NSDataFromBuffer } from "./objc/foundation/nsdata.js";
3
- export function createPRFInput(prf) {
4
- return createASAuthorizationPublicKeyCredentialPRFAssertionInputValues(NSDataFromBuffer(prf.first), prf.second ? NSDataFromBuffer(prf.second) : null);
5
- }
package/dist/test.d.ts DELETED
@@ -1 +0,0 @@
1
- export {};
package/dist/test.js DELETED
@@ -1,5 +0,0 @@
1
- import { parseAttestationObject } from "@oslojs/webauthn";
2
- const attestationObjectHex = "a363666d74646e6f6e656761747453746d74a06861757468446174615898c46cef82ad1b546477591d008b08759ec3e6d2ecb4f39474bfea6969925d03b75900000000fbfc3007154e4ecc8c0b6e020557d7bd0014dc5fff759fcb38d5dd7a258722f1aea8e261bc90a50102032620012158207f666e29c2e358562fd035c4097163ac0cfe994f51dfb37da8f86548a965df2b2258208cbb1082ff0575571998c90b03915cda4024fa176a87c4db0da4d5c45c192bc8";
3
- const attestationObject = Buffer.from(attestationObjectHex, "hex");
4
- const attestation = parseAttestationObject(attestationObject);
5
- console.log(attestation.authenticatorData.credential.publicKey.decoded);