@aithos/sdk 0.1.0-alpha.32 → 0.1.0-alpha.33
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/dist/src/auth.js +31 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/package.json +11 -12
package/dist/src/auth.js
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
// JWT-less sessions (recovery / mandate sign-ins) are valid: the
|
|
21
21
|
// keyStore is the source of truth for "is the user signed in", the
|
|
22
22
|
// JWT is auxiliary for compute/wallet.
|
|
23
|
-
import { buildBlobPlaintext, buildSignedEnvelope, createBrowserIdentity, decryptBlob, DEFAULT_KDF, deriveAuthAndEncKeys, encryptBlob, parseBlob, randomNonce, randomSalt, serializeBlob, signedDidDocument, zeroize, } from "@aithos/protocol-client";
|
|
23
|
+
import { browserIdentityFromStored, buildBlobPlaintext, buildSignedEnvelope, createBrowserIdentity, decryptBlob, DEFAULT_KDF, deriveAuthAndEncKeys, encryptBlob, parseBlob, randomNonce, randomSalt, serializeBlob, signedDidDocument, zeroize, } from "@aithos/protocol-client";
|
|
24
24
|
import { custodialResendVerify, custodialResetFinalize, custodialResetRequest, custodialSignIn, custodialSignUp, custodialVerifyEmail, loginChallenge, loginVerify, putBlob, registerAccount, } from "./auth-api.js";
|
|
25
25
|
import { defaultSessionStore, } from "./session-store.js";
|
|
26
26
|
import { defaultKeyStore, } from "./key-store.js";
|
|
@@ -883,6 +883,18 @@ export class AithosAuth {
|
|
|
883
883
|
zeroize(seedCircle);
|
|
884
884
|
zeroize(seedSelf);
|
|
885
885
|
zeroize(resp.encKey);
|
|
886
|
+
// Bootstrap the Ethos on api.aithos.be (cf. notes in signInCustodial).
|
|
887
|
+
// The magic-link flow is the FIRST time the user actually has
|
|
888
|
+
// hydrated keys client-side, so this is typically when the identity
|
|
889
|
+
// gets published. Idempotent — safe to call again on subsequent
|
|
890
|
+
// clicks (which won't get here normally, but defensively).
|
|
891
|
+
const identity = browserIdentityFromStored({
|
|
892
|
+
handle: stored.handle,
|
|
893
|
+
displayName: stored.displayName,
|
|
894
|
+
did: stored.did,
|
|
895
|
+
seeds: stored.seedsHex,
|
|
896
|
+
});
|
|
897
|
+
await this.#publishIdentity(identity);
|
|
886
898
|
if (this.#ownerSigners)
|
|
887
899
|
this.#ownerSigners.destroy();
|
|
888
900
|
this.#ownerSigners = OwnerSigners.fromStoredOwnerKeys(stored);
|
|
@@ -989,6 +1001,24 @@ export class AithosAuth {
|
|
|
989
1001
|
// The enc_key is informational here — the custodial blob is empty
|
|
990
1002
|
// at first login. We still don't keep it in memory.
|
|
991
1003
|
zeroize(resp.encKey);
|
|
1004
|
+
// Bootstrap the Ethos on api.aithos.be — same as signUp(zk). Without
|
|
1005
|
+
// this, the DID returned by signInCustodial isn't resolvable on the
|
|
1006
|
+
// platform (feed / profile lookups return "not found: did …"). The
|
|
1007
|
+
// call is idempotent server-side: a published identity replays as a
|
|
1008
|
+
// no-op. We do it here (rather than only on a "first login" flag)
|
|
1009
|
+
// because the auth Lambda doesn't know whether the api.aithos.be
|
|
1010
|
+
// side has been populated — the SDK is the single source of truth
|
|
1011
|
+
// for "the user's Ethos is bootstrapped".
|
|
1012
|
+
//
|
|
1013
|
+
// Failure aborts the sign-in: the user can retry (same behaviour as
|
|
1014
|
+
// signUp(zk)), and the local keystore is NOT populated half-way.
|
|
1015
|
+
const identity = browserIdentityFromStored({
|
|
1016
|
+
handle: stored.handle,
|
|
1017
|
+
displayName: stored.displayName,
|
|
1018
|
+
did: stored.did,
|
|
1019
|
+
seeds: stored.seedsHex,
|
|
1020
|
+
});
|
|
1021
|
+
await this.#publishIdentity(identity);
|
|
992
1022
|
// Hydrate in-memory owner signers from the freshly-stored material.
|
|
993
1023
|
if (this.#ownerSigners)
|
|
994
1024
|
this.#ownerSigners.destroy();
|
package/dist/src/index.d.ts
CHANGED
package/dist/src/index.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
// Public types specific to the SDK (`AithosSDKConfig`, `AithosSDKError`)
|
|
18
18
|
// are exported from here. Endpoint config (`AithosSdkEndpoints`,
|
|
19
19
|
// `DEFAULT_SDK_ENDPOINTS`) likewise.
|
|
20
|
-
export const VERSION = "0.1.0-alpha.
|
|
20
|
+
export const VERSION = "0.1.0-alpha.33";
|
|
21
21
|
export { AithosSDK } from "./sdk.js";
|
|
22
22
|
export { AithosSDKError } from "./types.js";
|
|
23
23
|
// Re-export protocol-client's JSON-RPC error type so consumers can
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aithos/sdk",
|
|
3
|
-
"version": "0.1.0-alpha.
|
|
4
|
-
"description": "Aithos SDK
|
|
3
|
+
"version": "0.1.0-alpha.33",
|
|
4
|
+
"description": "Aithos SDK — high-level TypeScript developer kit for building agentic apps on the Aithos protocol. Wraps @aithos/protocol-client and exposes the Aithos compute proxy and wallet (Stripe top-up) endpoints.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"aithos",
|
|
7
7
|
"sdk",
|
|
@@ -39,15 +39,6 @@
|
|
|
39
39
|
"README.md",
|
|
40
40
|
"LICENSE"
|
|
41
41
|
],
|
|
42
|
-
"scripts": {
|
|
43
|
-
"build": "tsc",
|
|
44
|
-
"build:test": "tsc -p tsconfig.test.json",
|
|
45
|
-
"check-types": "tsc --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
46
|
-
"test": "npm run clean && npm run build && npm run build:test && cd dist && node --test",
|
|
47
|
-
"test:watch": "cd dist && node --test --watch",
|
|
48
|
-
"clean": "rm -rf dist",
|
|
49
|
-
"prepublishOnly": "npm run clean && npm run build && npm test"
|
|
50
|
-
},
|
|
51
42
|
"engines": {
|
|
52
43
|
"node": ">=20"
|
|
53
44
|
},
|
|
@@ -63,5 +54,13 @@
|
|
|
63
54
|
"publishConfig": {
|
|
64
55
|
"access": "public",
|
|
65
56
|
"tag": "alpha"
|
|
57
|
+
},
|
|
58
|
+
"scripts": {
|
|
59
|
+
"build": "tsc",
|
|
60
|
+
"build:test": "tsc -p tsconfig.test.json",
|
|
61
|
+
"check-types": "tsc --noEmit && tsc -p tsconfig.test.json --noEmit",
|
|
62
|
+
"test": "npm run clean && npm run build && npm run build:test && cd dist && node --test",
|
|
63
|
+
"test:watch": "cd dist && node --test --watch",
|
|
64
|
+
"clean": "rm -rf dist"
|
|
66
65
|
}
|
|
67
|
-
}
|
|
66
|
+
}
|