Skip to content

Commit

Permalink
Merge pull request #9 from lacchain/lac1-support
Browse files Browse the repository at this point in the history
"lac1" support
  • Loading branch information
sergioceron committed Jul 28, 2023
2 parents ace8b11 + 3a232b6 commit 70849a8
Show file tree
Hide file tree
Showing 15 changed files with 3,064 additions and 343 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { default as DID } from './lib/did.js';
export { default as DIDRecoverable } from './lib/didrecoverable.js';
export { getResolver as Resolver } from './lib/resolver.js';
export { default as DID } from "./lib/did.js";
export { default as DIDRecoverable } from "./lib/didrecoverable.js";
export { getResolver as Resolver } from "./lib/resolver.js";
export { getResolver as Lac1Resolver } from "./lib/lac1/resolver.js";
4 changes: 4 additions & 0 deletions lib/did.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import DIDRegistry from "./registry.js";
import { createKeyPair } from "./utils.js";
import { getResolver } from "./resolver.js";
import { isAddress } from "ethers/lib/utils.js";

export default class DID {

Expand All @@ -9,6 +10,9 @@ export default class DID {
if( config.controllerPrivateKey && !config.address ) {
throw new Error( "If you set the controller private key you must also provide the DID address" );
} else if( !config.controllerPrivateKey && config.address ) {
if(!isAddress(config.address)) {
throw new Error( "Invalid 'address' attribute" );
};
this.address = config.address;
this.readOnly = true;
} else if( !config.controllerPrivateKey && !config.address ) {
Expand Down
Loading

0 comments on commit 70849a8

Please sign in to comment.