nostr-bray 1.29.3 → 1.30.0
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/context.js +9 -15
- package/dist/heartwood-context.js +1 -6
- package/package.json +1 -1
package/dist/context.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { fromNsec, fromMnemonic, derive, zeroise } from 'nsec-tree';
|
|
2
|
-
import { derivePersona } from 'nsec-tree/persona';
|
|
3
2
|
import { createBlindProof, createFullProof } from 'nsec-tree/proof';
|
|
4
3
|
import { finalizeEvent, getPublicKey } from 'nostr-tools/pure';
|
|
5
4
|
import { decode, npubEncode, nsecEncode } from 'nostr-tools/nip19';
|
|
@@ -88,21 +87,17 @@ export class IdentityContext {
|
|
|
88
87
|
return { npub, purpose: entry.purpose, index: entry.index, personaName: name };
|
|
89
88
|
}
|
|
90
89
|
}
|
|
91
|
-
const
|
|
90
|
+
const purpose = `persona/${name}`;
|
|
91
|
+
const identity = derive(this.root, purpose, index);
|
|
92
92
|
const entry = {
|
|
93
|
-
identity
|
|
94
|
-
purpose
|
|
95
|
-
index
|
|
93
|
+
identity,
|
|
94
|
+
purpose,
|
|
95
|
+
index,
|
|
96
96
|
personaName: name,
|
|
97
97
|
lastUsed: Date.now(),
|
|
98
98
|
};
|
|
99
|
-
this.putCache(
|
|
100
|
-
return {
|
|
101
|
-
npub: persona.identity.npub,
|
|
102
|
-
purpose: persona.identity.purpose,
|
|
103
|
-
index: persona.index,
|
|
104
|
-
personaName: name,
|
|
105
|
-
};
|
|
99
|
+
this.putCache(identity.npub, entry);
|
|
100
|
+
return { npub: identity.npub, purpose, index, personaName: name };
|
|
106
101
|
}
|
|
107
102
|
/** Switch active identity by purpose+index, persona name, or "master" */
|
|
108
103
|
async switch(purposeOrName, index) {
|
|
@@ -128,9 +123,8 @@ export class IdentityContext {
|
|
|
128
123
|
let purpose;
|
|
129
124
|
let personaName;
|
|
130
125
|
if (isPersonaName) {
|
|
131
|
-
|
|
132
|
-
identity =
|
|
133
|
-
purpose = persona.identity.purpose;
|
|
126
|
+
purpose = `persona/${purposeOrName}`;
|
|
127
|
+
identity = derive(this.root, purpose, index ?? 0);
|
|
134
128
|
personaName = purposeOrName;
|
|
135
129
|
}
|
|
136
130
|
else {
|
|
@@ -36,12 +36,7 @@ export class HeartwoodContext extends BunkerContext {
|
|
|
36
36
|
/** Derive a named persona on the Heartwood device. */
|
|
37
37
|
async derivePersona(name, index) {
|
|
38
38
|
const result = await this.signer.sendRequest('heartwood_derive_persona', [name, String(index)]);
|
|
39
|
-
|
|
40
|
-
// Log purpose so we can verify it matches nostr:persona:{name} convention
|
|
41
|
-
if (identity.purpose && identity.purpose !== `nostr:persona:${name}`) {
|
|
42
|
-
console.error(`[heartwood] note: device returned purpose "${identity.purpose}", bray uses "nostr:persona:${name}"`);
|
|
43
|
-
}
|
|
44
|
-
return identity;
|
|
39
|
+
return JSON.parse(result);
|
|
45
40
|
}
|
|
46
41
|
/** List all known identities on the Heartwood device. */
|
|
47
42
|
async listIdentities() {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nostr-bray",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"mcpName": "dev.forgesworn/bray",
|
|
5
5
|
"description": "Trust-aware Nostr for AI and humans. Three dimensions of trust -- verification, proximity, and access -- woven into every interaction.",
|
|
6
6
|
"type": "module",
|