Skip to content

Commit

Permalink
feat: change lifehash to sparrow recommendation
Browse files Browse the repository at this point in the history
  • Loading branch information
Stephen Debel authored and isordo committed Jan 6, 2025
1 parent a071018 commit 4c392c4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/app/components/secret-item/secret-item.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ export class SecretItemComponent implements OnInit {

this.getWalletsFromSecret()

this.lifehashData = await this.lifehashService.generateLifehash(this.secret.fingerprint)
const bytes = this.secret.fingerprint
? new Uint8Array(this.secret.fingerprint.match(/.{1,2}/g).map((byte) => parseInt(byte, 16)))
: new Uint8Array()

this.lifehashData = await this.lifehashService.generateLifehash(bytes)
}

public async getWalletsFromSecret() {
Expand Down
2 changes: 1 addition & 1 deletion src/app/services/lifehash/lifehash.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { LifeHash, LifeHashVersion } from 'lifehash'
export class LifehashService {
constructor() {}

public async generateLifehash(str: string) {
public async generateLifehash(str: string | Uint8Array) {
const image = LifeHash.makeFrom(str, LifeHashVersion.version2, 1, true)
return image.toDataUrl()
}
Expand Down

0 comments on commit 4c392c4

Please sign in to comment.