kokio-sdk 0.1.0 → 0.1.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.
|
@@ -18,8 +18,8 @@ jobs:
|
|
|
18
18
|
|
|
19
19
|
- uses: actions/setup-node@v4
|
|
20
20
|
with:
|
|
21
|
-
node-version:
|
|
22
|
-
registry-url: https://registry.npmjs.org/
|
|
21
|
+
node-version: 24
|
|
22
|
+
registry-url: 'https://registry.npmjs.org/'
|
|
23
23
|
|
|
24
24
|
- name: Get version from package.json
|
|
25
25
|
id: pkg
|
|
@@ -27,17 +27,17 @@ jobs:
|
|
|
27
27
|
VERSION=$(node -p "require('./package.json').version")
|
|
28
28
|
echo "version=$VERSION" >> $GITHUB_OUTPUT
|
|
29
29
|
|
|
30
|
-
- name: Create Git tag
|
|
31
|
-
run: |
|
|
32
|
-
git tag v${{ steps.pkg.outputs.version }}
|
|
33
|
-
git push origin v${{ steps.pkg.outputs.version }}
|
|
34
|
-
|
|
35
30
|
- name: Install deps (also runs postinstall)
|
|
36
|
-
run: npm install
|
|
31
|
+
run: npm install -g npm@latest
|
|
37
32
|
|
|
38
33
|
- name: Publish to npm
|
|
39
34
|
run: npm publish --access public
|
|
40
35
|
|
|
36
|
+
- name: Create Git tag
|
|
37
|
+
run: |
|
|
38
|
+
git tag v${{ steps.pkg.outputs.version }}
|
|
39
|
+
git push origin v${{ steps.pkg.outputs.version }}
|
|
40
|
+
|
|
41
41
|
- name: Create GitHub Release
|
|
42
42
|
uses: softprops/action-gh-release@v2
|
|
43
43
|
with:
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kokio-sdk",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/esm/config.js",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"@account-kit/core": "^4.13.0",
|
|
40
40
|
"@account-kit/infra": "^4.15.3",
|
|
41
41
|
"@account-kit/signer": "^4.14.0",
|
|
42
|
+
"@noble/curves": "^2.2.0",
|
|
42
43
|
"@peculiar/asn1-ecc": "^2.3.15",
|
|
43
44
|
"@peculiar/asn1-schema": "^2.3.15",
|
|
44
45
|
"@simplewebauthn/server": "^13.1.1",
|
|
@@ -54,6 +54,7 @@ export const _stamp = async (credentialId: string, rpId: string, payload: Hex):
|
|
|
54
54
|
} catch (e) {
|
|
55
55
|
console.log("Failed to get authenticationResult");
|
|
56
56
|
console.error(JSON.stringify(e, Object.getOwnPropertyNames(e)))
|
|
57
|
+
throw e;
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
// See https://github.com/f-23/react-native-passkey/issues/54
|
|
@@ -75,11 +76,16 @@ export const _stamp = async (credentialId: string, rpId: string, payload: Hex):
|
|
|
75
76
|
const typeSearchString = '"type":"webauthn.get"';
|
|
76
77
|
const challengeSearchString = '"challenge":';
|
|
77
78
|
|
|
78
|
-
const
|
|
79
|
+
const rawTypeIndex = clientDataJSONString.indexOf(typeSearchString);
|
|
79
80
|
const challengeIndex = clientDataJSONString.indexOf(challengeSearchString);
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
let typeIndex = rawTypeIndex;
|
|
83
|
+
if (rawTypeIndex === -1) {
|
|
84
|
+
console.warn("typeIndex not found", {
|
|
85
|
+
expected: typeSearchString,
|
|
86
|
+
clientDataSnippet: clientDataJSONString.slice(0, 200),
|
|
87
|
+
});
|
|
88
|
+
typeIndex = 0;
|
|
83
89
|
}
|
|
84
90
|
if (challengeIndex === -1) {
|
|
85
91
|
throw new Error(`Could not find challenge substring '${challengeSearchString}' in clientDataJSON for index calculation.`);
|
|
@@ -91,10 +97,22 @@ export const _stamp = async (credentialId: string, rpId: string, payload: Hex):
|
|
|
91
97
|
|
|
92
98
|
// 4. Decode signature (ASN.1 DER encoded)
|
|
93
99
|
const signatureBytes = isoBase64URL.toBuffer(signature);
|
|
94
|
-
let parsedSignature = p256.Signature.fromDER(signatureBytes);
|
|
95
|
-
parsedSignature =
|
|
96
|
-
|
|
97
|
-
|
|
100
|
+
// let parsedSignature = p256.Signature.fromDER(signatureBytes);
|
|
101
|
+
let parsedSignature = p256.Signature.fromBytes(
|
|
102
|
+
signatureBytes instanceof Uint8Array
|
|
103
|
+
? signatureBytes
|
|
104
|
+
: new Uint8Array(signatureBytes),
|
|
105
|
+
"der"
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
// Normalize s
|
|
109
|
+
const n = p256.Point.CURVE().n;
|
|
110
|
+
const halfN = n >> 1n;
|
|
111
|
+
|
|
112
|
+
const r = parsedSignature.r;
|
|
113
|
+
const s = parsedSignature.s > halfN
|
|
114
|
+
? n - parsedSignature.s
|
|
115
|
+
: parsedSignature.s;
|
|
98
116
|
|
|
99
117
|
const webAuthnSig = {
|
|
100
118
|
authenticatorData: authenticatorDataHex,
|