Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 2 additions & 10 deletions .github/workflows/package-release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Publish Package
on:
push:
branches: ['main', 'release/*']
workflow_dispatch:

jobs:
npm-publish:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -29,11 +29,3 @@ jobs:
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
GITHUB_TOKEN: ${{ steps.app-token.outputs.token }}
- name: Merge Release -> Trunk
uses: devmasx/merge-branch@854d3ac71ed1e9deb668e0074781b81fdd6e771f
if: github.ref == 'refs/heads/release/1.x'
with:
type: now
from_branch: release/1.x
target_branch: main
github_token: ${{ steps.app-token.outputs.token }}
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ docker-compose.override.yml
swagger-codegen-cli.jar
ngrok.yml
.data
lib
#lib
docs

# Logs
Expand Down Expand Up @@ -137,3 +137,6 @@ dist
.yarn/build-state.yml
.yarn/install-state.gz
.pnp.*

.idea/*
pnpm-lock.yaml
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# @algorandfoundation/liquid-client
# @algorandecosystem/liquid-client

[![CI](https://github.com/algorandfoundation/liquid-auth-js/actions/workflows/CI.yml/badge.svg)](https://github.com/algorandfoundation/liquid-auth-js/actions/workflows/CI.yml)[![Publish Package](https://github.com/algorandfoundation/liquid-auth-js/actions/workflows/package-release.yml/badge.svg)](https://github.com/algorandfoundation/liquid-auth-js/actions/workflows/package-release.yml)[![codecov](https://codecov.io/gh/algorandfoundation/liquid-auth-js/graph/badge.svg?token=AKN7VATWTO)](https://codecov.io/gh/algorandfoundation/liquid-auth-js)[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](code_of_conduct.md)

Expand All @@ -15,7 +15,7 @@ npm install algorandfoundation/liquid-auth-js --save
# 📝 Usage

```typescript
import {SignalClient} from '@algorandfoundation/liquid-client';
import {SignalClient} from '@algorandecosystem/liquid-client';
const client = new SignalClient(window.origin);
```

Expand Down
51 changes: 51 additions & 0 deletions lib/assertion.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
export * as fetch from './assertion.fetch.js';
export * as encoder from './assertion.encoder.js';
/**
* Represents the options for an assertion used during authentication.
*/
export type AssertionOptions = {
/**
* Represents the origin service to which a request should be sent.
*/
origin: string;
/**
* Represents the unique identifier for a credential.
* This variable identifies a specific credential within the authenticator.
*/
credId: string;
/**
* An optional configuration object that specifies options for a PublicKeyCredential request.
*
* This object is used during the process of requesting a credential from the user's device
* for Web Authentication (WebAuthn). It allows customization of the request to match
* the application's authentication requirements.
*
* Property details of `PublicKeyCredentialRequestOptions` typically include:
* - `timeout`: The time, in milliseconds, that the user agent is expected to wait for a response.
* - `userVerification`: Specifies the level of user verification required (e.g., "required", "preferred", "discouraged").
*
* This parameter is optional when calling authentication-related functions. If omitted,
* the request may rely on default or previously established options.
*/
options?: PublicKeyCredentialRequestOptions;
/**
* A boolean flag to enable or disable debug mode.
* If set to `true`, the application may output additional
* logging or diagnostic information useful for debugging.
* Defaults to `false` if not specified.
*/
debug?: boolean;
};
/**
* Assert a known credential
*
* Handles both {@link fetch.postOptions} and {@link fetch.postResponse} for the caller.
* This includes encoding/decoding the payloads from the service and navigator api.
*
* #### Quick Start:
* {@includeCode ./assertion.spec.ts#assertionImport,quickStart}
*
*
* @param {AssertionOptions} params
*/
export declare function assertion(params: AssertionOptions): Promise<any>;
96 changes: 96 additions & 0 deletions lib/assertion.encoder.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
/**
* Represents an encoded authenticator assertion response typically used in WebAuthn authentication.
* This type defines the structure of the response and ensures all required fields are provided in string format.
*
* EncodedAuthenticatorAssertionResponse includes:
* - A map of additional string properties if needed.
* - Fields such as `clientDataJSON`, `authenticatorData`, `signature`, and `userHandle`.
*
* The primary purpose of this type is to encapsulate the components originating from the authenticator
* required to validate the authentication assertion.
*
* @protected
*/
export type EncodedAuthenticatorAssertionResponse = {
[k: string]: string;
clientDataJSON: string;
authenticatorData: string;
signature: string;
userHandle: string;
};
/**
*
* @param response
* @protected
*/
export declare function encodeResponse(response: AuthenticatorAssertionResponse & Record<string, ArrayBuffer>): EncodedAuthenticatorAssertionResponse;
/**
* EncodedPublicKeyCredentialDescriptor represents a type that extends the PublicKeyCredentialDescriptor interface
* with an additional requirement for the 'id' property to be of type string.
*
* This type is used to encapsulate the properties of a public key credential, including its unique identifier,
* in a form where the 'id' is explicitly defined as a string rather than an ArrayBuffer.
*
* It is typically utilized in contexts where serialized or encoded values of public key credentials are required.
*
* Properties:
* - id: A string representation of the unique identifier for the public key credential.
*
* This type is a combination of PublicKeyCredentialDescriptor properties and overrides for specific use cases
* requiring encoded identifiers.
* @protected
*/
export type EncodedPublicKeyCredentialDescriptor = PublicKeyCredentialDescriptor & {
id: string;
};
/**
* EncodedPublicKeyCredentialRequestOptions is a composite type that extends
* the PublicKeyCredentialRequestOptions interface. This type is designed
* to represent request options for a WebAuthn authentication process,
* with specific adjustments to handle encoded data formats.
*
* The primary purpose of this type is to ensure compatibility with encoded
* challenges and allow credentials that are represented in an encoded format.
*
* Properties:
* - Includes all properties from PublicKeyCredentialRequestOptions.
* - `allowCredentials` (optional): An array of encoded credential descriptors
* that specify which credentials may be used for the assertion.
* - `challenge`: A cryptographic random challenge provided in encoded format,
* used in the WebAuthn assertion process.
*
* This type is intended to support workflows where cryptographic data must
* be encoded for transport or storage.
*
* @protected
*/
export type EncodedPublicKeyCredentialRequestOptions = PublicKeyCredentialRequestOptions & {
allowCredentials?: EncodedPublicKeyCredentialDescriptor[];
challenge: string;
};
/**
* Decodes the given assertion request options by converting base64URL-encoded fields
* into their corresponding ArrayBuffer representations and returns the decoded options.
*
* @param {EncodedPublicKeyCredentialRequestOptions} options - The encoded credential options to decode, containing properties such as `challenge` and `allowCredentials`.
* @return {PublicKeyCredentialRequestOptions} The decoded credential request options with binary data fields properly converted.
*/
export declare function decodeOptions(options: EncodedPublicKeyCredentialRequestOptions): PublicKeyCredentialRequestOptions;
/**
* @protected
*/
export type EncodedCredential = {
[k: string]: string | EncodedAuthenticatorAssertionResponse;
id: string;
type: string;
response: EncodedAuthenticatorAssertionResponse;
rawId: string;
};
/**
* Encodes the provided PublicKeyCredential into an EncodedCredential object.
*
* @param {PublicKeyCredential} credential - The PublicKeyCredential to be encoded.
* @return {EncodedCredential} A new object containing the encoded properties of the credential.
* @throws {Error} Throws an error if the input credential is invalid or cannot be processed.
*/
export declare function encodeCredential(credential: Credential | null): EncodedCredential;
48 changes: 48 additions & 0 deletions lib/assertion.encoder.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions lib/assertion.encoder.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

23 changes: 23 additions & 0 deletions lib/assertion.fetch.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { EncodedPublicKeyCredentialRequestOptions, EncodedCredential } from './assertion.encoder.js';
/**
* Fetch Assertion Options
*
* POST Authenticator Selector to the REST API
* to receive the PublicKeyCredentialRequestOptions
*
* @param origin
* @param credId
* @todo: Generate Typed JSON-RPC clients from Swagger/OpenAPI
* @module fetch
*/
export declare function postOptions(origin: string, credId: string): Promise<EncodedPublicKeyCredentialRequestOptions>;
/**
* Fetch Assertion Response
*
* POST an Authenticator Assertion Response to the REST API
*
* @param origin
* @param credential
* @todo: Generate Typed JSON-RPC clients from Swagger/OpenAPI
*/
export declare function postResponse(origin: string, credential: EncodedCredential): Promise<any>;
34 changes: 34 additions & 0 deletions lib/assertion.fetch.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading