signify-ts 0.3.0-rc2 → 0.3.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.
@@ -1,85 +1,98 @@
1
- import { Algos } from './manager.ts';
2
- import { Tier } from './salter.ts';
3
- export interface KeyState {
4
- vn: [number, number];
5
- i: string;
6
- s: string;
7
- p?: string;
8
- d: string;
9
- f: string;
10
- dt: string;
11
- et: string;
12
- kt: string | string[];
13
- k: string[];
14
- nt: string | string[];
15
- n: string[];
16
- bt: string;
17
- b: string[];
18
- c: string[];
19
- ee: EstablishmentState;
20
- di?: string;
21
- }
22
- export interface EstablishmentState {
23
- d: string;
24
- s: string;
25
- }
1
+ import { components } from '../../types/keria-api-schema.ts';
2
+ export type KeyState = components['schemas']['KeyStateRecord'];
3
+ export type EstablishmentState = components['schemas']['StateEERecord'];
26
4
  /**
27
5
  * Marker interface for state configuring an IdentifierManager.
28
6
  */
29
7
  export interface IdentifierManagerState {
30
8
  }
31
9
  /**
32
- * Interface defining configuration parameters for a specified, deterministic salt of an IdentifierManager.
10
+ * Defining configuration parameters for a specified, deterministic salt of an IdentifierManager.
33
11
  */
34
- export interface SaltyKeyState extends IdentifierManagerState {
35
- /**
36
- * Encrypted
37
- */
38
- sxlt: string;
39
- pidx: number;
40
- kidx: number;
41
- stem: string;
42
- tier: Tier;
43
- dcode: string;
44
- icodes: string[];
45
- ncodes: string[];
46
- transferable: boolean;
47
- }
12
+ export type SaltyKeyState = components['schemas']['SaltyState'];
48
13
  /**
49
- * Interface defining configuration parameters for a random seed identifier manager.
14
+ * Defining configuration parameters for a random seed identifier manager.
50
15
  */
51
- export interface RandyKeyState extends IdentifierManagerState {
52
- prxs: string[];
53
- nxts: string[];
54
- }
16
+ export type RandyKeyState = components['schemas']['RandyKeyState'];
55
17
  /**
56
- * Interface defining properties a multi-signature group identifier manager.
18
+ * Defining properties a multi-signature group identifier manager.
57
19
  */
58
- export interface GroupKeyState extends IdentifierManagerState {
59
- mhab: HabState;
60
- keys: string[];
61
- ndigs: string[];
62
- }
20
+ export type GroupKeyState = components['schemas']['GroupKeyState'];
63
21
  /**
64
- * Interface defining properties for an external module identifier manager that uses externally managed keys such as in an HSM or a KMS system.
22
+ * Defining properties for an external module identifier manager that uses externally managed keys such as in an HSM or a KMS system.
65
23
  */
66
- export interface ExternState extends IdentifierManagerState {
67
- extern_type: string;
68
- pidx: number;
69
- [key: string]: unknown;
70
- }
24
+ export type ExternState = components['schemas']['ExternState'];
71
25
  /**
72
- * Interface defining properties of an identifier habitat, know as a Hab in KERIpy.
26
+ * Defining properties of an identifier habitat, know as a Hab in KERIpy.
73
27
  */
