Skip to content

Commit

Permalink
feat: firefly rp (#11305)
Browse files Browse the repository at this point in the history
  • Loading branch information
guanbinrui committed Feb 19, 2024
1 parent ae5e4b2 commit 400a2f5
Show file tree
Hide file tree
Showing 91 changed files with 3,898 additions and 681 deletions.
5 changes: 5 additions & 0 deletions .changeset/strong-trains-attend.md
@@ -0,0 +1,5 @@
---
'@masknet/encryption': minor
---

add preset 2023_Firefly
22 changes: 14 additions & 8 deletions packages/base/src/Identifier/identifier.ts
Expand Up @@ -137,9 +137,8 @@ export class ECKeyIdentifier extends Identifier {
)
}
declare [Symbol.toStringTag]: string
#ec: undefined
static [Symbol.hasInstance](x: any): boolean {
return typeof x === 'object' && x !== null && #ec in x
return toText(x)?.startsWith('ec_key:') ?? false
}
static {
ECKeyIdentifier.prototype[Symbol.toStringTag] = 'ECKeyIdentifier'
Expand Down Expand Up @@ -184,9 +183,8 @@ export class PostIVIdentifier extends Identifier {
return new Uint8Array(decodeArrayBuffer(x))
}
declare [Symbol.toStringTag]: string
#post_iv: undefined
static [Symbol.hasInstance](x: any): boolean {
return typeof x === 'object' && x !== null && #post_iv in x
return toText(x)?.startsWith('post_iv:') ?? false
}
static {
PostIVIdentifier.prototype[Symbol.toStringTag] = 'PostIVIdentifier'
Expand Down Expand Up @@ -234,9 +232,8 @@ export class PostIdentifier extends Identifier {
return this.postID
}
declare [Symbol.toStringTag]: string
#post: undefined
static [Symbol.hasInstance](x: any): boolean {
return typeof x === 'object' && x !== null && #post in x
return toText(x)?.startsWith('post:') ?? false
}
static {
PostIdentifier.prototype[Symbol.toStringTag] = 'PostIdentifier'
Expand Down Expand Up @@ -293,9 +290,8 @@ export class ProfileIdentifier extends Identifier {
return `person:${this.network}/${this.userId}`
}
declare [Symbol.toStringTag]: string
#profile: undefined
static [Symbol.hasInstance](x: any): boolean {
return typeof x === 'object' && x !== null && #profile in x
return toText(x)?.startsWith('person:') ?? false
}
static {
ProfileIdentifier.prototype[Symbol.toStringTag] = 'ProfileIdentifier'
Expand All @@ -315,3 +311,13 @@ function banSlash(input: string | undefined | null, source?: string) {
if (!input) return
if (input.includes('/')) throw new TypeError(`Cannot contain / in a part of identifier (${source}): ${input}`)
}

function toText(x: any) {
try {
const text = x.toText()
if (typeof text === 'string') return text
return
} catch {
return
}
}
15 changes: 10 additions & 5 deletions packages/icons/general/AddUser.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions packages/icons/general/ArrowCircle.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions packages/icons/general/Comment.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions packages/icons/general/FireflyNFT.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/icons/general/Heart.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions packages/icons/general/Like.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/icons/general/Messages.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions packages/icons/general/NFTHolder.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 400a2f5

Please sign in to comment.