Skip to content

Commit

Permalink
fix: Minor issue
Browse files Browse the repository at this point in the history
  • Loading branch information
DaevMithran committed Jan 24, 2023
1 parent 4961942 commit e060576
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export function createVerificationKeys(publicKey: string, algo: MethodSpecificId
let methodSpecificId: TMethodSpecificId
let didUrl: IVerificationKeys['didUrl']

publicKey = isBase64(publicKey) ? publicKey : toString(fromString(publicKey, 'hex'), 'base64')
publicKey = publicKey.length == 43 ? publicKey : toString(fromString(publicKey, 'hex'), 'base64')
switch (algo) {
case MethodSpecificIdAlgo.Base58:
methodSpecificId = bases['base58btc'].encode(base64ToBytes(publicKey))
Expand All @@ -128,8 +128,6 @@ export function createVerificationKeys(publicKey: string, algo: MethodSpecificId
}
}

const isBase64 = (value: string) => /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{4})$/.test(value);

export function createDidVerificationMethod(verificationMethodTypes: VerificationMethods[], verificationKeys: IVerificationKeys[]): VerificationMethodPayload[] {
return verificationMethodTypes.map((type, _) => {
switch (type) {
Expand Down

0 comments on commit e060576

Please sign in to comment.