Skip to content

Commit

Permalink
feat: seaprate DIDCommAgent and adding Tasks
Browse files Browse the repository at this point in the history
Signed-off-by: Curtish <[email protected]>
  • Loading branch information
curtis-h committed Aug 29, 2024
1 parent bd64547 commit f1d44ff
Show file tree
Hide file tree
Showing 37 changed files with 1,790 additions and 1,857 deletions.
8 changes: 4 additions & 4 deletions src/apollo/Apollo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -213,11 +213,11 @@ export default class Apollo implements ApolloInterface, KeyRestoration {
const keyCurve = parameters[KeyProperties.curve];

if (isEmpty(keyType)) {
throw new ApolloError.InvalidKeyType(keyType);
throw new ApolloError.InvalidKeyType();
}

if (isEmpty(keyCurve)) {
throw new ApolloError.InvalidKeyCurve(keyCurve);
throw new ApolloError.InvalidKeyCurve();
}

const { curve } = getKeyCurveByNameAndIndex(keyCurve);
Expand Down Expand Up @@ -325,11 +325,11 @@ export default class Apollo implements ApolloInterface, KeyRestoration {
const keyCurve = parameters[KeyProperties.curve];

if (isEmpty(keyType)) {
throw new ApolloError.InvalidKeyType(keyType);
throw new ApolloError.InvalidKeyType();
}

if (isEmpty(keyCurve)) {
throw new ApolloError.InvalidKeyCurve(keyCurve);
throw new ApolloError.InvalidKeyCurve();
}

const { curve } = getKeyCurveByNameAndIndex(parameters[KeyProperties.curve]);
Expand Down
4 changes: 4 additions & 0 deletions src/domain/models/errors/Common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ export class SDKError extends Error {
export class UnknownError extends SDKError {
constructor() { super(-1, "Something went wrong"); }
}

export class ExpectError extends SDKError {
constructor(msg?: string) { super(-1, msg ?? "value should exist"); }
}
6 changes: 3 additions & 3 deletions src/domain/utils/JWT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { JWTPayload, Signer, createJWT } from "did-jwt";
import { base64url } from "multiformats/bases/base64";
import { DID, PrivateKey } from "..";
import { asJsonObj, isNil } from "../../utils/guards";
// ??? shouldnt be importing Pollux error
import { InvalidJWTString } from "../models/errors/Pollux";

export namespace JWT {
export interface Header {
Expand Down Expand Up @@ -65,9 +67,7 @@ export namespace JWT {
const payloadEnc = parts.at(1);

if (parts.length != 3 || isNil(headersEnc) || isNil(payloadEnc)) {
// TODO error
// throw new InvalidJWTString();
throw new Error();
throw new InvalidJWTString();
}

const headers = base64url.baseDecode(headersEnc);
Expand Down
7 changes: 6 additions & 1 deletion src/edge-agent/Agent.Backup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,14 @@ import * as Domain from "../domain";
import Agent from "./Agent";
import { isObject, validateSafe } from "../utils";

/**
* define Agent requirements for Backup
*/
type BackupAgent = Pick<Agent, "apollo" | "pluto" | "pollux" | "seed">;

export class AgentBackup {
constructor(
public readonly Agent: Agent
public readonly Agent: BackupAgent
) {}

/**
Expand Down
Loading

0 comments on commit f1d44ff

Please sign in to comment.