AuthProvider
Defined in: packages/core/src/auth-provider.ts:11
Type Parameters
Section titled “Type Parameters”PrivateKey
Section titled “PrivateKey”PrivateKey
PublicKey
Section titled “PublicKey”PublicKey
DocumentKey
Section titled “DocumentKey”DocumentKey = string
Properties
Section titled “Properties”nonceBytes
Section titled “nonceBytes”
readonlynonceBytes:number
Defined in: packages/core/src/auth-provider.ts:38
Returns the nonce/IV size in bytes for the configured encryption algorithm.
Methods
Section titled “Methods”decrypt()
Section titled “decrypt()”decrypt(
data,documentKey,nonce,associatedData):Promise<Uint8Array<ArrayBufferLike>>
Defined in: packages/core/src/auth-provider.ts:28
Parameters
Section titled “Parameters”Uint8Array
documentKey
Section titled “documentKey”DocumentKey
Uint8Array<ArrayBufferLike> | undefined
associatedData
Section titled “associatedData”Uint8Array
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike>>
deserializePublicKey()
Section titled “deserializePublicKey()”deserializePublicKey(
serialized):Promise<PublicKey>
Defined in: packages/core/src/auth-provider.ts:73
Restore a public identity from the canonical representation produced by
serializePublicKey. The result MUST round-trip to the exact same
canonical string and MUST be detached from mutable objects owned by the
caller of serializePublicKey (including nested aliases). Network
invitation flows require this operation so the inviter can verify proof
of possession from a previously unknown recipient and the recipient can
pin the inviter named in the offer. Reader and writer membership changes
round-trip every target identity through this codec before queueing so the
queued target is detached from the caller.
Parameters
Section titled “Parameters”serialized
Section titled “serialized”string
Returns
Section titled “Returns”Promise<PublicKey>
encrypt()
Section titled “encrypt()”encrypt(
data,documentKey,associatedData):Promise<EncryptionResult>
Defined in: packages/core/src/auth-provider.ts:23
Encrypt data and authenticate associatedData with it. The document
layer passes a value naming the document, the key ID and the payload
kind; decrypt must fail unless it receives the same bytes.
Parameters
Section titled “Parameters”Uint8Array
documentKey
Section titled “documentKey”DocumentKey
associatedData
Section titled “associatedData”Uint8Array
Returns
Section titled “Returns”Promise<EncryptionResult>
serializePublicKey()
Section titled “serializePublicKey()”serializePublicKey(
publicKey):Promise<string>
Defined in: packages/core/src/auth-provider.ts:60
Serialize a PublicKey to a stable string representation. The
representation MUST be canonical and collision-free for the provider’s
identity domain: two keys serialize equally if and only if the provider
treats them as the same identity. Two peers must therefore reach the same
identity decision from the serialized strings.
Implementations MUST capture every caller-owned value needed for the
encoding synchronously, before their first asynchronous suspension, and
MUST NOT retain a mutable caller-owned object for later inspection. Role
transitions snapshot identities before waiting for the document mutation
queue; deferring the read until after an await would let the caller
change which identity the queued operation targets.
This is used by the BeeKEM Welcome flow (recipient binding) and is intentionally generic so non-CryptoKey providers (e.g. opaque/hash-based identities) can supply their own canonical encoding. Membership changes use it to snapshot the target identity before they wait for the document mutation queue.
Parameters
Section titled “Parameters”publicKey
Section titled “publicKey”PublicKey
Returns
Section titled “Returns”Promise<string>
sign()
Section titled “sign()”sign(
data,privateKey):Promise<Uint8Array<ArrayBufferLike>>
Defined in: packages/core/src/auth-provider.ts:12
Parameters
Section titled “Parameters”Uint8Array
privateKey
Section titled “privateKey”PrivateKey
Returns
Section titled “Returns”Promise<Uint8Array<ArrayBufferLike>>
verify()
Section titled “verify()”verify(
data,publicKey,signature):Promise<boolean>
Defined in: packages/core/src/auth-provider.ts:13
Parameters
Section titled “Parameters”Uint8Array
publicKey
Section titled “publicKey”PublicKey
signature
Section titled “signature”Uint8Array
Returns
Section titled “Returns”Promise<boolean>