74
- export interface HabState {
75
- name: string;
76
- prefix: string;
77
- transferable: boolean;
78
- state: KeyState;
79
- windexes: unknown[];
80
- icp_dt: string;
81
- [Algos.salty]?: SaltyKeyState;
82
- [Algos.randy]?: RandyKeyState;
83
- [Algos.group]?: GroupKeyState;
84
- [Algos.extern]?: ExternState;
85
- }
28
+ export type HabState = components['schemas']['HabState'];
29
+ export type Icp = components['schemas']['ICP_V_1'] | components['schemas']['ICP_V_2'];
30
+ export type Ixn = components['schemas']['IXN_V_1'] | components['schemas']['IXN_V_2'];
31
+ export type ExnV1 = components['schemas']['EXN_V_1'];
32
+ export type Dip = components['schemas']['DIP_V_1'] | components['schemas']['DIP_V_2'];
33
+ export type Rot = components['schemas']['ROT_V_1'] | components['schemas']['ROT_V_2'];
34
+ export type ExnEmbeds = components['schemas']['ExnEmbeds'];
35
+ export type MultisigRpyEmbeds = components['schemas']['MultisigRpyEmbeds'];
36
+ /**
37
+ * Defining Operation types
38
+ */
39
+ export type OOBIOperation = components['schemas']['OOBIOperation'];
40
+ export type QueryOperation = components['schemas']['QueryOperation'];
41
+ export type EndRoleOperation = components['schemas']['EndRoleOperation'];
42
+ export type WitnessOperation = components['schemas']['WitnessOperation'];
43
+ export type DelegationOperation = components['schemas']['DelegationOperation'];
44
+ export type RegistryOperation = components['schemas']['RegistryOperation'];
45
+ export type LocSchemeOperation = components['schemas']['LocSchemeOperation'];
46
+ export type ChallengeOperation = components['schemas']['ChallengeOperation'];
47
+ export type ExchangeOperation = components['schemas']['ExchangeOperation'];
48
+ export type SubmitOperation = components['schemas']['SubmitOperation'];
49
+ export type DoneOperation = components['schemas']['DoneOperation'];
50
+ export type CredentialOperation = components['schemas']['CredentialOperation'];
51
+ export type GroupOperation = components['schemas']['GroupOperation'];
52
+ export type DelegatorOperation = components['schemas']['DelegatorOperation'];
53
+ export type PendingOOBIOperation = components['schemas']['PendingOOBIOperation'];
54
+ export type PendingQueryOperation = components['schemas']['PendingQueryOperation'];
55
+ export type PendingEndRoleOperation = components['schemas']['PendingEndRoleOperation'];
56
+ export type PendingWitnessOperation = components['schemas']['PendingWitnessOperation'];
57
+ export type PendingDelegationOperation = components['schemas']['PendingDelegationOperation'];
58
+ export type PendingRegistryOperation = components['schemas']['PendingRegistryOperation'];
59
+ export type PendingLocSchemeOperation = components['schemas']['PendingLocSchemeOperation'];
60
+ export type PendingChallengeOperation = components['schemas']['PendingChallengeOperation'];
61
+ export type PendingExchangeOperation = components['schemas']['PendingExchangeOperation'];
62
+ export type PendingSubmitOperation = components['schemas']['PendingSubmitOperation'];
63
+ export type PendingDoneOperation = components['schemas']['PendingDoneOperation'];
64
+ export type PendingCredentialOperation = components['schemas']['PendingCredentialOperation'];
65
+ export type PendingGroupOperation = components['schemas']['PendingGroupOperation'];
66
+ export type PendingDelegatorOperation = components['schemas']['PendingDelegatorOperation'];
67
+ export type PendingOperation = PendingOOBIOperation | PendingQueryOperation | PendingEndRoleOperation | PendingWitnessOperation | PendingDelegationOperation | PendingRegistryOperation | PendingLocSchemeOperation | PendingChallengeOperation | PendingExchangeOperation | PendingSubmitOperation | PendingDoneOperation | PendingCredentialOperation | PendingGroupOperation | PendingDelegatorOperation;
68
+ export type CompletedWitnessOperation = components['schemas']['CompletedWitnessOperation'];
69
+ export type CompletedEndRoleOperation = components['schemas']['CompletedEndRoleOperation'];
70
+ export type CompletedOOBIOperation = components['schemas']['CompletedOOBIOperation'];
71
+ export type CompletedDelegationOperation = components['schemas']['CompletedDelegationOperation'];
72
+ export type CompletedRegistryOperation = components['schemas']['CompletedRegistryOperation'];
73
+ export type CompletedLocSchemeOperation = components['schemas']['CompletedLocSchemeOperation'];
74
+ export type CompletedChallengeOperation = components['schemas']['CompletedChallengeOperation'];
75
+ export type CompletedExchangeOperation = components['schemas']['CompletedExchangeOperation'];
76
+ export type CompletedSubmitOperation = components['schemas']['CompletedSubmitOperation'];
77
+ export type CompletedDoneOperation = components['schemas']['CompletedDoneOperation'];
78
+ export type CompletedCredentialOperation = components['schemas']['CompletedCredentialOperation'];
79
+ export type CompletedGroupOperation = components['schemas']['CompletedGroupOperation'];
80
+ export type CompletedDelegatorOperation = components['schemas']['CompletedDelegatorOperation'];
81
+ export type CompletedQueryOperation = components['schemas']['CompletedQueryOperation'];
82
+ export type CompletedOperation = CompletedOOBIOperation | CompletedEndRoleOperation | CompletedWitnessOperation | CompletedDelegationOperation | CompletedRegistryOperation | CompletedLocSchemeOperation | CompletedChallengeOperation | CompletedExchangeOperation | CompletedSubmitOperation | CompletedDoneOperation | CompletedCredentialOperation | CompletedGroupOperation | CompletedDelegatorOperation | CompletedQueryOperation;
83
+ export type FailedOOBIOperation = components['schemas']['FailedOOBIOperation'];
84
+ export type FailedQueryOperation = components['schemas']['FailedQueryOperation'];
85
+ export type FailedEndRoleOperation = components['schemas']['FailedEndRoleOperation'];
86
+ export type FailedWitnessOperation = components['schemas']['FailedWitnessOperation'];
87
+ export type FailedDelegationOperation = components['schemas']['FailedDelegationOperation'];
88
+ export type FailedRegistryOperation = components['schemas']['FailedRegistryOperation'];
89
+ export type FailedLocSchemeOperation = components['schemas']['FailedLocSchemeOperation'];
90
+ export type FailedChallengeOperation = components['schemas']['FailedChallengeOperation'];
91
+ export type FailedExchangeOperation = components['schemas']['FailedExchangeOperation'];
92
+ export type FailedSubmitOperation = components['schemas']['FailedSubmitOperation'];
93
+ export type FailedDoneOperation = components['schemas']['FailedDoneOperation'];
94
+ export type FailedCredentialOperation = components['schemas']['FailedCredentialOperation'];
95
+ export type FailedGroupOperation = components['schemas']['FailedGroupOperation'];
96
+ export type FailedDelegatorOperation = components['schemas']['FailedDelegatorOperation'];
97
+ export type FailedOperation = FailedOOBIOperation | FailedQueryOperation | FailedEndRoleOperation | FailedWitnessOperation | FailedDelegationOperation | FailedRegistryOperation | FailedLocSchemeOperation | FailedChallengeOperation | FailedExchangeOperation | FailedSubmitOperation | FailedDoneOperation | FailedCredentialOperation | FailedGroupOperation | FailedDelegatorOperation;
98
+ export type GenericOperation = OOBIOperation | QueryOperation | EndRoleOperation | WitnessOperation | DelegationOperation | RegistryOperation | LocSchemeOperation | ChallengeOperation | ExchangeOperation | SubmitOperation | DoneOperation | CredentialOperation | GroupOperation | DelegatorOperation;
@@ -1 +1 @@
1
- import { Algos } from "./manager.js";
1
+ export {};
@@ -1,6 +1,6 @@
1
1
  import { Matter, MatterArgs } from './matter.ts';
