@didcid/keymaster 0.4.0 → 0.4.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.
@@ -1,5 +1,5 @@
1
1
  import { DidCidDocument, ResolveDIDOptions, Operation, Proof, ProofPurpose } from '@didcid/gatekeeper/types';
2
- import { Challenge, ChallengeResponse, CheckWalletResult, CreateAssetOptions, FileAssetOptions, CreateResponseOptions, DmailItem, DmailMessage, EncryptOptions, FileAsset, FixWalletResult, Group, Vault, VaultOptions, IDInfo, ImageFileAsset, IssueCredentialsOptions, KeymasterInterface, KeymasterOptions, NoticeMessage, PollConfig, PossiblyProofed, ViewBallotResult, StoredWallet, VerifiableCredential, ViewPollResult, WalletFile, WalletEncFile } from '@didcid/keymaster/types';
2
+ import { Challenge, ChallengeResponse, CheckWalletResult, CreateAssetOptions, FileAssetOptions, CreateResponseOptions, DmailItem, DmailMessage, EncryptOptions, FileAsset, FixWalletResult, Group, Vault, VaultOptions, IDInfo, ImageFileAsset, IssueCredentialsOptions, KeymasterInterface, KeymasterOptions, LightningConfig, LightningBalance, LightningInvoice, LightningPayment, LightningPaymentStatus, DecodedLightningInvoice, NostrKeys, NostrEvent, NoticeMessage, PollConfig, PossiblyProofed, ViewBallotResult, StoredWallet, VerifiableCredential, ViewPollResult, WalletFile, WalletEncFile } from '@didcid/keymaster/types';
3
3
  import { EcdsaJwkPair, EcdsaJwkPublic } from '@didcid/cipher/types';
