Add comprehensive installation and setup documentation

- Add GETTING_STARTED.md with quick start guide and development modes
- Add INSTALL.sh automated installation script
- Add INSTALLATION_CHECKLIST.md, INSTALLATION_SUCCESS.md, and INSTALLATION_SUMMARY.md
- Add QUICK_REFERENCE.md for common commands
- Add SETUP_GUIDE.md with detailed setup instructions
- Update README.md with improved project overview
- Add did-wallet app dependencies and node_modules
This commit is contained in:
Dorian
2026-01-27 17:18:21 +00:00
parent a81f655133
commit 0d073fa89e
22658 changed files with 4494151 additions and 6 deletions
+2
View File
@@ -0,0 +1,2 @@
export * from './user-agent.js';
//# sourceMappingURL=index.js.map
+1
View File
@@ -0,0 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC"}
+142
View File
@@ -0,0 +1,142 @@
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { LevelStore } from '@web5/common';
import { DidDht, DidJwk, DidResolverCacheLevel } from '@web5/dids';
import { AgentDidApi, AgentDwnApi, DwnDidStore, DwnKeyStore, AgentSyncApi, Web5RpcClient, AgentCryptoApi, HdIdentityVault, LocalKeyManager, SyncEngineLevel, AgentIdentityApi, DwnIdentityStore, } from '@web5/agent';
export class Web5UserAgent {
constructor(params) {
this._agentDid = params.agentDid;
this.crypto = params.cryptoApi;
this.did = params.didApi;
this.dwn = params.dwnApi;
this.identity = params.identityApi;
this.keyManager = params.keyManager;
this.rpc = params.rpcClient;
this.sync = params.syncApi;
this.vault = params.agentVault;
// Set this agent to be the default agent.
this.did.agent = this;
this.dwn.agent = this;
this.identity.agent = this;
this.keyManager.agent = this;
this.sync.agent = this;
}
get agentDid() {
if (this._agentDid === undefined) {
throw new Error('Web5UserAgent: The "agentDid" property is not set. Ensure the agent is properly ' +
'initialized and a DID is assigned.');
}
return this._agentDid;
}
set agentDid(did) {
this._agentDid = did;
}
/**
* If any of the required agent components are not provided, instantiate default implementations.
*/
static create({ dataPath = 'DATA/AGENT', agentDid, agentVault, cryptoApi, didApi, dwnApi, identityApi, keyManager, rpcClient, syncApi } = {}) {
return __awaiter(this, void 0, void 0, function* () {
agentVault !== null && agentVault !== void 0 ? agentVault : (agentVault = new HdIdentityVault({
keyDerivationWorkFactor: 210000,
store: new LevelStore({ location: `${dataPath}/VAULT_STORE` })
}));
cryptoApi !== null && cryptoApi !== void 0 ? cryptoApi : (cryptoApi = new AgentCryptoApi());
didApi !== null && didApi !== void 0 ? didApi : (didApi = new AgentDidApi({
didMethods: [DidDht, DidJwk],
resolverCache: new DidResolverCacheLevel({ location: `${dataPath}/DID_RESOLVERCACHE` }),
store: new DwnDidStore()
}));
dwnApi !== null && dwnApi !== void 0 ? dwnApi : (dwnApi = new AgentDwnApi({
dwn: yield AgentDwnApi.createDwn({ dataPath, didResolver: didApi })
}));
identityApi !== null && identityApi !== void 0 ? identityApi : (identityApi = new AgentIdentityApi({ store: new DwnIdentityStore() }));
keyManager !== null && keyManager !== void 0 ? keyManager : (keyManager = new LocalKeyManager({ keyStore: new DwnKeyStore() }));
rpcClient !== null && rpcClient !== void 0 ? rpcClient : (rpcClient = new Web5RpcClient());
syncApi !== null && syncApi !== void 0 ? syncApi : (syncApi = new AgentSyncApi({ syncEngine: new SyncEngineLevel({ dataPath }) }));
// Instantiate the Agent using the provided or default components.
return new Web5UserAgent({
agentDid,
agentVault,
cryptoApi,
didApi,
dwnApi,
keyManager,
identityApi,
rpcClient,
syncApi
});
});
}
firstLaunch() {
return __awaiter(this, void 0, void 0, function* () {
// Check whether data vault is already initialize
return (yield this.vault.isInitialized()) === false;
});
}
/**
* Initializes the User Agent with a password, and optionally a recovery phrase.
*
* This method is typically called once, the first time the Agent is launched, and is responsible
* for setting up the agent's operational environment, cryptographic key material, and readiness
* for processing Web5 requests.
*
* The password is used to secure the Agent vault, and the recovery phrase is used to derive the
* cryptographic keys for the vault. If a recovery phrase is not provided, a new recovery phrase
* will be generated and returned. The password should be chosen and entered by the end-user.
*/
initialize({ password, recoveryPhrase }) {
return __awaiter(this, void 0, void 0, function* () {
// Initialize the Agent vault.
recoveryPhrase = yield this.vault.initialize({ password, recoveryPhrase });
return recoveryPhrase;
});
}
processDidRequest(request) {
return __awaiter(this, void 0, void 0, function* () {
return this.did.processRequest(request);
});
}
processDwnRequest(request) {
return __awaiter(this, void 0, void 0, function* () {
return this.dwn.processRequest(request);
});
}
processVcRequest(_request) {
return __awaiter(this, void 0, void 0, function* () {
throw new Error('Not implemented');
});
}
sendDidRequest(_request) {
return __awaiter(this, void 0, void 0, function* () {
throw new Error('Not implemented');
});
}
sendDwnRequest(request) {
return __awaiter(this, void 0, void 0, function* () {
return this.dwn.sendRequest(request);
});
}
sendVcRequest(_request) {
return __awaiter(this, void 0, void 0, function* () {
throw new Error('Not implemented');
});
}
start({ password }) {
return __awaiter(this, void 0, void 0, function* () {
// If the Agent vault is locked, unlock it.
if (this.vault.isLocked()) {
yield this.vault.unlock({ password });
}
// Set the Agent's DID.
this.agentDid = yield this.vault.getDid();
});
}
}
//# sourceMappingURL=user-agent.js.map
@@ -0,0 +1 @@
{"version":3,"file":"user-agent.js","sourceRoot":"","sources":["../../src/user-agent.ts"],"names":[],"mappings":";;;;;;;;;AAeA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAa,MAAM,EAAE,MAAM,EAAE,qBAAqB,EAAE,MAAM,YAAY,CAAC;AAC9E,OAAO,EACL,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,aAAa,EACb,cAAc,EAEd,eAAe,EACf,eAAe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