kokio-sdk 0.0.9 → 0.0.10
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
|
@@ -4,7 +4,7 @@ import { decodeAttestationObject, decodeClientDataJSON, isoBase64URL, parseAuthe
|
|
|
4
4
|
import { _add0x, base64UrlToBuffer, parseSignature } from "../utils.js";
|
|
5
5
|
import { WebAuthnSignature } from "../../types.js";
|
|
6
6
|
import { Passkey, PasskeyGetResult } from "react-native-passkey";
|
|
7
|
-
import { p256 } from "@noble/curves/
|
|
7
|
+
import { p256 } from "@noble/curves/nist.js";
|
|
8
8
|
import { AuthenticatorTransport } from "@turnkey/react-native-passkey-stamper";
|
|
9
9
|
|
|
10
10
|
type BrokenPasskeyGetResult = PasskeyGetResult | string;
|
|
@@ -16,7 +16,7 @@ type BrokenPasskeyGetResult = PasskeyGetResult | string;
|
|
|
16
16
|
*/
|
|
17
17
|
export const _stamp = async (credentialId: string, rpId: string, payload: Hex): Promise<WebAuthnSignature> => {
|
|
18
18
|
const signingOptions = {
|
|
19
|
-
challenge: isoBase64URL.fromBuffer(hexToBytes(payload)), // Base64URL of the raw EIP-191 hash bytes
|
|
19
|
+
challenge: isoBase64URL.fromBuffer((hexToBytes(payload) as unknown) as Uint8Array<ArrayBuffer> ), // Base64URL of the raw EIP-191 hash bytes
|
|
20
20
|
allowCredentials: [{
|
|
21
21
|
id: credentialId,
|
|
22
22
|
type: 'public-key',
|
|
@@ -109,7 +109,7 @@ export const _signMessageWithTurnkey = async (client: TurnkeyClient, organizatio
|
|
|
109
109
|
assertActivityCompleted(activity);
|
|
110
110
|
|
|
111
111
|
const attestationObject = assertNonNull(activity.intent.createOrganizationIntent?.rootAuthenticator.attestation.response.attestationObject);
|
|
112
|
-
const decodedAttestationObj = decodeAttestationObject(base64UrlToBuffer(attestationObject))
|
|
112
|
+
const decodedAttestationObj = decodeAttestationObject((base64UrlToBuffer(attestationObject) as unknown) as Uint8Array<ArrayBuffer>)
|
|
113
113
|
|
|
114
114
|
const clientDataJson = assertNonNull(activity.intent.createOrganizationIntent?.rootAuthenticator.attestation.response.clientDataJson);
|
|
115
115
|
const decodedClientDataJson = decodeClientDataJSON(clientDataJson);
|
|
@@ -148,7 +148,7 @@ export const _signTypedDataWithTurnkey = async <
|
|
|
148
148
|
assertActivityCompleted(activity);
|
|
149
149
|
|
|
150
150
|
const attestationObject = assertNonNull(activity.intent.createOrganizationIntent?.rootAuthenticator.attestation.response.attestationObject);
|
|
151
|
-
const decodedAttestationObj = decodeAttestationObject(base64UrlToBuffer(attestationObject))
|
|
151
|
+
const decodedAttestationObj = decodeAttestationObject((base64UrlToBuffer(attestationObject) as unknown) as Uint8Array<ArrayBuffer>)
|
|
152
152
|
|
|
153
153
|
const clientDataJson = assertNonNull(activity.intent.createOrganizationIntent?.rootAuthenticator.attestation.response.clientDataJson);
|
|
154
154
|
const decodedClientDataJson = decodeClientDataJSON(clientDataJson);
|
|
@@ -215,7 +215,7 @@ export const _stampAndSignMessageWithTurnkey = async (client: TurnkeyClient, org
|
|
|
215
215
|
const originalPayloadBytes = getBytesFromPayload(payload as Hex);
|
|
216
216
|
// Replace the challenge in decodedClientDataJson with the Base64URL of the *actual bytes*
|
|
217
217
|
// isoBase64URL.fromBuffer from simplewebauthn/server removes padding, which is standard for WebAuthn.
|
|
218
|
-
decodedClientDataJson.challenge = isoBase64URL.fromBuffer(originalPayloadBytes);
|
|
218
|
+
decodedClientDataJson.challenge = isoBase64URL.fromBuffer((originalPayloadBytes as unknown) as Uint8Array<ArrayBuffer>);
|
|
219
219
|
const typeIndex = JSON.stringify(decodedClientDataJson).indexOf('"type":"webauthn.get"');
|
|
220
220
|
const challengeIndex = JSON.stringify(decodedClientDataJson).indexOf('"challenge":');
|
|
221
221
|
if (typeIndex === -1 || challengeIndex === -1) {
|