2
2
  export declare class CesrNumber extends Matter {
3
- constructor({ raw, code, qb64b, qb64, qb2 }: MatterArgs, num?: number | string, numh?: string);
3
+ constructor({ raw, code, qb64b, qb64, qb2 }: MatterArgs, num?: number | string);
4
4
  get num(): number;
5
5
  get numh(): string;
6
6
  get positive(): boolean;
@@ -1,17 +1,20 @@
1
1
  import { Matter, NumDex } from "./matter.js";
2
2
  import { bytesToInt, intToBytes } from "./utils.js";
3
3
  export class CesrNumber extends Matter {
4
- constructor({ raw, code, qb64b, qb64, qb2 }, num, numh) {
4
+ constructor({ raw, code, qb64b, qb64, qb2 }, num) {
5
5
  let _num;
6
6
  if (raw == undefined &&
7
7
  qb64 == undefined &&
8
8
  qb64b == undefined &&
9
9
  qb2 == undefined) {
10
- if (typeof num == 'number') {
10
+ if (typeof num === 'number') {
11
11
  _num = num;
12
12
  }
13
- else if (numh != undefined) {
14
- _num = parseInt(numh, 16);
13
+ else if (typeof num === 'string') {
14
+ _num = parseInt(num, 16);
15
+ if (Number.isNaN(_num)) {
16
+ throw new Error(`Invalid hex string for num: ${num}`);
17
+ }
15
18
  }
16
19
  else {
17
20
  _num = 0;
@@ -1,13 +1,7 @@
1
1
  import { Signer } from './signer.ts';
2
2
  import { Matter } from './matter.ts';
3
- /**
4
- * Secret derivation security tier.
5
- */
6
- export declare enum Tier {
7
- low = "low",
8
- med = "med",
9
- high = "high"
10
- }
3
+ import { Tier } from '../../types/keria-api-schema.ts';
4
+ export { Tier } from '../../types/keria-api-schema.ts';
11
5
  interface SalterArgs {
12
6
  raw?: Uint8Array | undefined;
13
7
  code?: string;
@@ -62,4 +56,3 @@ export declare class Salter extends Matter {
62
56
  signer(code?: string, transferable?: boolean, path?: string, tier?: Tier | null, temp?: boolean): Signer;
63
57
  get tier(): Tier | null;
64
58
  }
65
- export {};
@@ -2,15 +2,8 @@ import { Signer } from "./signer.js";
2
2
  import { Matter, MtrDex } from "./matter.js";
3
3
  import { EmptyMaterialError } from "./kering.js";
4
4
  import libsodium from 'libsodium-wrappers-sumo';
5
- /**
6
- * Secret derivation security tier.
7
- */
8
- export var Tier;
9
- (function (Tier) {
10
- Tier["low"] = "low";
11
- Tier["med"] = "med";
12
- Tier["high"] = "high";
13
- })(Tier || (Tier = {}));
5
+ import { Tier } from "../../types/keria-api-schema.js";
6
+ export { Tier } from "../../types/keria-api-schema.js";
14
7
  /**
15
8
  * Maintains a random salt for secrets (private keys).
16
9
  * Its .raw is random salt, .code as cipher suite for salt