4
4
  export declare enum DmailTags {
5
5
  DMAIL = "dmail",
@@ -21,7 +21,7 @@ export declare enum PollItems {
21
21
  RESULTS = "results"
22
22
  }
23
23
  export default class Keymaster implements KeymasterInterface {
24
- private readonly passphrase;
24
+ private passphrase;
25
25
  private gatekeeper;
26
26
  private db;
27
27
  private cipher;
@@ -39,6 +39,7 @@ export default class Keymaster implements KeymasterInterface {
39
39
  newWallet(mnemonic?: string, overwrite?: boolean): Promise<WalletFile>;
40
40
  decryptMnemonic(): Promise<string>;
41
41
  getMnemonicForDerivation(wallet: WalletFile): Promise<string>;
42
+ changePassphrase(newPassphrase: string): Promise<boolean>;
42
43
  checkWallet(): Promise<CheckWalletResult>;
43
44
  fixWallet(): Promise<FixWalletResult>;
44
45
  resolveSeedBank(): Promise<DidCidDocument>;
@@ -106,6 +107,22 @@ export default class Keymaster implements KeymasterInterface {
106
107
  addAlias(alias: string, did: string): Promise<boolean>;
107
108
  getAlias(alias: string): Promise<string | null>;
108
109
  removeAlias(alias: string): Promise<boolean>;
110
+ addNostr(name?: string): Promise<NostrKeys>;
111
+ removeNostr(name?: string): Promise<boolean>;
112
+ exportNsec(name?: string): Promise<string>;
113
+ signNostrEvent(event: NostrEvent): Promise<NostrEvent>;
114
+ private requireDrawbridge;
115
+ private getLightningConfig;
116
+ addLightning(name?: string): Promise<LightningConfig>;
117
+ removeLightning(name?: string): Promise<boolean>;
118
+ getLightningBalance(name?: string): Promise<LightningBalance>;
119
+ createLightningInvoice(amount: number, memo?: string, name?: string): Promise<LightningInvoice>;
120
+ payLightningInvoice(bolt11: string, name?: string): Promise<LightningPayment>;
121
+ checkLightningPayment(paymentHash: string, name?: string): Promise<LightningPaymentStatus>;
122
+ decodeLightningInvoice(bolt11: string): Promise<DecodedLightningInvoice>;
123
+ publishLightning(name?: string): Promise<boolean>;
124
+ unpublishLightning(name?: string): Promise<boolean>;
125
+ zapLightning(id: string, amount: number, memo?: string, name?: string): Promise<LightningPayment>;
109
126
  testAgent(id: string): Promise<boolean>;
110
127
  bindCredential(subjectId: string, options?: {
111
128
  schema?: string;
@@ -1,5 +1,6 @@
1
- import { Cipher, EcdsaJwkPublic } from '@didcid/cipher/types';
2
- import { GatekeeperInterface, DidCidDocument, ResolveDIDOptions, Proof } from '@didcid/gatekeeper/types';
1
+ import { Cipher, EcdsaJwkPublic, NostrKeys, NostrEvent } from '@didcid/cipher/types';
2
+ import { GatekeeperInterface, DidCidDocument, ResolveDIDOptions, Proof, LightningConfig, LightningBalance, LightningInvoice, LightningPayment, LightningPaymentStatus } from '@didcid/gatekeeper/types';
3
+ export type { NostrKeys, NostrEvent } from '@didcid/cipher/types';
3
4
  export interface Seed {
4
5
  /** Passphrase-encrypted mnemonic */
5
6
  mnemonicEnc?: {
@@ -60,6 +61,10 @@ export interface Group {
60
61
  name: string;
61
62
  members: string[];
62
63
  }
64
+ export interface GroupData {
65
+ version: 2;
66
+ members: string[];
67
+ }
63
68
  export interface CredentialSchema {
64
69
  id: string;
65
70
  type: "JsonSchema";
@@ -193,6 +198,16 @@ export interface WalletBase {
193
198
  loadWallet(): Promise<StoredWallet | null>;
194
199
  updateWallet(mutator: (wallet: StoredWallet) => void | Promise<void>): Promise<void>;
195
200
  }
201
+ export type { LightningConfig, LightningBalance, LightningInvoice, LightningPayment, LightningPaymentStatus, } from '@didcid/gatekeeper/types';
202
+ export interface DecodedLightningInvoice {
203
+ amount?: string;
204
+ description?: string;
205
+ created?: string;
206
+ expiry?: string;
207
+ expires?: string;
208
+ payment_hash?: string;
209
+ network?: string;
210
+ }
196
211
  export interface KeymasterOptions {
197
212
  passphrase: string;
198
213
  gatekeeper: GatekeeperInterface;
@@ -213,6 +228,7 @@ export interface PossiblyProofed {
213
228
  }
214
229
  export interface RestClientOptions {
215
230
  url?: string;
231
+ apiKey?: string;
216
232
  console?: any;
217
233
  waitUntilReady?: boolean;
218
234
  intervalSeconds?: number;
@@ -258,6 +274,7 @@ export interface KeymasterInterface {
258
274
  checkWallet(): Promise<CheckWalletResult>;
259
275
  fixWallet(): Promise<FixWalletResult>;
260
276
  decryptMnemonic(): Promise<string>;
277
+ changePassphrase(newPassphrase: string): Promise<boolean>;
261
278
  exportEncryptedWallet(): Promise<WalletEncFile>;
262
279
  listIds(): Promise<string[]>;
263
280
  getCurrentId(): Promise<string | undefined>;
@@ -273,6 +290,20 @@ export interface KeymasterInterface {
273
290
  addAlias(alias: string, did: string): Promise<boolean>;
274
291
  getAlias(alias: string): Promise<string | null>;
275
292
  removeAlias(alias: string): Promise<boolean>;
293
+ addNostr(id?: string): Promise<NostrKeys>;
294
+ removeNostr(id?: string): Promise<boolean>;
295
+ exportNsec(id?: string): Promise<string>;
296
+ signNostrEvent(event: NostrEvent): Promise<NostrEvent>;
297
+ addLightning(id?: string): Promise<LightningConfig>;
298
+ removeLightning(id?: string): Promise<boolean>;
299
+ getLightningBalance(id?: string): Promise<LightningBalance>;
300
+ createLightningInvoice(amount: number, memo: string, id?: string): Promise<LightningInvoice>;
301
+ payLightningInvoice(bolt11: string, id?: string): Promise<LightningPayment>;
302
+ checkLightningPayment(paymentHash: string, id?: string): Promise<LightningPaymentStatus>;
303
+ decodeLightningInvoice(bolt11: string): Promise<DecodedLightningInvoice>;
304
+ publishLightning(name?: string): Promise<boolean>;
305
+ unpublishLightning(name?: string): Promise<boolean>;
306
+ zapLightning(id: string, amount: number, memo?: string, name?: string): Promise<LightningPayment>;
276
307
  resolveDID(did: string, options?: ResolveDIDOptions): Promise<DidCidDocument>;
277
308
  updateDID(id: string, doc: DidCidDocument): Promise<boolean>;
278
309
  createAsset(data: unknown, options?: CreateAssetOptions): Promise<string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@didcid/keymaster",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Archon Keymaster",
5
5
  "type": "module",
6
6
  "module": "./dist/esm/index.js",
@@ -141,15 +141,16 @@
141
141
  "author": "David McFadzean <davidmc@gmail.com>",
142
142
  "license": "MIT",
143
143
  "dependencies": {
144
- "@didcid/cipher": "^0.2.0",
145
- "@didcid/common": "^0.1.3",
146
- "@didcid/gatekeeper": "^0.4.0",
144
+ "@didcid/cipher": "^0.2.2",
145
+ "@didcid/common": "^0.1.4",
146
+ "@didcid/gatekeeper": "^0.4.2",
147
147
  "axios": "^1.7.7",
148
148
  "commander": "^11.1.0",
149
149
  "dotenv": "^16.4.5",
150
150
  "file-type": "^21.0.0",
151
151
  "image-size": "^2.0.1",
152
152
  "ioredis": "^5.4.1",
153
+ "light-bolt11-decoder": "^3.2.0",
153
154
  "mongodb": "^6.5.0",
154
155
  "sqlite": "^5.1.1",
155
156
  "sqlite3": "^5.1.7"
@@ -158,5 +159,5 @@
158
159
  "type": "git",
159
160
  "url": "git+https://github.com/archetech/archon.git"
160
161
  },
161
- "gitHead": "4692cc18e1377cafc96aaf7a55cd969a0b09b77c"
162
+ "gitHead": "3a01d5def7dc01c473d5016f5c543742fc83cc26"
162
163
  }